Skip to content

[Feat] Add XRPL#67

Merged
RogerKSI merged 57 commits intomainfrom
refactor-for-next-chain
Mar 18, 2026
Merged

[Feat] Add XRPL#67
RogerKSI merged 57 commits intomainfrom
refactor-for-next-chain

Conversation

@tanut32039
Copy link
Copy Markdown
Contributor

Fixed: #XXXX

Implementation details

  • refactor some parts to be compatible for next chain type (ex. xrpl native, sol)

Please ensure the following requirements are met before submitting a pull request:

  • The pull request is targeted against the correct target branch
  • The pull request is linked to an issue with appropriate discussion and an accepted design OR is linked to a spec that describes the work.
  • The pull request includes a description of the implementation/work done in detail.
  • The pull request includes any and all appropriate unit/integration tests
  • You have added a relevant changelog entry to CHANGELOG_UNRELEASED.md
  • You have re-reviewed the files affected by the pull request (e.g. using the Files changed tab in the Github PR explorer)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 SavePrivateKey interface from accepting *ecdsa.PrivateKey to accepting string for chain-agnostic key handling
  • Moved key management functions (AddKeyByPrivateKey, DeleteKey, ExportPrivateKey, ListKeys, ShowKey, AddRemoteSignerKey) from chain provider implementations to a common chains package
  • 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.

Comment thread relayer/wallet/evm/wallet_test.go
Comment thread relayer/chains/keys.go Outdated
Comment thread relayer/chains/provider.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread relayer/chains/signer.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread relayer/chains/provider.go Outdated
@tanut32039 tanut32039 force-pushed the refactor-for-next-chain branch from 769b441 to 81fddd7 Compare January 26, 2026 09:23
@tanut32039 tanut32039 changed the title [Feat] refactor for next chain [Feat] Add XRPL Jan 30, 2026
@RogerKSI RogerKSI requested review from RogerKSI and Copilot January 30, 2026 09:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread relayer/chains/xrpl/provider.go Outdated
Comment thread relayer/chains/xrpl/provider.go Outdated
Comment thread relayer/wallet/xrpl/wallet.go
Comment thread relayer/tunnel_relayer.go Outdated
Comment thread relayer/chains/xrpl/utils.go Outdated
Comment thread relayer/chains/xrpl/provider.go
Comment thread cmd/flags.go Outdated
Comment thread go.mod
Comment thread relayer/chains/xrpl/config.go Outdated
Comment thread relayer/wallet/xrpl/wallet.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread relayer/tunnel_relayer.go Outdated
Comment thread relayer/wallet/xrpl/wallet.go Outdated
Comment thread relayer/wallet/xrpl/wallet.go Outdated
Comment thread relayer/chains/xrpl/provider.go Outdated
Comment thread relayer/chains/xrpl/utils.go Outdated
Comment thread relayer/tunnel_relayer.go Outdated
Comment thread relayer/wallet/xrpl/wallet.go Outdated
Comment thread relayer/wallet/xrpl/wallet.go Outdated
Comment thread relayer/chains/xrpl/provider.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 excluding CreatedAt).
	// 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.

Comment thread relayer/wallet/xrpl/remote_signer.go Outdated
Comment thread relayer/chains/xrpl/client.go Outdated
Comment thread cmd/keys.go
Comment thread cmd/keys.go Outdated
Comment thread README.md
Comment thread relayer/wallet/xrpl/remote_signer.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread scripts/mockgen.sh Outdated
Comment thread cmd/keys.go
Comment thread relayer/chains/xrpl/utils.go Outdated
Comment thread relayer/wallet/geth/wallet.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread relayer/chains/xrpl/client.go Outdated
Comment thread relayer/chains/xrpl/provider.go Outdated
Comment thread relayer/chains/xrpl/client.go Outdated
Comment thread relayer/wallet/xrpl/remote_signer_test.go
Comment thread relayer/wallet/xrpl/remote_signer.go
Comment thread relayer/wallet/xrpl/local_signer.go
Comment thread relayer/tunnel_relayer.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread relayer/chains/xrpl/provider.go
Comment thread relayer/db/sql.go Outdated
Comment thread relayer/chains/xrpl/provider.go Outdated
Comment thread relayer/db/db.go Outdated
Comment thread relayer/chains/xrpl/client.go
Comment thread relayer/tunnel_relayer.go Outdated
Comment thread relayer/wallet/icon/remote_signer.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread relayer/chains/xrpl/provider.go Outdated
Comment thread relayer/tunnel_relayer.go
Comment thread relayer/chains/client_pool.go
Comment thread relayer/wallet/record_test.go
Comment thread relayer/wallet/tss.go
Comment thread relayer/db/sql.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread relayer/store/filesystem.go
Comment thread relayer/tunnel_relayer.go
Comment thread relayer/wallet/tss.go
Comment thread cmd/chains.go Outdated
@RogerKSI RogerKSI merged commit d7487f9 into main Mar 18, 2026
2 checks passed
@RogerKSI RogerKSI deleted the refactor-for-next-chain branch March 18, 2026 10:42
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.

5 participants