Verifying storage proofs

How to interact with the `AxiomV0StoragePf` contract

To verify historic storage slots, users and applications can use AxiomV0StoragePf and the attestSlots function, which has the following signature:

function attestSlots(
    IAxiomV0.BlockHashWitness calldata blockData, 
    bytes calldata proof)
external;

This takes in a block hash witness and a ZK proof with public inputs

  • blockHash: The claimed block hash in the attestation.

  • blockNumber: The claimed block number in the attestation.

  • addr: The claimed address in the attestation.

  • slotArray: An array of claimed (slot, slotValue) pairs in the account storage of addr.

The function body checks that

  • blockData is a valid Merkle inclusion proof into the block hash cache

  • proof verifies correctly against our SNARK verifier

  • the public inputs of proof are as claimed.

If all of these checks pass, attestSlots emits:

SlotAttestationEvent(uint32 blockNumber, address addr, uint256 slot, uint256 slotValue)

and sets the value of keccak(blockNumber || addr || slot || slotValue) to true in the mapping

mapping(bytes32 => bool) public slotAttestations;

Last updated