File | Type | Proxy |
---|---|---|
RegistryStateSender.sol |
Singleton(mainnet) | No proxy |
RegistryStateSender
manages cross-chain state synchronization for the stake registry. It handles sending state updates to other chains through bridges, enabling multi-chain operator set management.
struct BridgeInfo {
address bridge; // Bridge contract address
address receiver; // Receiver contract on target chain
}
mapping(uint256 => BridgeInfo) public chainToBridgeInfo; // Chain ID to bridge info
uint256[] public supportedChainIds; // List of supported chains
uint128 public constant EXECUTE_GAS_LIMIT = 500_000; // Cross-chain execution gas limit
address public immutable epochManager; // Epoch manager reference
Bridge Configuration
function addBridge(
uint256 _chainId,
address _bridge,
address _receiver
) external onlyOwner
- Adds new bridge configuration for a chain
- Validates bridge and receiver addresses
- Prevents duplicate bridge configurations
- Maintains list of supported chains
Bridge Modification
function modifyBridge(
uint256 _chainId,
address _newBridge,
address _newReceiver
) external onlyOwner
- Updates existing bridge configuration
- Validates new addresses
- Emits modification event
Batch Updates
function sendBatchUpdates(
uint256 epoch,
uint256 chainId,
IEpochManager.StateUpdate[] memory updates
) external payable onlyEpochManager
- Sends state updates to target chain
- Handles bridge fee estimation and payment
- Ensures sufficient fee provided
- Only callable by epoch manager
Bridge Removal
function removeBridge(uint256 _chainId) external onlyOwner
- Removes bridge configuration
- Updates supported chain list
- Validates chain support
Bridge Information
function getBridgeInfoByChainId(uint256 chainId) external view returns (BridgeInfo memory)
function getSupportedChainIds() external view returns (uint256[] memory)
- Query bridge configurations
- Access supported chain list
The contract integrates with:
- EpochManager: Controls state update timing
- Bridge Contracts: Handles cross-chain messaging
- Receiver Contracts: Processes updates on target chains
-
Access Control
- Owner-only bridge management
- EpochManager-only update submission
- Validated bridge configurations
-
Fee Management
- Automatic fee estimation
- Fee validation before sending
- Protection against insufficient fees
-
State Validation
- Bridge address validation
- Chain support verification
- Duplicate prevention
event BridgeAdded(uint256 indexed chainId, address bridge, address receiver)
event BridgeRemoved(uint256 indexed chainId)
event BridgeModified(uint256 indexed chainId, address newBridge, address newReceiver)
event UpdatesSent(uint256 indexed chainId, uint256 epoch, uint256 updateCount)