Closed adu-web3 closed 4 months ago
This update involves enhanced handling of Exocore contracts' setup, including expanded client chain metadata registration, token whitelisting with detailed parameters, and restaking functionality. Key modifications include additional validation in token and client chain management, reentrancy protection in mock contracts, and comprehensive test adaptations.
File Path | Change Summary |
---|---|
script/3_Setup.s.sol |
Expanded setup for Exocore contracts: added client chain metadata registration, detailed token whitelisting, and restaking support; new function parameters for decimals, TVL limits, names, and metadata. |
src/core/ExocoreGateway.sol |
Added client chain metadata functions; removed requestRegisterTokens ; introduced token whitelisting; updated existing functions with additional parameters and error handling; modified internal functions for enhanced logic. |
test/foundry (multiple files) |
Adjusted for new events and functionality: changed whitelistTokens from address[] to bytes32[] ; added new test functions and error scenarios for token whitelisting and client chain registration. |
test/mocks/ExocoreGatewayMock.sol |
Added new functions for client chain and token whitelisting; implemented reentrancy protection in markBootstrapOnAllChains ; updated existing functions to incorporate new parameters and validation. |
src/storage (multiple files) |
Updated constants and added new mappings and events for client chain and token whitelisting; refined error definitions for better error handling and validation in ExocoreGatewayStorage and GatewayStorage ; removed old constants and events from ClientChainGatewayStorage . |
sequenceDiagram
participant User as User
participant SetupScript as SetupScript
participant ExocoreGateway as ExocoreGateway
participant ClientChain as ClientChain
User->>SetupScript: call setup()
SetupScript->>ExocoreGateway: call registerOrUpdateClientChain()
ExocoreGateway->>ClientChain: validate metadata
ClientChain-->>ExocoreGateway: return validation results
ExocoreGateway->>SetupScript: update chain metadata
User->>SetupScript: call addWhitelistTokens()
SetupScript->>ExocoreGateway: call addWhitelistTokens()
ExocoreGateway->>ClientChain: validate and whitelist tokens
ClientChain-->>ExocoreGateway: return validation and whitelist results
ExocoreGateway->>SetupScript: update whitelist tokens
🐰 In fields of code where changes play,
New tokens join the whitelist today.
Client chains with metadata fair,
Enhanced and setup with tender care.
Restaking soars, validation's tight,
Exocore shines in blockchain light.✨
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?
checklist:
addWhitelistTokens
in ExocoreGateway and disable addWhitelistTokens
in ClientChainGatewayExocoreGateway.registerOrUpdateClientChain
to write more meta data of client chain like address lenght, signature type and name to native assets module and set client chain gateway as trusted peer to activate layerzero messagingExocoreGateway.setPeer
to forbid updating peer address before corresponding client chain being registered ExocoreGateway.updateWhitelistedTokens
to enable contract owner updating token info like tvl limit@coderabbitai please review these commits since this PR is ready for review
@adu-web3, I've reviewed the changes listed in your checklist against the codebase. Here's the breakdown:
Enable addWhitelistTokens
in ExocoreGateway and disable in ClientChainGateway:
addWhitelistTokens
function is implemented and active.addWhitelistTokens
still exists and does not appear to be disabled. It is marked as external onlyOwner whenNotPaused
, which suggests it's still operational unless further context (like a dynamic feature toggle) is provided elsewhere in the code.Add ExocoreGateway.registerOrUpdateClientChain
:
Override ExocoreGateway.setPeer
:
setPeer
function in ExocoreGateway
has been overridden to include additional logic before calling the superclass method, aligning with your requirements to restrict updates until the client chain is registered.Add ExocoreGateway.updateWhitelistedTokens
:
Unit Tests:
addWhitelistTokens
and updateWhitelistedTokens
are found in the test files, indicating that unit tests have been addressed as per your checklist.You may need to check the operational status of the addWhitelistTokens
function in the ClientChainGateway
to ensure it's disabled as intended. If there's anything specific you would like me to look into further or any additional changes, please let me know!
Test https://github.com/ExocoreNetwork/exocore-contracts/pull/39/commits/3cd44bb19b08a64775ae67a6de74f80ab671e540 passed with https://github.com/ExocoreNetwork/exocore/pull/116/commits/8a9a9d8d0d483c38f7dcf81979abc58240a7c9b3 for deposit/withdraw/delegateTo/depositThenDelegate function.
Description
according to the interface design and implementation of
IAssets.sol
on exocore chain side: https://github.com/ExocoreNetwork/exocore/pull/116, more token infos like decimals and tvl limit is required for assets module. So we need to add those fields to layerzero message payload and decode them on exocore side to feed into assets precompile@coderabbitai pause review for this pr until it is ready for review
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests
Chores