-
Notifications
You must be signed in to change notification settings - Fork 116
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: add Whitelist message ability to whitelist SPL tokens on Solana #2984
Conversation
@lumtis @ws4charlie could you please do initial review for this draft? i left some questions and open points, thanks |
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces significant updates to the ZetaChain node in version 21.0.0, including new features such as stateful precompiled contracts, an RPC package for zetacored, and enhancements for Solana and Bitcoin support. The changes also expand testing capabilities, particularly for Solana's SPL token whitelisting. Refactoring efforts focus on improving code quality and test coverage. Additionally, various modules have been updated to enhance functionality and stability, alongside modifications to dependencies and JSON structures related to transaction processing. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
!!!WARNING!!! Be very careful about using Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203 Pay extra attention to the way |
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.
Not needed for this release but we should probably rename all erc20 occurence to asset
MsgWhitelistAsset
opened issue for renaming with TODO in code in proto file: #3083 |
foreignCoins := k.fungibleKeeper.GetAllForeignCoins(ctx) | ||
for _, fCoin := range foreignCoins { | ||
assetAddr := ethcommon.HexToAddress(fCoin.Asset) | ||
if assetAddr == erc20Addr && fCoin.ForeignChainId == msg.ChainId { | ||
if fCoin.Asset == msg.Erc20Address && fCoin.ForeignChainId == msg.ChainId { | ||
return nil, errorsmod.Wrapf( |
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.
You could use k.fungibleKeeper.GetForeignCoinFromAsset()
instead to re-use existing logic.
Description
Related solana program PR: zeta-chain/protocol-contracts-solana#60
This also includes latest version of gateway, and minor fixes so existing functionality works with latest gateway.
There is some duplicate code between whitelist and withdraw, as we add more spl integration soon it will be more clear which parts can be abstracted away.
NOTE: I didnt rename erc20 to something more generic, like maybe
asset
? in MsgWhitelistERC20 and related code, if thats needed will do in next PR, to focus on reviewing other pieces here, as that renaming should be simple but will result in bunch of files changed.Also, this is adding protocol-contracts-solana package with autogenerated IDL for discriminators for now. There are some todos to generate types as well there, but it is out of scope of this PR.
How Has This Been Tested?
Summary by CodeRabbit
Release Notes for Version 21.0.0
New Features
Bug Fixes
Tests
Chores