Types Reference

This page summarizes the most important Rust and Cairo types used by HDP.

Rust input/output types

TypeDescriptionLocation
HDPDryRunInputCompiled class, params, injected statecrates/types/src/lib.rs
HDPInputCompiled class, params, proofs, injected statecrates/types/src/lib.rs
ProofsDatachain_proofs, state_proofs, unconstrainedcrates/types/src/lib.rs
HDPDryRunOutputTask hash and output root fieldscrates/types/src/lib.rs
HDPOutputTask hash, output root, mmr_metascrates/types/src/lib.rs
MmrMetaOutputPoseidon or Keccak MMR metadatacrates/types/src/lib.rs
StateProofsInjected state proof listcrates/types/src/proofs/injected_state/
InjectedStateInitial injected state mapcrates/types/src/lib.rs
UnconstrainedStateUnconstrained data mapcrates/types/src/lib.rs

Chain identifiers

TypeDescription
ChainIdsEnum of supported chains
ChainProofsPer-chain proof bundles
HashingFunctionPoseidon or Keccak

ProofsData (the proofs.json file) is structured as:

{
  "chain_proofs": [ ... ],
  "state_proofs": [ ... ],
  "unconstrained": { ... }
}

state_proofs is ordered and can include both read and write proofs.

Chain ID constants (Cairo)

The Cairo library exposes chain ID constants:

  • hdp_cairo::evm::{ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_TESTNET_CHAIN_ID, OPTIMISM_MAINNET_CHAIN_ID, OPTIMISM_TESTNET_CHAIN_ID}
  • hdp_cairo::starknet::{STARKNET_MAINNET_CHAIN_ID, STARKNET_TESTNET_CHAIN_ID}

Dry run keys

Dry run handlers collect keys in a DryRunKey enum:

  • Header, Account, Storage, Tx, Receipt for EVM
  • Starknet keys are tracked in the Starknet handler

Source: crates/dry_hint_processor/src/syscall_handler/

Injected state and unconstrained handlers also define their own DryRunKey enums for state actions and bytecode.

Cairo key structs

These are used when calling hdp_cairo APIs:

  • EVM: HeaderKey, AccountKey, StorageKey, BlockTxKey, BlockReceiptKey, LogKey
  • Starknet: HeaderKey, StorageKey

Output fields

The sound run output segment is decoded as:

task_hash_low, task_hash_high, output_root_low, output_root_high,
poseidon_len, keccak_len,
poseidon_metas (4 felts each), keccak_metas (5 felts each)

MmrMetaOutput is encoded as:

  • Poseidon: id, size, chain_id, root
  • Keccak: id, size, chain_id, root_low, root_high