Skip to content

Commit 3074262

Browse files
authored
Merge branch 'merge-train/barretenberg' into ad/bbapi/vk-simplified-buffer
2 parents 9a0b69e + 620c91e commit 3074262

File tree

53 files changed

+995
-711
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+995
-711
lines changed

barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp

Lines changed: 181 additions & 146 deletions
Large diffs are not rendered by default.

barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,14 @@ class ClientIVC {
224224
}
225225
};
226226

227+
// Specifies proof type or equivalently the type of recursive verification to be performed on a given proof
227228
enum class QUEUE_TYPE {
228229
OINK,
229230
PG,
230231
PG_FINAL, // the final PG verification, used in hiding kernel
231232
PG_TAIL, // used in tail to indicate special handling of merge for ZK
232233
MEGA
233-
}; // for specifying type of proof in the verification queue
234+
};
234235

235236
// An entry in the native verification queue
236237
struct VerifierInputs {
@@ -268,7 +269,6 @@ class ClientIVC {
268269

269270
ProverFoldOutput fold_output; // prover accumulator and fold proof
270271
HonkProof decider_proof; // decider proof to be verified in the hiding circuit
271-
HonkProof mega_proof; // proof of the hiding circuit
272272

273273
std::shared_ptr<DeciderVerificationKey>
274274
recursive_verifier_native_accum; // native verifier accumulator used in recursive folding
@@ -303,7 +303,7 @@ class ClientIVC {
303303
perform_recursive_verification_and_databus_consistency_checks(
304304
ClientCircuit& circuit,
305305
const StdlibVerifierInputs& verifier_inputs,
306-
const std::shared_ptr<RecursiveDeciderVerificationKey>& input_stdlib_verifier_accumulator,
306+
const std::shared_ptr<RecursiveDeciderVerificationKey>& input_verifier_accumulator,
307307
const TableCommitments& T_prev_commitments,
308308
const std::shared_ptr<RecursiveTranscript>& accumulation_recursive_transcript);
309309

@@ -322,30 +322,54 @@ class ClientIVC {
322322

323323
Proof prove();
324324

325-
std::shared_ptr<ClientIVC::DeciderZKProvingKey> construct_hiding_circuit_key(ClientCircuit& circuit);
326-
std::shared_ptr<ClientIVC::DeciderZKProvingKey> compute_hiding_circuit_proving_key(ClientCircuit& circuit);
327325
static void hide_op_queue_accumulation_result(ClientCircuit& circuit);
328-
HonkProof prove_hiding_circuit(ClientCircuit& circuit);
326+
HonkProof construct_mega_proof_for_hiding_kernel(ClientCircuit& circuit);
329327

330328
static bool verify(const Proof& proof, const VerificationKey& vk);
331329

332330
bool verify(const Proof& proof) const;
333331

334332
bool prove_and_verify();
335333

336-
HonkProof decider_prove();
334+
HonkProof construct_decider_proof();
337335

338336
VerificationKey get_vk() const;
339337

340338
private:
341339
/**
342-
* @brief Update the native verifier accumulator based on the provided queue entry and transcript.
340+
* @brief Runs either Oink or PG native verifier to update the native verifier accumulator
343341
*
344342
* @param queue_entry The verifier inputs from the queue.
345343
* @param verifier_transcript Verifier transcript corresponding to the prover transcript.
346344
*/
347345
void update_native_verifier_accumulator(const VerifierInputs& queue_entry,
348346
const std::shared_ptr<Transcript>& verifier_transcript);
347+
348+
HonkProof construct_oink_proof(const std::shared_ptr<DeciderProvingKey>& proving_key,
349+
const std::shared_ptr<MegaVerificationKey>& honk_vk,
350+
const std::shared_ptr<Transcript>& transcript);
351+
352+
HonkProof construct_pg_proof(const std::shared_ptr<DeciderProvingKey>& proving_key,
353+
const std::shared_ptr<MegaVerificationKey>& honk_vk,
354+
const std::shared_ptr<Transcript>& transcript,
355+
bool is_kernel);
356+
357+
QUEUE_TYPE get_queue_type() const;
358+
359+
static std::shared_ptr<RecursiveDeciderVerificationKey> perform_oink_recursive_verification(
360+
ClientCircuit& circuit,
361+
const std::shared_ptr<RecursiveDeciderVerificationKey>& verifier_instance,
362+
const std::shared_ptr<RecursiveTranscript>& transcript,
363+
const StdlibProof& proof);
364+
365+
static std::shared_ptr<RecursiveDeciderVerificationKey> perform_pg_recursive_verification(
366+
ClientCircuit& circuit,
367+
const std::shared_ptr<RecursiveDeciderVerificationKey>& verifier_accumulator,
368+
const std::shared_ptr<RecursiveDeciderVerificationKey>& verifier_instance,
369+
const std::shared_ptr<RecursiveTranscript>& transcript,
370+
const StdlibProof& proof,
371+
std::optional<StdlibFF>& prev_accum_hash,
372+
bool is_kernel);
349373
};
350374

351375
// Serialization methods for ClientIVC::VerificationKey

barretenberg/cpp/src/barretenberg/dsl/acir_proofs/honk_contract.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,10 @@ library TranscriptLib {
494494
pure
495495
returns (Fr[CONST_PROOF_SIZE_LOG_N] memory gateChallenges, Fr nextPreviousChallenge)
496496
{
497-
for (uint256 i = 0; i < logN; i++) {
498-
previousChallenge = FrLib.fromBytes32(keccak256(abi.encodePacked(Fr.unwrap(previousChallenge))));
499-
Fr unused;
500-
(gateChallenges[i], unused) = splitChallenge(previousChallenge);
497+
previousChallenge = FrLib.fromBytes32(keccak256(abi.encodePacked(Fr.unwrap(previousChallenge))));
498+
(gateChallenges[0],) = splitChallenge(previousChallenge);
499+
for (uint256 i = 1; i < logN; i++) {
500+
gateChallenges[i] = gateChallenges[i - 1] * gateChallenges[i - 1];
501501
}
502502
nextPreviousChallenge = previousChallenge;
503503
}

barretenberg/cpp/src/barretenberg/dsl/acir_proofs/honk_zk_contract.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,10 @@ library ZKTranscriptLib {
494494
pure
495495
returns (Fr[CONST_PROOF_SIZE_LOG_N] memory gateChallenges, Fr nextPreviousChallenge)
496496
{
497-
for (uint256 i = 0; i < logN; i++) {
498-
previousChallenge = FrLib.fromBytes32(keccak256(abi.encodePacked(Fr.unwrap(previousChallenge))));
499-
500-
(gateChallenges[i],) = splitChallenge(previousChallenge);
497+
previousChallenge = FrLib.fromBytes32(keccak256(abi.encodePacked(Fr.unwrap(previousChallenge))));
498+
(gateChallenges[0],) = splitChallenge(previousChallenge);
499+
for (uint256 i = 1; i < logN; i++) {
500+
gateChallenges[i] = gateChallenges[i - 1] * gateChallenges[i - 1];
501501
}
502502
nextPreviousChallenge = previousChallenge;
503503
}

barretenberg/sol/src/honk/Transcript.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ library TranscriptLib {
163163
pure
164164
returns (Fr[CONST_PROOF_SIZE_LOG_N] memory gateChallenges, Fr nextPreviousChallenge)
165165
{
166-
for (uint256 i = 0; i < logN; i++) {
167-
previousChallenge = FrLib.fromBytes32(keccak256(abi.encodePacked(Fr.unwrap(previousChallenge))));
168-
Fr unused;
169-
(gateChallenges[i], unused) = splitChallenge(previousChallenge);
166+
previousChallenge = FrLib.fromBytes32(keccak256(abi.encodePacked(Fr.unwrap(previousChallenge))));
167+
(gateChallenges[0],) = splitChallenge(previousChallenge);
168+
for (uint256 i = 1; i < logN; i++) {
169+
gateChallenges[i] = gateChallenges[i - 1] * gateChallenges[i - 1];
170170
}
171171
nextPreviousChallenge = previousChallenge;
172172
}

barretenberg/sol/src/honk/ZKTranscript.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ library ZKTranscriptLib {
163163
pure
164164
returns (Fr[CONST_PROOF_SIZE_LOG_N] memory gateChallenges, Fr nextPreviousChallenge)
165165
{
166-
for (uint256 i = 0; i < logN; i++) {
167-
previousChallenge = FrLib.fromBytes32(keccak256(abi.encodePacked(Fr.unwrap(previousChallenge))));
168-
169-
(gateChallenges[i],) = splitChallenge(previousChallenge);
166+
previousChallenge = FrLib.fromBytes32(keccak256(abi.encodePacked(Fr.unwrap(previousChallenge))));
167+
(gateChallenges[0],) = splitChallenge(previousChallenge);
168+
for (uint256 i = 1; i < logN; i++) {
169+
gateChallenges[i] = gateChallenges[i - 1] * gateChallenges[i - 1];
170170
}
171171
nextPreviousChallenge = previousChallenge;
172172
}

l1-contracts/src/core/RollupCore.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ contract RollupCore is EIP712("Aztec Rollup", "1"), Ownable, IStakingCore, IVali
237237

238238
// We call one external library or another based on the slasher flavor
239239
// This allows us to keep the slash flavors in separate external libraries so we do not exceed max contract size
240-
if (_config.slasherFlavor == SlasherFlavor.TALLY) {
240+
// Note that we do not deploy a slasher if we run with no committees (i.e. targetCommitteeSize == 0)
241+
if (_config.targetCommitteeSize == 0) {
242+
slasher = ISlasher(address(0));
243+
} else if (_config.slasherFlavor == SlasherFlavor.TALLY) {
241244
slasher = TallySlasherDeploymentExtLib.deployTallySlasher(
242245
address(this),
243246
_config.slashingVetoer,

l1-contracts/src/core/slashing/TallySlashingProposer.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ contract TallySlashingProposer is EIP712 {
144144
* @notice EIP-712 type hash for the Vote struct used in signature verification
145145
* @dev Defines the structure: Vote(uint256 slot,bytes votes) for EIP-712 signing
146146
*/
147-
bytes32 public constant VOTE_TYPEHASH = keccak256("Vote(uint256 slot,bytes votes)");
147+
bytes32 public constant VOTE_TYPEHASH = keccak256("Vote(bytes votes,uint256 slot)");
148148

149149
/**
150150
* @notice Type of slashing proposer (either Tally or Empire)

l1-contracts/test/benchmark/happy.t.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ contract BenchmarkRollupTest is FeeModelTestPoints, DecoderBase {
135135
bool internal IS_IGNITION;
136136

137137
Rollup internal rollup;
138+
Slasher internal slasher;
138139

139140
address internal coinbase = address(bytes20("MONEY MAKER"));
140141
TestERC20 internal asset;
@@ -193,7 +194,8 @@ contract BenchmarkRollupTest is FeeModelTestPoints, DecoderBase {
193194

194195
asset = builder.getConfig().testERC20;
195196
rollup = builder.getConfig().rollup;
196-
slashingProposer = Slasher(rollup.getSlasher()).PROPOSER();
197+
slasher = Slasher(rollup.getSlasher());
198+
slashingProposer = address(slasher) == address(0) ? address(0) : slasher.PROPOSER();
197199

198200
SlashFactory slashFactory = new SlashFactory(IValidatorSelection(address(rollup)));
199201
address[] memory toSlash = new address[](0);

spartan/aztec-network/files/config/get-private-key.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fi
6262
# Note, currently writing keys for all services for convenience
6363
cat <<EOF >/shared/config/keys.env
6464
export VALIDATOR_PRIVATE_KEYS=$validator_private_keys
65-
export WEB3_SIGNER_ADDRESSES=$validator_addresses
65+
export VALIDATOR_ADDRESSES=$validator_addresses
6666
export L1_PRIVATE_KEY=$private_key
6767
export SEQ_PUBLISHER_PRIVATE_KEY=$private_key
6868
export PROVER_PUBLISHER_PRIVATE_KEY=$private_key

0 commit comments

Comments
 (0)