purify
C++ Purify implementation with native circuit and BPP support
Loading...
Searching...
No Matches
purify::NativeBulletproofCircuitTemplate Class Reference

Public-key-agnostic native verifier-circuit template. More...

#include <bulletproof.hpp>

Public Member Functions

Result< bool > partial_evaluate (const BulletproofAssignmentData &assignment) const
 Evaluates only the public-key-agnostic base circuit cached inside the template.
Result< bool > final_evaluate (const BulletproofAssignmentData &assignment, const UInt512 &pubkey) const
 Evaluates only the late-bound public-key/output constraints against one assignment.
Result< Bytes > integrity_digest () const
 Returns a stable digest of the packed base circuit plus late-bound expressions.
Result< NativeBulletproofCircuit::PackedWithSlack > instantiate_packed (const UInt512 &pubkey) const
Result< NativeBulletproofCircuit > instantiate (const UInt512 &pubkey) const
Result< NativeBulletproofCircuit > instantiate_sum (std::span< const UInt512 > public_keys) const
 Builds one circuit binding the sum of distinct hosts' outputs to one commitment.
Result< BulletproofAssignmentData > sum_assignments (std::span< const UInt512 > public_keys, std::span< const BulletproofAssignmentData > assignments) const
 Validates and concatenates local assignments for instantiate_sum.

Static Public Member Functions

static NativeBulletproofCircuitTemplate from_parts (NativeBulletproofCircuit::PackedWithSlack base_packed, Expr p1x, Expr p2x, Expr out)
 Builds a template from a lowered base circuit plus late-bound public expressions.

Detailed Description

This caches the message/topic-dependent lowering work up to, but not including, the final public-key binding step. Instantiate it with a packed Purify public key when you need the exact native circuit for a specific user.

Definition at line 351 of file bulletproof.hpp.

Member Function Documentation

◆ final_evaluate()

◆ from_parts()

NativeBulletproofCircuitTemplate purify::NativeBulletproofCircuitTemplate::from_parts ( NativeBulletproofCircuit::PackedWithSlack base_packed,
Expr p1x,
Expr p2x,
Expr out )
staticnodiscard

Definition at line 2102 of file bulletproof.cpp.

Referenced by purify::verifier_circuit_template().

◆ instantiate()

◆ instantiate_packed()

◆ instantiate_sum()

Result< NativeBulletproofCircuit > purify::NativeBulletproofCircuitTemplate::instantiate_sum ( std::span< const UInt512 > public_keys) const

Hosts retain their supplied order. Every host uses this template's evaluation input; individual output commitments are replaced by one commitment to their field sum. Empty rosters, duplicate hosts, invalid dimensions, and overflow are rejected. This composes a circuit relation; it does not implement distributed proving.

Definition at line 2225 of file bulletproof.cpp.

References purify::NativeBulletproofCircuitRow::add(), purify::NativeBulletproofCircuit::add_commitment_term(), purify::NativeBulletproofCircuit::add_constraint(), purify::NativeBulletproofCircuit::c, purify::checked_add_size(), purify::checked_mul_size(), purify::NativeBulletproofCircuitRow::entries, purify::IndexOutOfRange, purify::FieldElement::one(), purify::Overflow, PURIFY_ASSIGN_OR_RETURN, PURIFY_RETURN_IF_ERROR, purify::FieldElement::try_from_uint256(), purify::unexpected_error(), purify::unpack_public(), purify::NativeBulletproofCircuit::wl, purify::NativeBulletproofCircuit::wo, and purify::NativeBulletproofCircuit::wr.

◆ integrity_digest()

Result< Bytes > purify::NativeBulletproofCircuitTemplate::integrity_digest ( ) const

◆ partial_evaluate()

◆ sum_assignments()

Result< BulletproofAssignmentData > purify::NativeBulletproofCircuitTemplate::sum_assignments ( std::span< const UInt512 > public_keys,
std::span< const BulletproofAssignmentData > assignments ) const

Each assignment must satisfy this template and its corresponding host. Gate columns are padded with zeros, and the sole output commitment is the sum of member outputs. The caller receives every witness centrally; this is not a private MPC operation.

Definition at line 2294 of file bulletproof.cpp.

References purify::BindingMismatch, purify::BulletproofAssignmentData::commitments, purify::EquationMismatch, final_evaluate(), purify::BulletproofAssignmentData::left, purify::BulletproofAssignmentData::output, partial_evaluate(), PURIFY_ASSIGN_OR_RETURN, PURIFY_RETURN_IF_ERROR, purify::BulletproofAssignmentData::right, purify::SizeMismatch, purify::unexpected_error(), and purify::FieldElement::zero().


The documentation for this class was generated from the following files: