Expand description
Proofs of Tenderdash blocks: what getBlocks and getOwnerTransactionsInBlock return
when asked to prove.
Tenderdash already commits to a block’s contents. The transactions and their execution results are Merkle trees whose roots are in the block header, the header hashes to the block id, and the validator quorum signs a vote for that block id. A proof carries the header, the block id and the signature, and for single transactions the Merkle paths to the two roots.
This module is the one definition of every hash on that chain. DAPI builds its proofs
with it and checks them before they leave (check_header, check_block_contents,
check_block_fields, MerkleTree), and a client verifies them with it (verify_block_proof,
verify_transaction_proof), so a node cannot hand out a proof that clients refuse.
Modules§
- fixtures
- Blocks signed by test quorums, and the answers a node would give for them, for tests of this crate and of the crates that verify block proofs through it.
Structs§
- Merkle
Tree - The tree over some leaves, with the paths of the selected ones: what a node needs to prove those leaves are under the root.
Enums§
- Block
Proof Error - Why a Tenderdash block proof, or what an answer says about the block, was refused.
Functions§
- check_
block_ contents - Check that a block’s contents are the ones
headercommits to: every transaction, by its hash, in block order, and the result leaf of each. - check_
block_ fields - Check that the fields a
getBlocksblock repeats from its header are the ones inproof. Only the header is signed, and a node reads those fields from another Tenderdash answer than the proof, so nothing else ties them to it. - check_
header - Check that
headeris the one behindblock_id: that it hashes to the block hash and to the state id, the two values of a block id a quorum’s signature covers. - header_
hash - The hash Tenderdash gives a block: the Merkle root of its header’s fields, each in its protobuf encoding. A string, number or hash is wrapped in a one-field message first, so one that is empty or zero is an empty leaf.
- header_
time_ ms - A header’s time in milliseconds since the Unix epoch, the precision a state id keeps.
- merkle_
root - The root of the tree over
leaves. - proof_
parts - The header and block id of a proof, which a well-formed one always carries.
- result_
leaf - The leaf of a transaction’s execution result in the tree behind a header’s
results_hash: Tenderdash hashes only these fields of the result. - root_
from_ path - Follow
pathup from the leaf atindexof a tree oftotalleaves, returning the root it leads to.pathruns from the leaf’s sibling up to a child of the root. - state_
id_ hash - The state id Tenderdash derives from a header, which the quorum signs next to the
block hash: the hash of these fields as Tenderdash’s
StateID. - transaction_
hash - The hash Tenderdash knows a transaction by, which is also its leaf in the tree behind
a header’s
data_hash. - verify_
block_ proof - Verify that a quorum committed the block
proofdescribes, and return that block’s header, every field of which the quorum’s signature then covers. - verify_
transaction_ proof - Check that a transaction and its execution result are in the block of
header, at the positionproofnames.