Skip to content

Commit 29f5525

Browse files
committed
Merge branch 'master' into v2.1
2 parents 1a72fa5 + 3d4558d commit 29f5525

File tree

8 files changed

+1906
-42
lines changed

8 files changed

+1906
-42
lines changed

.circleci/config.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ jobs:
236236

237237
contracts:
238238
machine:
239-
image: ubuntu-2004:202010-01
239+
image: default
240240
resource_class: large
241241
steps:
242242
- *checkout
@@ -247,7 +247,7 @@ jobs:
247247

248248
yarn-project-base:
249249
machine:
250-
image: ubuntu-2004:202010-01
250+
image: default
251251
resource_class: large
252252
steps:
253253
- *checkout
@@ -258,7 +258,7 @@ jobs:
258258

259259
barretenberg-js:
260260
machine:
261-
image: ubuntu-2004:202010-01
261+
image: default
262262
resource_class: large
263263
steps:
264264
- *checkout
@@ -280,7 +280,7 @@ jobs:
280280

281281
blockchain:
282282
machine:
283-
image: ubuntu-2004:202010-01
283+
image: default
284284
resource_class: large
285285
steps:
286286
- *checkout
@@ -291,7 +291,7 @@ jobs:
291291

292292
aztec-dev-cli:
293293
machine:
294-
image: ubuntu-2004:202010-01
294+
image: default
295295
resource_class: large
296296
steps:
297297
- *checkout
@@ -302,7 +302,7 @@ jobs:
302302

303303
kebab:
304304
machine:
305-
image: ubuntu-2004:202010-01
305+
image: default
306306
resource_class: large
307307
steps:
308308
- *checkout
@@ -313,7 +313,7 @@ jobs:
313313

314314
halloumi:
315315
machine:
316-
image: ubuntu-2004:202010-01
316+
image: default
317317
resource_class: large
318318
steps:
319319
- *checkout
@@ -324,7 +324,7 @@ jobs:
324324

325325
falafel:
326326
machine:
327-
image: ubuntu-2004:202010-01
327+
image: default
328328
resource_class: large
329329
steps:
330330
- *checkout
@@ -335,7 +335,7 @@ jobs:
335335

336336
block-server:
337337
machine:
338-
image: ubuntu-2004:202010-01
338+
image: default
339339
resource_class: large
340340
steps:
341341
- *checkout
@@ -346,7 +346,7 @@ jobs:
346346

347347
sdk:
348348
machine:
349-
image: ubuntu-2004:202010-01
349+
image: default
350350
resource_class: large
351351
steps:
352352
- *checkout
@@ -357,7 +357,7 @@ jobs:
357357

358358
wasabi:
359359
machine:
360-
image: ubuntu-2004:202010-01
360+
image: default
361361
resource_class: large
362362
steps:
363363
- *checkout
@@ -368,7 +368,7 @@ jobs:
368368

369369
hummus:
370370
machine:
371-
image: ubuntu-2004:202010-01
371+
image: default
372372
resource_class: large
373373
steps:
374374
- *checkout
@@ -379,7 +379,7 @@ jobs:
379379

380380
wallet:
381381
machine:
382-
image: ubuntu-2004:202010-01
382+
image: default
383383
resource_class: large
384384
steps:
385385
- *checkout
@@ -390,7 +390,7 @@ jobs:
390390

391391
end-to-end:
392392
machine:
393-
image: ubuntu-2004:202010-01
393+
image: default
394394
resource_class: large
395395
steps:
396396
- *checkout
@@ -615,7 +615,7 @@ jobs:
615615

616616
deploy:
617617
machine:
618-
image: ubuntu-2004:202010-01
618+
image: default
619619
resource_class: medium
620620
steps:
621621
- *checkout

