-
Notifications
You must be signed in to change notification settings - Fork 810
wallet: remove ledger support in favor of golang SDK implementation of ledger keychain #4413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Introduces signing options infrastructure to provide transaction context (chain alias and network ID) to wallet signers. This enables remote signing services to properly format addresses and validate transactions while maintaining backward compatibility with existing signer implementations. Changes: - Add SigningOptions with functional options pattern - Update Signer interface to accept variadic SigningOption parameters - Pass chain alias and network ID to Sign() calls in P/X/C chain wallets - Update ledger and secp256k1 signers to accept but ignore options
Extends C-chain signer to accept and pass networkID parameter, completing the signing options infrastructure across all chains (P, X, and C).
Removes ledger hardware wallet support and the signHash parameter from wallet signers. Removed: - Ledger keychain implementation and related types - signHash parameter from P-chain and C-chain signers - utils/crypto/ledger package - Ledger-related tests and mocks - Ledger dependencies from go.mod
The SigningOptions type and related functions (WithChainAlias, WithNetworkID) have been removed. The Signer.Sign() method no longer accepts signing options as the chain alias and network ID context are not needed for the actual signing operation. Changes: - Remove variadic SigningOption parameter from Signer.Sign() interface - Remove networkID field from all signer implementations (C/P/X chains) - Update all signer constructors to not accept networkID parameter - Remove WithChainAlias and WithNetworkID function calls - Update test files to use new signer constructor signatures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Removes built-in Ledger hardware wallet integration and simplifies wallet signing to always use Sign with full unsigned transaction bytes. Key changes:
- Eliminated ledger-specific code (wrapper, keychain implementations, mocks, tests, and dependencies).
- Removed signHash boolean path; all transactions now invoke signer.Sign(unsignedBytes).
- Updated keychain comments but retained SignHash in the Signer interface without internal use.
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
wallet/chain/p/signer/visitor.go | Removed signHash parameter usage; all P-chain transactions now call sign(tx, txSigners). |
wallet/chain/c/signer.go | Simplified atomic signer to remove hash signing path; always signs full bytes. |
utils/crypto/ledger/ledger_test.go | Removed Ledger integration test. |
utils/crypto/ledger/ledger.go | Removed Ledger device wrapper implementation. |
utils/crypto/keychain/mocks_generate_test.go | Removed mock generation directive for Ledger. |
utils/crypto/keychain/ledger.go | Removed Ledger interface definition (now unused). |
utils/crypto/keychain/keychainmock/ledger.go | Removed generated Ledger mock. |
utils/crypto/keychain/keychain_test.go | Removed Ledger keychain and signer tests. |
utils/crypto/keychain/keychain.go | Deleted ledgerKeychain and ledgerSigner implementations; updated Signer comment. |
go.mod | Dropped ledger-related dependencies and added an indirect objx requirement. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
// to sign a hash | ||
// to sign a hash or transaction | ||
type Signer interface { | ||
SignHash([]byte) ([]byte, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think not
Why this should be merged
This PR removes built-in Ledger hardware wallet support from AvalancheGo's wallet implementation, also delegating hash signing decisions to keychain implementations instead.
This change:
How this works
The implementation removes:
utils/crypto/ledger
, ledger keychain, tests, and mocks)Sign(unsignedBytes, ...SigningOption)
with full transaction bytes and contextKeychain implementations receive the full transaction bytes along with signing context (chain alias, network ID) and can decide internally how to sign. For example:
How this was tested