Task generator generates tasks off chain and stores them in database. These tasks are then distributed to operators who sign and return an aggregated ECDSA signature. The responses are recorded in the database along with the tasks.
Users can validate the proof by calling the isValidSignature
function in the corresponding stake registry contract:
// IERC1271Upgradeable interface defined magic value
bytes4 constant internal MAGICVALUE = 0x1626ba7e;
If calling isValidSignature
returns MAGICVALUE
, the signature is valid.
We implement an epoch system to manage operator states. The epoch period is 7 days with a 1-day grace period. Any operator state update will be effective at the next epoch if called before the grace period ends. Updates made during the grace period will take effect at the epoch after next.
- Operator registers to stake registry by calling
registerOperatorWithSignature
function in stake registry. This will callSpottedServiceManagerBase::registerOperator
function.
function registerOperatorWithSignature(
ISignatureUtils.SignatureWithSaltAndExpiry memory _operatorSignature,
address _signingKey
) external
-
SpottedServiceManagerBase::registerOperator
function will callAVSDirectory::registerOperatorWithSig
function. -
ECDSAStakeRegistry
finishes the registration process on mainnet and needs to sync operators states to other supported chains. It callsEpochManager::queueStateUpdate
function which stores the update and will be effective at the next epoch (if not in grace period). -
EpochManager::sendStateUpdates
function will utilize Abridge to send state updates to other supported chains viaRegistryStateSender
contract. -
RegistryStateReceiver
contract will callhandleMessage
function to receive the state updates and update the operator states by callingLightStakeRegistry::processEpochUpdate
function.
Similar to the register process.
As illustrated in the register process, the operator states will be updated at the next epoch if the update is called before the grace period ends. The light stake registry will sync the states to other supported chains. It serves as a replica of the mainnet stake registry, ensuring consistency of operator states across different chains in the same epoch.
- Malicious operators sign a wrong state proof.
- AVS detects and challengeSubmitter submits a challenge by calling
StateDisputeResolver::submitChallenge
function. Then a challenge is created and stored inStateDisputeResolver
contract, with a uniquechallengeId
generated (same as task id).
bytes32 challengeId =
keccak256(abi.encodePacked(
state.user,
state.chainId,
state.blockNumber,
state.timestamp,
state.key));
-
Anyone can call
RemoteChainVerifier::verifyState
function to verify the state on remote chain (queryStateManager::getHistoryAtBlock
function) and then send the result toMainChainVerifier
contract through Abridge.MainChainVerifier
contract will record the verified state and emitStateVerified
event. -
Anyone can call
StateDisputeResolver::resolveChallenge
function to resolve the challenge by queryingMainChainVerifier
's mapping. If the challenge is successful, the operator will be slashed by callingAllocationManager::slashOperator
function.
AVS will call SpottedServiceManagerBase::submitReward
function to submit rewards based on the weight and task responses of operators. The detailed reward calculation can be found in the go script repo.