Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Goblin acir composer #4112

Merged
merged 25 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a485b04
split honk acir composer from original
ledwards2225 Jan 17, 2024
44259ee
use accumulate framework for basic GUH
ledwards2225 Jan 17, 2024
735fd29
use accumulate nomenclature
ledwards2225 Jan 17, 2024
ebbc8f7
update to use accumulate nomenclature everywhere
ledwards2225 Jan 18, 2024
f95a12a
update docker files to use accumulate
ledwards2225 Jan 18, 2024
22bfac8
debug prints
ledwards2225 Jan 18, 2024
934e38a
full goblin verifies
ledwards2225 Jan 18, 2024
1402ef7
cleanup and commenting
ledwards2225 Jan 18, 2024
851d430
Add goblin flow to docker
ledwards2225 Jan 18, 2024
f370400
name change honk to goblin
ledwards2225 Jan 18, 2024
8c7ef97
Merge branch 'master' into lde/honk_acir_composer
ledwards2225 Jan 18, 2024
8fc65a4
fix wasm: create goblin acir composer
ledwards2225 Jan 18, 2024
d9f5b67
fix index ts formatting
ledwards2225 Jan 18, 2024
a05e3b4
removed grumpkin from the wrong flow
ledwards2225 Jan 18, 2024
d415de2
js flow for full goblin prove and verify
ledwards2225 Jan 19, 2024
4a14cdc
debug
ledwards2225 Jan 19, 2024
8b71f47
test faking it with accum methods
ledwards2225 Jan 19, 2024
a49026b
Merge branch 'master' into lde/honk_acir_composer
ledwards2225 Jan 19, 2024
52c52a2
WiP debug
ledwards2225 Jan 19, 2024
3c91cdc
Merge branch 'master' into lde/honk_acir_composer
ledwards2225 Jan 19, 2024
28c085c
bring it all together
ledwards2225 Jan 19, 2024
cad7ac7
Merge branch 'master' into lde/honk_acir_composer
ledwards2225 Jan 22, 2024
91fc81e
fix bberg and acir
ledwards2225 Jan 22, 2024
57af750
additional comments
ledwards2225 Jan 22, 2024
f8efa12
Merge branch 'master' into lde/honk_acir_composer
ledwards2225 Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
additional comments
ledwards2225 committed Jan 22, 2024
commit 57af750a69f09a926d5ec33e383e086c79b337f1
14 changes: 12 additions & 2 deletions barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
@@ -44,6 +44,12 @@ void init_bn254_crs(size_t dyadic_circuit_size)
srs::init_crs_factory(bn254_g1_data, bn254_g2_data);
}

/**
* @brief Initialize the global crs_factory for grumpkin based on a known dyadic circuit size
* @details Grumpkin crs is required only for the ECCVM
*
* @param dyadic_circuit_size power-of-2 circuit size
*/
void init_grumpkin_crs(size_t eccvm_dyadic_circuit_size)
{
auto grumpkin_g1_data = get_grumpkin_g1_data(CRS_PATH, eccvm_dyadic_circuit_size);
@@ -129,17 +135,19 @@ bool proveAndVerify(const std::string& bytecodePath, const std::string& witnessP
*/
bool accumulateAndVerifyGoblin(const std::string& bytecodePath, const std::string& witnessPath)
{
// Populate the acir constraint system and witness from gzipped data
auto constraint_system = get_constraint_system(bytecodePath);
auto witness = get_witness(witnessPath);

// Instantiate a Goblin acir composer and construct a bberg circuit from the acir representation
acir_proofs::GoblinAcirComposer acir_composer;
acir_composer.create_circuit(constraint_system, witness);

// TODO(https://github.com/AztecProtocol/barretenberg/issues/811): Don't hardcode dyadic circuit size. Currently set
// to max circuit size present in acir tests suite.
size_t hardcoded_bn254_dyadic_size_hack = 1 << 18;
init_bn254_crs(hardcoded_bn254_dyadic_size_hack);
size_t hardcoded_grumpkin_dyadic_size_hack = 1 << 10;
size_t hardcoded_grumpkin_dyadic_size_hack = 1 << 10; // For eccvm only
init_grumpkin_crs(hardcoded_grumpkin_dyadic_size_hack);

// Call accumulate to generate a GoblinUltraHonk proof
@@ -168,17 +176,19 @@ bool proveAndVerifyGoblin(const std::string& bytecodePath,
const std::string& witnessPath,
[[maybe_unused]] bool recursive)
{
// Populate the acir constraint system and witness from gzipped data
auto constraint_system = get_constraint_system(bytecodePath);
auto witness = get_witness(witnessPath);

// Instantiate a Goblin acir composer and construct a bberg circuit from the acir representation
acir_proofs::GoblinAcirComposer acir_composer;
acir_composer.create_circuit(constraint_system, witness);

// TODO(https://github.com/AztecProtocol/barretenberg/issues/811): Don't hardcode dyadic circuit size. Currently set
// to max circuit size present in acir tests suite.
size_t hardcoded_bn254_dyadic_size_hack = 1 << 18;
init_bn254_crs(hardcoded_bn254_dyadic_size_hack);
size_t hardcoded_grumpkin_dyadic_size_hack = 1 << 10;
size_t hardcoded_grumpkin_dyadic_size_hack = 1 << 10; // For eccvm only
init_grumpkin_crs(hardcoded_grumpkin_dyadic_size_hack);

// Generate a GoblinUltraHonk proof and a full Goblin proof
18 changes: 18 additions & 0 deletions barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.hpp
Original file line number Diff line number Diff line change
@@ -34,11 +34,21 @@ WASM_EXPORT void acir_create_proof(in_ptr acir_composer_ptr,
bool const* is_recursive,
uint8_t** out);

/**
* @brief Perform the goblin accumulate operation
* @details Constructs a GUH proof and possibly handles transcript merge logic
*
*/
WASM_EXPORT void acir_goblin_accumulate(in_ptr acir_composer_ptr,
uint8_t const* constraint_system_buf,
uint8_t const* witness_buf,
uint8_t** out);

/**
* @brief Construct a full goblin proof
* @details Makes a call to accumulate to a final circuit before constructing a Goblin proof
*
*/
WASM_EXPORT void acir_goblin_prove(in_ptr acir_composer_ptr,
uint8_t const* constraint_system_buf,
uint8_t const* witness_buf,
@@ -57,8 +67,16 @@ WASM_EXPORT void acir_verify_proof(in_ptr acir_composer_ptr,
bool const* is_recursive,
bool* result);

/**
* @brief Verifies a GUH proof produced during goblin accumulation
*
*/
WASM_EXPORT void acir_goblin_verify_accumulator(in_ptr acir_composer_ptr, uint8_t const* proof_buf, bool* result);

/**
* @brief Verifies a full goblin proof (and the GUH proof produced by accumulation)
*
*/
WASM_EXPORT void acir_goblin_verify(in_ptr acir_composer_ptr, uint8_t const* proof_buf, bool* result);

WASM_EXPORT void acir_get_solidity_verifier(in_ptr acir_composer_ptr, out_str_buf out);
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/goblin/goblin.hpp
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ class Goblin {
std::unique_ptr<ECCVMProver> eccvm_prover;
std::unique_ptr<TranslatorComposer> translator_composer;

AccumulationOutput accumulator; // Used only for ACIR methods
AccumulationOutput accumulator; // Used only for ACIR methods for now

public:
/**