File | Type | Proxy |
---|---|---|
RegistryStateReceiver.sol |
Singleton(other support chains) | No proxy |
RegistryStateReceiver
is responsible for receiving and processing operator state updates from the mainnet through Abridge. It maintains the synchronized operator state by forwarding updates to the LightStakeRegistry on the destination chain.
IAbridge public immutable abridge; // Bridge interface
address public immutable sender; // Authorized sender address
ILightStakeRegistry public immutable stakeRegistry; // Stake registry reference
uint256 private currentEpoch; // Current epoch number
modifier onlyAbridge() {
if (msg.sender != address(abridge)) revert RegistryStateReceiver__InvalidSender();
_;
}
modifier onlyOwner() {
// OpenZeppelin Ownable implementation
}
function handleMessage(
address from,
bytes calldata message,
bytes32 /*guid*/
) external onlyAbridge returns (bytes4)
- Processes state updates received through the bridge
- Validates sender authorization
- Decodes epoch and update data
- Updates current epoch
- Forwards updates to stake registry
- Returns success selector
function updateRoute(bool allowed) external onlyOwner
- Updates bridge route settings for sender
- Controls message reception authorization
- Only callable by owner
function getCurrentEpoch() external view returns (uint256)
- Returns current epoch number
- Used for synchronization verification
The contract integrates with:
- Abridge: For cross-chain message reception
- LightStakeRegistry: For processing state updates
- RegistryStateSender: Source of state updates on mainnet
-
Access Control
- Bridge-only message handling
- Owner-only route management
- Sender validation
-
Message Validation
- Source address verification
- Message format validation
- Update processing verification
-
Error Handling
- Explicit revert conditions
- Update failure detection
- Clear error messages
error RegistryStateReceiver__InvalidSender()
error RegistryStateReceiver__BatchUpdateFailed()
event UpdateProcessed(uint256 epoch, uint256 updateCount)