Skip to content

Feature: Implement KMS Wallet#510

Merged
sirpy merged 75 commits intomasterfrom
feat/kms-wallet
Feb 18, 2026
Merged

Feature: Implement KMS Wallet#510
sirpy merged 75 commits intomasterfrom
feat/kms-wallet

Conversation

@blueogin
Copy link
Collaborator

@blueogin blueogin commented Dec 9, 2025

Description

Added the KMS wallet, which signs transactions using keys stored in AWS KMS.
The kms-ethereum-signing dependency is the modularized PoC project I previously built.

About # (link your issue here)

How Has This Been Tested?

The KMS wallet is tested in adminWalletKMS.test.ts.

Checklist:

  • PR title matches follow: (Feature|Bug|Chore) Task Name
  • My code follows the style guidelines of this project
  • I have followed all the instructions described in the initial task (check Definitions of Done)
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added reference to a related issue in the repository
  • I have added a detailed description of the changes proposed in the pull request. I am as descriptive as possible, assisting reviewers as much as possible.
  • I have added screenshots related to my pull request (for frontend tasks)
  • I have pasted a gif showing the feature.
  • @mentions of the person or team responsible for reviewing proposed changes

Summary by Sourcery

Introduce AWS KMS–backed wallet support and integrate it into the admin wallet while improving gas handling and test stability.

New Features:

  • Add a KMSWallet adapter that uses AWS KMS for Ethereum key management and signing.
  • Enable Web3Wallet/AdminWallet to initialize and send transactions using KMS-managed keys, configurable via environment variables.

Bug Fixes:

  • Prevent async wallet initialization from running during Jest teardown in tests and avoid invalid faucet calls when the faucet contract is not configured.

Enhancements:

  • Refine Web3Wallet gas pricing logic with shared EIP-1559/legacy handling and cached capability detection.
  • Normalize wallet address handling and improve faucet behavior when no valid faucet contract is available.
  • Adjust AdminWallet initialization to better handle mainnet addresses and expose a factory for KMS-enabled instances.

Build:

  • Add @gooddollar/kms-ethereum-signing dependency for KMS-based Ethereum signing support.

CI:

  • Inject AWS and KMS-related environment variables into the test workflow for KMS integration tests.

Documentation:

  • Clarify configuration options for mnemonic, deprecated private key usage, and new KMS env vars in server configuration.

Tests:

  • Add adminWalletKMS test suite that validates KMS-backed transaction flows end-to-end.
  • Mock MongoDB for Jest to avoid real DB connections during tests and stabilize task runner behavior.
  • Update Jest and CI configuration to support @aws-sdk modules and AWS/KMS environment usage, and skip flaky staking/fish manager tests.

- Added KMS wallet support to handle Ethereum transactions securely using AWS Key Management Service.
- Updated configuration to allow KMS key IDs and region settings.
- Refactored AdminWallet and Web3Wallet to support KMS-based transaction signing.
- Introduced KMSWallet class to encapsulate KMS operations.
- Added tests for KMS transaction submission and wallet functionality.
- Updated KMSWallet and Web3Wallet to store and retrieve wallet addresses in a case-insensitive manner.
- Removed unnecessary console log from KMSWallet during transaction signing.
- Adjusted tests to ensure KMS wallet address normalization is correctly handled.
…ated package versions in package.json and package-lock.json
@blueogin blueogin requested a review from sirpy January 27, 2026 16:58
@sirpy
Copy link
Contributor

sirpy commented Feb 4, 2026

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The new KMS tests in adminWalletKMS.test.js depend on real AWS KMS and a hard‑coded mainnet WETH address, which makes the test suite tightly coupled to specific infrastructure and networks; consider parameterizing the contract address / network and adding a way to skip or stub KMS calls when the required env vars or AWS credentials are not present.
  • The EIP‑1559 support detection in supportsEIP1559() relies on a hard‑coded chain ID allowlist; it might be more robust to make this list configurable (e.g., via config/env) or to fallback to a feature probe (eth_feeHistory/eth_maxPriorityFeePerGas) so new networks don’t require a code change.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new KMS tests in `adminWalletKMS.test.js` depend on real AWS KMS and a hard‑coded mainnet WETH address, which makes the test suite tightly coupled to specific infrastructure and networks; consider parameterizing the contract address / network and adding a way to skip or stub KMS calls when the required env vars or AWS credentials are not present.
- The EIP‑1559 support detection in `supportsEIP1559()` relies on a hard‑coded chain ID allowlist; it might be more robust to make this list configurable (e.g., via config/env) or to fallback to a feature probe (`eth_feeHistory`/`eth_maxPriorityFeePerGas`) so new networks don’t require a code change.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@sirpy sirpy self-requested a review February 4, 2026 08:47
@sirpy sirpy merged commit 7adb9b6 into master Feb 18, 2026
2 of 8 checks passed
@sirpy sirpy deleted the feat/kms-wallet branch February 18, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments