File | Type | Proxy |
---|---|---|
MainChainVerifier.sol |
Singleton(mainnet) | No proxy |
MainChainVerifier
is responsible for receiving and storing state verification results from remote chains through Abridge. It maintains a record of verified states and manages remote verifier authorizations.
- Cross-chain state verification reception
- Remote verifier authorization
- Verified state storage
- Bridge message handling
- State Variables:
mapping(uint256 => mapping(address => mapping(uint256 => mapping(uint256 => Value)))) private verifiedStates; // chainId -> user -> key -> blockNumber -> Value
mapping(uint256 => address) public remoteVerifiers; // chainId -> verifier address
mapping(address => bool) public isRemoteVerifier; // verifier address -> is authorized
address public immutable disputeResolver; // Dispute resolver contract
IAbridge public immutable abridge; // Bridge interface
- Value Struct:
struct Value {
uint256 value; // Verified state value
bool exist; // Whether the state exists
}
The contract implements multi-layer access control:
- Owner: Can configure remote verifiers
- Abridge: Only bridge can deliver messages
- Remote Verifiers: Authorized to submit verification results
function setRemoteVerifier(
uint256 chainId,
address verifier
) external onlyOwner
Configures authorized verifier for a specific chain.
Effects:
- Revokes old verifier permissions if exists
- Sets new verifier address
- Updates bridge route permissions
- Emits RemoteVerifierSet event
Requirements:
- Only owner can call
- Valid verifier address
function handleMessage(
address from,
bytes calldata message,
bytes32 guid
) external returns (bytes4)
Processes verification results received from remote chains.
Effects:
- Decodes state verification data
- Stores verified state information
- Emits StateVerified event
Requirements:
- Must be called by bridge
- Sender must be authorized remote verifier
- Valid message format
function getVerifiedState(
uint256 chainId,
address user,
uint256 key,
uint256 blockNumber
) external view returns (uint256 value, bool exist)
Retrieves verified state information.
Returns:
- Verified value
- Existence flag
The contract integrates with:
- Abridge for cross-chain message reception
- Remote chain verifiers
- Dispute resolution system (
StateDisputeResolver
will query this contract if a dispute is raised) - State management system
Key interactions:
- Receives verification results through bridge
- Maintains verified state records
- Provides query interface for dispute resolution