Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::Goblin Class Reference

#include <goblin.hpp>

Classes

struct  VerificationKey
 

Public Types

using MegaBuilder = MegaCircuitBuilder
 
using Fr = bb::fr
 
using Transcript = NativeTranscript
 
using OpQueue = ECCOpQueue
 
using ECCVMBuilder = ECCVMFlavor::CircuitBuilder
 
using ECCVMProvingKey = ECCVMFlavor::ProvingKey
 
using TranslatorBuilder = TranslatorCircuitBuilder
 
using MergeProof = MergeProver::MergeProof
 
using ECCVMVerificationKey = ECCVMFlavor::VerificationKey
 
using TranslatorVerificationKey = TranslatorFlavor::VerificationKey
 
using MergeRecursiveVerifier = stdlib::recursion::goblin::MergeRecursiveVerifier< MegaBuilder >
 
using PairingPoints = MergeRecursiveVerifier::PairingPoints
 
using TableCommitments = MergeVerifier::TableCommitments
 
using RecursiveTableCommitments = MergeRecursiveVerifier::TableCommitments
 
using MergeCommitments = MergeVerifier::InputCommitments
 
using RecursiveMergeCommitments = MergeRecursiveVerifier::InputCommitments
 
using RecursiveCommitment = MergeRecursiveVerifier::Commitment
 
using RecursiveTranscript = MegaStdlibTranscript
 
using TranslatorInputData = TranslatorInputData_< fq >
 
using IPA_PCS = IPA< ECCVMFlavor::Curve, CONST_ECCVM_LOG_N >
 

Public Member Functions

 Goblin (CommitmentKey< curve::BN254 > bn254_commitment_key=CommitmentKey< curve::BN254 >(), const std::shared_ptr< Transcript > &transcript=std::make_shared< Transcript >())
 
void prove_merge (const std::shared_ptr< Transcript > &transcript=std::make_shared< Transcript >(), const MergeSettings merge_settings=MergeSettings::PREPEND)
 Construct a merge proof for the goblin ECC ops in the provided circuit; append the proof to the merge_verification_queue.
 
void prove_eccvm ()
 Construct an ECCVM proof and IPA opening proof.
 
void prove_translator ()
 Construct a translator proof.
 
GoblinProof prove (const MergeSettings merge_settings=MergeSettings::PREPEND)
 Constuct a full Goblin proof (ECCVM, Translator, merge)
 
std::pair< PairingPoints, RecursiveTableCommitmentsrecursively_verify_merge (MegaBuilder &builder, const RecursiveMergeCommitments &merge_commitments, const std::shared_ptr< RecursiveTranscript > &transcript, const MergeSettings merge_settings=MergeSettings::PREPEND)
 Recursively verify the next merge proof in the merge verification queue.
 
void ensure_well_formed_op_queue_for_avm (MegaBuilder &builder) const
 Add required initial ops to the op queue for AVM mode.
 

Public Attributes

std::shared_ptr< OpQueueop_queue = std::make_shared<OpQueue>()
 
CommitmentKey< curve::BN254commitment_key
 
GoblinProof goblin_proof
 
fq translation_batching_challenge_v
 
fq evaluation_challenge_x
 
std::shared_ptr< Transcripttranscript
 
std::deque< MergeProofmerge_verification_queue
 
bool avm_mode = false
 

Private Types

using Commitment = MegaFlavor::Commitment
 
using FF = MegaFlavor::FF
 

Detailed Description

Definition at line 22 of file goblin.hpp.

Member Typedef Documentation

◆ Commitment

Definition at line 23 of file goblin.hpp.

◆ ECCVMBuilder

◆ ECCVMProvingKey

◆ ECCVMVerificationKey

◆ FF

using bb::Goblin::FF = MegaFlavor::FF
private

Definition at line 24 of file goblin.hpp.

◆ Fr

Definition at line 28 of file goblin.hpp.

◆ IPA_PCS

using bb::Goblin::IPA_PCS = IPA<ECCVMFlavor::Curve, CONST_ECCVM_LOG_N>

Definition at line 46 of file goblin.hpp.

◆ MegaBuilder

Definition at line 27 of file goblin.hpp.

◆ MergeCommitments

◆ MergeProof

Definition at line 34 of file goblin.hpp.

◆ MergeRecursiveVerifier

◆ OpQueue

Definition at line 30 of file goblin.hpp.

◆ PairingPoints

◆ RecursiveCommitment

◆ RecursiveMergeCommitments

◆ RecursiveTableCommitments

◆ RecursiveTranscript

◆ TableCommitments

◆ Transcript

Definition at line 29 of file goblin.hpp.

◆ TranslatorBuilder

◆ TranslatorInputData

