Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors the wallet and key management architecture to support multiple chain types beyond EVM (e.g., XRPL native, Solana). The refactoring makes the codebase more modular and chain-agnostic by extracting common wallet operations into a shared chains package.
Changes:
- Changed
SavePrivateKeyinterface from accepting*ecdsa.PrivateKeyto acceptingstringfor chain-agnostic key handling - Moved key management functions (AddKeyByPrivateKey, DeleteKey, ExportPrivateKey, ListKeys, ShowKey, AddRemoteSignerKey) from chain provider implementations to a common
chainspackage - Updated all tests and mocks to reflect the new architecture
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| relayer/wallet/wallet.go | Changed SavePrivateKey signature to accept string instead of *ecdsa.PrivateKey |
| relayer/wallet/geth/wallet.go | Updated implementation to convert hex string to ECDSA key internally |
| relayer/wallet/geth/wallet_test.go | Updated tests to pass hex-encoded private keys |
| relayer/chains/keys.go | New file containing chain-agnostic key management functions |
| relayer/chains/signer.go | New file containing LoadSigners helper function |
| relayer/chains/provider.go | Removed key management methods from KeyProvider interface |
| relayer/chains/evm/keys.go | Simplified to only handle mnemonic-based key generation |
| relayer/chains/evm/signer.go | Simplified to delegate to chains.LoadSigners |
| relayer/chains/evm/keys_test.go | Updated tests to use new chains package functions |
| relayer/chains/signer_test.go | Moved and updated test, changed package name |
| relayer/app.go | Added getWallet helper and updated to use chains package functions |
| relayer/app_test.go | Updated mock expectations to work with new architecture |
| internal/relayertest/mocks/wallet.go | Updated mock SavePrivateKey signature |
| internal/relayertest/mocks/chain_provider.go | Removed key management methods from mock |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
769b441 to
81fddd7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 45 out of 46 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 45 out of 46 changed files in this pull request and generated 9 comments.
Comments suppressed due to low confidence (2)
relayer/chains/xrpl/provider.go:300
- The XRPL implementation lacks test coverage. While EVM chains have comprehensive tests (keys_test.go, provider_test.go, utils_test.go), XRPL has no test files. At minimum, tests should be added for critical functionality like wallet operations (SaveBySecret, SaveByMnemonic, DeleteKey), provider operations (RelayPacket, QueryBalance), and utility functions (stringToHex, parseAssetsFromSignal).
relayer/wallet/xrpl/wallet.go:270 - The XRPL wallet implementation lacks test coverage. Critical wallet operations like SaveBySecret, SaveByMnemonic, SaveRemoteSignerKey, and DeleteKey should have tests similar to the GethWallet test suite to ensure they work correctly and handle edge cases properly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1dc46f7 to
b65571a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 70 out of 71 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
relayer/app_test.go:447
- This test uses
time.Now().Unix()twice when constructing the expected and returned packets; those calls can differ by a second, making the equality assertion flaky. Capture the timestamp once (e.g.,now := time.Now().Unix()) and reuse it for both packets (or assert on fields excludingCreatedAt).
// Create the expected Packet object
tunnelPacketBandInfo := bandtypes.NewPacket(
1,
1,
signalPrices,
signingInfo,
nil,
time.Now().Unix(),
)
// Set up the mock expectation
s.client.EXPECT().
GetTunnelPacket(gomock.Any(), uint64(1), uint64(1)).
Return(tunnelPacketBandInfo, nil)
// Call the function under test
packet, err := s.app.QueryTunnelPacketInfo(context.Background(), 1, 1)
// Create the expected packet structure for comparison
expected := bandtypes.NewPacket(1, 1, signalPrices, signingInfo, nil, time.Now().Unix())
// Assertions
s.Require().NoError(err)
s.Require().Equal(expected, packet)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 69 out of 70 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 96 out of 98 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 96 out of 98 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 96 out of 98 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (2)
relayer/wallet/evm/remote_signer_test.go:64
- The Sign behavior of evm.RemoteSigner is no longer covered by tests after the Signer interface change. Adding a test that calls Sign(payload, wallet.TssPayload{}) and asserts the expected SignEvm request (especially the lowercased address) would help prevent regressions.
relayer/wallet/evm/local_signer_test.go:48 - The local EVM signer no longer has a test that exercises Sign(...) after the Signer interface change. Consider adding a test that signs some payload via Sign(payload, wallet.TssPayload{}) and verifies the signature recovers to the expected address (or otherwise matches the expected behavior).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 96 out of 98 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Fixed: #XXXX
Implementation details
Please ensure the following requirements are met before submitting a pull request:
CHANGELOG_UNRELEASED.mdFiles changedtab in the Github PR explorer)