AggOracle Component
Overview
The AggOracle component ensures the Global Exit Root (GER) is propagated from L1 to the L2 sovereign chain smart contract. This is critical for enabling asset and message bridging between chains.
The GER is indexed from the smart contract by L2GERSyncer component and persisted in local storage.
Key Components:
ChainSender
: Interface for submitting GERs to the smart contract.EVMChainGERSender
: An implementation ofChainSender
interface.
Workflow
What is Global Exit Root (GER)?
The Global Exit Root consolidates:
-
Mainnet Exit Root (MER): Updated during bridge transactions from L1.
-
Rollup Exit Root (RER): Updated when verified rollup batches are submitted via ZKP.
GER = hash(MER, RER)
Process
- Fetch Finalized GER:
- AggOracle retrieves the latest GER finalized on L1.
- Check GER Injection:
- Confirms whether the GER is already stored in the smart contract.
- Inject GER:
- If missing, AggOracle submits the GER via the
insertGlobalExitRoot
function.
- If missing, AggOracle submits the GER via the
- Sync Locally:
- L2GERSyncer fetches and stores the GER locally for downstream use.
The sequence diagram below depicts the interaction in the AggOracle.
sequenceDiagram participant AggOracle participant ChainSender participant L1InfoTreeSyncer participant L1Client AggOracle->>AggOracle: start loop trigger on preconfigured frequency AggOracle->>AggOracle: process latest GER AggOracle->>L1InfoTreeSyncer: get last finalized GER AggOracle->>L1InfoTreeSyncer: get latest finalized L1 info tree L1InfoTreeSyncer-->>AggOracle: retrieve global exit root (from L1 info tree) AggOracle->>ChainSender: check is GER injected ChainSender-->>AggOracle: isGERInjected result alt is GER injected AggOracle->>AggOracle: log GER already injected else AggOracle->>ChainSender: inject GER ChainSender-->>AggOracle: GER injection result end end AggOracle->>AggOracle: handle GER processing error
Key Components
1. AggOracle
The AggOracle
fetches the finalized GER and ensures its injection into the L2 smart contract.
Functions:
Start
: Periodically processes GER updates using a ticker.processLatestGER
: Checks if the GER exists and injects it if necessary.
2. ChainSender Interface
Defines the interface for submitting GERs.
IsGERInjected(ger common.Hash) (bool, error)
InjectGER(ctx context.Context, ger common.Hash) error
3. EVMChainGERSender
Implements ChainSender
using Ethereum clients and transaction management.
Functions:
IsGERInjected
: Verifies GER presence in the smart contract.InjectGER
: Submits the GER using theinsertGlobalExitRoot
method and monitors transaction status.
Smart Contract Integration
- Contract:
GlobalExitRootManagerL2SovereignChain.sol
- Function:
insertGlobalExitRoot
- Bindings: Available in cdk-contracts-tooling.
Summary
The AggOracle component automates the propagation of GERs from L1 to L2, enabling bridging across networks.
Refer to the EVM implementation in evm.go for guidance on building chain senders for non-EVM chains.