Skip to main content

Finalize Circuit

finalize is the last step of aggregation. It verifies the root of the binary recursion tree which is either a recursive_2_leaf proof (when only one leaf was needed) or a recursive_2_inner proof and is proved with the EVM transcript so the on-chain verifier can check it.

What it does

Two responsibilities:

  1. Verify the root. verify_honk_proof checks hash(root_vk) == root_kh and that root_proof verifies for the supplied root_pubs. Because root_pubs is built from the public inputs finalize was called with, this binds the root's published [action_vk_hash, leaf_vk_hash, inner_vk_hash, publics_digest] to finalize's own public inputs — completing the chain from on-chain calldata down to every Action.
  2. Constrain the root's VK. root_kh must be leaf_vk_hash or inner_vk_hash. Since both leaf and inner emit the identical 4-field layout, finalize verifies either uniformly, while the disjunction prevents a third (attacker) VK from being substituted at the root.

Failure modes

SymptomCause
verify_honk_proof fails in-circuitthe root proof is invalid, or root_vk doesn't hash to root_kh
root_kh_ok assertion failsthe root was produced under an unknown VK (a substitution attempt)
on-chain Orchestrator__InvalidProofreconstructed publicsDigest ≠ the proof's, or a pinned VK hash drifted