Skip to content
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

Support multi-ecosystem derivation and sui addresses #5

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

russanto
Copy link

@russanto russanto commented Jan 16, 2025

New features

  • Implement derivation of deposit addresses for non-EVM chains
  • Support Sui deposit addresses
  • Use types for Chain Id and Address over generic byte slices

TODOs

  • Include test data to compare implementation with

@russanto russanto requested a review from hashxtree January 16, 2025 17:33
@russanto russanto requested a review from oliviathet February 14, 2025 09:42
oliviathet
oliviathet previously approved these changes Feb 14, 2025
Copy link

@oliviathet oliviathet left a comment

Choose a reason for hiding this comment

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

lgtm

//
// taggedHash( AuxData || EvmTag || ChainId || LBTCAddress || WalletAddress )
// taggedHash( AuxData || ChainId || LBTCAddress || WalletAddress )
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. by the fact the byte is still there
  2. mb LChainId is better to show that it's something custom
Suggested change
// taggedHash( AuxData || ChainId || LBTCAddress || WalletAddress )
// taggedHash( AuxData || DeprecatedChainTag || LChainId || LBTCAddress || WalletAddress )

// - 'wallet' is the EVM address that will claim this deposit
// - 'chainId' is the chain id for the target EVM chain
func EvmDepositSegwitPubkey(pk *PublicKey, lbtcContract, wallet Address, chainId, auxData []byte) (*PublicKey, error) {
// - 'lbtcContract' is the address of the LBTC contract or object on the destination chain
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// - 'lbtcContract' is the address of the LBTC contract or object on the destination chain
// - 'lbtcContract' is the address of the LBTC contract (EVM) or object (SUI) on the destination chain

Comment on lines +310 to +312
// just an initial seed to generate constant data for all tests
hashVal := sha256.Sum256([]byte("segwit_lombard_tweak_test_rs"))
pk := secp256k1.PrivKeyFromBytes(hashVal[:]).PubKey()

Choose a reason for hiding this comment

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

shouldn't you read this public key from referenceValues (e.g., from the rootDepositKey field) so that the reference values are self-contained?

Choose a reason for hiding this comment

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

@russanto @hashxtree any thoughts here? Thanks so much!

Copy link

@mlfbrown mlfbrown left a comment

Choose a reason for hiding this comment

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

Hey @hashxtree, are you guys going to merge this? We're currently using values from here to test our address generation and want to make sure the values/spec won't change.

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