Realm & GUTA Gadgets
These gadgets are used within the circuits run by the network's Realm and Coordinator nodes for aggregating proofs.
GUTAStatsGadget
- File:
guta_stats_rs.txt - Purpose: Represents and aggregates key statistics during GUTA processing (fees, operations counts, slots modified).
- Technical Function: Data structure holding targets for stats. Provides
combine_withmethod for additive aggregation andto_hashfor commitment. - Inputs/Witness: Targets for
fees_collected,user_ops_processed,total_transactions,slots_modified. - Outputs/Computed: Combined stats (via
combine_with), hash of stats (to_hash). - Constraints:
combine_withuses addition constraints.to_hashuses packing/hashing. - Assumptions: Assumes input target values are correct.
- Role: Tracks operational metrics through the aggregation tree.
GlobalUserTreeAggregatorHeaderGadget
- File:
guta_header_rs.txt - Purpose: Defines the standard public input structure for all GUTA-related aggregation circuits. Encapsulates the result of an aggregation step.
- Technical Function: Data structure holding
guta_circuit_whitelistroot,checkpoint_tree_root, thestate_transition(SubTreeNodeStateTransitionGadget) for theGUSRtree segment covered, and aggregatedstats(GUTAStatsGadget). Providesto_hashmethod. - Inputs/Witness: Component targets/gadgets.
- Outputs/Computed: Hash of the header (
to_hash). - Constraints:
to_hashcombines hashes of components. - Assumptions: Assumes input components are correctly formed/verified.
- Role: Standardizes the interface between recursive GUTA circuits, ensuring consistent information propagation and verification.
VerifyEndCapProofGadget
- File:
verify_end_cap_rs.txt - Purpose: Verifies a user's submitted End Cap proof (output of UPS Phase 1) at the entry point of the GUTA aggregation (typically within a Realm node circuit).
- Technical Function: Verifies the End Cap ZK proof, checks its fingerprint against the known constant, matches public inputs against witness data (result/stats), verifies the user's claimed checkpoint root against a historical checkpoint proof, and translates the result into a
GlobalUserTreeAggregatorHeaderGadget. - Inputs/Witness:
end_cap_result_gadget,guta_stats: Witness for claimed outputs.checkpoint_historical_merkle_proof: Witness proving user'scheckpoint_tree_root_hashwas valid historically.verifier_data,proof_target: The End Cap proof itself and its verifier data.known_end_cap_fingerprint_hash: Constant parameter.
- Outputs/Computed: Implements
ToGUTAHeaderto output aGlobalUserTreeAggregatorHeaderGadget. - Constraints:
- Verifies
proof_targetusingverifier_data. - Computes fingerprint from
verifier_data, connects toknown_end_cap_fingerprint_hash. - Computes expected public inputs hash from
end_cap_result_gadgetandguta_stats, connects toproof_target.public_inputs. - Verifies
checkpoint_historical_merkle_proofusingHistoricalRootMerkleProofGadget. - Connects
historical_proof.historical_roottoend_cap_result.checkpoint_tree_root_hash. - Constructs output GUTA header using
historical_proof.current_rootas thecheckpoint_tree_root, deriving the state transition fromend_cap_result(leaf hashes and user ID), and using the verifiedguta_stats.
- Verifies
- Assumptions: Assumes witness data is valid initially. Assumes
known_end_cap_fingerprint_hashand inputdefault_guta_circuit_whitelistare correct. - Role: Securely ingests a user's proven session result into the GUTA aggregation, validating it against global rules and historical state before converting it to the standard GUTA format.
VerifyGUTAProofGadget
- File:
verify_guta_proof_rs.txt - Purpose: Verifies a GUTA proof generated by a lower level in the aggregation hierarchy (e.g., verifying a Realm's proof at the Coordinator level, or verifying sub-realm proofs within a Realm).
- Technical Function: Verifies the input GUTA ZK proof, checks its fingerprint against the GUTA circuit whitelist, and ensures its public inputs match the claimed GUTA header witness.
- Inputs/Witness:
guta_proof_header_gadget: Witness for the claimed header of the proof being verified.guta_whitelist_merkle_proof: Witness proving the sub-proof's circuit fingerprint is in the GUTA whitelist.verifier_data,proof_target: The GUTA proof and its verifier data.
- Outputs/Computed: The verified
guta_proof_header_gadget. - Constraints:
- Verifies
proof_targetusingverifier_data. - Computes fingerprint from
verifier_data. - Verifies
guta_whitelist_merkle_proof. - Connects
guta_proof_header.guta_circuit_whitelisttowhitelist_proof.root. - Computes expected public inputs hash from
guta_proof_header, connects toproof_target.public_inputs. - Connects
whitelist_proof.valueto computed fingerprint.
- Verifies
- Assumptions: Assumes witness data is valid initially.
- Role: The core recursive verification step for GUTA aggregation circuits. Ensures that only valid proofs generated by allowed GUTA circuits are incorporated into higher levels of aggregation.
TwoNCAStateTransitionGadget
- File:
two_nca_state_transition_rs.txt - Purpose: Combines the
GUSRstate transitions from two independent GUTA proofs (A and B) that modify different branches of the tree, computing the resulting state transition at their Nearest Common Ancestor (NCA). - Technical Function: Uses
UpdateNearestCommonAncestorProofOptGadgetto verify the NCA proof witness against the state transitions provided by the input GUTA headers (a_header,b_header). Combines statistics and outputs a new GUTA header for the NCA node. - Inputs/Witness:
a_header,b_header: Verified GUTA headers from the two child proofs.UpdateNearestCommonAncestorProof: Witness containing NCA proof data (partial or full).
- Outputs/Computed:
new_guta_headerrepresenting the transition at the NCA. - Constraints:
- Connects
a_header.checkpoint_tree_root==b_header.checkpoint_tree_root. - Connects
a_header.guta_circuit_whitelist==b_header.guta_circuit_whitelist. - Connects
a_header.state_transitionfields (old/new value, index, level) toupdate_nca_proof_gadget.child_afields. - Connects
b_header.state_transitionfields toupdate_nca_proof_gadget.child_bfields. - Computes
new_stats=a_header.stats.combine_with(b_header.stats). - Constructs
new_guta_headerusing whitelist/checkpoint from children, the NCA state transition details fromupdate_nca_proof_gadget, andnew_stats.
- Connects
- Assumptions: Assumes input headers
a_headerandb_headerhave already been verified. Assumes the NCA proof witness is valid initially. - Role: Enables efficient parallel aggregation by merging results from independent subtrees using cryptographic proofs of their combined effect at the parent node.
GUTAHeaderLineProofGadget
- File:
guta_line_rs.txt - Purpose: Propagates a GUTA state transition upwards along a direct path in the
GUSRtree (when there's only one child updating that path segment). - Technical Function: Uses
SubTreeNodeTopLineGadgetto recompute the Merkle root hash from the child's transition level up to a specified higher level (e.g., Realm root or global root), using sibling hashes provided as witness. - Inputs/Witness:
child_proof_header: The verified GUTA header from the lower level.siblings: Witness array of Merkle sibling hashes for the path.- Height parameters.
- Outputs/Computed:
new_guta_headerwith the state transition updated to reflect the higher level. - Constraints: Relies on
SubTreeNodeTopLineGadget's internal Merkle hashing constraints. - Assumptions: Assumes
child_proof_headeris verified. Assumessiblingswitness is correct. - Role: Efficiently moves a verified state transition up the tree hierarchy when merging (NCA) is not required.
VerifyGUTAProofToLineGadget
- File:
verify_guta_proof_to_line_rs.txt - Purpose: Combines verifying a lower-level GUTA proof with immediately propagating its state transition upwards using a line proof.
- Technical Function: Orchestrates
VerifyGUTAProofGadgetfollowed byGUTAHeaderLineProofGadget. - Inputs/Witness: Combines witnesses for both sub-gadgets (proof, header, whitelist proof, siblings).
- Outputs/Computed:
new_guta_headerat the top of the line. - Constraints: Instantiates and connects the two sub-gadgets.
- Assumptions: Relies on sub-gadget assumptions.
- Role: A common pattern gadget simplifying the verification and upward propagation of a single GUTA proof branch.
(Coordinator/GUTA Gadgets related to User Registration: GUTARegisterUserCoreGadget, GUTARegisterUserFullGadget, GUTARegisterUsersGadget, GUTAOnlyRegisterUsersGadget, GUTARegisterUsersBatchGadget - Descriptions remain largely the same as the previous detailed version, focusing on GUSR tree updates and User Registration Tree checks.)
GUTANoChangeGadget
- File:
guta_no_change_gadget_rs.txt - Purpose: Creates a GUTA header signifying that the
GUSRtree state did not change for this block/subtree, while still potentially updating the referencedcheckpoint_tree_root. - Technical Function: Verifies a checkpoint proof to get the current
checkpoint_tree_rootand the correspondinguser_tree_rootfrom the checkpoint leaf. Constructs a GUTA header with a "no-op" state transition (old=new=user_tree_root at level 0) and zero stats. - Inputs/Witness:
guta_circuit_whitelist: Input constant/parameter.checkpoint_tree_proof: Witness provingcheckpoint_leafexistence.checkpoint_leaf_gadget: Witness for theQEDCheckpointLeafCompactWithStateRoots.
- Outputs/Computed:
new_guta_header(indicating no GUSR change). - Constraints: Verifies checkpoint proof (
MerkleProofGadget). Verifies consistency between proof value and leaf hash. Constructs header with no-op transition and zero stats. - Assumptions: Assumes witness proof/leaf data is valid initially. Assumes input
guta_circuit_whitelistis correct. - Role: Allows the GUTA aggregation structure to remain consistent and synchronized with the main Checkpoint Tree advancement even during periods where no user state relevant to GUTA was modified.