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

feat: whitelist spl [in progress] #2984

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from
Draft

feat: whitelist spl [in progress] #2984

wants to merge 7 commits into from

Conversation

skosito
Copy link
Contributor

@skosito skosito commented Oct 9, 2024

Description

in progress

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

@skosito skosito added the SOLANA_TESTS Run make start-solana-test label Oct 9, 2024
@skosito skosito linked an issue Oct 9, 2024 that may be closed by this pull request
@@ -76,8 +76,8 @@ policy_accounts:
private_key: "0595CB0CD9BF5264A85A603EC8E43C30ADBB5FD2D9E2EF84C374EA4A65BB616C"
observer_relayer_accounts:
relayer_accounts:
- solana_address: "2qBVcNBZCubcnSR3NyCnFjCfkCVUB3G7ECPoaW5rxVjx"
solana_private_key: "3EMjCcCJg53fMEGVj13UPQpo6py9AKKyLE2qroR4yL1SvAN2tUznBvDKRYjntw7m6Jof1R2CSqjTddL27rEb6sFQ"
- solana_address: "37yGiHAnLvWZUNVwu9esp74YQFqxU1qHCbABkDvRddUQ"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ws4charlie solana relayer and deployer used in e2e tests are different, and with recent introduction of using deployer as authority for whitelist (and other messages), is it ok to use same account here, or maybe we can add new key for zetaclient?

require.NoError(r, err)

tokenAccount := solana.NewWallet()
createAccountInstruction := system.NewCreateAccountInstruction(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using create account and initialize mint instructions in same transaction to create new mint account

@@ -8,7 +8,7 @@ import (

const (
// SolanaGatewayProgramID is the program ID of the Solana gateway program
SolanaGatewayProgramID = "94U5AHQMKkV5txNJ17QPXWoh474PheGou6cNP2FEuL1d"
SolanaGatewayProgramID = "BaDmykPHVwPQNY9SXQnJU8JPXdN89z3ib7qEfhNfkWRg"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ws4charlie i used anchor build locally to get latest program changes, and this is program id generated based on keypair generated, but it is out of sync with current program id used in that repo, i assume we need to use same gateway key pair file to build it, but we dont have correct one anywhere

)
}
}
// erc20Addr := ethcommon.HexToAddress(msg.Erc20Address)
Copy link
Contributor Author

@skosito skosito Oct 14, 2024

Choose a reason for hiding this comment

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

since this msg is not just erc20 anymore, these checks can be removed

below check if already exists is redundant since we have it below in DeployZRC20Contract but can be reverted

Q: should we rename erc20 everywhere in this msg and params to asset?

if ethcommon.HexToAddress(msg.Erc20Address) == (ethcommon.Address{}) {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid ERC20 contract address (%s)", msg.Erc20Address)
}
// if ethcommon.HexToAddress(msg.Erc20Address) == (ethcommon.Address{}) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

similarly, not needed anymore since erc20 is not only asset used with this msg

@@ -352,6 +359,10 @@ func ParseGatewayInstruction(
switch coinType {
case coin.CoinType_Gas:
return contracts.ParseInstructionWithdraw(instruction)
// for these currently parsing is not needed since instructions are empty, and these instructions dont implement OutboundInstruction interface
// can be revisited as more are added
case coin.CoinType_Cmd:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think this part can be cleaner, but currently interface for instruction seems tightly coupled with withdraw, and it is not applied at all to whitelist, so i thought to just dont parse these since parsed result is not needed to further process them

@skosito
Copy link
Contributor Author

skosito commented Oct 14, 2024

@lumtis @ws4charlie could you please do initial review for this draft? i left some questions and open points, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:cli SOLANA_TESTS Run make start-solana-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow MsgWhitelistERC20 to be used for Solana SPL tokens
1 participant