|
purify
C++ Purify implementation with native circuit and BPP support
|
Resettable packed circuit representation backed by one aligned owning slab. More...
#include <bulletproof.hpp>
Public Member Functions | |
| PackedWithSlack ()=default | |
| PackedWithSlack (const PackedWithSlack &other) | |
| PackedWithSlack & | operator= (const PackedWithSlack &other) |
| PackedWithSlack (PackedWithSlack &&other) noexcept | |
| PackedWithSlack & | operator= (PackedWithSlack &&other) noexcept |
| std::size_t | n_gates () const noexcept |
| std::size_t | n_commitments () const noexcept |
| std::size_t | n_bits () const noexcept |
| std::size_t | constraint_count () const noexcept |
| std::size_t | constraint_capacity () const noexcept |
| bool | has_valid_shape () const noexcept |
| void | reset () noexcept |
| Restores the packed circuit to its original base row sizes and constraint count. | |
| std::size_t | add_constraint (const FieldElement &constant=FieldElement::zero()) |
| Appends a new linear constraint constant term and returns its index. | |
| void | add_left_term (std::size_t gate_idx, std::size_t constraint_idx, const FieldElement &scalar) |
| Adds a coefficient to the left-wire matrix. | |
| void | add_right_term (std::size_t gate_idx, std::size_t constraint_idx, const FieldElement &scalar) |
| Adds a coefficient to the right-wire matrix. | |
| void | add_output_term (std::size_t gate_idx, std::size_t constraint_idx, const FieldElement &scalar) |
| Adds a coefficient to the output-wire matrix. | |
| void | add_commitment_term (std::size_t commitment_idx, std::size_t constraint_idx, const FieldElement &scalar) |
| Adds a coefficient to the commitment matrix using the Bulletproof sign convention. | |
| bool | evaluate (const BulletproofAssignmentData &assignment) const |
| Evaluates the packed circuit directly against a witness assignment. | |
| Result< NativeBulletproofCircuit > | unpack () const |
| Materializes the packed circuit back into the ergonomic row-vector representation. | |
| NativeBulletproofCircuitRow::PackedWithSlack | left_row (std::size_t gate_idx) const noexcept |
| Returns a read-only packed left-wire row view. | |
| NativeBulletproofCircuitRow::PackedWithSlack | right_row (std::size_t gate_idx) const noexcept |
| Returns a read-only packed right-wire row view. | |
| NativeBulletproofCircuitRow::PackedWithSlack | output_row (std::size_t gate_idx) const noexcept |
| Returns a read-only packed output-wire row view. | |
| NativeBulletproofCircuitRow::PackedWithSlack | commitment_row (std::size_t commitment_idx) const noexcept |
| Returns a read-only packed commitment row view. | |
| std::span< const FieldElement > | constants () const noexcept |
| Returns the live constraint constants stored in the slab. | |
Static Public Member Functions | |
| static Result< PackedWithSlack > | from_circuit (const NativeBulletproofCircuit &circuit, const PackedSlackPlan &slack) |
| Packs a native circuit into one aligned slab with caller-supplied row and constraint slack. | |
This keeps row metadata, sparse terms, and constants in one compact slab sized for the base circuit plus caller-supplied slack. It supports two cache-friendly modes: copying the object cheaply for const use, or mutating it in place and then calling reset() to return to the original packed base shape.
Definition at line 98 of file bulletproof.hpp.
|
default |
| purify::NativeBulletproofCircuit::PackedWithSlack::PackedWithSlack | ( | const PackedWithSlack & | other | ) |
Definition at line 964 of file bulletproof.cpp.
|
noexcept |
Definition at line 979 of file bulletproof.cpp.
| void purify::NativeBulletproofCircuit::PackedWithSlack::add_commitment_term | ( | std::size_t | commitment_idx, |
| std::size_t | constraint_idx, | ||
| const FieldElement & | scalar | ||
| ) |
Definition at line 1262 of file bulletproof.cpp.
References scalar.
| std::size_t purify::NativeBulletproofCircuit::PackedWithSlack::add_constraint | ( | const FieldElement & | constant = FieldElement::zero() | ) |
Definition at line 1222 of file bulletproof.cpp.
| void purify::NativeBulletproofCircuit::PackedWithSlack::add_left_term | ( | std::size_t | gate_idx, |
| std::size_t | constraint_idx, | ||
| const FieldElement & | scalar | ||
| ) |
Definition at line 1247 of file bulletproof.cpp.
References scalar.
| void purify::NativeBulletproofCircuit::PackedWithSlack::add_output_term | ( | std::size_t | gate_idx, |
| std::size_t | constraint_idx, | ||
| const FieldElement & | scalar | ||
| ) |
Definition at line 1257 of file bulletproof.cpp.
References scalar.
| void purify::NativeBulletproofCircuit::PackedWithSlack::add_right_term | ( | std::size_t | gate_idx, |
| std::size_t | constraint_idx, | ||
| const FieldElement & | scalar | ||
| ) |
Definition at line 1252 of file bulletproof.cpp.
References scalar.
|
noexcept |
Definition at line 1283 of file bulletproof.cpp.
|
noexcept |
Definition at line 1287 of file bulletproof.cpp.
|
inlinenoexcept |
Definition at line 127 of file bulletproof.hpp.
|
inlinenoexcept |
Definition at line 123 of file bulletproof.hpp.
| bool purify::NativeBulletproofCircuit::PackedWithSlack::evaluate | ( | const BulletproofAssignmentData & | assignment | ) | const |
Definition at line 1291 of file bulletproof.cpp.
References purify::BulletproofAssignmentData::commitments, purify::NativeBulletproofCircuit::has_valid_shape(), purify::NativeBulletproofCircuitTerm::idx, purify::BulletproofAssignmentData::left, purify::FieldElement::negate(), purify::BulletproofAssignmentData::output, purify::BulletproofAssignmentData::right, purify::NativeBulletproofCircuitTerm::scalar, and purify::FieldElement::zero().
|
static |
Definition at line 1373 of file bulletproof.cpp.
References purify::NativeBulletproofCircuit::c, purify::checked_add_size(), purify::NativeBulletproofCircuit::PackedSlackPlan::constraint_slack, purify::Expected< T, E >::error(), purify::NativeBulletproofCircuit::has_valid_shape(), purify::Expected< T, E >::has_value(), purify::InvalidDimensions, purify::NativeBulletproofCircuit::n_bits, purify::NativeBulletproofCircuit::n_commitments, purify::NativeBulletproofCircuit::n_gates, purify::Overflow, purify::SizeMismatch, purify::unexpected_error(), purify::NativeBulletproofCircuit::PackedSlackPlan::wl, purify::NativeBulletproofCircuit::wl, purify::NativeBulletproofCircuit::PackedSlackPlan::wo, purify::NativeBulletproofCircuit::wo, purify::NativeBulletproofCircuit::PackedSlackPlan::wr, purify::NativeBulletproofCircuit::wr, purify::NativeBulletproofCircuit::PackedSlackPlan::wv, purify::NativeBulletproofCircuit::wv, and purify::FieldElement::zero().
Referenced by purify::NativeBulletproofCircuit::pack_with_slack().
|
noexcept |
Definition at line 1058 of file bulletproof.cpp.
Referenced by purify::verify_experimental_circuit().
|
noexcept |
Definition at line 1268 of file bulletproof.cpp.
|
inlinenoexcept |
Definition at line 119 of file bulletproof.hpp.
|
inlinenoexcept |
Definition at line 115 of file bulletproof.hpp.
Referenced by purify::detail::circuit_n_commitments(), and purify::verify_experimental_circuit().
|
inlinenoexcept |
Definition at line 111 of file bulletproof.hpp.
Referenced by purify::detail::circuit_n_gates(), and purify::verify_experimental_circuit().
| NativeBulletproofCircuit::PackedWithSlack & purify::NativeBulletproofCircuit::PackedWithSlack::operator= | ( | const PackedWithSlack & | other | ) |
Definition at line 989 of file bulletproof.cpp.
|
noexcept |
Definition at line 999 of file bulletproof.cpp.
|
noexcept |
Definition at line 1278 of file bulletproof.cpp.
|
noexcept |
Definition at line 1103 of file bulletproof.cpp.
Referenced by purify::NativeBulletproofCircuitTemplate::instantiate_packed().
|
noexcept |
Definition at line 1273 of file bulletproof.cpp.
| Result< NativeBulletproofCircuit > purify::NativeBulletproofCircuit::PackedWithSlack::unpack | ( | ) | const |
Definition at line 1345 of file bulletproof.cpp.
References purify::NativeBulletproofCircuit::c, purify::NativeBulletproofCircuit::has_valid_shape(), purify::InvalidDimensions, purify::unexpected_error(), purify::NativeBulletproofCircuit::wl, purify::NativeBulletproofCircuit::wo, purify::NativeBulletproofCircuit::wr, and purify::NativeBulletproofCircuit::wv.