aztec-connect-cpp/src/rollup/constants.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ constexpr bool is_circuit_change_expected = 0;
3939
constexpr uint32_t ACCOUNT = 23967;
4040
constexpr uint32_t JOIN_SPLIT = 64047;
4141
constexpr uint32_t CLAIM = 23050;
42-
constexpr uint32_t ROLLUP = 1173221;
43-
constexpr uint32_t ROOT_ROLLUP = 5481327;
44-
constexpr uint32_t ROOT_VERIFIER = 7435892;
42+
constexpr uint32_t ROLLUP = 1167809;
43+
constexpr uint32_t ROOT_ROLLUP = 5466707;
44+
constexpr uint32_t ROOT_VERIFIER = 7628270;
4545
}; // namespace circuit_gate_count
4646

4747
namespace circuit_gate_next_power_of_two {
@@ -62,11 +62,11 @@ namespace circuit_vk_hash {
6262
constexpr auto ACCOUNT = uint256_t(0xcd6d70c733eaf823, 0x6505d3402817ad3d, 0xbf9e2b6a262589cf, 0xafcc546b55cc45e3);
6363
constexpr auto JOIN_SPLIT = uint256_t(0xb23c7772f47bc823, 0x5493625d4f08603c, 0x21ac50a5929576f9, 0xb7b3113c131460e5);
6464
constexpr auto CLAIM = uint256_t(0xa753ce523719749e, 0x80216aff7f8bc9ce, 0xa9b0f69bbd24ac33, 0xae17c5fb7d488138);
65-
constexpr auto ROLLUP = uint256_t(0x5f2f6590e5553f19, 0x62c287e01b897621, 0xf32d03437085e2d, 0x567b0be24dc99966);
66-
constexpr auto ROOT_ROLLUP = uint256_t(0x64e5e03cf9534ed6, 0x7fdc871935b9e4fe, 0xd2b81e990cc15f3d, 0x47f00f76d92e5e4d);
67-
;
65+
constexpr auto ROLLUP = uint256_t(0x47427863b042e198, 0xbcfaeb63d9e263e, 0x405c66379df643d0, 0x11a2cb6aef44a77d);
66+
constexpr auto ROOT_ROLLUP = uint256_t(0x3f9f4b9944097e45, 0x20279b5f76e6ec69, 0xd7a31ace33aaed41, 0x49f209bdff64342c);
6867
constexpr auto ROOT_VERIFIER =
69-
uint256_t(0xb4349747ae6ea507, 0xfaafa0f2e384c984, 0x9325870bcc594daf, 0x50163a2572c67363);
68+
uint256_t(0x7de149243dd52594, 0x1c40fbda00798466, 0x8afc5663ee50a18c, 0xa1c5c44397212706);
69+
7070
}; // namespace circuit_vk_hash
7171

7272
namespace ProofIds {

aztec-connect-cpp/src/rollup/proofs/rollup/rollup_circuit.cpp

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,12 @@ recursion_output<bn254> rollup_circuit(Composer& composer,
290290
auto bridge_call_datas = map(rollup.bridge_call_datas, [&](auto& bid) {
291291
return suint_ct(witness_ct(&composer, bid), DEFI_BRIDGE_CALL_DATA_BIT_LENGTH, "bridge_call_data");
292292
});
293-
const auto recursive_manifest = Composer::create_unrolled_manifest(verification_keys[0]->num_public_inputs);
293+
294+
// We need a special manifest that includes pairing inputs from previous batch operations for all steps but the
295+
// initial one
296+
const auto recursive_manifest_step_0 = Composer::create_unrolled_manifest(verification_keys[0]->num_public_inputs);
297+
const auto recursive_manifest_with_batching =
298+
Composer::create_unrolled_manifest_for_batching(verification_keys[0]->num_public_inputs);
294299

295300
const auto num_asset_ids = field_ct(witness_ct(&composer, rollup.num_asset_ids));
296301
auto asset_ids = map(rollup.asset_ids, [&](auto& aid) { return field_ct(witness_ct(&composer, aid)); });
@@ -332,12 +337,23 @@ recursion_output<bn254> rollup_circuit(Composer& composer,
332337
recursive_verification_key->validate_key_is_in_set(verification_keys);
333338

334339
// Verify the inner proof.
335-
recursion_output =
336-
verify_proof<bn254, recursive_turbo_verifier_settings<bn254>>(&composer,
337-
recursive_verification_key,
338-
recursive_manifest,
339-
waffle::plonk_proof{ rollup.txs[i] },
340-
recursion_output);
340+
if (i == 0) {
341+
// First proof uses standard unrolled transcript
342+
recursion_output =
343+
verify_proof<bn254, recursive_turbo_verifier_settings<bn254>>(&composer,
344+
recursive_verification_key,
345+
recursive_manifest_step_0,
346+
waffle::plonk_proof{ rollup.txs[i] },
347+
recursion_output);
348+
} else {
349+
// The following transcripts embed previous recursion outputs to ensure batching isn't exploitable
350+
recursion_output =
351+
verify_proof<bn254, recursive_turbo_verifier_settings<bn254>>(&composer,
352+
recursive_verification_key,
353+
recursive_manifest_with_batching,
354+
waffle::plonk_proof{ rollup.txs[i] },
355+
recursion_output);
356+
}
341357

342358
auto is_real = num_txs > uint32_ct(&composer, i);
343359
auto& public_inputs = recursion_output.public_inputs;

aztec-connect-cpp/src/rollup/proofs/root_rollup/root_rollup_circuit.cpp

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,14 @@ circuit_result_data root_rollup_circuit(Composer& composer,
251251
return circuit::defi_interaction::note(circuit::defi_interaction::witness_data(composer, n));
252252
});
253253
const auto num_previous_defi_interactions = field_ct(witness_ct(&composer, tx.num_previous_defi_interactions));
254-
const auto recursive_manifest = Composer::create_unrolled_manifest(inner_verification_key->num_public_inputs);
254+
255+
// We need a special manifest that includes pairing inputs from previous batch operations for all steps but the
256+
// initial one
257+
const auto recursive_manifest_step_0 =
258+
Composer::create_unrolled_manifest(inner_verification_key->num_public_inputs);
259+
const auto recursive_manifest_with_batching =
260+
Composer::create_unrolled_manifest_for_batching(inner_verification_key->num_public_inputs);
261+
255262
const auto recursive_verification_key =
256263
plonk::stdlib::recursion::verification_key<bn254>::from_constants(&composer, inner_verification_key);
257264
field_ct rollup_beneficiary = field_ct(witness_ct(&composer, tx.rollup_beneficiary));
@@ -279,12 +286,24 @@ circuit_result_data root_rollup_circuit(Composer& composer,
279286
for (uint32_t i = 0; i < max_num_inner_proofs; ++i) {
280287
auto is_real = num_inner_proofs > i;
281288

282-
recursion_output =
283-
verify_proof<bn254, recursive_turbo_verifier_settings<bn254>>(&composer,
284-
recursive_verification_key,
285-
recursive_manifest,
286-
waffle::plonk_proof{ tx.rollups[i] },
287-
recursion_output);
289+
// Verify the inner proof.
290+
if (i == 0) {
291+
// First proof uses standard unrolled transcript
292+
recursion_output =
293+
verify_proof<bn254, recursive_turbo_verifier_settings<bn254>>(&composer,
294+
recursive_verification_key,
295+
recursive_manifest_step_0,
296+
waffle::plonk_proof{ tx.rollups[i] },
297+
recursion_output);
298+
} else {
299+
// The following transcripts embed previous recursion outputs to ensure batching isn't exploitable
300+
recursion_output =
301+
verify_proof<bn254, recursive_turbo_verifier_settings<bn254>>(&composer,
302+
recursive_verification_key,
303+
recursive_manifest_with_batching,
304+
waffle::plonk_proof{ tx.rollups[i] },
305+
recursion_output);
306+
}
288307

289308
auto& public_inputs = recursion_output.public_inputs;
290309

0 commit comments

Comments
 (0)