Similar to the storage slot value proof described in the previous section, receipt proof is also using the synced block header information stored on the destination chain as the ground truth. With this, one can prove the source chain's receipt information by proving the following parts:
- 1.validity of a block receipt root that matches the synced block header info;
- 2.validity of the receipt leaf hash that matches the receipt root.
The rest of this page outlines the mechanisms for implementing receipt proof attestation:
This circuit is composed of two parts, including MPT calculation and block header calculation.
Public Inputs (can be used by on-chain app contracts):
LeafHashLeaf node (receipt leaf node) key of the receipt MPT.
BlockHashHash of the block which include this receipt.
BlockNumberNumber of the block which include this receipt.
BlockTimeTime of the block which include this receipt.
KeyThe key nibble of the receipt in MPT.
KeyLengthThe length of the key above.
RootHashReceipt MPT root hash.
KeyFragmentStartsThe index for each node in key nibbles.
NodeRlpNode value for each node in the merkle branch.
NodeRlpRoundIndexesNodeRlp keecak round number.
NodePathPrefixLengthLength for check node type in merkle branch.
NodeTypesMPT node type.
BlockFieldsNumBlock fields count.
BlockRoundIndexBlock hash keccak count from block rlp.
The receipt root hash is one field of the block header RLP, which is used to calculate the block hash. The circuit first proves that the receipt root hash is included in the decoded block RLP, and then it computes the keccak hash of the block RLP to match the provided public input.
To prove the validity of the public input receipt leaf hash, the circuit uses the Merkel branch that includes the receipt leaf to compute the MPT root hash and verify that it matches the validated receipt root hash. Note that the circuit only validates the receipt leaf hash, leaving the validation of receipt RLP fields to the on-chain verifier contract.