◆ TranslatorVerificationKey

Constructor & Destructor Documentation

◆ Goblin()

bb::Goblin::Goblin ( CommitmentKey< curve::BN254 bn254_commitment_key = CommitmentKey<curve::BN254>(),
const std::shared_ptr< Transcript > &  transcript = std::make_shared<Transcript>() 
)

Definition at line 24 of file goblin.cpp.

Member Function Documentation

◆ ensure_well_formed_op_queue_for_avm()

void bb::Goblin::ensure_well_formed_op_queue_for_avm ( MegaBuilder builder) const

Add required initial ops to the op queue for AVM mode.

Adds 1 no-op (for shiftability) followed by 3 random ops (for ZK hiding of accumulation result). This matches the structure expected by Translator. In Chonk, these ops are added automatically during circuit accumulation, but AVM uses Goblin directly without the full Chonk IVC flow.

Todo:
(https://github.com/AztecProtocol/barretenberg/issues/1537) Assess whether two Translator variants (one with ZK and one without) would be a better option

Definition at line 109 of file goblin.cpp.

◆ prove()

GoblinProof bb::Goblin::prove ( const MergeSettings  merge_settings = MergeSettings::PREPEND)

Constuct a full Goblin proof (ECCVM, Translator, merge)

Returns
Proof

Definition at line 62 of file goblin.cpp.

◆ prove_eccvm()

void bb::Goblin::prove_eccvm ( )

Construct an ECCVM proof and IPA opening proof.

Also computes the translation polynomial evaluation challenges (batching_challenge_v, evaluation_challenge_x) which are passed to the Translator.

Definition at line 36 of file goblin.cpp.

◆ prove_merge()

void bb::Goblin::prove_merge ( const std::shared_ptr< Transcript > &  transcript = std::make_shared<Transcript>(),
const MergeSettings  merge_settings = MergeSettings::PREPEND 
)

Construct a merge proof for the goblin ECC ops in the provided circuit; append the proof to the merge_verification_queue.

Parameters
transcript

Definition at line 29 of file goblin.cpp.

◆ prove_translator()

void bb::Goblin::prove_translator ( )

Construct a translator proof.

Definition at line 53 of file goblin.cpp.

◆ recursively_verify_merge()

std::pair< Goblin::PairingPoints, Goblin::RecursiveTableCommitments > bb::Goblin::recursively_verify_merge ( MegaBuilder builder,
const RecursiveMergeCommitments merge_commitments,
const std::shared_ptr< RecursiveTranscript > &  transcript,
const MergeSettings  merge_settings = MergeSettings::PREPEND 
)

Recursively verify the next merge proof in the merge verification queue.

Recursively verify the next merge proof in the queue.

Proofs are verified in a FIFO manner

Parameters
builderThe circuit in which the recursive verification will be performed.
inputs_commitmentsThe commitment used by the Merge verifier
transcriptThe transcript to be passed to the MergeRecursiveVerifier.
merge_settingsHow the most recent ecc op subtable is going to be merged into the table of ecc ops
Returns
Pair of PairingPoints and commitments to the merged tables as read from the proof by the Merge verifier

Merge proofs are verified in FIFO order to match the circuit accumulation order. Each kernel verifies the merge proof from its corresponding app circuit. Since circuits are accumulated in sequence (e.g., App₀ → Kernel₀ → App₁ → Kernel₁ → ..., though in practice there can be repeated kernels such as inner → reset), the merge proofs must be verified in the same order to maintain consistency of the op queue commitments.

Definition at line 91 of file goblin.cpp.

Member Data Documentation

◆ avm_mode

bool bb::Goblin::avm_mode = false

Definition at line 62 of file goblin.hpp.

◆ commitment_key

CommitmentKey<curve::BN254> bb::Goblin::commitment_key

Definition at line 49 of file goblin.hpp.

◆ evaluation_challenge_x

fq bb::Goblin::evaluation_challenge_x

Definition at line 54 of file goblin.hpp.

◆ goblin_proof

GoblinProof bb::Goblin::goblin_proof

Definition at line 51 of file goblin.hpp.

◆ merge_verification_queue

std::deque<MergeProof> bb::Goblin::merge_verification_queue

Definition at line 57 of file goblin.hpp.

◆ op_queue

std::shared_ptr<OpQueue> bb::Goblin::op_queue = std::make_shared<OpQueue>()

Definition at line 48 of file goblin.hpp.

◆ transcript

std::shared_ptr<Transcript> bb::Goblin::transcript

Definition at line 55 of file goblin.hpp.

◆ translation_batching_challenge_v

fq bb::Goblin::translation_batching_challenge_v

Definition at line 53 of file goblin.hpp.


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