Expand description
§bal-source
Where BALs and proofs come from. Two traits — BalSource
(head, headers, blocks with their BAL) and StateSource
(eth_getProof) — plus a JSON-RPC implementation, Merkle-proof
verification against a header’s state_root, and a primary/backup
combinator.
use bal_source::{BalSource, Fallback, JsonRpcSource};
// Your full node decides what the chain is; an archive provider is asked
// only for BAL bodies it has pruned and proofs outside its state window.
// Both are verified the same way, so the backup adds reach, not trust.
let src = Fallback::new(
JsonRpcSource::new("http://localhost:8545"),
Some(JsonRpcSource::new("https://archive.example")),
);
let head = src.head().await?;
let block = src.block(head).await?; // header + decoded, unverified BAL
block.bal.verify(block.header.block_access_list_hash.unwrap())?;verify_account_proof checks the account leaf against state_root and
every storage leaf against the account’s storage root; a zero value is
proven by exclusion. check_requested refuses a proof that answers for
slots you did not ask about. The trie verifier runs under a panic guard,
so a crafted node cannot abort the process.
Transport: 30 s timeout, no redirects, 64 MiB response cap. The day-0
probe (JsonRpcSource::probe) reports whether an endpoint serves BALs,
for how old blocks, and how far back it serves proofs.
Part of balq.
Source abstraction: the archive never talks to a node directly, it talks
to a BalSource (blocks + BALs) and a StateSource (Merkle proofs for
bootstrap). Implementations: JSON-RPC (here), Engine API and in-process
(later crates). Which of these actually work is the day-0 question; the
archive does not care.
Re-exports§
pub use proof::check_requested;pub use proof::verify_account_proof;pub use proof::ProofError;
Modules§
- proof
- Merkle-proof verification for bootstrap values. This is what turns an
eth_getProofanswer from “the RPC said so” into a value anchored to a block header’sstate_root— promise #2 for the only records that do not come from a BAL.
Structs§
- Account
Proof eth_getProofresponse: account leaf plus any number of storage proofs.- Fallback
- Primary for the chain, backup for old data.
- Header
- The parts of a block header the archive needs. Kept minimal on purpose: the full Glamsterdam header layout is not frozen, and only these fields participate in verification.
- Json
RpcSource BalSource+StateSourceover plain JSON-RPC. One request per call; no batching, no retries — callers own that policy.- Probe
Report - Day-0 findings for one endpoint. Printed by
balq probe. - Sourced
Block - A block as the archive consumes it: header plus decoded, unverified BAL.
Verification against
header.block_access_list_hashis the archive’s job so that no source implementation can skip it. - Storage
Proof - One slot’s proof against an account’s storage root.
Enums§
- BalProbe
- Outcome of fetching one block’s BAL and checking it against its header.
- Source
Error - What can go wrong between the archive and a node.
Constants§
- BAL_
HASH_ FIELD - Header field carrying
keccak(rlp(bal))on the block object. - BAL_
METHOD - JSON-RPC method serving the BAL body (execution-apis).
Traits§
- BalSource
- Where blocks and their BALs come from.
- State
Source - Where Merkle proofs come from.
Type Aliases§
- Result
- Result of source operations.