Mass exit API and CLI reference
On this page
- EVM contract functions
- Trigger mass exit
- Trigger with historical validators
- Withdraw via snapshot
- Complete in-progress withdrawal
- Chromia CLI and queries
- Get account state proof
- Get state slot IDs for user balance
- Get state slot IDs for withdrawal
- Get withdrawal by tx + op index
- Get withdrawal event proof
- Cross-Chain recovery
- Deploy recovery contract
- Set recovery contract RID
- Register recovery contract on downstream
- Register it upstream via ICCF on Bridge Chain
This topic summarizes key CLI commands, Rell queries, and EVM contract calls used throughout the mass exit flow.
EVM contract functions
Trigger mass exit
Solidity
function triggerMassExit(
bytes memory blockHeader, //Recent, verified block header
bytes[] memory sigs, //Validator signatures endorsing the header
address[] memory signers, //Validator addresses corresponding to the signatures
Data.ExtraProofData memory extraProof //Additional proof data if neededTrigger with historical validators
Solidity
function triggerMassExitWithHistoricalValidators(
bytes memory blockHeader, //Recent, verified block header
bytes[] memory sigs, //Validator signatures endorsing the header
address[] memory signers, //Validator addresses corresponding to the signatures
Data.ExtraProofData memory extraProof,//Additional proof data if needed
address[] memory historicalValidators //Historical validator addresses used for verification
)Withdraw via snapshot
Solidity
function withdrawBySnapshot(
bytes calldata snapshot, //Snapshot data capturing the account state
Data.Proof memory stateProof //Merkle proof validating the snapshot
)Complete in-progress withdrawal
Solidity
function completeWithdrawalBySnapshot(
bytes calldata _stateRecord, //Account state record data (header and withdrawal event hashes)
uint64 n, //Index of the specific withdrawal event in the record
bytes memory _event, //Withdrawal event data
Data.Proof memory stateProof //Merkle proof for the account state record
)Chromia CLI and queries
Get account state proof
Terminal
chr query -brid $BRIDGE get_account_state_merkle_proof \
-- blockHeight=$BLOCK_HEIGHT \
accountNumber=$ACCOUNT_STATE_SLOT_IDGet state slot IDs for user balance
Rell
val state_slot_ids = hbridge.get_state_slot_ids_for_address(
beneficiary,//EVM address of the user
network_id //Identifier of the EVM network
);Get state slot IDs for withdrawal
Rell
val slot_ids = hbridge.get_withdrawal_state_slot_ids_for_address(
beneficiary,//EVM address of the user
network_id //Identifier of the EVM network
);Get withdrawal by tx + op index
Rell
val withdrawal = hbridge.get_erc20_withdrawal_by_tx(
tx_rid, //Rell transaction RID
op_index //Operation index within the transaction
);Get withdrawal event proof
Terminal
chr query -brid $BRIDGE get_event_merkle_proof \
-- eventHash=$WITHDRAWAL_EVENT_HASHCross-Chain recovery
Deploy recovery contract
Terminal
npx hardhat deploy:recovery --network <network> \
--validator-address <VALIDATOR_CONTRACT_ADDRESS>Set recovery contract RID
Terminal
npx hardhat setBlockchainRid:recovery \
--network <network> \
--address <RECOVERY_CONTRACT_ADDRESS> \
--blockchain-rid <DOWNSTREAM_CHAIN_RID>Register recovery contract on downstream
Terminal
chr tx -brid $DOWNSTREAM_CHAIN_RID register_recovery_contract \
-- $NETWORK_ID x"'$RECOVERY_CONTRACT_ADDRESS'"Register it upstream via ICCF on Bridge Chain
Terminal
chr tx -brid $BRIDGE --iccf-tx $ICCF_TX_RID \
--iccf-source $DOWNSTREAM_CHAIN_RID \
register_recovery_contract -- 0