From aaf0d8c02b99eb1c037745d54c0859553492c088 Mon Sep 17 00:00:00 2001 From: David Banks <47112877+dbanks12@users.noreply.github.com> Date: Tue, 4 Feb 2025 07:51:43 -0500 Subject: [PATCH 01/17] chore: benchmark sha256 number of instructions executed in AVM (#11253) Also move hash stuff into another AVM test contract. This lets us get stats like below, although note that this isn't directly an output from the yarn tests: For a `sha256` of N bytes, how many AVM/Brillig instructions are executed and how much gas does it consume? ```N= 10 bytes: 3998 instructions, 69006 L2 Gas N= 20 bytes: 4513 instructions, 77778 L2 Gas N= 30 bytes: 5328 instructions, 91326 L2 Gas N= 40 bytes: 5843 instructions, 100098 L2 Gas N= 50 bytes: 6672 instructions, 113877 L2 Gas N= 60 bytes: 7490 instructions, 127626 L2 Gas N= 70 bytes: 8662 instructions, 147936 L2 Gas N= 80 bytes: 9207 instructions, 157368 L2 Gas N= 90 bytes: 10052 instructions, 171576 L2 Gas N= 100 bytes: 10597 instructions, 181008 L2 Gas N= 255 bytes: 23046 instructions, 392055 L2 Gas N= 256 bytes: 23022 instructions, 392121 L2 Gas N= 511 bytes: 43107 instructions, 732336 L2 Gas N= 512 bytes: 42978 instructions, 731004 L2 Gas N=2048 bytes: 162801 instructions, 2765820 L2 Gas``` --- noir-projects/noir-contracts/Nargo.toml | 1 + .../avm_gadgets_test_contract/Nargo.toml | 8 ++ .../avm_gadgets_test_contract/src/main.nr | 93 +++++++++++++++++++ .../contracts/avm_test_contract/src/main.nr | 13 ++- .../simulator/src/avm/avm_simulator.test.ts | 31 ++++++- .../simulator/src/avm/fixtures/index.ts | 39 ++++++++ 6 files changed, 177 insertions(+), 8 deletions(-) create mode 100644 noir-projects/noir-contracts/contracts/avm_gadgets_test_contract/Nargo.toml create mode 100644 noir-projects/noir-contracts/contracts/avm_gadgets_test_contract/src/main.nr diff --git a/noir-projects/noir-contracts/Nargo.toml b/noir-projects/noir-contracts/Nargo.toml index 18ba10820a7..263c45bba62 100644 --- a/noir-projects/noir-contracts/Nargo.toml +++ b/noir-projects/noir-contracts/Nargo.toml @@ -5,6 +5,7 @@ members = [ "contracts/auth_contract", "contracts/auth_registry_contract", "contracts/auth_wit_test_contract", + "contracts/avm_gadgets_test_contract", "contracts/avm_initializer_test_contract", "contracts/avm_test_contract", "contracts/fpc_contract", diff --git a/noir-projects/noir-contracts/contracts/avm_gadgets_test_contract/Nargo.toml b/noir-projects/noir-contracts/contracts/avm_gadgets_test_contract/Nargo.toml new file mode 100644 index 00000000000..ca88c967955 --- /dev/null +++ b/noir-projects/noir-contracts/contracts/avm_gadgets_test_contract/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "avm_gadgets_test_contract" +authors = [""] +compiler_version = ">=0.25.0" +type = "contract" + +[dependencies] +aztec = { path = "../../../aztec-nr/aztec" } diff --git a/noir-projects/noir-contracts/contracts/avm_gadgets_test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/avm_gadgets_test_contract/src/main.nr new file mode 100644 index 00000000000..0a353249339 --- /dev/null +++ b/noir-projects/noir-contracts/contracts/avm_gadgets_test_contract/src/main.nr @@ -0,0 +1,93 @@ +use dep::aztec::macros::aztec; + +#[aztec] +contract AvmGadgetsTest { + use dep::aztec::macros::functions::public; + + #[public] + fn keccak_hash(data: [u8; 10]) -> [u8; 32] { + std::hash::keccak256(data, data.len() as u32) + } + + #[public] + fn keccak_f1600(data: [u64; 25]) -> [u64; 25] { + std::hash::keccak::keccakf1600(data) + } + + #[public] + fn poseidon2_hash(data: [Field; 10]) -> Field { + std::hash::poseidon2::Poseidon2::hash(data, data.len()) + } + + #[public] + fn sha256_hash_10(data: [u8; 10]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_20(data: [u8; 20]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_30(data: [u8; 30]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_40(data: [u8; 40]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_50(data: [u8; 50]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_60(data: [u8; 60]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_70(data: [u8; 70]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_80(data: [u8; 80]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_90(data: [u8; 90]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_100(data: [u8; 100]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_255(data: [u8; 255]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_256(data: [u8; 256]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_511(data: [u8; 511]) -> [u8; 32] { + std::hash::sha256(data) + } + #[public] + fn sha256_hash_512(data: [u8; 512]) -> [u8; 32] { + std::hash::sha256(data) + } + + #[public] + fn sha256_hash_2048(data: [u8; 2048]) -> [u8; 32] { + std::hash::sha256(data) + } + + #[public] + fn pedersen_hash(data: [Field; 10]) -> Field { + std::hash::pedersen_hash(data) + } + + #[public] + fn pedersen_hash_with_index(data: [Field; 10]) -> Field { + std::hash::pedersen_hash_with_separator(data, /*index=*/ 20) + } +} diff --git a/noir-projects/noir-contracts/contracts/avm_test_contract/src/main.nr b/noir-projects/noir-contracts/contracts/avm_test_contract/src/main.nr index e3d45c694ea..5fd24054467 100644 --- a/noir-projects/noir-contracts/contracts/avm_test_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/avm_test_contract/src/main.nr @@ -297,6 +297,8 @@ pub contract AvmTest { } /************************************************************************ +<<<<<<< HEAD +======= * Hashing functions ************************************************************************/ #[public] @@ -330,6 +332,7 @@ pub contract AvmTest { } /************************************************************************ +>>>>>>> master * Contract instance ************************************************************************/ #[public] @@ -660,15 +663,15 @@ pub contract AvmTest { dep::aztec::oracle::debug_log::debug_log("read_storage_map"); let _ = read_storage_map(context.this_address()); dep::aztec::oracle::debug_log::debug_log("keccak_hash"); - let _ = keccak_hash(args_u8); + let _ = std::hash::keccak256(args_u8, args_u8.len() as u32); dep::aztec::oracle::debug_log::debug_log("sha256_hash"); - let _ = sha256_hash(args_u8); + let _ = std::hash::sha256(args_u8); dep::aztec::oracle::debug_log::debug_log("poseidon2_hash"); - let _ = poseidon2_hash(args_field); + let _ = std::hash::poseidon2::Poseidon2::hash(args_field, args_field.len()); dep::aztec::oracle::debug_log::debug_log("pedersen_hash"); - let _ = pedersen_hash(args_field); + let _ = std::hash::pedersen_hash(args_field); dep::aztec::oracle::debug_log::debug_log("pedersen_hash_with_index"); - let _ = pedersen_hash_with_index(args_field); + let _ = std::hash::pedersen_hash_with_separator(args_field, /*index=*/ 20); dep::aztec::oracle::debug_log::debug_log("test_get_contract_instance"); test_get_contract_instance_matches( get_instance_for_address, diff --git a/yarn-project/simulator/src/avm/avm_simulator.test.ts b/yarn-project/simulator/src/avm/avm_simulator.test.ts index ab3b1946c34..255420c45a2 100644 --- a/yarn-project/simulator/src/avm/avm_simulator.test.ts +++ b/yarn-project/simulator/src/avm/avm_simulator.test.ts @@ -36,6 +36,7 @@ import { AvmSimulator } from './avm_simulator.js'; import { AvmEphemeralForest } from './avm_tree.js'; import { isAvmBytecode, markBytecodeAsAvm } from './bytecode_utils.js'; import { + getAvmGadgetsTestContractBytecode, getAvmTestContractArtifact, getAvmTestContractBytecode, initContext, @@ -384,19 +385,43 @@ describe('AVM simulator: transpiled Noir contracts', () => { }); }); + /* + * Can run these as follows to measure sha256 instruction execution counts: + * for i in 10 20 30 40 50 60 70 80 90 100 255 256 511 512 2048; do + * echo sha-ing $i...; + * LOG_LEVEL=debug yarn test src/avm/avm_simulator.test.ts -t "sha256_hash_$i " &> sha$i.log; + * done + * for i in 10 20 30 40 50 60 70 80 90 100 255 256 511 512 2048; do + * echo sha256 of $i bytes $(grep -Eo 'Executed .* instructions.* Gas' sha$i.log); + * done + */ describe.each([ - ['sha256_hash', /*input=*/ randomMemoryBytes(10), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_10', /*input=*/ randomMemoryBytes(10), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_20', /*input=*/ randomMemoryBytes(20), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_30', /*input=*/ randomMemoryBytes(30), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_40', /*input=*/ randomMemoryBytes(40), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_50', /*input=*/ randomMemoryBytes(50), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_60', /*input=*/ randomMemoryBytes(60), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_70', /*input=*/ randomMemoryBytes(70), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_80', /*input=*/ randomMemoryBytes(80), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_90', /*input=*/ randomMemoryBytes(90), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_100', /*input=*/ randomMemoryBytes(100), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_255', /*input=*/ randomMemoryBytes(255), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_256', /*input=*/ randomMemoryBytes(256), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_511', /*input=*/ randomMemoryBytes(511), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_512', /*input=*/ randomMemoryBytes(512), /*output=*/ sha256FromMemoryBytes], + ['sha256_hash_2048', /*input=*/ randomMemoryBytes(2048), /*output=*/ sha256FromMemoryBytes], ['keccak_hash', /*input=*/ randomMemoryBytes(10), /*output=*/ keccak256FromMemoryBytes], ['keccak_f1600', /*input=*/ randomMemoryUint64s(25), /*output=*/ keccakF1600FromMemoryUint64s], ['poseidon2_hash', /*input=*/ randomMemoryFields(10), /*output=*/ poseidon2FromMemoryFields], ['pedersen_hash', /*input=*/ randomMemoryFields(10), /*output=*/ pedersenFromMemoryFields], ['pedersen_hash_with_index', /*input=*/ randomMemoryFields(10), /*output=*/ indexedPedersenFromMemoryFields], ])('Hashes in noir contracts', (name: string, input: MemoryValue[], output: (msg: any[]) => Promise) => { - it(`Should execute contract function that performs ${name}`, async () => { + it(`Should execute contract function that performs ${name} on input of length ${input.length}`, async () => { const calldata = input.map(e => e.toFr()); const context = initContext({ env: initExecutionEnvironment({ calldata }) }); - const bytecode = getAvmTestContractBytecode(name); + const bytecode = getAvmGadgetsTestContractBytecode(name); const results = await new AvmSimulator(context).executeBytecode(bytecode); expect(results.reverted).toBe(false); diff --git a/yarn-project/simulator/src/avm/fixtures/index.ts b/yarn-project/simulator/src/avm/fixtures/index.ts index 938bebf2a2c..8ef8937470e 100644 --- a/yarn-project/simulator/src/avm/fixtures/index.ts +++ b/yarn-project/simulator/src/avm/fixtures/index.ts @@ -4,6 +4,7 @@ import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from ' import { AztecAddress } from '@aztec/foundation/aztec-address'; import { EthAddress } from '@aztec/foundation/eth-address'; import { Fr } from '@aztec/foundation/fields'; +import { AvmGadgetsTestContractArtifact } from '@aztec/noir-contracts.js/AvmGadgetsTest'; import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; import { strict as assert } from 'assert'; @@ -169,6 +170,13 @@ export function getAvmTestContractFunctionSelector(functionName: string): Promis return getFunctionSelector(functionName, AvmTestContractArtifact); } +export function getAvmGadgetsTestContractFunctionSelector(functionName: string): Promise { + const artifact = AvmGadgetsTestContractArtifact.functions.find(f => f.name === functionName)!; + assert(!!artifact, `Function ${functionName} not found in AvmGadgetsTestContractArtifact`); + const params = artifact.parameters; + return FunctionSelector.fromNameAndParameters(artifact.name, params); +} + export function getAvmTestContractArtifact(functionName: string): FunctionArtifact { const artifact = getContractFunctionArtifact(functionName, AvmTestContractArtifact); assert( @@ -178,11 +186,25 @@ export function getAvmTestContractArtifact(functionName: string): FunctionArtifa return artifact; } +export function getAvmGadgetsTestContractArtifact(functionName: string): FunctionArtifact { + const artifact = AvmGadgetsTestContractArtifact.functions.find(f => f.name === functionName)!; + assert( + !!artifact?.bytecode, + `No bytecode found for function ${functionName}. Try re-running bootstrap.sh on the repository root.`, + ); + return artifact; +} + export function getAvmTestContractBytecode(functionName: string): Buffer { const artifact = getAvmTestContractArtifact(functionName); return artifact.bytecode; } +export function getAvmGadgetsTestContractBytecode(functionName: string): Buffer { + const artifact = getAvmGadgetsTestContractArtifact(functionName); + return artifact.bytecode; +} + export function resolveAvmTestContractAssertionMessage( functionName: string, revertReason: AvmRevertReason, @@ -190,3 +212,20 @@ export function resolveAvmTestContractAssertionMessage( ): string | undefined { return resolveContractAssertionMessage(functionName, revertReason, output, AvmTestContractArtifact); } + +export function resolveAvmGadgetsTestContractAssertionMessage( + functionName: string, + revertReason: AvmRevertReason, + output: Fr[], +): string | undefined { + traverseCauseChain(revertReason, cause => { + revertReason = cause as AvmRevertReason; + }); + + const functionArtifact = AvmGadgetsTestContractArtifact.functions.find(f => f.name === functionName); + if (!functionArtifact || !revertReason.noirCallStack || !isNoirCallStackUnresolved(revertReason.noirCallStack)) { + return undefined; + } + + return resolveAssertionMessageFromRevertData(output, functionArtifact); +} From 177886764a23b9437fdc767726cc7c8533c27f08 Mon Sep 17 00:00:00 2001 From: ludamad Date: Tue, 4 Feb 2025 13:49:18 +0000 Subject: [PATCH 02/17] chore(bb-prover): avm test skip and split (#11717) --- .../avm_check_circuit1.test.ts | 114 +++++++++++++++++ .../avm_check_circuit2.test.ts | 118 ++++++++++++++++++ .../avm_check_circuit3.test.ts | 106 ++++++++++++++++ .../avm_contract_class_limits.test.ts | 84 +++++++++++++ .../avm_proving_and_verification.test.ts | 60 +++++++++ .../avm_public_fee_payment.test.ts | 73 +++++++++++ .../src/avm_proving_tests/avm_v2.test.ts | 64 ++++++++++ 7 files changed, 619 insertions(+) create mode 100644 yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit1.test.ts create mode 100644 yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit2.test.ts create mode 100644 yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit3.test.ts create mode 100644 yarn-project/bb-prover/src/avm_proving_tests/avm_contract_class_limits.test.ts create mode 100644 yarn-project/bb-prover/src/avm_proving_tests/avm_proving_and_verification.test.ts create mode 100644 yarn-project/bb-prover/src/avm_proving_tests/avm_public_fee_payment.test.ts create mode 100644 yarn-project/bb-prover/src/avm_proving_tests/avm_v2.test.ts diff --git a/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit1.test.ts b/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit1.test.ts new file mode 100644 index 00000000000..6833b8786f6 --- /dev/null +++ b/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit1.test.ts @@ -0,0 +1,114 @@ +import { + type ContractClassPublic, + type ContractInstanceWithAddress, + FunctionSelector, + MAX_L2_TO_L1_MSGS_PER_TX, + MAX_NOTE_HASHES_PER_TX, + MAX_NULLIFIERS_PER_TX, + MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, + MAX_PUBLIC_LOGS_PER_TX, + PUBLIC_DISPATCH_SELECTOR, +} from '@aztec/circuits.js'; +import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; +import { Fr } from '@aztec/foundation/fields'; +import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; +import { getAvmTestContractBytecode } from '@aztec/simulator/public/fixtures'; + +import { AvmProvingTester } from './avm_proving_tester.js'; + +const TIMEOUT = 300_000; +const DISPATCH_FN_NAME = 'public_dispatch'; +const DISPATCH_SELECTOR = new FunctionSelector(PUBLIC_DISPATCH_SELECTOR); + +describe('AVM WitGen & Circuit – check circuit', () => { + const avmTestContractClassSeed = 0; + const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); + let avmTestContractClass: ContractClassPublic; + let avmTestContractInstance: ContractInstanceWithAddress; + let tester: AvmProvingTester; + + beforeEach(async () => { + avmTestContractClass = await makeContractClassPublic( + /*seed=*/ avmTestContractClassSeed, + /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, + ); + avmTestContractInstance = await makeContractInstanceFromClassId( + avmTestContractClass.id, + /*seed=*/ avmTestContractClassSeed, + ); + tester = await AvmProvingTester.create(/*checkCircuitOnly*/ true); + await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); + await tester.addContractInstance(avmTestContractInstance); + }); + + it( + 'perform too many storage writes and revert', + async () => { + await tester.simProveVerifyAppLogic( + { + address: avmTestContractInstance.address, + fnName: 'n_storage_writes', + args: [new Fr(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX + 1)], + }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); + it( + 'create too many note hashes and revert', + async () => { + await tester.simProveVerifyAppLogic( + { + address: avmTestContractInstance.address, + fnName: 'n_new_note_hashes', + args: [new Fr(MAX_NOTE_HASHES_PER_TX + 1)], + }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); + it( + 'create too many nullifiers and revert', + async () => { + await tester.simProveVerifyAppLogic( + { + address: avmTestContractInstance.address, + fnName: 'n_new_nullifiers', + args: [new Fr(MAX_NULLIFIERS_PER_TX + 1)], + }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); + it( + 'create too many l2tol1 messages and revert', + async () => { + await tester.simProveVerifyAppLogic( + { + address: avmTestContractInstance.address, + fnName: 'n_new_l2_to_l1_msgs', + args: [new Fr(MAX_L2_TO_L1_MSGS_PER_TX + 1)], + }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); + it( + 'create too many public logs and revert', + async () => { + await tester.simProveVerifyAppLogic( + { + address: avmTestContractInstance.address, + fnName: 'n_new_public_logs', + args: [new Fr(MAX_PUBLIC_LOGS_PER_TX + 1)], + }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); +}); diff --git a/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit2.test.ts b/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit2.test.ts new file mode 100644 index 00000000000..7cdccc0adcb --- /dev/null +++ b/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit2.test.ts @@ -0,0 +1,118 @@ +import { + AztecAddress, + type ContractClassPublic, + type ContractInstanceWithAddress, + FunctionSelector, + PUBLIC_DISPATCH_SELECTOR, +} from '@aztec/circuits.js'; +import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; +import { Fr } from '@aztec/foundation/fields'; +import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; +import { getAvmTestContractBytecode } from '@aztec/simulator/public/fixtures'; + +import { AvmProvingTester } from './avm_proving_tester.js'; + +const TIMEOUT = 300_000; +const DISPATCH_FN_NAME = 'public_dispatch'; +const DISPATCH_SELECTOR = new FunctionSelector(PUBLIC_DISPATCH_SELECTOR); + +describe('AVM WitGen & Circuit – check circuit', () => { + const sender = AztecAddress.fromNumber(42); + const avmTestContractClassSeed = 0; + const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); + let avmTestContractClass: ContractClassPublic; + let avmTestContractInstance: ContractInstanceWithAddress; + let tester: AvmProvingTester; + + beforeEach(async () => { + avmTestContractClass = await makeContractClassPublic( + /*seed=*/ avmTestContractClassSeed, + /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, + ); + avmTestContractInstance = await makeContractInstanceFromClassId( + avmTestContractClass.id, + /*seed=*/ avmTestContractClassSeed, + ); + tester = await AvmProvingTester.create(/*checkCircuitOnly*/ true); + await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); + await tester.addContractInstance(avmTestContractInstance); + }); + + it( + 'an exceptional halt due to a nested call to non-existent contract is propagated to top-level', + async () => { + await tester.simProveVerifyAppLogic( + { address: avmTestContractInstance.address, fnName: 'nested_call_to_nothing', args: [] }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); + it( + 'an exceptional halt due to a nested call to non-existent contract is recovered from in caller', + async () => { + await tester.simProveVerifyAppLogic( + { address: avmTestContractInstance.address, fnName: 'nested_call_to_nothing_recovers', args: [] }, + /*expectRevert=*/ false, + ); + }, + TIMEOUT, + ); + it.skip('top-level exceptional halts due to a non-existent contract in app-logic and teardown', async () => { + // don't insert contracts into trees, and make sure retrieval fails + const tester = await AvmProvingTester.create(/*checkCircuitOnly=*/ true, /*skipContractDeployments=*/ true); + await tester.simProveVerify( + sender, + /*setupCalls=*/ [], + /*appCalls=*/ [ + { address: avmTestContractInstance.address, fnName: 'add_args_return', args: [new Fr(1), new Fr(2)] }, + ], + /*teardownCall=*/ { + address: avmTestContractInstance.address, + fnName: 'add_args_return', + args: [new Fr(1), new Fr(2)], + }, + /*expectRevert=*/ true, + ); + }); + it( + 'enqueued calls in every phase, with enqueued calls that depend on each other', + async () => { + await tester.simProveVerify( + sender, + /*setupCalls=*/ [ + { address: avmTestContractInstance.address, fnName: 'read_assert_storage_single', args: [new Fr(0)] }, + { address: avmTestContractInstance.address, fnName: 'set_storage_single', args: [new Fr(5)] }, + ], + /*appCalls=*/ [ + { address: avmTestContractInstance.address, fnName: 'read_assert_storage_single', args: [new Fr(5)] }, + { address: avmTestContractInstance.address, fnName: 'set_storage_single', args: [new Fr(10)] }, + ], + /*teardownCall=*/ { + address: avmTestContractInstance.address, + fnName: 'read_assert_storage_single', + args: [new Fr(10)], + }, + /*expectRevert=*/ false, + ); + }, + TIMEOUT, + ); + it( + 'Should prove and verify a TX that reverts in teardown', + async () => { + await tester.simProveVerify( + sender, + /*setupCalls=*/ [], + /*appCalls=*/ [], + /*teardownCall=*/ { + address: avmTestContractInstance.address, + fnName: 'read_assert_storage_single', + args: [new Fr(10)], + }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); +}); diff --git a/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit3.test.ts b/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit3.test.ts new file mode 100644 index 00000000000..034c8b2dce2 --- /dev/null +++ b/yarn-project/bb-prover/src/avm_proving_tests/avm_check_circuit3.test.ts @@ -0,0 +1,106 @@ +import { + AztecAddress, + type ContractClassPublic, + type ContractInstanceWithAddress, + FunctionSelector, + PUBLIC_DISPATCH_SELECTOR, +} from '@aztec/circuits.js'; +import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; +import { Fr } from '@aztec/foundation/fields'; +import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; +import { getAvmTestContractBytecode } from '@aztec/simulator/public/fixtures'; + +import { AvmProvingTester } from './avm_proving_tester.js'; + +const TIMEOUT = 300_000; +const DISPATCH_FN_NAME = 'public_dispatch'; +const DISPATCH_SELECTOR = new FunctionSelector(PUBLIC_DISPATCH_SELECTOR); + +describe('AVM WitGen & Circuit – check circuit', () => { + const sender = AztecAddress.fromNumber(42); + const avmTestContractClassSeed = 0; + const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); + let avmTestContractClass: ContractClassPublic; + let avmTestContractInstance: ContractInstanceWithAddress; + let tester: AvmProvingTester; + + beforeEach(async () => { + avmTestContractClass = await makeContractClassPublic( + /*seed=*/ avmTestContractClassSeed, + /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, + ); + avmTestContractInstance = await makeContractInstanceFromClassId( + avmTestContractClass.id, + /*seed=*/ avmTestContractClassSeed, + ); + tester = await AvmProvingTester.create(/*checkCircuitOnly*/ true); + await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); + await tester.addContractInstance(avmTestContractInstance); + }); + + it( + 'top-level exceptional halts in both app logic and teardown', + async () => { + await tester.simProveVerify( + sender, + /*setupCalls=*/ [], + /*appCalls=*/ [{ address: avmTestContractInstance.address, fnName: 'divide_by_zero', args: [] }], + /*teardownCall=*/ undefined, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); + it( + 'top-level exceptional halt in app logic, but teardown succeeds', + async () => { + await tester.simProveVerify( + sender, + /*setupCalls=*/ [], + /*appCalls=*/ [{ address: avmTestContractInstance.address, fnName: 'divide_by_zero', args: [] }], + /*teardownCall=*/ { + address: avmTestContractInstance.address, + fnName: 'add_args_return', + args: [new Fr(1), new Fr(2)], + }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); + it( + 'top-level exceptional halt in teardown, but app logic succeeds', + async () => { + await tester.simProveVerify( + sender, + /*setupCalls=*/ [], + /*appCalls=*/ [ + { address: avmTestContractInstance.address, fnName: 'add_args_return', args: [new Fr(1), new Fr(2)] }, + ], + /*teardownCall=*/ { address: avmTestContractInstance.address, fnName: 'divide_by_zero', args: [] }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); + it( + 'a nested exceptional halt propagate to top-level', + async () => { + await tester.simProveVerifyAppLogic( + { address: avmTestContractInstance.address, fnName: 'external_call_to_divide_by_zero', args: [] }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); + it( + 'a nested exceptional halt is recovered from in caller', + async () => { + await tester.simProveVerifyAppLogic( + { address: avmTestContractInstance.address, fnName: 'external_call_to_divide_by_zero_recovers', args: [] }, + /*expectRevert=*/ false, + ); + }, + TIMEOUT, + ); +}); diff --git a/yarn-project/bb-prover/src/avm_proving_tests/avm_contract_class_limits.test.ts b/yarn-project/bb-prover/src/avm_proving_tests/avm_contract_class_limits.test.ts new file mode 100644 index 00000000000..bbba6b94cb4 --- /dev/null +++ b/yarn-project/bb-prover/src/avm_proving_tests/avm_contract_class_limits.test.ts @@ -0,0 +1,84 @@ +import { + AztecAddress, + type ContractInstanceWithAddress, + MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS, +} from '@aztec/circuits.js'; +import { makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; +import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; + +import { AvmProvingTester } from './avm_proving_tester.js'; + +const TIMEOUT = 300_000; + +describe('AVM WitGen & Circuit – check circuit - contract class limits', () => { + const deployer = AztecAddress.fromNumber(42); + let instances: ContractInstanceWithAddress[]; + let tester: AvmProvingTester; + let avmTestContractAddress: AztecAddress; + + beforeEach(async () => { + tester = await AvmProvingTester.create(/*checkCircuitOnly=*/ true); + // create enough unique contract classes to hit the limit + instances = []; + for (let i = 0; i <= MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS; i++) { + const instance = await tester.registerAndDeployContract( + /*constructorArgs=*/ [], + deployer, + /*contractArtifact=*/ AvmTestContractArtifact, + /*seed=*/ i, + ); + instances.push(instance); + } + avmTestContractAddress = instances[0].address; + }); + it.skip( + 'call the max number of unique contract classes', + async () => { + // args is initialized to MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS contract addresses with unique class IDs + const instanceAddresses = instances + .map(instance => instance.address) + .slice(0, MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS); + + // include the first contract again again at the end to ensure that we can call it even after the limit is reached + instanceAddresses.push(instanceAddresses[0]); + + // include another contract address that reuses a class ID to ensure that we can call it even after the limit is reached + const instanceSameClassAsFirstContract = await makeContractInstanceFromClassId( + instances[0].contractClassId, + /*seed=*/ 1000, + ); + instanceAddresses.push(instanceSameClassAsFirstContract.address); + // add it to the contract data source so it is found + await tester.addContractInstance(instanceSameClassAsFirstContract); + + await tester.simProveVerifyAppLogic( + { + address: avmTestContractAddress, + fnName: 'nested_call_to_add_n_times_different_addresses', + args: [instanceAddresses], + }, + /*expectRevert=*/ false, + ); + }, + TIMEOUT, + ); + it.skip( + 'attempt too many calls to unique contract class ids', + async () => { + // args is initialized to MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS+1 contract addresses with unique class IDs + // should fail because we are trying to call MAX+1 unique class IDs + const instanceAddresses = instances.map(instance => instance.address); + // push an empty one (just padding to match function calldata size of MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS+2) + instanceAddresses.push(AztecAddress.zero()); + await tester.simProveVerifyAppLogic( + { + address: avmTestContractAddress, + fnName: 'nested_call_to_add_n_times_different_addresses', + args: [instanceAddresses], + }, + /*expectRevert=*/ true, + ); + }, + TIMEOUT, + ); +}); diff --git a/yarn-project/bb-prover/src/avm_proving_tests/avm_proving_and_verification.test.ts b/yarn-project/bb-prover/src/avm_proving_tests/avm_proving_and_verification.test.ts new file mode 100644 index 00000000000..56656363080 --- /dev/null +++ b/yarn-project/bb-prover/src/avm_proving_tests/avm_proving_and_verification.test.ts @@ -0,0 +1,60 @@ +import { + type ContractClassPublic, + type ContractInstanceWithAddress, + FunctionSelector, + PUBLIC_DISPATCH_SELECTOR, +} from '@aztec/circuits.js'; +import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; +import { Fr } from '@aztec/foundation/fields'; +import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; +import { getAvmTestContractBytecode } from '@aztec/simulator/public/fixtures'; + +import { AvmProvingTester } from './avm_proving_tester.js'; + +const TIMEOUT = 300_000; +const DISPATCH_FN_NAME = 'public_dispatch'; +const DISPATCH_SELECTOR = new FunctionSelector(PUBLIC_DISPATCH_SELECTOR); + +describe('AVM WitGen & Circuit – proving and verification', () => { + const avmTestContractClassSeed = 0; + const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); + let avmTestContractClass: ContractClassPublic; + let avmTestContractInstance: ContractInstanceWithAddress; + let tester: AvmProvingTester; + + beforeEach(async () => { + avmTestContractClass = await makeContractClassPublic( + /*seed=*/ avmTestContractClassSeed, + /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, + ); + avmTestContractInstance = await makeContractInstanceFromClassId( + avmTestContractClass.id, + /*seed=*/ avmTestContractClassSeed, + ); + tester = await AvmProvingTester.create(/*checkCircuitOnly*/ false); + await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); + await tester.addContractInstance(avmTestContractInstance); + }); + + it( + 'bulk_testing v1', + async () => { + // Get a deployed contract instance to pass to the contract + // for it to use as "expected" values when testing contract instance retrieval. + const expectContractInstance = avmTestContractInstance; + const argsField = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x)); + const argsU8 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x)); + const args = [ + argsField, + argsU8, + /*getInstanceForAddress=*/ expectContractInstance.address.toField(), + /*expectedDeployer=*/ expectContractInstance.deployer.toField(), + /*expectedClassId=*/ expectContractInstance.contractClassId.toField(), + /*expectedInitializationHash=*/ expectContractInstance.initializationHash.toField(), + ]; + + await tester.simProveVerifyAppLogic({ address: avmTestContractInstance.address, fnName: 'bulk_testing', args }); + }, + TIMEOUT, + ); +}); diff --git a/yarn-project/bb-prover/src/avm_proving_tests/avm_public_fee_payment.test.ts b/yarn-project/bb-prover/src/avm_proving_tests/avm_public_fee_payment.test.ts new file mode 100644 index 00000000000..90997ce9314 --- /dev/null +++ b/yarn-project/bb-prover/src/avm_proving_tests/avm_public_fee_payment.test.ts @@ -0,0 +1,73 @@ +import { + AztecAddress, + type ContractClassPublic, + type ContractInstanceWithAddress, + FunctionSelector, + PUBLIC_DISPATCH_SELECTOR, +} from '@aztec/circuits.js'; +import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; +import { Fr } from '@aztec/foundation/fields'; +import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; +import { type ProtocolContract } from '@aztec/protocol-contracts'; +import { FeeJuiceArtifact, getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice'; +import { getAvmTestContractBytecode } from '@aztec/simulator/public/fixtures'; + +import { AvmProvingTester } from './avm_proving_tester.js'; + +const TIMEOUT = 300_000; +const DISPATCH_FN_NAME = 'public_dispatch'; +const DISPATCH_SELECTOR = new FunctionSelector(PUBLIC_DISPATCH_SELECTOR); + +describe('AVM WitGen & Circuit – public fee payment', () => { + const sender = AztecAddress.fromNumber(42); + const feePayer = sender; + + const initialFeeJuiceBalance = new Fr(20000); + let feeJuice: ProtocolContract; + let feeJuiceContractClassPublic: ContractClassPublic; + + const avmTestContractClassSeed = 0; + const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); + let avmTestContractClass: ContractClassPublic; + let avmTestContractInstance: ContractInstanceWithAddress; + let tester: AvmProvingTester; + + beforeEach(async () => { + feeJuice = await getCanonicalFeeJuice(); + feeJuiceContractClassPublic = { + ...feeJuice.contractClass, + privateFunctions: [], + unconstrainedFunctions: [], + }; + avmTestContractClass = await makeContractClassPublic( + /*seed=*/ avmTestContractClassSeed, + /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, + ); + avmTestContractInstance = await makeContractInstanceFromClassId( + avmTestContractClass.id, + /*seed=*/ avmTestContractClassSeed, + ); + tester = await AvmProvingTester.create(/*checkCircuitOnly*/ true); + await tester.addContractClass(feeJuiceContractClassPublic, FeeJuiceArtifact); + await tester.addContractInstance(feeJuice.instance); + await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); + await tester.addContractInstance(avmTestContractInstance); + await tester.setFeePayerBalance(feePayer, initialFeeJuiceBalance); + }); + it( + 'fee payment', + async () => { + await tester.simProveVerify( + sender, + /*setupCalls=*/ [], + /*appCalls=*/ [ + { address: avmTestContractInstance.address, fnName: 'add_args_return', args: [new Fr(1), new Fr(2)] }, + ], + /*teardownCall=*/ undefined, + /*expectRevert=*/ false, + feePayer, + ); + }, + TIMEOUT, + ); +}); diff --git a/yarn-project/bb-prover/src/avm_proving_tests/avm_v2.test.ts b/yarn-project/bb-prover/src/avm_proving_tests/avm_v2.test.ts new file mode 100644 index 00000000000..1ba8f7658b1 --- /dev/null +++ b/yarn-project/bb-prover/src/avm_proving_tests/avm_v2.test.ts @@ -0,0 +1,64 @@ +import { + AztecAddress, + type ContractClassPublic, + type ContractInstanceWithAddress, + FunctionSelector, + PUBLIC_DISPATCH_SELECTOR, +} from '@aztec/circuits.js'; +import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; +import { Fr } from '@aztec/foundation/fields'; +import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; +import { getAvmTestContractBytecode } from '@aztec/simulator/public/fixtures'; + +import { AvmProvingTesterV2 } from './avm_proving_tester.js'; + +const DISPATCH_FN_NAME = 'public_dispatch'; +const DISPATCH_SELECTOR = new FunctionSelector(PUBLIC_DISPATCH_SELECTOR); + +describe('AVM v2', () => { + const sender = AztecAddress.fromNumber(42); + const avmTestContractClassSeed = 0; + const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); + let avmTestContractClass: ContractClassPublic; + let avmTestContractInstance: ContractInstanceWithAddress; + + let tester: AvmProvingTesterV2; + + beforeEach(async () => { + avmTestContractClass = await makeContractClassPublic( + /*seed=*/ avmTestContractClassSeed, + /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, + ); + avmTestContractInstance = await makeContractInstanceFromClassId( + avmTestContractClass.id, + /*seed=*/ avmTestContractClassSeed, + ); + tester = await AvmProvingTesterV2.create(); + await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); + await tester.addContractInstance(avmTestContractInstance); + }); + + it('bulk_testing v2', async () => { + // Get a deployed contract instance to pass to the contract + // for it to use as "expected" values when testing contract instance retrieval. + const expectContractInstance = avmTestContractInstance; + const argsField = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x)); + const argsU8 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x)); + const args = [ + argsField, + argsU8, + /*getInstanceForAddress=*/ expectContractInstance.address.toField(), + /*expectedDeployer=*/ expectContractInstance.deployer.toField(), + /*expectedClassId=*/ expectContractInstance.contractClassId.toField(), + /*expectedInitializationHash=*/ expectContractInstance.initializationHash.toField(), + ]; + + await tester.simProveVerifyV2( + sender, + /*setupCalls=*/ [], + /*appCalls=*/ [{ address: avmTestContractInstance.address, fnName: 'bulk_testing', args }], + /*teardownCall=*/ undefined, + /*expectRevert=*/ false, + ); + }, 180_000); +}); From 9dc8158715e69e772b5b08a6556124e1786e9810 Mon Sep 17 00:00:00 2001 From: ludamad Date: Tue, 4 Feb 2025 14:43:38 +0000 Subject: [PATCH 03/17] fix: remove avm test that was split (#11719) --- .../src/avm_proving_tests/avm_proving.test.ts | 486 ------------------ 1 file changed, 486 deletions(-) delete mode 100644 yarn-project/bb-prover/src/avm_proving_tests/avm_proving.test.ts diff --git a/yarn-project/bb-prover/src/avm_proving_tests/avm_proving.test.ts b/yarn-project/bb-prover/src/avm_proving_tests/avm_proving.test.ts deleted file mode 100644 index 7f0b6a3a723..00000000000 --- a/yarn-project/bb-prover/src/avm_proving_tests/avm_proving.test.ts +++ /dev/null @@ -1,486 +0,0 @@ -import { - AztecAddress, - type ContractClassPublic, - type ContractInstanceWithAddress, - FunctionSelector, - MAX_L2_TO_L1_MSGS_PER_TX, - MAX_NOTE_HASHES_PER_TX, - MAX_NULLIFIERS_PER_TX, - MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS, - MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, - MAX_PUBLIC_LOGS_PER_TX, - PUBLIC_DISPATCH_SELECTOR, -} from '@aztec/circuits.js'; -import { makeContractClassPublic, makeContractInstanceFromClassId } from '@aztec/circuits.js/testing'; -import { Fr } from '@aztec/foundation/fields'; -import { AvmTestContractArtifact } from '@aztec/noir-contracts.js/AvmTest'; -import { type ProtocolContract } from '@aztec/protocol-contracts'; -import { FeeJuiceArtifact, getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice'; -import { getAvmTestContractBytecode } from '@aztec/simulator/public/fixtures'; - -import { AvmProvingTester, AvmProvingTesterV2 } from './avm_proving_tester.js'; - -const TIMEOUT = 300_000; -const DISPATCH_FN_NAME = 'public_dispatch'; -const DISPATCH_SELECTOR = new FunctionSelector(PUBLIC_DISPATCH_SELECTOR); - -describe('AVM WitGen & Circuit', () => { - describe('proving and verification', () => { - const avmTestContractClassSeed = 0; - const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); - let avmTestContractClass: ContractClassPublic; - let avmTestContractInstance: ContractInstanceWithAddress; - let tester: AvmProvingTester; - - beforeEach(async () => { - avmTestContractClass = await makeContractClassPublic( - /*seed=*/ avmTestContractClassSeed, - /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, - ); - avmTestContractInstance = await makeContractInstanceFromClassId( - avmTestContractClass.id, - /*seed=*/ avmTestContractClassSeed, - ); - tester = await AvmProvingTester.create(/*checkCircuitOnly*/ false); - await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); - await tester.addContractInstance(avmTestContractInstance); - }); - - it( - 'bulk_testing v1', - async () => { - // Get a deployed contract instance to pass to the contract - // for it to use as "expected" values when testing contract instance retrieval. - const expectContractInstance = avmTestContractInstance; - const argsField = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x)); - const argsU8 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x)); - const args = [ - argsField, - argsU8, - /*getInstanceForAddress=*/ expectContractInstance.address.toField(), - /*expectedDeployer=*/ expectContractInstance.deployer.toField(), - /*expectedClassId=*/ expectContractInstance.contractClassId.toField(), - /*expectedInitializationHash=*/ expectContractInstance.initializationHash.toField(), - ]; - - await tester.simProveVerifyAppLogic({ address: avmTestContractInstance.address, fnName: 'bulk_testing', args }); - }, - TIMEOUT, - ); - }); - - describe('check circuit', () => { - const sender = AztecAddress.fromNumber(42); - const avmTestContractClassSeed = 0; - const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); - let avmTestContractClass: ContractClassPublic; - let avmTestContractInstance: ContractInstanceWithAddress; - let tester: AvmProvingTester; - - beforeEach(async () => { - avmTestContractClass = await makeContractClassPublic( - /*seed=*/ avmTestContractClassSeed, - /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, - ); - avmTestContractInstance = await makeContractInstanceFromClassId( - avmTestContractClass.id, - /*seed=*/ avmTestContractClassSeed, - ); - tester = await AvmProvingTester.create(/*checkCircuitOnly*/ true); - await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); - await tester.addContractInstance(avmTestContractInstance); - }); - - it( - 'perform too many storage writes and revert', - async () => { - await tester.simProveVerifyAppLogic( - { - address: avmTestContractInstance.address, - fnName: 'n_storage_writes', - args: [new Fr(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX + 1)], - }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'create too many note hashes and revert', - async () => { - await tester.simProveVerifyAppLogic( - { - address: avmTestContractInstance.address, - fnName: 'n_new_note_hashes', - args: [new Fr(MAX_NOTE_HASHES_PER_TX + 1)], - }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'create too many nullifiers and revert', - async () => { - await tester.simProveVerifyAppLogic( - { - address: avmTestContractInstance.address, - fnName: 'n_new_nullifiers', - args: [new Fr(MAX_NULLIFIERS_PER_TX + 1)], - }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'create too many l2tol1 messages and revert', - async () => { - await tester.simProveVerifyAppLogic( - { - address: avmTestContractInstance.address, - fnName: 'n_new_l2_to_l1_msgs', - args: [new Fr(MAX_L2_TO_L1_MSGS_PER_TX + 1)], - }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'create too many public logs and revert', - async () => { - await tester.simProveVerifyAppLogic( - { - address: avmTestContractInstance.address, - fnName: 'n_new_public_logs', - args: [new Fr(MAX_PUBLIC_LOGS_PER_TX + 1)], - }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'top-level exceptional halts in both app logic and teardown', - async () => { - await tester.simProveVerify( - sender, - /*setupCalls=*/ [], - /*appCalls=*/ [{ address: avmTestContractInstance.address, fnName: 'divide_by_zero', args: [] }], - /*teardownCall=*/ undefined, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'top-level exceptional halt in app logic, but teardown succeeds', - async () => { - await tester.simProveVerify( - sender, - /*setupCalls=*/ [], - /*appCalls=*/ [{ address: avmTestContractInstance.address, fnName: 'divide_by_zero', args: [] }], - /*teardownCall=*/ { - address: avmTestContractInstance.address, - fnName: 'add_args_return', - args: [new Fr(1), new Fr(2)], - }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'top-level exceptional halt in teardown, but app logic succeeds', - async () => { - await tester.simProveVerify( - sender, - /*setupCalls=*/ [], - /*appCalls=*/ [ - { address: avmTestContractInstance.address, fnName: 'add_args_return', args: [new Fr(1), new Fr(2)] }, - ], - /*teardownCall=*/ { address: avmTestContractInstance.address, fnName: 'divide_by_zero', args: [] }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'a nested exceptional halt propagate to top-level', - async () => { - await tester.simProveVerifyAppLogic( - { address: avmTestContractInstance.address, fnName: 'external_call_to_divide_by_zero', args: [] }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'a nested exceptional halt is recovered from in caller', - async () => { - await tester.simProveVerifyAppLogic( - { address: avmTestContractInstance.address, fnName: 'external_call_to_divide_by_zero_recovers', args: [] }, - /*expectRevert=*/ false, - ); - }, - TIMEOUT, - ); - it( - 'an exceptional halt due to a nested call to non-existent contract is propagated to top-level', - async () => { - await tester.simProveVerifyAppLogic( - { address: avmTestContractInstance.address, fnName: 'nested_call_to_nothing', args: [] }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - it( - 'an exceptional halt due to a nested call to non-existent contract is recovered from in caller', - async () => { - await tester.simProveVerifyAppLogic( - { address: avmTestContractInstance.address, fnName: 'nested_call_to_nothing_recovers', args: [] }, - /*expectRevert=*/ false, - ); - }, - TIMEOUT, - ); - // FIXME(dbanks12): fails with "Lookup PERM_MAIN_ALU failed." - it.skip('top-level exceptional halts due to a non-existent contract in app-logic and teardown', async () => { - // don't insert contracts into trees, and make sure retrieval fails - const tester = await AvmProvingTester.create(/*checkCircuitOnly=*/ true, /*skipContractDeployments=*/ true); - await tester.simProveVerify( - sender, - /*setupCalls=*/ [], - /*appCalls=*/ [ - { address: avmTestContractInstance.address, fnName: 'add_args_return', args: [new Fr(1), new Fr(2)] }, - ], - /*teardownCall=*/ { - address: avmTestContractInstance.address, - fnName: 'add_args_return', - args: [new Fr(1), new Fr(2)], - }, - /*expectRevert=*/ true, - ); - }); - it( - 'enqueued calls in every phase, with enqueued calls that depend on each other', - async () => { - await tester.simProveVerify( - sender, - /*setupCalls=*/ [ - { address: avmTestContractInstance.address, fnName: 'read_assert_storage_single', args: [new Fr(0)] }, - { address: avmTestContractInstance.address, fnName: 'set_storage_single', args: [new Fr(5)] }, - ], - /*appCalls=*/ [ - { address: avmTestContractInstance.address, fnName: 'read_assert_storage_single', args: [new Fr(5)] }, - { address: avmTestContractInstance.address, fnName: 'set_storage_single', args: [new Fr(10)] }, - ], - /*teardownCall=*/ { - address: avmTestContractInstance.address, - fnName: 'read_assert_storage_single', - args: [new Fr(10)], - }, - /*expectRevert=*/ false, - ); - }, - TIMEOUT, - ); - it( - 'Should prove and verify a TX that reverts in teardown', - async () => { - await tester.simProveVerify( - sender, - /*setupCalls=*/ [], - /*appCalls=*/ [], - /*teardownCall=*/ { - address: avmTestContractInstance.address, - fnName: 'read_assert_storage_single', - args: [new Fr(10)], - }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - }); - - describe('check circuit - contract class limits', () => { - const deployer = AztecAddress.fromNumber(42); - let instances: ContractInstanceWithAddress[]; - let tester: AvmProvingTester; - let avmTestContractAddress: AztecAddress; - - beforeEach(async () => { - tester = await AvmProvingTester.create(/*checkCircuitOnly=*/ true); - // create enough unique contract classes to hit the limit - instances = []; - for (let i = 0; i <= MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS; i++) { - const instance = await tester.registerAndDeployContract( - /*constructorArgs=*/ [], - deployer, - /*contractArtifact=*/ AvmTestContractArtifact, - /*seed=*/ i, - ); - instances.push(instance); - } - avmTestContractAddress = instances[0].address; - }); - it( - 'call the max number of unique contract classes', - async () => { - // args is initialized to MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS contract addresses with unique class IDs - const instanceAddresses = instances - .map(instance => instance.address) - .slice(0, MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS); - - // include the first contract again again at the end to ensure that we can call it even after the limit is reached - instanceAddresses.push(instanceAddresses[0]); - - // include another contract address that reuses a class ID to ensure that we can call it even after the limit is reached - const instanceSameClassAsFirstContract = await makeContractInstanceFromClassId( - instances[0].contractClassId, - /*seed=*/ 1000, - ); - instanceAddresses.push(instanceSameClassAsFirstContract.address); - // add it to the contract data source so it is found - await tester.addContractInstance(instanceSameClassAsFirstContract); - - await tester.simProveVerifyAppLogic( - { - address: avmTestContractAddress, - fnName: 'nested_call_to_add_n_times_different_addresses', - args: [instanceAddresses], - }, - /*expectRevert=*/ false, - ); - }, - TIMEOUT, - ); - it( - 'attempt too many calls to unique contract class ids', - async () => { - // args is initialized to MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS+1 contract addresses with unique class IDs - // should fail because we are trying to call MAX+1 unique class IDs - const instanceAddresses = instances.map(instance => instance.address); - // push an empty one (just padding to match function calldata size of MAX_PUBLIC_CALLS_TO_UNIQUE_CONTRACT_CLASS_IDS+2) - instanceAddresses.push(AztecAddress.zero()); - await tester.simProveVerifyAppLogic( - { - address: avmTestContractAddress, - fnName: 'nested_call_to_add_n_times_different_addresses', - args: [instanceAddresses], - }, - /*expectRevert=*/ true, - ); - }, - TIMEOUT, - ); - }); - - // Add instance & class for fee juice token contract - // Initialize balance of payer - // Include payer in TX - describe('public fee payment', () => { - const sender = AztecAddress.fromNumber(42); - const feePayer = sender; - - const initialFeeJuiceBalance = new Fr(20000); - let feeJuice: ProtocolContract; - let feeJuiceContractClassPublic: ContractClassPublic; - - const avmTestContractClassSeed = 0; - const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); - let avmTestContractClass: ContractClassPublic; - let avmTestContractInstance: ContractInstanceWithAddress; - let tester: AvmProvingTester; - - beforeEach(async () => { - feeJuice = await getCanonicalFeeJuice(); - feeJuiceContractClassPublic = { - ...feeJuice.contractClass, - privateFunctions: [], - unconstrainedFunctions: [], - }; - avmTestContractClass = await makeContractClassPublic( - /*seed=*/ avmTestContractClassSeed, - /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, - ); - avmTestContractInstance = await makeContractInstanceFromClassId( - avmTestContractClass.id, - /*seed=*/ avmTestContractClassSeed, - ); - tester = await AvmProvingTester.create(/*checkCircuitOnly*/ true); - await tester.addContractClass(feeJuiceContractClassPublic, FeeJuiceArtifact); - await tester.addContractInstance(feeJuice.instance); - await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); - await tester.addContractInstance(avmTestContractInstance); - await tester.setFeePayerBalance(feePayer, initialFeeJuiceBalance); - }); - it( - 'fee payment', - async () => { - await tester.simProveVerify( - sender, - /*setupCalls=*/ [], - /*appCalls=*/ [ - { address: avmTestContractInstance.address, fnName: 'add_args_return', args: [new Fr(1), new Fr(2)] }, - ], - /*teardownCall=*/ undefined, - /*expectRevert=*/ false, - feePayer, - ); - }, - TIMEOUT, - ); - }); -}); - -describe('AVM v2', () => { - const sender = AztecAddress.fromNumber(42); - const avmTestContractClassSeed = 0; - const avmTestContractBytecode = getAvmTestContractBytecode(DISPATCH_FN_NAME); - let avmTestContractClass: ContractClassPublic; - let avmTestContractInstance: ContractInstanceWithAddress; - - let tester: AvmProvingTesterV2; - - beforeEach(async () => { - avmTestContractClass = await makeContractClassPublic( - /*seed=*/ avmTestContractClassSeed, - /*publicDispatchFunction=*/ { bytecode: avmTestContractBytecode, selector: DISPATCH_SELECTOR }, - ); - avmTestContractInstance = await makeContractInstanceFromClassId( - avmTestContractClass.id, - /*seed=*/ avmTestContractClassSeed, - ); - tester = await AvmProvingTesterV2.create(); - await tester.addContractClass(avmTestContractClass, AvmTestContractArtifact); - await tester.addContractInstance(avmTestContractInstance); - }); - - it('bulk_testing v2', async () => { - // Get a deployed contract instance to pass to the contract - // for it to use as "expected" values when testing contract instance retrieval. - const expectContractInstance = avmTestContractInstance; - const argsField = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x)); - const argsU8 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x)); - const args = [ - argsField, - argsU8, - /*getInstanceForAddress=*/ expectContractInstance.address.toField(), - /*expectedDeployer=*/ expectContractInstance.deployer.toField(), - /*expectedClassId=*/ expectContractInstance.contractClassId.toField(), - /*expectedInitializationHash=*/ expectContractInstance.initializationHash.toField(), - ]; - - await tester.simProveVerifyV2( - sender, - /*setupCalls=*/ [], - /*appCalls=*/ [{ address: avmTestContractInstance.address, fnName: 'bulk_testing', args }], - /*teardownCall=*/ undefined, - /*expectRevert=*/ false, - ); - }, 180_000); -}); From 7a142afe387995a40b77d0072987fa6864effd82 Mon Sep 17 00:00:00 2001 From: ludamad Date: Tue, 4 Feb 2025 14:49:03 +0000 Subject: [PATCH 04/17] chore: no rbac on kind (#11714) - save a few minutes - allow kind tests in parallel - dont need to clean this up between kind tests --- spartan/aztec-network/templates/boot-node.yaml | 2 +- spartan/aztec-network/templates/deploy-l1-verifier.yaml | 2 ++ spartan/aztec-network/templates/faucet.yaml | 2 +- spartan/aztec-network/templates/prover-agent.yaml | 2 +- spartan/aztec-network/templates/prover-broker.yaml | 2 +- spartan/aztec-network/templates/prover-node.yaml | 2 +- spartan/aztec-network/templates/pxe.yaml | 2 +- spartan/aztec-network/templates/rbac.yaml | 4 +++- spartan/aztec-network/templates/setup-l2-contracts.yaml | 2 ++ spartan/aztec-network/templates/transaction-bot.yaml | 2 +- spartan/aztec-network/templates/validator.yaml | 2 +- 11 files changed, 15 insertions(+), 9 deletions(-) diff --git a/spartan/aztec-network/templates/boot-node.yaml b/spartan/aztec-network/templates/boot-node.yaml index 5b5e5867f88..75a81e07ddd 100644 --- a/spartan/aztec-network/templates/boot-node.yaml +++ b/spartan/aztec-network/templates/boot-node.yaml @@ -35,9 +35,9 @@ spec: dnsPolicy: ClusterFirstWithHostNet {{- if .Values.network.public }} hostNetwork: true + serviceAccountName: {{ include "aztec-network.fullname" . }}-node {{- include "aztec-network.publicAntiAffinity" . | nindent 6 }} {{- end }} - serviceAccountName: {{ include "aztec-network.fullname" . }}-node initContainers: {{- include "aztec-network.p2pSetupContainer" . | nindent 8 }} {{- include "aztec-network.serviceAddressSetupContainer" . | nindent 8 }} diff --git a/spartan/aztec-network/templates/deploy-l1-verifier.yaml b/spartan/aztec-network/templates/deploy-l1-verifier.yaml index ac165f393a7..1fcccf022b0 100644 --- a/spartan/aztec-network/templates/deploy-l1-verifier.yaml +++ b/spartan/aztec-network/templates/deploy-l1-verifier.yaml @@ -18,7 +18,9 @@ spec: app: deploy-l1-verifier spec: restartPolicy: OnFailure + {{- if .Values.network.public }} serviceAccountName: {{ include "aztec-network.fullname" . }}-node + {{- end }} volumes: - name: config emptyDir: {} diff --git a/spartan/aztec-network/templates/faucet.yaml b/spartan/aztec-network/templates/faucet.yaml index 30bee614d06..7b5722d7f4b 100644 --- a/spartan/aztec-network/templates/faucet.yaml +++ b/spartan/aztec-network/templates/faucet.yaml @@ -17,12 +17,12 @@ spec: {{- include "aztec-network.selectorLabels" . | nindent 8 }} app: faucet spec: - serviceAccountName: {{ include "aztec-network.fullname" . }}-node {{- if .Values.network.gke }} nodeSelector: node-type: network {{- end }} {{- if .Values.network.public }} + serviceAccountName: {{ include "aztec-network.fullname" . }}-node hostNetwork: true dnsPolicy: ClusterFirstWithHostNet {{- end }} diff --git a/spartan/aztec-network/templates/prover-agent.yaml b/spartan/aztec-network/templates/prover-agent.yaml index 8c5507c84bc..19ec7954d9e 100644 --- a/spartan/aztec-network/templates/prover-agent.yaml +++ b/spartan/aztec-network/templates/prover-agent.yaml @@ -31,10 +31,10 @@ spec: value: "true" effect: "NoSchedule" {{- end }} - serviceAccountName: {{ include "aztec-network.fullname" . }}-node {{- if .Values.network.public }} hostNetwork: true dnsPolicy: ClusterFirstWithHostNet + serviceAccountName: {{ include "aztec-network.fullname" . }}-node {{- end }} volumes: - name: config diff --git a/spartan/aztec-network/templates/prover-broker.yaml b/spartan/aztec-network/templates/prover-broker.yaml index f76f7b8245b..96d14ec115f 100644 --- a/spartan/aztec-network/templates/prover-broker.yaml +++ b/spartan/aztec-network/templates/prover-broker.yaml @@ -27,13 +27,13 @@ spec: {{- include "aztec-network.selectorLabels" . | nindent 8 }} app: prover-broker spec: - serviceAccountName: {{ include "aztec-network.fullname" . }}-node {{- if .Values.network.gke }} nodeSelector: local-ssd: "{{ .Values.storage.localSsd }}" node-type: network {{- end }} {{- if .Values.network.public }} + serviceAccountName: {{ include "aztec-network.fullname" . }}-node hostNetwork: true dnsPolicy: ClusterFirstWithHostNet {{- include "aztec-network.publicAntiAffinity" . | nindent 6 }} diff --git a/spartan/aztec-network/templates/prover-node.yaml b/spartan/aztec-network/templates/prover-node.yaml index e7a41d20fd1..214dcab6977 100644 --- a/spartan/aztec-network/templates/prover-node.yaml +++ b/spartan/aztec-network/templates/prover-node.yaml @@ -33,11 +33,11 @@ spec: node-type: network {{- end }} {{- if .Values.network.public }} + serviceAccountName: {{ include "aztec-network.fullname" . }}-node hostNetwork: true dnsPolicy: ClusterFirstWithHostNet {{- include "aztec-network.publicAntiAffinity" . | nindent 6 }} {{- end }} - serviceAccountName: {{ include "aztec-network.fullname" . }}-node initContainers: {{- include "aztec-network.serviceAddressSetupContainer" . | nindent 8 }} {{- include "aztec-network.p2pSetupContainer" . | nindent 8 }} diff --git a/spartan/aztec-network/templates/pxe.yaml b/spartan/aztec-network/templates/pxe.yaml index 8d3061f3fc0..163a5574704 100644 --- a/spartan/aztec-network/templates/pxe.yaml +++ b/spartan/aztec-network/templates/pxe.yaml @@ -21,8 +21,8 @@ spec: local-ssd: "{{ .Values.storage.localSsd }}" node-type: network {{- end }} - serviceAccountName: {{ include "aztec-network.fullname" . }}-node {{- if .Values.network.public }} + serviceAccountName: {{ include "aztec-network.fullname" . }}-node hostNetwork: true dnsPolicy: ClusterFirstWithHostNet {{- end }} diff --git a/spartan/aztec-network/templates/rbac.yaml b/spartan/aztec-network/templates/rbac.yaml index 94f143f619e..e4dad20a3fd 100644 --- a/spartan/aztec-network/templates/rbac.yaml +++ b/spartan/aztec-network/templates/rbac.yaml @@ -1,3 +1,4 @@ +{{- if .Values.network.public }} --- apiVersion: v1 kind: ServiceAccount @@ -55,4 +56,5 @@ roleRef: subjects: - kind: ServiceAccount name: {{ include "aztec-network.fullname" . }}-node - namespace: {{ .Release.Namespace }} \ No newline at end of file + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/spartan/aztec-network/templates/setup-l2-contracts.yaml b/spartan/aztec-network/templates/setup-l2-contracts.yaml index 804ed7cc7e1..4d5262bfbb4 100644 --- a/spartan/aztec-network/templates/setup-l2-contracts.yaml +++ b/spartan/aztec-network/templates/setup-l2-contracts.yaml @@ -17,7 +17,9 @@ spec: app: setup-l2-contracts spec: restartPolicy: OnFailure + {{- if .Values.network.public }} serviceAccountName: {{ include "aztec-network.fullname" . }}-node + {{- end }} volumes: - name: scripts configMap: diff --git a/spartan/aztec-network/templates/transaction-bot.yaml b/spartan/aztec-network/templates/transaction-bot.yaml index 6d65e5377c3..a3f6f616eda 100644 --- a/spartan/aztec-network/templates/transaction-bot.yaml +++ b/spartan/aztec-network/templates/transaction-bot.yaml @@ -32,9 +32,9 @@ spec: effect: "NoSchedule" {{- end }} {{- if .Values.network.public }} + serviceAccountName: {{ include "aztec-network.fullname" . }}-node hostNetwork: true {{- end }} - serviceAccountName: {{ include "aztec-network.fullname" . }}-node volumes: - name: config emptyDir: {} diff --git a/spartan/aztec-network/templates/validator.yaml b/spartan/aztec-network/templates/validator.yaml index bd99669915d..ee73f1a277c 100644 --- a/spartan/aztec-network/templates/validator.yaml +++ b/spartan/aztec-network/templates/validator.yaml @@ -35,11 +35,11 @@ spec: {{- end }} {{- if .Values.network.public }} + serviceAccountName: {{ include "aztec-network.fullname" . }}-node hostNetwork: true dnsPolicy: ClusterFirstWithHostNet {{- include "aztec-network.publicAntiAffinity" . | nindent 6 }} {{- end }} - serviceAccountName: {{ include "aztec-network.fullname" . }}-node initContainers: {{- include "aztec-network.p2pSetupContainer" . | nindent 8 }} {{- include "aztec-network.serviceAddressSetupContainer" . | nindent 8 }} From 5e9f12ebf35d9b26f2aa72c7a89d3d1ddd1f5f24 Mon Sep 17 00:00:00 2001 From: just-mitch <68168980+just-mitch@users.noreply.github.com> Date: Tue, 4 Feb 2025 15:09:08 +0000 Subject: [PATCH 05/17] chore: zombienet yaml (#11705) Please read [contributing guidelines](CONTRIBUTING.md) and remove this line. --- spartan/aztec-network/templates/faucet.yaml | 2 +- spartan/aztec-network/templates/pxe.yaml | 2 + spartan/aztec-network/values.yaml | 2 + .../aztec-network/values/zombienet-reth.yaml | 75 +++++++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 spartan/aztec-network/values/zombienet-reth.yaml diff --git a/spartan/aztec-network/templates/faucet.yaml b/spartan/aztec-network/templates/faucet.yaml index 7b5722d7f4b..c846e89094c 100644 --- a/spartan/aztec-network/templates/faucet.yaml +++ b/spartan/aztec-network/templates/faucet.yaml @@ -1,4 +1,4 @@ -{{- if not .Values.ethereum.externalHost }} +{{- if and (not .Values.ethereum.externalHost) .Values.pxe.enabled }} apiVersion: apps/v1 kind: Deployment metadata: diff --git a/spartan/aztec-network/templates/pxe.yaml b/spartan/aztec-network/templates/pxe.yaml index 163a5574704..e54c6b0e192 100644 --- a/spartan/aztec-network/templates/pxe.yaml +++ b/spartan/aztec-network/templates/pxe.yaml @@ -1,3 +1,4 @@ +{{ if .Values.pxe.enabled }} apiVersion: apps/v1 kind: Deployment metadata: @@ -177,3 +178,4 @@ spec: {{- end }} --- {{ end }} +{{ end }} \ No newline at end of file diff --git a/spartan/aztec-network/values.yaml b/spartan/aztec-network/values.yaml index 60ee0e0485f..a20a1c35631 100644 --- a/spartan/aztec-network/values.yaml +++ b/spartan/aztec-network/values.yaml @@ -179,6 +179,7 @@ proverNode: failedProofStore: "gs://aztec-develop/spartan/failed-proofs" pxe: + enabled: true logLevel: "debug; info: aztec:simulator, json-rpc" replicas: 1 service: @@ -313,6 +314,7 @@ jobs: enable: false faucet: + enabled: true replicas: 1 service: nodePort: 8085 diff --git a/spartan/aztec-network/values/zombienet-reth.yaml b/spartan/aztec-network/values/zombienet-reth.yaml new file mode 100644 index 00000000000..8af2186d7f3 --- /dev/null +++ b/spartan/aztec-network/values/zombienet-reth.yaml @@ -0,0 +1,75 @@ +telemetry: + enabled: true + +aztec: + slotDuration: 36 + epochDuration: 32 + realProofs: true + +network: + setupL2Contracts: false + +bot: + enabled: false + +pxe: + enabled: false + +faucet: + enabled: false + +validator: + replicas: 3 + sequencer: + minTxsPerBlock: 0 + maxTxsPerBlock: 0 + validator: + disabled: false + resources: + requests: + cpu: "1" + +bootNode: + validator: + disabled: true + resources: + requests: + cpu: "1" + +proverBroker: + resources: + requests: + memory: "2Gi" + cpu: "1" + +proverAgent: + replicas: 2 + bb: + hardwareConcurrency: 31 + gke: + spotEnabled: true + resources: + requests: + memory: "116Gi" + cpu: "31" + +ethereum: + execution: + resources: + requests: + memory: "1Gi" + cpu: "0.5" + beacon: + resources: + requests: + memory: "1Gi" + cpu: "0.5" + validator: + resources: + requests: + memory: "1Gi" + cpu: "0.5" + +jobs: + deployL1Verifier: + enable: true From c0503201f5d25bc559462926222d2ad6bc93479d Mon Sep 17 00:00:00 2001 From: Lasse Herskind <16536249+LHerskind@users.noreply.github.com> Date: Tue, 4 Feb 2025 15:21:08 +0000 Subject: [PATCH 06/17] feat!: staking library (#11559) Fixes #11519. Minor oddities can be encountered, if the events are in the library, they won't be part of the rollup contract since the library is external. Therefore events and structs are kept in the interface for simple access. --- l1-contracts/src/core/ValidatorSelection.sol | 142 ++++++++++--- l1-contracts/src/core/interfaces/IStaking.sol | 11 +- .../src/core/libraries/staking/StakingLib.sol | 145 +++++++++++++ l1-contracts/src/core/staking/Staking.sol | 193 ------------------ l1-contracts/test/base/Base.sol | 11 +- .../scenario/slashing/Slashing.t.sol | 4 +- l1-contracts/test/staking/StakingCheater.sol | 90 +++++++- l1-contracts/test/staking/base.t.sol | 2 +- l1-contracts/test/staking/deposit.t.sol | 2 +- .../test/staking/finaliseWithdraw.t.sol | 9 +- l1-contracts/test/staking/getters.t.sol | 2 +- .../test/staking/initiateWithdraw.t.sol | 9 +- l1-contracts/test/staking/slash.t.sol | 5 +- .../ValidatorSelection.t.sol | 6 +- .../cli/src/cmds/infrastructure/sequencers.ts | 2 +- .../cli/src/cmds/l1/update_l1_validators.ts | 2 +- .../end-to-end/src/e2e_p2p/slashing.test.ts | 8 +- yarn-project/ethereum/src/contracts/rollup.ts | 8 +- .../ethereum/src/deploy_l1_contracts.ts | 6 + .../scripts/generate-artifacts.sh | 1 + 20 files changed, 392 insertions(+), 266 deletions(-) create mode 100644 l1-contracts/src/core/libraries/staking/StakingLib.sol delete mode 100644 l1-contracts/src/core/staking/Staking.sol diff --git a/l1-contracts/src/core/ValidatorSelection.sol b/l1-contracts/src/core/ValidatorSelection.sol index 1d065cfaf26..9dc6b172652 100644 --- a/l1-contracts/src/core/ValidatorSelection.sol +++ b/l1-contracts/src/core/ValidatorSelection.sol @@ -2,6 +2,7 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.27; +import {IStaking, ValidatorInfo, Exit, OperatorInfo} from "@aztec/core/interfaces/IStaking.sol"; import { IValidatorSelection, EpochData, @@ -10,13 +11,13 @@ import { import {Signature} from "@aztec/core/libraries/crypto/SignatureLib.sol"; import {DataStructures} from "@aztec/core/libraries/DataStructures.sol"; import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {StakingLib} from "@aztec/core/libraries/staking/StakingLib.sol"; import { Timestamp, Slot, Epoch, SlotLib, EpochLib, TimeLib } from "@aztec/core/libraries/TimeLib.sol"; import {ValidatorSelectionLib} from "@aztec/core/libraries/ValidatorSelectionLib/ValidatorSelectionLib.sol"; -import {Staking} from "@aztec/core/staking/Staking.sol"; - +import {Slasher} from "@aztec/core/staking/Slasher.sol"; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; @@ -27,7 +28,7 @@ import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; * It is a reference implementation, it is not optimized for gas. * */ -contract ValidatorSelection is Staking, IValidatorSelection { +contract ValidatorSelection is IValidatorSelection, IStaking { using EnumerableSet for EnumerableSet.AddressSet; using SlotLib for Slot; @@ -50,10 +51,45 @@ contract ValidatorSelection is Staking, IValidatorSelection { uint256 _slotDuration, uint256 _epochDuration, uint256 _targetCommitteeSize - ) Staking(_stakingAsset, _minimumStake, _slashingQuorum, _roundSize) { + ) { TARGET_COMMITTEE_SIZE = _targetCommitteeSize; TimeLib.initialize(block.timestamp, _slotDuration, _epochDuration); + + Timestamp exitDelay = Timestamp.wrap(60 * 60 * 24); + Slasher slasher = new Slasher(_slashingQuorum, _roundSize); + StakingLib.initialize(_stakingAsset, _minimumStake, exitDelay, address(slasher)); + } + + function deposit(address _attester, address _proposer, address _withdrawer, uint256 _amount) + external + override(IStaking) + { + setupEpoch(); + require( + _attester != address(0) && _proposer != address(0), + Errors.ValidatorSelection__InvalidDeposit(_attester, _proposer) + ); + StakingLib.deposit(_attester, _proposer, _withdrawer, _amount); + } + + function initiateWithdraw(address _attester, address _recipient) + external + override(IStaking) + returns (bool) + { + // @note The attester might be chosen for the epoch, so the delay must be long enough + // to allow for that. + setupEpoch(); + return StakingLib.initiateWithdraw(_attester, _recipient); + } + + function finaliseWithdraw(address _attester) external override(IStaking) { + StakingLib.finaliseWithdraw(_attester); + } + + function slash(address _attester, uint256 _amount) external override(IStaking) { + StakingLib.slash(_attester, _amount); } function getGenesisTime() external view override(IValidatorSelection) returns (Timestamp) { @@ -68,6 +104,67 @@ contract ValidatorSelection is Staking, IValidatorSelection { return TimeLib.getStorage().epochDuration; } + function getSlasher() external view override(IStaking) returns (address) { + return StakingLib.getStorage().slasher; + } + + function getStakingAsset() external view override(IStaking) returns (IERC20) { + return StakingLib.getStorage().stakingAsset; + } + + function getMinimumStake() external view override(IStaking) returns (uint256) { + return StakingLib.getStorage().minimumStake; + } + + function getExitDelay() external view override(IStaking) returns (Timestamp) { + return StakingLib.getStorage().exitDelay; + } + + function getActiveAttesterCount() external view override(IStaking) returns (uint256) { + return StakingLib.getStorage().attesters.length(); + } + + function getProposerForAttester(address _attester) + external + view + override(IStaking) + returns (address) + { + return StakingLib.getStorage().info[_attester].proposer; + } + + function getAttesterAtIndex(uint256 _index) external view override(IStaking) returns (address) { + return StakingLib.getStorage().attesters.at(_index); + } + + function getProposerAtIndex(uint256 _index) external view override(IStaking) returns (address) { + return StakingLib.getStorage().info[StakingLib.getStorage().attesters.at(_index)].proposer; + } + + function getInfo(address _attester) + external + view + override(IStaking) + returns (ValidatorInfo memory) + { + return StakingLib.getStorage().info[_attester]; + } + + function getExit(address _attester) external view override(IStaking) returns (Exit memory) { + return StakingLib.getStorage().exits[_attester]; + } + + function getOperatorAtIndex(uint256 _index) + external + view + override(IStaking) + returns (OperatorInfo memory) + { + address attester = StakingLib.getStorage().attesters.at(_index); + return + OperatorInfo({proposer: StakingLib.getStorage().info[attester].proposer, attester: attester}); + } + /** * @notice Get the validator set for a given epoch * @@ -97,7 +194,7 @@ contract ValidatorSelection is Staking, IValidatorSelection { returns (address[] memory) { return ValidatorSelectionLib.getCommitteeAt( - validatorSelectionStore, stakingStore, getCurrentEpoch(), TARGET_COMMITTEE_SIZE + validatorSelectionStore, StakingLib.getStorage(), getCurrentEpoch(), TARGET_COMMITTEE_SIZE ); } @@ -115,7 +212,7 @@ contract ValidatorSelection is Staking, IValidatorSelection { returns (address[] memory) { return ValidatorSelectionLib.getCommitteeAt( - validatorSelectionStore, stakingStore, getEpochAt(_ts), TARGET_COMMITTEE_SIZE + validatorSelectionStore, StakingLib.getStorage(), getEpochAt(_ts), TARGET_COMMITTEE_SIZE ); } @@ -144,29 +241,6 @@ contract ValidatorSelection is Staking, IValidatorSelection { return ValidatorSelectionLib.getSampleSeed(validatorSelectionStore, getCurrentEpoch()); } - function initiateWithdraw(address _attester, address _recipient) - public - override(Staking) - returns (bool) - { - // @note The attester might be chosen for the epoch, so the delay must be long enough - // to allow for that. - setupEpoch(); - return super.initiateWithdraw(_attester, _recipient); - } - - function deposit(address _attester, address _proposer, address _withdrawer, uint256 _amount) - public - override(Staking) - { - setupEpoch(); - require( - _attester != address(0) && _proposer != address(0), - Errors.ValidatorSelection__InvalidDeposit(_attester, _proposer) - ); - super.deposit(_attester, _proposer, _withdrawer, _amount); - } - /** * @notice Performs a setup of an epoch if needed. The setup will * - Sample the validator set for the epoch @@ -185,7 +259,7 @@ contract ValidatorSelection is Staking, IValidatorSelection { epoch.sampleSeed = ValidatorSelectionLib.getSampleSeed(validatorSelectionStore, epochNumber); epoch.nextSeed = validatorSelectionStore.lastSeed = _computeNextSeed(epochNumber); epoch.committee = ValidatorSelectionLib.sampleValidators( - stakingStore, epoch.sampleSeed, TARGET_COMMITTEE_SIZE + StakingLib.getStorage(), epoch.sampleSeed, TARGET_COMMITTEE_SIZE ); } } @@ -198,7 +272,7 @@ contract ValidatorSelection is Staking, IValidatorSelection { * @return The validator set */ function getAttesters() public view override(IValidatorSelection) returns (address[] memory) { - return stakingStore.attesters.values(); + return StakingLib.getStorage().attesters.values(); } /** @@ -271,7 +345,7 @@ contract ValidatorSelection is Staking, IValidatorSelection { Slot slot = getSlotAt(_ts); Epoch epochNumber = getEpochAtSlot(slot); return ValidatorSelectionLib.getProposerAt( - validatorSelectionStore, stakingStore, slot, epochNumber, TARGET_COMMITTEE_SIZE + validatorSelectionStore, StakingLib.getStorage(), slot, epochNumber, TARGET_COMMITTEE_SIZE ); } @@ -325,7 +399,7 @@ contract ValidatorSelection is Staking, IValidatorSelection { Errors.ValidatorSelection__InvalidDeposit(_attester, _proposer) ); - super.deposit(_attester, _proposer, _withdrawer, _amount); + StakingLib.deposit(_attester, _proposer, _withdrawer, _amount); } /** @@ -353,7 +427,7 @@ contract ValidatorSelection is Staking, IValidatorSelection { Epoch epochNumber = getEpochAtSlot(_slot); ValidatorSelectionLib.validateValidatorSelection( validatorSelectionStore, - stakingStore, + StakingLib.getStorage(), _slot, epochNumber, _signatures, diff --git a/l1-contracts/src/core/interfaces/IStaking.sol b/l1-contracts/src/core/interfaces/IStaking.sol index 63363af287b..a3a7414f605 100644 --- a/l1-contracts/src/core/interfaces/IStaking.sol +++ b/l1-contracts/src/core/interfaces/IStaking.sol @@ -2,7 +2,8 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.27; -import {Timestamp} from "@aztec/core/libraries/TimeLib.sol"; +import {Timestamp} from "@aztec/core/libraries/TimeMath.sol"; +import {IERC20} from "@oz/token/ERC20/IERC20.sol"; import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; // None -> Does not exist in our setup @@ -35,6 +36,10 @@ struct Exit { } struct StakingStorage { + IERC20 stakingAsset; + address slasher; + uint256 minimumStake; + Timestamp exitDelay; EnumerableSet.AddressSet attesters; mapping(address attester => ValidatorInfo) info; mapping(address attester => Exit) exits; @@ -61,4 +66,8 @@ interface IStaking { function getProposerAtIndex(uint256 _index) external view returns (address); function getProposerForAttester(address _attester) external view returns (address); function getOperatorAtIndex(uint256 _index) external view returns (OperatorInfo memory); + function getSlasher() external view returns (address); + function getStakingAsset() external view returns (IERC20); + function getMinimumStake() external view returns (uint256); + function getExitDelay() external view returns (Timestamp); } diff --git a/l1-contracts/src/core/libraries/staking/StakingLib.sol b/l1-contracts/src/core/libraries/staking/StakingLib.sol new file mode 100644 index 00000000000..0071f09b626 --- /dev/null +++ b/l1-contracts/src/core/libraries/staking/StakingLib.sol @@ -0,0 +1,145 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2024 Aztec Labs. +pragma solidity >=0.8.27; + +import { + Status, + ValidatorInfo, + Exit, + Timestamp, + StakingStorage +} from "@aztec/core/interfaces/IStaking.sol"; +import {IStaking} from "@aztec/core/interfaces/IStaking.sol"; +import {Errors} from "@aztec/core/libraries/Errors.sol"; +import {IERC20} from "@oz/token/ERC20/IERC20.sol"; +import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; +import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; + +library StakingLib { + using SafeERC20 for IERC20; + using EnumerableSet for EnumerableSet.AddressSet; + + bytes32 private constant STAKING_SLOT = keccak256("aztec.core.staking.storage"); + + function initialize( + IERC20 _stakingAsset, + uint256 _minimumStake, + Timestamp _exitDelay, + address _slasher + ) external { + StakingStorage storage store = getStorage(); + store.stakingAsset = _stakingAsset; + store.minimumStake = _minimumStake; + store.exitDelay = _exitDelay; + store.slasher = _slasher; + } + + function finaliseWithdraw(address _attester) external { + StakingStorage storage store = getStorage(); + ValidatorInfo storage validator = store.info[_attester]; + require(validator.status == Status.EXITING, Errors.Staking__NotExiting(_attester)); + + Exit storage exit = store.exits[_attester]; + require( + exit.exitableAt <= Timestamp.wrap(block.timestamp), + Errors.Staking__WithdrawalNotUnlockedYet(Timestamp.wrap(block.timestamp), exit.exitableAt) + ); + + uint256 amount = validator.stake; + address recipient = exit.recipient; + + delete store.exits[_attester]; + delete store.info[_attester]; + + store.stakingAsset.transfer(recipient, amount); + + emit IStaking.WithdrawFinalised(_attester, recipient, amount); + } + + function slash(address _attester, uint256 _amount) external { + StakingStorage storage store = getStorage(); + require(msg.sender == store.slasher, Errors.Staking__NotSlasher(store.slasher, msg.sender)); + + ValidatorInfo storage validator = store.info[_attester]; + require(validator.status != Status.NONE, Errors.Staking__NoOneToSlash(_attester)); + + // There is a special, case, if exiting and past the limit, it is untouchable! + require( + !( + validator.status == Status.EXITING + && store.exits[_attester].exitableAt <= Timestamp.wrap(block.timestamp) + ), + Errors.Staking__CannotSlashExitedStake(_attester) + ); + validator.stake -= _amount; + + // If the attester was validating AND is slashed below the MINIMUM_STAKE we update him to LIVING + // When LIVING, he can only start exiting, we don't "really" exit him, because that cost + // gas and cost edge cases around recipient, so lets just avoid that. + if (validator.status == Status.VALIDATING && validator.stake < store.minimumStake) { + require(store.attesters.remove(_attester), Errors.Staking__FailedToRemove(_attester)); + validator.status = Status.LIVING; + } + + emit IStaking.Slashed(_attester, _amount); + } + + function deposit(address _attester, address _proposer, address _withdrawer, uint256 _amount) + external + { + StakingStorage storage store = getStorage(); + require( + _amount >= store.minimumStake, Errors.Staking__InsufficientStake(_amount, store.minimumStake) + ); + store.stakingAsset.transferFrom(msg.sender, address(this), _amount); + require( + store.info[_attester].status == Status.NONE, Errors.Staking__AlreadyRegistered(_attester) + ); + require(store.attesters.add(_attester), Errors.Staking__AlreadyActive(_attester)); + + // If BLS, need to check possession of private key to avoid attacks. + + store.info[_attester] = ValidatorInfo({ + stake: _amount, + withdrawer: _withdrawer, + proposer: _proposer, + status: Status.VALIDATING + }); + + emit IStaking.Deposit(_attester, _proposer, _withdrawer, _amount); + } + + function initiateWithdraw(address _attester, address _recipient) external returns (bool) { + StakingStorage storage store = getStorage(); + ValidatorInfo storage validator = store.info[_attester]; + + require( + msg.sender == validator.withdrawer, + Errors.Staking__NotWithdrawer(validator.withdrawer, msg.sender) + ); + require( + validator.status == Status.VALIDATING || validator.status == Status.LIVING, + Errors.Staking__NothingToExit(_attester) + ); + if (validator.status == Status.VALIDATING) { + require(store.attesters.remove(_attester), Errors.Staking__FailedToRemove(_attester)); + } + + // Note that the "amount" is not stored here, but reusing the `validators` + // We always exit fully. + store.exits[_attester] = + Exit({exitableAt: Timestamp.wrap(block.timestamp) + store.exitDelay, recipient: _recipient}); + validator.status = Status.EXITING; + + emit IStaking.WithdrawInitiated(_attester, _recipient, validator.stake); + + return true; + } + + function getStorage() public pure returns (StakingStorage storage storageStruct) { + bytes32 position = STAKING_SLOT; + assembly { + storageStruct.slot := position + } + } +} diff --git a/l1-contracts/src/core/staking/Staking.sol b/l1-contracts/src/core/staking/Staking.sol deleted file mode 100644 index 6f6edffebca..00000000000 --- a/l1-contracts/src/core/staking/Staking.sol +++ /dev/null @@ -1,193 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2024 Aztec Labs. -pragma solidity >=0.8.27; - -import { - IStaking, - ValidatorInfo, - Exit, - Status, - OperatorInfo, - StakingStorage -} from "@aztec/core/interfaces/IStaking.sol"; -import {Errors} from "@aztec/core/libraries/Errors.sol"; -import {Timestamp} from "@aztec/core/libraries/TimeLib.sol"; -import {Slasher} from "@aztec/core/staking/Slasher.sol"; -import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; -import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; - -contract Staking is IStaking { - using SafeERC20 for IERC20; - using EnumerableSet for EnumerableSet.AddressSet; - - // Constant pulled out of the ass - Timestamp public constant EXIT_DELAY = Timestamp.wrap(60 * 60 * 24); - - Slasher public immutable SLASHER; - IERC20 public immutable STAKING_ASSET; - uint256 public immutable MINIMUM_STAKE; - - StakingStorage internal stakingStore; - - constructor( - IERC20 _stakingAsset, - uint256 _minimumStake, - uint256 _slashingQuorum, - uint256 _roundSize - ) { - SLASHER = new Slasher(_slashingQuorum, _roundSize); - STAKING_ASSET = _stakingAsset; - MINIMUM_STAKE = _minimumStake; - } - - function finaliseWithdraw(address _attester) external override(IStaking) { - ValidatorInfo storage validator = stakingStore.info[_attester]; - require(validator.status == Status.EXITING, Errors.Staking__NotExiting(_attester)); - - Exit storage exit = stakingStore.exits[_attester]; - require( - exit.exitableAt <= Timestamp.wrap(block.timestamp), - Errors.Staking__WithdrawalNotUnlockedYet(Timestamp.wrap(block.timestamp), exit.exitableAt) - ); - - uint256 amount = validator.stake; - address recipient = exit.recipient; - - delete stakingStore.exits[_attester]; - delete stakingStore.info[_attester]; - - STAKING_ASSET.transfer(recipient, amount); - - emit IStaking.WithdrawFinalised(_attester, recipient, amount); - } - - function slash(address _attester, uint256 _amount) external override(IStaking) { - require( - msg.sender == address(SLASHER), Errors.Staking__NotSlasher(address(SLASHER), msg.sender) - ); - - ValidatorInfo storage validator = stakingStore.info[_attester]; - require(validator.status != Status.NONE, Errors.Staking__NoOneToSlash(_attester)); - - // There is a special, case, if exiting and past the limit, it is untouchable! - require( - !( - validator.status == Status.EXITING - && stakingStore.exits[_attester].exitableAt <= Timestamp.wrap(block.timestamp) - ), - Errors.Staking__CannotSlashExitedStake(_attester) - ); - validator.stake -= _amount; - - // If the attester was validating AND is slashed below the MINIMUM_STAKE we update him to LIVING - // When LIVING, he can only start exiting, we don't "really" exit him, because that cost - // gas and cost edge cases around recipient, so lets just avoid that. - if (validator.status == Status.VALIDATING && validator.stake < MINIMUM_STAKE) { - require(stakingStore.attesters.remove(_attester), Errors.Staking__FailedToRemove(_attester)); - validator.status = Status.LIVING; - } - - emit Slashed(_attester, _amount); - } - - function getInfo(address _attester) - external - view - override(IStaking) - returns (ValidatorInfo memory) - { - return stakingStore.info[_attester]; - } - - function getExit(address _attester) external view override(IStaking) returns (Exit memory) { - return stakingStore.exits[_attester]; - } - - function getOperatorAtIndex(uint256 _index) - external - view - override(IStaking) - returns (OperatorInfo memory) - { - address attester = stakingStore.attesters.at(_index); - return OperatorInfo({proposer: stakingStore.info[attester].proposer, attester: attester}); - } - - function deposit(address _attester, address _proposer, address _withdrawer, uint256 _amount) - public - virtual - override(IStaking) - { - require(_amount >= MINIMUM_STAKE, Errors.Staking__InsufficientStake(_amount, MINIMUM_STAKE)); - STAKING_ASSET.transferFrom(msg.sender, address(this), _amount); - require( - stakingStore.info[_attester].status == Status.NONE, - Errors.Staking__AlreadyRegistered(_attester) - ); - require(stakingStore.attesters.add(_attester), Errors.Staking__AlreadyActive(_attester)); - - // If BLS, need to check possession of private key to avoid attacks. - - stakingStore.info[_attester] = ValidatorInfo({ - stake: _amount, - withdrawer: _withdrawer, - proposer: _proposer, - status: Status.VALIDATING - }); - - emit IStaking.Deposit(_attester, _proposer, _withdrawer, _amount); - } - - function initiateWithdraw(address _attester, address _recipient) - public - virtual - override(IStaking) - returns (bool) - { - ValidatorInfo storage validator = stakingStore.info[_attester]; - - require( - msg.sender == validator.withdrawer, - Errors.Staking__NotWithdrawer(validator.withdrawer, msg.sender) - ); - require( - validator.status == Status.VALIDATING || validator.status == Status.LIVING, - Errors.Staking__NothingToExit(_attester) - ); - if (validator.status == Status.VALIDATING) { - require(stakingStore.attesters.remove(_attester), Errors.Staking__FailedToRemove(_attester)); - } - - // Note that the "amount" is not stored here, but reusing the `validators` - // We always exit fully. - stakingStore.exits[_attester] = - Exit({exitableAt: Timestamp.wrap(block.timestamp) + EXIT_DELAY, recipient: _recipient}); - validator.status = Status.EXITING; - - emit IStaking.WithdrawInitiated(_attester, _recipient, validator.stake); - - return true; - } - - function getActiveAttesterCount() public view override(IStaking) returns (uint256) { - return stakingStore.attesters.length(); - } - - function getProposerForAttester(address _attester) - public - view - override(IStaking) - returns (address) - { - return stakingStore.info[_attester].proposer; - } - - function getAttesterAtIndex(uint256 _index) public view override(IStaking) returns (address) { - return stakingStore.attesters.at(_index); - } - - function getProposerAtIndex(uint256 _index) public view override(IStaking) returns (address) { - return stakingStore.info[stakingStore.attesters.at(_index)].proposer; - } -} diff --git a/l1-contracts/test/base/Base.sol b/l1-contracts/test/base/Base.sol index f01da01e64e..52d175faeab 100644 --- a/l1-contracts/test/base/Base.sol +++ b/l1-contracts/test/base/Base.sol @@ -3,10 +3,12 @@ pragma solidity >=0.8.27; import {Timestamp, Slot, Epoch, SlotLib, EpochLib} from "@aztec/core/libraries/TimeLib.sol"; import {Test} from "forge-std/Test.sol"; +import {stdStorage, StdStorage} from "forge-std/Test.sol"; contract TestBase is Test { using SlotLib for Slot; using EpochLib for Epoch; + using stdStorage for StdStorage; function assertGt(Timestamp a, Timestamp b) internal { if (a <= b) { @@ -223,8 +225,11 @@ contract TestBase is Test { // Blobs function skipBlobCheck(address rollup) internal { - // 9 is the slot of checkBlob. We force it to be false (=0): - // Slot number can be checked by running forge inspect src/core/Rollup.sol:Rollup storage - vm.store(rollup, bytes32(uint256(9)), 0); + // For not entirely clear reasons, the checked_write and find in stdStore breaks with + // under/overflow errors if using them. But we can still use them to find the slot + // and looking in the logs. Interesting. + // Alternative, run forge inspect src/core/Rollup.sol:Rollup storageLayout --pretty + // uint256 slot = stdstore.target(address(rollup)).sig("checkBlob()").find(); + vm.store(address(rollup), bytes32(uint256(5)), bytes32(uint256(0))); } } diff --git a/l1-contracts/test/governance/scenario/slashing/Slashing.t.sol b/l1-contracts/test/governance/scenario/slashing/Slashing.t.sol index dd0476d7c0f..364cd1083c3 100644 --- a/l1-contracts/test/governance/scenario/slashing/Slashing.t.sol +++ b/l1-contracts/test/governance/scenario/slashing/Slashing.t.sol @@ -18,8 +18,6 @@ import {Slasher, IPayload} from "@aztec/core/staking/Slasher.sol"; import {IValidatorSelection} from "@aztec/core/interfaces/IValidatorSelection.sol"; import {Status, ValidatorInfo} from "@aztec/core/interfaces/IStaking.sol"; -import {Errors} from "@aztec/core/libraries/Errors.sol"; - import {CheatDepositArgs} from "@aztec/core/interfaces/IRollup.sol"; import {SlashingProposer} from "@aztec/core/staking/SlashingProposer.sol"; @@ -72,7 +70,7 @@ contract SlashingScenario is TestBase { slashingRoundSize: TestConstants.AZTEC_SLASHING_ROUND_SIZE }) }); - slasher = rollup.SLASHER(); + slasher = Slasher(rollup.getSlasher()); slashingProposer = slasher.PROPOSER(); slashFactory = new SlashFactory(IValidatorSelection(address(rollup))); diff --git a/l1-contracts/test/staking/StakingCheater.sol b/l1-contracts/test/staking/StakingCheater.sol index a886a3d2f72..15fd16795ec 100644 --- a/l1-contracts/test/staking/StakingCheater.sol +++ b/l1-contracts/test/staking/StakingCheater.sol @@ -2,11 +2,17 @@ // Copyright 2024 Aztec Labs. pragma solidity >=0.8.27; -import {Staking, Status} from "@aztec/core/staking/Staking.sol"; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; +import { + IStaking, ValidatorInfo, Exit, OperatorInfo, Status +} from "@aztec/core/interfaces/IStaking.sol"; -contract StakingCheater is Staking { +import {Timestamp} from "@aztec/core/libraries/TimeLib.sol"; +import {StakingLib} from "@aztec/core/libraries/staking/StakingLib.sol"; +import {Slasher} from "@aztec/core/staking/Slasher.sol"; + +contract StakingCheater is IStaking { using EnumerableSet for EnumerableSet.AddressSet; constructor( @@ -14,17 +20,89 @@ contract StakingCheater is Staking { uint256 _minimumStake, uint256 _slashingQuorum, uint256 _roundSize - ) Staking(_stakingAsset, _minimumStake, _slashingQuorum, _roundSize) {} + ) { + Timestamp exitDelay = Timestamp.wrap(60 * 60 * 24); + Slasher slasher = new Slasher(_slashingQuorum, _roundSize); + StakingLib.initialize(_stakingAsset, _minimumStake, exitDelay, address(slasher)); + } + + function finaliseWithdraw(address _attester) external { + StakingLib.finaliseWithdraw(_attester); + } + + function slash(address _attester, uint256 _amount) external { + StakingLib.slash(_attester, _amount); + } + + function deposit(address _attester, address _proposer, address _withdrawer, uint256 _amount) + external + { + StakingLib.deposit(_attester, _proposer, _withdrawer, _amount); + } + + function initiateWithdraw(address _attester, address _recipient) external returns (bool) { + return StakingLib.initiateWithdraw(_attester, _recipient); + } + + function getActiveAttesterCount() external view returns (uint256) { + return StakingLib.getStorage().attesters.length(); + } + + function getProposerForAttester(address _attester) external view returns (address) { + return StakingLib.getStorage().info[_attester].proposer; + } + + function getAttesterAtIndex(uint256 _index) external view returns (address) { + return StakingLib.getStorage().attesters.at(_index); + } + + function getProposerAtIndex(uint256 _index) external view returns (address) { + return StakingLib.getStorage().info[StakingLib.getStorage().attesters.at(_index)].proposer; + } + + function getInfo(address _attester) external view returns (ValidatorInfo memory) { + return StakingLib.getStorage().info[_attester]; + } + + function getExit(address _attester) external view returns (Exit memory) { + return StakingLib.getStorage().exits[_attester]; + } + + function getOperatorAtIndex(uint256 _index) external view returns (OperatorInfo memory) { + address attester = StakingLib.getStorage().attesters.at(_index); + return + OperatorInfo({proposer: StakingLib.getStorage().info[attester].proposer, attester: attester}); + } + + function getSlasher() external view returns (address) { + return StakingLib.getStorage().slasher; + } + + function getStakingAsset() external view returns (IERC20) { + return StakingLib.getStorage().stakingAsset; + } + + function getMinimumStake() external view returns (uint256) { + return StakingLib.getStorage().minimumStake; + } + + function getExitDelay() external view returns (Timestamp) { + return StakingLib.getStorage().exitDelay; + } + + ////////////// + // CHEATING // + ////////////// function cheat__SetStatus(address _attester, Status _status) external { - stakingStore.info[_attester].status = _status; + StakingLib.getStorage().info[_attester].status = _status; } function cheat__AddAttester(address _attester) external { - stakingStore.attesters.add(_attester); + StakingLib.getStorage().attesters.add(_attester); } function cheat__RemoveAttester(address _attester) external { - stakingStore.attesters.remove(_attester); + StakingLib.getStorage().attesters.remove(_attester); } } diff --git a/l1-contracts/test/staking/base.t.sol b/l1-contracts/test/staking/base.t.sol index 441d418d244..18fc8cddb10 100644 --- a/l1-contracts/test/staking/base.t.sol +++ b/l1-contracts/test/staking/base.t.sol @@ -23,6 +23,6 @@ contract StakingBase is TestBase { stakingAsset = new TestERC20("test", "TEST", address(this)); staking = new StakingCheater(stakingAsset, MINIMUM_STAKE, 1, 1); - SLASHER = address(staking.SLASHER()); + SLASHER = staking.getSlasher(); } } diff --git a/l1-contracts/test/staking/deposit.t.sol b/l1-contracts/test/staking/deposit.t.sol index 900d2a58372..ac2f51be3ec 100644 --- a/l1-contracts/test/staking/deposit.t.sol +++ b/l1-contracts/test/staking/deposit.t.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.27; import {StakingBase} from "./base.t.sol"; import {Errors} from "@aztec/core/libraries/Errors.sol"; import {IERC20Errors} from "@oz/interfaces/draft-IERC6093.sol"; -import {Staking, IStaking, Status, ValidatorInfo} from "@aztec/core/staking/Staking.sol"; +import {IStaking, Status, ValidatorInfo} from "@aztec/core/interfaces/IStaking.sol"; contract DepositTest is StakingBase { uint256 internal depositAmount; diff --git a/l1-contracts/test/staking/finaliseWithdraw.t.sol b/l1-contracts/test/staking/finaliseWithdraw.t.sol index dea6053c04d..1cdde4fcddb 100644 --- a/l1-contracts/test/staking/finaliseWithdraw.t.sol +++ b/l1-contracts/test/staking/finaliseWithdraw.t.sol @@ -3,8 +3,9 @@ pragma solidity >=0.8.27; import {StakingBase} from "./base.t.sol"; import {Errors} from "@aztec/core/libraries/Errors.sol"; -import {IStaking, Status, ValidatorInfo, Exit} from "@aztec/core/staking/Staking.sol"; -import {Timestamp} from "@aztec/core/libraries/TimeLib.sol"; +import { + Timestamp, Status, ValidatorInfo, Exit, IStaking +} from "@aztec/core/interfaces/IStaking.sol"; contract FinaliseWithdrawTest is StakingBase { function test_GivenStatusIsNotExiting() external { @@ -44,7 +45,7 @@ contract FinaliseWithdrawTest is StakingBase { abi.encodeWithSelector( Errors.Staking__WithdrawalNotUnlockedYet.selector, Timestamp.wrap(block.timestamp), - Timestamp.wrap(block.timestamp) + staking.EXIT_DELAY() + Timestamp.wrap(block.timestamp) + staking.getExitDelay() ) ); staking.finaliseWithdraw(ATTESTER); @@ -58,7 +59,7 @@ contract FinaliseWithdrawTest is StakingBase { Exit memory exit = staking.getExit(ATTESTER); assertEq(exit.recipient, RECIPIENT); - assertEq(exit.exitableAt, Timestamp.wrap(block.timestamp) + staking.EXIT_DELAY()); + assertEq(exit.exitableAt, Timestamp.wrap(block.timestamp) + staking.getExitDelay()); ValidatorInfo memory info = staking.getInfo(ATTESTER); assertTrue(info.status == Status.EXITING); diff --git a/l1-contracts/test/staking/getters.t.sol b/l1-contracts/test/staking/getters.t.sol index 2497c994d5a..ceb09a1d4b5 100644 --- a/l1-contracts/test/staking/getters.t.sol +++ b/l1-contracts/test/staking/getters.t.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.27; import {StakingBase} from "./base.t.sol"; -import {OperatorInfo} from "@aztec/core/staking/Staking.sol"; +import {OperatorInfo} from "@aztec/core/interfaces/IStaking.sol"; contract GettersTest is StakingBase { function setUp() public override { diff --git a/l1-contracts/test/staking/initiateWithdraw.t.sol b/l1-contracts/test/staking/initiateWithdraw.t.sol index 3883e826ac9..fe69c47c7d1 100644 --- a/l1-contracts/test/staking/initiateWithdraw.t.sol +++ b/l1-contracts/test/staking/initiateWithdraw.t.sol @@ -3,8 +3,9 @@ pragma solidity >=0.8.27; import {StakingBase} from "./base.t.sol"; import {Errors} from "@aztec/core/libraries/Errors.sol"; -import {IStaking, Status, ValidatorInfo, Exit} from "@aztec/core/staking/Staking.sol"; -import {Timestamp} from "@aztec/core/libraries/TimeLib.sol"; +import { + Timestamp, Status, ValidatorInfo, Exit, IStaking +} from "@aztec/core/interfaces/IStaking.sol"; contract InitiateWithdrawTest is StakingBase { function test_WhenAttesterIsNotRegistered() external { @@ -112,7 +113,7 @@ contract InitiateWithdrawTest is StakingBase { assertEq(stakingAsset.balanceOf(address(staking)), MINIMUM_STAKE); assertEq(stakingAsset.balanceOf(RECIPIENT), 0); exit = staking.getExit(ATTESTER); - assertEq(exit.exitableAt, Timestamp.wrap(block.timestamp) + staking.EXIT_DELAY()); + assertEq(exit.exitableAt, Timestamp.wrap(block.timestamp) + staking.getExitDelay()); assertEq(exit.recipient, RECIPIENT); info = staking.getInfo(ATTESTER); assertTrue(info.status == Status.EXITING); @@ -145,7 +146,7 @@ contract InitiateWithdrawTest is StakingBase { assertEq(stakingAsset.balanceOf(address(staking)), MINIMUM_STAKE); assertEq(stakingAsset.balanceOf(RECIPIENT), 0); exit = staking.getExit(ATTESTER); - assertEq(exit.exitableAt, Timestamp.wrap(block.timestamp) + staking.EXIT_DELAY()); + assertEq(exit.exitableAt, Timestamp.wrap(block.timestamp) + staking.getExitDelay()); assertEq(exit.recipient, RECIPIENT); info = staking.getInfo(ATTESTER); assertTrue(info.status == Status.EXITING); diff --git a/l1-contracts/test/staking/slash.t.sol b/l1-contracts/test/staking/slash.t.sol index fd4ded49803..d0cfe2e4364 100644 --- a/l1-contracts/test/staking/slash.t.sol +++ b/l1-contracts/test/staking/slash.t.sol @@ -3,8 +3,9 @@ pragma solidity >=0.8.27; import {StakingBase} from "./base.t.sol"; import {Errors} from "@aztec/core/libraries/Errors.sol"; -import {Staking, IStaking, Status, ValidatorInfo, Exit} from "@aztec/core/staking/Staking.sol"; -import {Timestamp} from "@aztec/core/libraries/TimeLib.sol"; +import { + IStaking, Status, ValidatorInfo, Exit, Timestamp +} from "@aztec/core/interfaces/IStaking.sol"; contract SlashTest is StakingBase { uint256 internal constant DEPOSIT_AMOUNT = MINIMUM_STAKE + 2; diff --git a/l1-contracts/test/validator-selection/ValidatorSelection.t.sol b/l1-contracts/test/validator-selection/ValidatorSelection.t.sol index 773248000c9..adcf5ceef4e 100644 --- a/l1-contracts/test/validator-selection/ValidatorSelection.t.sol +++ b/l1-contracts/test/validator-selection/ValidatorSelection.t.sol @@ -126,7 +126,7 @@ contract ValidatorSelectionTest is DecoderBase { slashingRoundSize: TestConstants.AZTEC_SLASHING_ROUND_SIZE }) }); - slasher = rollup.SLASHER(); + slasher = Slasher(rollup.getSlasher()); slashFactory = new SlashFactory(IValidatorSelection(address(rollup))); testERC20.mint(address(this), TestConstants.AZTEC_MINIMUM_STAKE * _validatorCount); @@ -310,6 +310,8 @@ contract ValidatorSelectionTest is DecoderBase { skipBlobCheck(address(rollup)); if (_expectRevert && _invalidProposer) { + emit log("We do be reverting?"); + address realProposer = ree.proposer; ree.proposer = address(uint160(uint256(keccak256(abi.encode("invalid", ree.proposer))))); vm.expectRevert( @@ -319,6 +321,8 @@ contract ValidatorSelectionTest is DecoderBase { ); ree.shouldRevert = true; } + + emit log("Time to propose"); vm.prank(ree.proposer); rollup.propose(args, signatures, full.block.body, full.block.blobInputs); diff --git a/yarn-project/cli/src/cmds/infrastructure/sequencers.ts b/yarn-project/cli/src/cmds/infrastructure/sequencers.ts index cf5dbe7bdc1..c54f8c7588e 100644 --- a/yarn-project/cli/src/cmds/infrastructure/sequencers.ts +++ b/yarn-project/cli/src/cmds/infrastructure/sequencers.ts @@ -66,7 +66,7 @@ export async function sequencers(opts: { log(`Adding ${who} as sequencer`); const stakingAsset = getContract({ - address: await rollup.read.STAKING_ASSET(), + address: await rollup.read.getStakingAsset(), abi: TestERC20Abi, client: walletClient, }); diff --git a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts index 38a8dc6a9f2..c19d7496783 100644 --- a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts +++ b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts @@ -58,7 +58,7 @@ export async function addL1Validator({ }); const stakingAsset = getContract({ - address: await rollup.read.STAKING_ASSET(), + address: await rollup.read.getStakingAsset(), abi: TestERC20Abi, client: walletClient, }); diff --git a/yarn-project/end-to-end/src/e2e_p2p/slashing.test.ts b/yarn-project/end-to-end/src/e2e_p2p/slashing.test.ts index fcb6cca9c3f..f830b8fc1b0 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/slashing.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/slashing.test.ts @@ -66,7 +66,7 @@ describe('e2e_p2p_slashing', () => { }); const slasherContract = getContract({ - address: getAddress(await rollup.read.SLASHER()), + address: getAddress(await rollup.read.getSlasher()), abi: SlasherAbi, client: t.ctx.deployL1ContractsValues.publicClient, }); @@ -219,11 +219,7 @@ describe('e2e_p2p_slashing', () => { const tx = await slashingProposer.write.executeProposal([sInfo.roundNumber], { account: t.ctx.deployL1ContractsValues.walletClient.account, }); - await t.ctx.deployL1ContractsValues.publicClient.waitForTransactionReceipt({ - hash: tx, - }); - - const receipt = await t.ctx.deployL1ContractsValues.publicClient.getTransactionReceipt({ + const receipt = await t.ctx.deployL1ContractsValues.publicClient.waitForTransactionReceipt({ hash: tx, }); diff --git a/yarn-project/ethereum/src/contracts/rollup.ts b/yarn-project/ethereum/src/contracts/rollup.ts index be14a371cd9..45013f3b30a 100644 --- a/yarn-project/ethereum/src/contracts/rollup.ts +++ b/yarn-project/ethereum/src/contracts/rollup.ts @@ -80,7 +80,7 @@ export class RollupContract { @memoize public async getSlashingProposer() { - const slasherAddress = await this.rollup.read.SLASHER(); + const slasherAddress = await this.rollup.read.getSlasher(); const slasher = getContract({ address: slasherAddress, abi: SlasherAbi, client: this.client }); const proposerAddress = await slasher.read.PROPOSER(); return new SlashingProposerContract(this.client, proposerAddress); @@ -118,11 +118,11 @@ export class RollupContract { @memoize getMinimumStake() { - return this.rollup.read.MINIMUM_STAKE(); + return this.rollup.read.getMinimumStake(); } public async getSlashingProposerAddress() { - const slasherAddress = await this.rollup.read.SLASHER(); + const slasherAddress = await this.rollup.read.getSlasher(); const slasher = getContract({ address: getAddress(slasherAddress.toString()), abi: SlasherAbi, @@ -203,7 +203,7 @@ export class RollupContract { this.rollup.read.FEE_JUICE_PORTAL(), this.rollup.read.REWARD_DISTRIBUTOR(), this.rollup.read.ASSET(), - this.rollup.read.STAKING_ASSET(), + this.rollup.read.getStakingAsset(), ] as const) ).map(EthAddress.fromString); diff --git a/yarn-project/ethereum/src/deploy_l1_contracts.ts b/yarn-project/ethereum/src/deploy_l1_contracts.ts index ff5c5f92c78..ab3a18ba3ad 100644 --- a/yarn-project/ethereum/src/deploy_l1_contracts.ts +++ b/yarn-project/ethereum/src/deploy_l1_contracts.ts @@ -28,6 +28,8 @@ import { RollupLinkReferences, SlashFactoryAbi, SlashFactoryBytecode, + StakingLibAbi, + StakingLibBytecode, TestERC20Abi, TestERC20Bytecode, ValidatorSelectionLibAbi, @@ -146,6 +148,10 @@ export const l1Artifacts = { contractAbi: ExtRollupLibAbi, contractBytecode: ExtRollupLibBytecode as Hex, }, + StakingLib: { + contractAbi: StakingLibAbi, + contractBytecode: StakingLibBytecode as Hex, + }, }, }, }, diff --git a/yarn-project/l1-artifacts/scripts/generate-artifacts.sh b/yarn-project/l1-artifacts/scripts/generate-artifacts.sh index 0e105e252e7..802a41ace83 100755 --- a/yarn-project/l1-artifacts/scripts/generate-artifacts.sh +++ b/yarn-project/l1-artifacts/scripts/generate-artifacts.sh @@ -37,6 +37,7 @@ contracts=( "SlashFactory" "Forwarder" "HonkVerifier" + "StakingLib" ) # Combine error ABIs once, removing duplicates by {type, name}. From 08fc279405cfbd88a679046d3c97b6c145b57b7a Mon Sep 17 00:00:00 2001 From: Aztec Bot <49558828+AztecBot@users.noreply.github.com> Date: Tue, 4 Feb 2025 10:50:13 -0500 Subject: [PATCH 07/17] chore(master): Release 0.74.0 (#11676) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit :robot: I have created a release *beep* *boop* ---
aztec-package: 0.74.0 ## [0.74.0](https://github.com/AztecProtocol/aztec-packages/compare/aztec-package-v0.73.0...aztec-package-v0.74.0) (2025-02-04) ### Miscellaneous * Ensure new kv-store is used on the server ([#11662](https://github.com/AztecProtocol/aztec-packages/issues/11662)) ([aee1420](https://github.com/AztecProtocol/aztec-packages/commit/aee14208a42f9b5b7f9aef4b6e0d92e303a265c1))
barretenberg.js: 0.74.0 ## [0.74.0](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg.js-v0.73.0...barretenberg.js-v0.74.0) (2025-02-04) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions
aztec-packages: 0.74.0 ## [0.74.0](https://github.com/AztecProtocol/aztec-packages/compare/aztec-packages-v0.73.0...aztec-packages-v0.74.0) (2025-02-04) ### ⚠ BREAKING CHANGES * time library ([#11542](https://github.com/AztecProtocol/aztec-packages/issues/11542)) ### Features * `u128.ts` accepting string on input ([#11664](https://github.com/AztecProtocol/aztec-packages/issues/11664)) ([bb25992](https://github.com/AztecProtocol/aztec-packages/commit/bb2599240f8cea20c111c1533cff457372e5d458)) * Add network, better drawer performance ([#11694](https://github.com/AztecProtocol/aztec-packages/issues/11694)) ([1f61822](https://github.com/AztecProtocol/aztec-packages/commit/1f61822e731b6d1cd7295772f54afda54b646514)) * Skip calculation of partial sums when simulating blobs ([#11257](https://github.com/AztecProtocol/aztec-packages/issues/11257)) ([aca66f7](https://github.com/AztecProtocol/aztec-packages/commit/aca66f7611be2eba774b9d204d732801853cc6a2)) * Time library ([#11542](https://github.com/AztecProtocol/aztec-packages/issues/11542)) ([3b463f9](https://github.com/AztecProtocol/aztec-packages/commit/3b463f9f9376393c5f781cf2495c6db379308aca)), closes [#11520](https://github.com/AztecProtocol/aztec-packages/issues/11520) * UltraHonkZK contract ([#11553](https://github.com/AztecProtocol/aztec-packages/issues/11553)) ([a68369f](https://github.com/AztecProtocol/aztec-packages/commit/a68369fd1f12d00e037a2626b2bbc17375054883)) ### Bug Fixes * Add bootstrap.sh to rebuild_patterns ([#11683](https://github.com/AztecProtocol/aztec-packages/issues/11683)) ([e84a81a](https://github.com/AztecProtocol/aztec-packages/commit/e84a81a556b2059be843e06a7e814cd4fb7f99eb)) * **archiver:** Do not attempt to decode blob before filtering ([#11668](https://github.com/AztecProtocol/aztec-packages/issues/11668)) ([961cbdd](https://github.com/AztecProtocol/aztec-packages/commit/961cbdd9ee33ce85f9509e690c346988e1a3bccf)) * Barretenber/stdlib/logic bugs ([#11651](https://github.com/AztecProtocol/aztec-packages/issues/11651)) ([dddab22](https://github.com/AztecProtocol/aztec-packages/commit/dddab22934b3abb798dbf204bccb68b557ee2193)) * Barretenberg/stdlib/logic bugs (redo) ([#11691](https://github.com/AztecProtocol/aztec-packages/issues/11691)) ([6d0bad7](https://github.com/AztecProtocol/aztec-packages/commit/6d0bad77b2ffdc966462cc333faa9cea4b21f4dc)) * **docs:** Keys docs update ([#11665](https://github.com/AztecProtocol/aztec-packages/issues/11665)) ([ce3d92c](https://github.com/AztecProtocol/aztec-packages/commit/ce3d92c966cbdd68cc1c8e1e34e1831db5080a34)) * Revert "barretenberg/stdlib/logic bugs" ([#11689](https://github.com/AztecProtocol/aztec-packages/issues/11689)) ([b99570d](https://github.com/AztecProtocol/aztec-packages/commit/b99570d416f4c4c59f38e47a8677b476c5c06f0b)) * Solidity verifier caching ([#11712](https://github.com/AztecProtocol/aztec-packages/issues/11712)) ([2ba1e71](https://github.com/AztecProtocol/aztec-packages/commit/2ba1e7112c4d8052967603ab78c1213cc70b8038)) * Use eth-execution label ([#11713](https://github.com/AztecProtocol/aztec-packages/issues/11713)) ([d3c31d8](https://github.com/AztecProtocol/aztec-packages/commit/d3c31d887b696865f3df41611fae534e1d89460f)) ### Miscellaneous * Add tests for gov proposer ([#11633](https://github.com/AztecProtocol/aztec-packages/issues/11633)) ([5c6a48a](https://github.com/AztecProtocol/aztec-packages/commit/5c6a48a251ff4ef25a2efdf90891241df05e8652)), closes [#11681](https://github.com/AztecProtocol/aztec-packages/issues/11681) * **bb-prover:** Avm test skip and split ([#11717](https://github.com/AztecProtocol/aztec-packages/issues/11717)) ([1778867](https://github.com/AztecProtocol/aztec-packages/commit/177886764a23b9437fdc767726cc7c8533c27f08)) * Benchmark sha256 number of instructions executed in AVM ([#11253](https://github.com/AztecProtocol/aztec-packages/issues/11253)) ([aaf0d8c](https://github.com/AztecProtocol/aztec-packages/commit/aaf0d8c02b99eb1c037745d54c0859553492c088)) * Delete MerkleTrees implementation in JS ([#11697](https://github.com/AztecProtocol/aztec-packages/issues/11697)) ([1db7b78](https://github.com/AztecProtocol/aztec-packages/commit/1db7b7845405e1c877da71185566b8495c9469e7)) * Ensure new kv-store is used on the server ([#11662](https://github.com/AztecProtocol/aztec-packages/issues/11662)) ([aee1420](https://github.com/AztecProtocol/aztec-packages/commit/aee14208a42f9b5b7f9aef4b6e0d92e303a265c1)) * Field encoding should use `fromString` instead of `fromHexString` ([#11585](https://github.com/AztecProtocol/aztec-packages/issues/11585)) ([43fdbb1](https://github.com/AztecProtocol/aztec-packages/commit/43fdbb17361c3c2e7ab8b2cb79f0c91932a0d56e)), closes [#10331](https://github.com/AztecProtocol/aztec-packages/issues/10331) * Improve boxes ([#11656](https://github.com/AztecProtocol/aztec-packages/issues/11656)) ([46a3e85](https://github.com/AztecProtocol/aztec-packages/commit/46a3e85c08c930aa2dacb6b20483de1f7926c0ff)) * Increase node pool count and don't use a release channel ([#11687](https://github.com/AztecProtocol/aztec-packages/issues/11687)) ([65a3f11](https://github.com/AztecProtocol/aztec-packages/commit/65a3f11944975c8cb990a72c8b87df3ed224323c)) * Mark contracts as pub ([#11241](https://github.com/AztecProtocol/aztec-packages/issues/11241)) ([b168601](https://github.com/AztecProtocol/aztec-packages/commit/b1686016dd91d559cc81a2e250228698e7ff925e)) * Reduce memory requests on prover node ([#11678](https://github.com/AztecProtocol/aztec-packages/issues/11678)) ([a720151](https://github.com/AztecProtocol/aztec-packages/commit/a720151115471722fa46f4f4f8d6a08408659107)) * Remove profiler cache fallback ([#11680](https://github.com/AztecProtocol/aztec-packages/issues/11680)) ([a305aef](https://github.com/AztecProtocol/aztec-packages/commit/a305aefb8caa0e462f3f7ee535a6dbcadef871da)) * Remove some templates in templates ([#11698](https://github.com/AztecProtocol/aztec-packages/issues/11698)) ([61614b1](https://github.com/AztecProtocol/aztec-packages/commit/61614b1a0fa4a766b1ad5090a29f92a122511806)) * Remove unused functions from public side effect trace ([#11600](https://github.com/AztecProtocol/aztec-packages/issues/11600)) ([54e9602](https://github.com/AztecProtocol/aztec-packages/commit/54e960255e43c103170d7caee716fb6a0253f6f4)) * Replace relative paths to noir-protocol-circuits ([739151e](https://github.com/AztecProtocol/aztec-packages/commit/739151ead0f5e6a9aa421567e9e6329fa7774c13)) * Replace relative paths to noir-protocol-circuits ([bbd526c](https://github.com/AztecProtocol/aztec-packages/commit/bbd526ce0f53e227f40e9a4ef3c068796aff447b)) * **sequencer:** Add InvalidArchive to canProposeAtNextEthBlock ignored errors ([#11682](https://github.com/AztecProtocol/aztec-packages/issues/11682)) ([eea4bd3](https://github.com/AztecProtocol/aztec-packages/commit/eea4bd3db21858e67e730324d0610f7c90a12023)) * **spartan:** Remove hardcoded keys and addresses - derive all from mnemonic ([#11672](https://github.com/AztecProtocol/aztec-packages/issues/11672)) ([65f0e48](https://github.com/AztecProtocol/aztec-packages/commit/65f0e484513734a73e88d78ff490d8c939005eea)) * Turn off auto-upgrade in node-pools ([#11679](https://github.com/AztecProtocol/aztec-packages/issues/11679)) ([09f98a9](https://github.com/AztecProtocol/aztec-packages/commit/09f98a9f10f18fd48895af40981b670c015f7aa3)) * Turn on masking in ultra and mega zk + oink clean-up ([#11693](https://github.com/AztecProtocol/aztec-packages/issues/11693)) ([08e96fe](https://github.com/AztecProtocol/aztec-packages/commit/08e96fee292c53afa645a00a8d2689d01e8136d5)) ### Documentation * Update mig notes release version ([#11685](https://github.com/AztecProtocol/aztec-packages/issues/11685)) ([46a30b5](https://github.com/AztecProtocol/aztec-packages/commit/46a30b5a7438b23c64336bc217dcc1686e94b7c4))
barretenberg: 0.74.0 ## [0.74.0](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg-v0.73.0...barretenberg-v0.74.0) (2025-02-04) ### Features * UltraHonkZK contract ([#11553](https://github.com/AztecProtocol/aztec-packages/issues/11553)) ([a68369f](https://github.com/AztecProtocol/aztec-packages/commit/a68369fd1f12d00e037a2626b2bbc17375054883)) ### Bug Fixes * Barretenber/stdlib/logic bugs ([#11651](https://github.com/AztecProtocol/aztec-packages/issues/11651)) ([dddab22](https://github.com/AztecProtocol/aztec-packages/commit/dddab22934b3abb798dbf204bccb68b557ee2193)) * Barretenberg/stdlib/logic bugs (redo) ([#11691](https://github.com/AztecProtocol/aztec-packages/issues/11691)) ([6d0bad7](https://github.com/AztecProtocol/aztec-packages/commit/6d0bad77b2ffdc966462cc333faa9cea4b21f4dc)) * Revert "barretenberg/stdlib/logic bugs" ([#11689](https://github.com/AztecProtocol/aztec-packages/issues/11689)) ([b99570d](https://github.com/AztecProtocol/aztec-packages/commit/b99570d416f4c4c59f38e47a8677b476c5c06f0b)) ### Miscellaneous * Ensure new kv-store is used on the server ([#11662](https://github.com/AztecProtocol/aztec-packages/issues/11662)) ([aee1420](https://github.com/AztecProtocol/aztec-packages/commit/aee14208a42f9b5b7f9aef4b6e0d92e303a265c1)) * Remove some templates in templates ([#11698](https://github.com/AztecProtocol/aztec-packages/issues/11698)) ([61614b1](https://github.com/AztecProtocol/aztec-packages/commit/61614b1a0fa4a766b1ad5090a29f92a122511806)) * Turn on masking in ultra and mega zk + oink clean-up ([#11693](https://github.com/AztecProtocol/aztec-packages/issues/11693)) ([08e96fe](https://github.com/AztecProtocol/aztec-packages/commit/08e96fee292c53afa645a00a8d2689d01e8136d5))
--- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- .release-please-manifest.json | 8 ++--- CHANGELOG.md | 60 +++++++++++++++++++++++++++++++++ barretenberg/CHANGELOG.md | 21 ++++++++++++ barretenberg/cpp/CMakeLists.txt | 2 +- barretenberg/ts/CHANGELOG.md | 7 ++++ barretenberg/ts/package.json | 2 +- yarn-project/aztec/CHANGELOG.md | 7 ++++ yarn-project/aztec/package.json | 2 +- 8 files changed, 102 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b8b46617e26..1b1a9f796fe 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,7 +1,7 @@ { - ".": "0.73.0", + ".": "0.74.0", "yarn-project/cli": "0.35.1", - "yarn-project/aztec": "0.73.0", - "barretenberg": "0.73.0", - "barretenberg/ts": "0.73.0" + "yarn-project/aztec": "0.74.0", + "barretenberg": "0.74.0", + "barretenberg/ts": "0.74.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b8de3644ab..c99597ff192 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,65 @@ # Changelog +## [0.74.0](https://github.com/AztecProtocol/aztec-packages/compare/aztec-packages-v0.73.0...aztec-packages-v0.74.0) (2025-02-04) + + +### ⚠ BREAKING CHANGES + +* staking library ([#11559](https://github.com/AztecProtocol/aztec-packages/issues/11559)) +* time library ([#11542](https://github.com/AztecProtocol/aztec-packages/issues/11542)) + +### Features + +* `u128.ts` accepting string on input ([#11664](https://github.com/AztecProtocol/aztec-packages/issues/11664)) ([bb25992](https://github.com/AztecProtocol/aztec-packages/commit/bb2599240f8cea20c111c1533cff457372e5d458)) +* Add network, better drawer performance ([#11694](https://github.com/AztecProtocol/aztec-packages/issues/11694)) ([1f61822](https://github.com/AztecProtocol/aztec-packages/commit/1f61822e731b6d1cd7295772f54afda54b646514)) +* Skip calculation of partial sums when simulating blobs ([#11257](https://github.com/AztecProtocol/aztec-packages/issues/11257)) ([aca66f7](https://github.com/AztecProtocol/aztec-packages/commit/aca66f7611be2eba774b9d204d732801853cc6a2)) +* Staking library ([#11559](https://github.com/AztecProtocol/aztec-packages/issues/11559)) ([c050320](https://github.com/AztecProtocol/aztec-packages/commit/c0503201f5d25bc559462926222d2ad6bc93479d)) +* Time library ([#11542](https://github.com/AztecProtocol/aztec-packages/issues/11542)) ([3b463f9](https://github.com/AztecProtocol/aztec-packages/commit/3b463f9f9376393c5f781cf2495c6db379308aca)), closes [#11520](https://github.com/AztecProtocol/aztec-packages/issues/11520) +* UltraHonkZK contract ([#11553](https://github.com/AztecProtocol/aztec-packages/issues/11553)) ([a68369f](https://github.com/AztecProtocol/aztec-packages/commit/a68369fd1f12d00e037a2626b2bbc17375054883)) + + +### Bug Fixes + +* Add bootstrap.sh to rebuild_patterns ([#11683](https://github.com/AztecProtocol/aztec-packages/issues/11683)) ([e84a81a](https://github.com/AztecProtocol/aztec-packages/commit/e84a81a556b2059be843e06a7e814cd4fb7f99eb)) +* **archiver:** Do not attempt to decode blob before filtering ([#11668](https://github.com/AztecProtocol/aztec-packages/issues/11668)) ([961cbdd](https://github.com/AztecProtocol/aztec-packages/commit/961cbdd9ee33ce85f9509e690c346988e1a3bccf)) +* Barretenber/stdlib/logic bugs ([#11651](https://github.com/AztecProtocol/aztec-packages/issues/11651)) ([dddab22](https://github.com/AztecProtocol/aztec-packages/commit/dddab22934b3abb798dbf204bccb68b557ee2193)) +* Barretenberg/stdlib/logic bugs (redo) ([#11691](https://github.com/AztecProtocol/aztec-packages/issues/11691)) ([6d0bad7](https://github.com/AztecProtocol/aztec-packages/commit/6d0bad77b2ffdc966462cc333faa9cea4b21f4dc)) +* **docs:** Keys docs update ([#11665](https://github.com/AztecProtocol/aztec-packages/issues/11665)) ([ce3d92c](https://github.com/AztecProtocol/aztec-packages/commit/ce3d92c966cbdd68cc1c8e1e34e1831db5080a34)) +* Remove avm test that was split ([#11719](https://github.com/AztecProtocol/aztec-packages/issues/11719)) ([9dc8158](https://github.com/AztecProtocol/aztec-packages/commit/9dc8158715e69e772b5b08a6556124e1786e9810)) +* Revert "barretenberg/stdlib/logic bugs" ([#11689](https://github.com/AztecProtocol/aztec-packages/issues/11689)) ([b99570d](https://github.com/AztecProtocol/aztec-packages/commit/b99570d416f4c4c59f38e47a8677b476c5c06f0b)) +* Solidity verifier caching ([#11712](https://github.com/AztecProtocol/aztec-packages/issues/11712)) ([2ba1e71](https://github.com/AztecProtocol/aztec-packages/commit/2ba1e7112c4d8052967603ab78c1213cc70b8038)) +* Use eth-execution label ([#11713](https://github.com/AztecProtocol/aztec-packages/issues/11713)) ([d3c31d8](https://github.com/AztecProtocol/aztec-packages/commit/d3c31d887b696865f3df41611fae534e1d89460f)) + + +### Miscellaneous + +* Add tests for gov proposer ([#11633](https://github.com/AztecProtocol/aztec-packages/issues/11633)) ([5c6a48a](https://github.com/AztecProtocol/aztec-packages/commit/5c6a48a251ff4ef25a2efdf90891241df05e8652)), closes [#11681](https://github.com/AztecProtocol/aztec-packages/issues/11681) +* **bb-prover:** Avm test skip and split ([#11717](https://github.com/AztecProtocol/aztec-packages/issues/11717)) ([1778867](https://github.com/AztecProtocol/aztec-packages/commit/177886764a23b9437fdc767726cc7c8533c27f08)) +* Benchmark sha256 number of instructions executed in AVM ([#11253](https://github.com/AztecProtocol/aztec-packages/issues/11253)) ([aaf0d8c](https://github.com/AztecProtocol/aztec-packages/commit/aaf0d8c02b99eb1c037745d54c0859553492c088)) +* Delete MerkleTrees implementation in JS ([#11697](https://github.com/AztecProtocol/aztec-packages/issues/11697)) ([1db7b78](https://github.com/AztecProtocol/aztec-packages/commit/1db7b7845405e1c877da71185566b8495c9469e7)) +* Ensure new kv-store is used on the server ([#11662](https://github.com/AztecProtocol/aztec-packages/issues/11662)) ([aee1420](https://github.com/AztecProtocol/aztec-packages/commit/aee14208a42f9b5b7f9aef4b6e0d92e303a265c1)) +* Field encoding should use `fromString` instead of `fromHexString` ([#11585](https://github.com/AztecProtocol/aztec-packages/issues/11585)) ([43fdbb1](https://github.com/AztecProtocol/aztec-packages/commit/43fdbb17361c3c2e7ab8b2cb79f0c91932a0d56e)), closes [#10331](https://github.com/AztecProtocol/aztec-packages/issues/10331) +* Improve boxes ([#11656](https://github.com/AztecProtocol/aztec-packages/issues/11656)) ([46a3e85](https://github.com/AztecProtocol/aztec-packages/commit/46a3e85c08c930aa2dacb6b20483de1f7926c0ff)) +* Increase node pool count and don't use a release channel ([#11687](https://github.com/AztecProtocol/aztec-packages/issues/11687)) ([65a3f11](https://github.com/AztecProtocol/aztec-packages/commit/65a3f11944975c8cb990a72c8b87df3ed224323c)) +* Mark contracts as pub ([#11241](https://github.com/AztecProtocol/aztec-packages/issues/11241)) ([b168601](https://github.com/AztecProtocol/aztec-packages/commit/b1686016dd91d559cc81a2e250228698e7ff925e)) +* No rbac on kind ([#11714](https://github.com/AztecProtocol/aztec-packages/issues/11714)) ([7a142af](https://github.com/AztecProtocol/aztec-packages/commit/7a142afe387995a40b77d0072987fa6864effd82)) +* Reduce memory requests on prover node ([#11678](https://github.com/AztecProtocol/aztec-packages/issues/11678)) ([a720151](https://github.com/AztecProtocol/aztec-packages/commit/a720151115471722fa46f4f4f8d6a08408659107)) +* Remove profiler cache fallback ([#11680](https://github.com/AztecProtocol/aztec-packages/issues/11680)) ([a305aef](https://github.com/AztecProtocol/aztec-packages/commit/a305aefb8caa0e462f3f7ee535a6dbcadef871da)) +* Remove some templates in templates ([#11698](https://github.com/AztecProtocol/aztec-packages/issues/11698)) ([61614b1](https://github.com/AztecProtocol/aztec-packages/commit/61614b1a0fa4a766b1ad5090a29f92a122511806)) +* Remove unused functions from public side effect trace ([#11600](https://github.com/AztecProtocol/aztec-packages/issues/11600)) ([54e9602](https://github.com/AztecProtocol/aztec-packages/commit/54e960255e43c103170d7caee716fb6a0253f6f4)) +* Replace relative paths to noir-protocol-circuits ([739151e](https://github.com/AztecProtocol/aztec-packages/commit/739151ead0f5e6a9aa421567e9e6329fa7774c13)) +* Replace relative paths to noir-protocol-circuits ([bbd526c](https://github.com/AztecProtocol/aztec-packages/commit/bbd526ce0f53e227f40e9a4ef3c068796aff447b)) +* **sequencer:** Add InvalidArchive to canProposeAtNextEthBlock ignored errors ([#11682](https://github.com/AztecProtocol/aztec-packages/issues/11682)) ([eea4bd3](https://github.com/AztecProtocol/aztec-packages/commit/eea4bd3db21858e67e730324d0610f7c90a12023)) +* **spartan:** Remove hardcoded keys and addresses - derive all from mnemonic ([#11672](https://github.com/AztecProtocol/aztec-packages/issues/11672)) ([65f0e48](https://github.com/AztecProtocol/aztec-packages/commit/65f0e484513734a73e88d78ff490d8c939005eea)) +* Turn off auto-upgrade in node-pools ([#11679](https://github.com/AztecProtocol/aztec-packages/issues/11679)) ([09f98a9](https://github.com/AztecProtocol/aztec-packages/commit/09f98a9f10f18fd48895af40981b670c015f7aa3)) +* Turn on masking in ultra and mega zk + oink clean-up ([#11693](https://github.com/AztecProtocol/aztec-packages/issues/11693)) ([08e96fe](https://github.com/AztecProtocol/aztec-packages/commit/08e96fee292c53afa645a00a8d2689d01e8136d5)) +* Zombienet yaml ([#11705](https://github.com/AztecProtocol/aztec-packages/issues/11705)) ([5e9f12e](https://github.com/AztecProtocol/aztec-packages/commit/5e9f12ebf35d9b26f2aa72c7a89d3d1ddd1f5f24)) + + +### Documentation + +* Update mig notes release version ([#11685](https://github.com/AztecProtocol/aztec-packages/issues/11685)) ([46a30b5](https://github.com/AztecProtocol/aztec-packages/commit/46a30b5a7438b23c64336bc217dcc1686e94b7c4)) + ## [0.73.0](https://github.com/AztecProtocol/aztec-packages/compare/aztec-packages-v0.72.1...aztec-packages-v0.73.0) (2025-02-01) diff --git a/barretenberg/CHANGELOG.md b/barretenberg/CHANGELOG.md index e04702f2ccd..806eca3c3c2 100644 --- a/barretenberg/CHANGELOG.md +++ b/barretenberg/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [0.74.0](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg-v0.73.0...barretenberg-v0.74.0) (2025-02-04) + + +### Features + +* UltraHonkZK contract ([#11553](https://github.com/AztecProtocol/aztec-packages/issues/11553)) ([a68369f](https://github.com/AztecProtocol/aztec-packages/commit/a68369fd1f12d00e037a2626b2bbc17375054883)) + + +### Bug Fixes + +* Barretenber/stdlib/logic bugs ([#11651](https://github.com/AztecProtocol/aztec-packages/issues/11651)) ([dddab22](https://github.com/AztecProtocol/aztec-packages/commit/dddab22934b3abb798dbf204bccb68b557ee2193)) +* Barretenberg/stdlib/logic bugs (redo) ([#11691](https://github.com/AztecProtocol/aztec-packages/issues/11691)) ([6d0bad7](https://github.com/AztecProtocol/aztec-packages/commit/6d0bad77b2ffdc966462cc333faa9cea4b21f4dc)) +* Revert "barretenberg/stdlib/logic bugs" ([#11689](https://github.com/AztecProtocol/aztec-packages/issues/11689)) ([b99570d](https://github.com/AztecProtocol/aztec-packages/commit/b99570d416f4c4c59f38e47a8677b476c5c06f0b)) + + +### Miscellaneous + +* Ensure new kv-store is used on the server ([#11662](https://github.com/AztecProtocol/aztec-packages/issues/11662)) ([aee1420](https://github.com/AztecProtocol/aztec-packages/commit/aee14208a42f9b5b7f9aef4b6e0d92e303a265c1)) +* Remove some templates in templates ([#11698](https://github.com/AztecProtocol/aztec-packages/issues/11698)) ([61614b1](https://github.com/AztecProtocol/aztec-packages/commit/61614b1a0fa4a766b1ad5090a29f92a122511806)) +* Turn on masking in ultra and mega zk + oink clean-up ([#11693](https://github.com/AztecProtocol/aztec-packages/issues/11693)) ([08e96fe](https://github.com/AztecProtocol/aztec-packages/commit/08e96fee292c53afa645a00a8d2689d01e8136d5)) + ## [0.73.0](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg-v0.72.1...barretenberg-v0.73.0) (2025-02-01) diff --git a/barretenberg/cpp/CMakeLists.txt b/barretenberg/cpp/CMakeLists.txt index 066cdad2ebd..54cb373d38e 100644 --- a/barretenberg/cpp/CMakeLists.txt +++ b/barretenberg/cpp/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24 FATAL_ERROR) project( Barretenberg DESCRIPTION "BN254 elliptic curve library, and PLONK SNARK prover" - VERSION 0.73.0 # x-release-please-version + VERSION 0.74.0 # x-release-please-version LANGUAGES CXX C ) # Insert version into `bb` config file diff --git a/barretenberg/ts/CHANGELOG.md b/barretenberg/ts/CHANGELOG.md index abe591bd113..1c4a42691ec 100644 --- a/barretenberg/ts/CHANGELOG.md +++ b/barretenberg/ts/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.74.0](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg.js-v0.73.0...barretenberg.js-v0.74.0) (2025-02-04) + + +### Miscellaneous + +* **barretenberg.js:** Synchronize aztec-packages versions + ## [0.73.0](https://github.com/AztecProtocol/aztec-packages/compare/barretenberg.js-v0.72.1...barretenberg.js-v0.73.0) (2025-02-01) diff --git a/barretenberg/ts/package.json b/barretenberg/ts/package.json index 35cce9ccdd4..3ccd338750c 100644 --- a/barretenberg/ts/package.json +++ b/barretenberg/ts/package.json @@ -1,7 +1,7 @@ { "name": "@aztec/bb.js", "packageManager": "yarn@4.5.2", - "version": "0.73.0", + "version": "0.74.0", "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/barretenberg/ts", "license": "MIT", "type": "module", diff --git a/yarn-project/aztec/CHANGELOG.md b/yarn-project/aztec/CHANGELOG.md index 540129e0bd6..fe986b533b2 100644 --- a/yarn-project/aztec/CHANGELOG.md +++ b/yarn-project/aztec/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.74.0](https://github.com/AztecProtocol/aztec-packages/compare/aztec-package-v0.73.0...aztec-package-v0.74.0) (2025-02-04) + + +### Miscellaneous + +* Ensure new kv-store is used on the server ([#11662](https://github.com/AztecProtocol/aztec-packages/issues/11662)) ([aee1420](https://github.com/AztecProtocol/aztec-packages/commit/aee14208a42f9b5b7f9aef4b6e0d92e303a265c1)) + ## [0.73.0](https://github.com/AztecProtocol/aztec-packages/compare/aztec-package-v0.72.1...aztec-package-v0.73.0) (2025-02-01) diff --git a/yarn-project/aztec/package.json b/yarn-project/aztec/package.json index 8807c4fa2c4..b2945af85e2 100644 --- a/yarn-project/aztec/package.json +++ b/yarn-project/aztec/package.json @@ -1,6 +1,6 @@ { "name": "@aztec/aztec", - "version": "0.73.0", + "version": "0.74.0", "type": "module", "exports": { ".": "./dest/index.js" From 652c25137bafec903759dd4ad831881bf53dde1d Mon Sep 17 00:00:00 2001 From: Alex Gherghisan Date: Tue, 4 Feb 2025 16:07:24 +0000 Subject: [PATCH 08/17] chore: re-enable p2p test (#11706) Fix #10737 --- yarn-project/p2p/src/client/p2p_client.test.ts | 3 +-- yarn-project/p2p/src/client/p2p_client.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/yarn-project/p2p/src/client/p2p_client.test.ts b/yarn-project/p2p/src/client/p2p_client.test.ts index a2690fe2ae6..b68d7e6ce52 100644 --- a/yarn-project/p2p/src/client/p2p_client.test.ts +++ b/yarn-project/p2p/src/client/p2p_client.test.ts @@ -201,8 +201,7 @@ describe('In-Memory P2P Client', () => { }); describe('Chain prunes', () => { - // TODO(#10737) flake cc Maddiaa0 - it.skip('moves the tips on a chain reorg', async () => { + it('moves the tips on a chain reorg', async () => { blockSource.setProvenBlockNumber(0); await client.start(); diff --git a/yarn-project/p2p/src/client/p2p_client.ts b/yarn-project/p2p/src/client/p2p_client.ts index 0cb4a5b303d..5a87cb0d0ce 100644 --- a/yarn-project/p2p/src/client/p2p_client.ts +++ b/yarn-project/p2p/src/client/p2p_client.ts @@ -662,7 +662,7 @@ export class P2PClient blocks.map(async block => this.synchedBlockHashes.set(block.number, (await block.hash()).toString())), ); await this.synchedLatestBlockNumber.set(lastBlockNum); - this.log.debug(`Synched to latest block ${lastBlockNum}`); + this.log.verbose(`Synched to latest block ${lastBlockNum}`); await this.startServiceIfSynched(); } From c5cbf659ffebff15d3609c0cb92d732133691ea0 Mon Sep 17 00:00:00 2001 From: saleel Date: Tue, 4 Feb 2025 20:45:40 +0400 Subject: [PATCH 09/17] chore: playground name change (#11720) Please read [contributing guidelines](CONTRIBUTING.md) and remove this line. --- CHANGELOG.md | 2 +- barretenberg/ts/CHANGELOG.md | 2 +- {gaztec => playground}/.env | 0 {gaztec => playground}/.gitignore | 0 {gaztec => playground}/.yarnrc.yml | 0 {gaztec => playground}/README.md | 2 +- {gaztec => playground}/eslint.config.js | 0 {gaztec => playground}/index.html | 2 +- playground/netlify.toml | 5 + {gaztec => playground}/package.json | 2 +- {gaztec => playground}/src/App.tsx | 0 .../src/assets/Aztec_logo.png | Bin {gaztec => playground}/src/aztecEnv.ts | 0 {gaztec => playground}/src/common.styles.tsx | 0 .../common/copyToClipboardButton.tsx | 0 .../src/components/common/fnParameter.tsx | 0 .../components/createAuthwitDialog.tsx | 0 .../components/deployContractDialog.tsx | 0 .../components/registerContractDialog.tsx | 0 .../src/components/contract/contract.tsx | 0 .../src/components/contract/dropzone.css | 0 .../src/components/home/home.tsx | 0 .../src/components/logPanel/logPanel.tsx | 0 .../sidebar/components/addNetworkDialog.tsx | 0 .../sidebar/components/addSenderDialog.tsx | 0 .../components/createAccountDialog.tsx | 0 .../sidebar/components/txsPanel.tsx | 0 .../src/components/sidebar/sidebar.tsx | 4 +- {gaztec => playground}/src/main.tsx | 0 {gaztec => playground}/src/utils/constants.ts | 0 .../src/utils/conversion.ts | 0 {gaztec => playground}/src/utils/storage.ts | 0 {gaztec => playground}/src/utils/txs.ts | 0 {gaztec => playground}/src/vite-env.d.ts | 0 {gaztec => playground}/tsconfig.json | 0 {gaztec => playground}/vite.config.ts | 0 {gaztec => playground}/yarn.lock | 116 +++++++++--------- yarn-project/aztec/CHANGELOG.md | 2 +- 38 files changed, 71 insertions(+), 66 deletions(-) rename {gaztec => playground}/.env (100%) rename {gaztec => playground}/.gitignore (100%) rename {gaztec => playground}/.yarnrc.yml (100%) rename {gaztec => playground}/README.md (98%) rename {gaztec => playground}/eslint.config.js (100%) rename {gaztec => playground}/index.html (88%) create mode 100644 playground/netlify.toml rename {gaztec => playground}/package.json (98%) rename {gaztec => playground}/src/App.tsx (100%) rename {gaztec => playground}/src/assets/Aztec_logo.png (100%) rename {gaztec => playground}/src/aztecEnv.ts (100%) rename {gaztec => playground}/src/common.styles.tsx (100%) rename {gaztec => playground}/src/components/common/copyToClipboardButton.tsx (100%) rename {gaztec => playground}/src/components/common/fnParameter.tsx (100%) rename {gaztec => playground}/src/components/contract/components/createAuthwitDialog.tsx (100%) rename {gaztec => playground}/src/components/contract/components/deployContractDialog.tsx (100%) rename {gaztec => playground}/src/components/contract/components/registerContractDialog.tsx (100%) rename {gaztec => playground}/src/components/contract/contract.tsx (100%) rename {gaztec => playground}/src/components/contract/dropzone.css (100%) rename {gaztec => playground}/src/components/home/home.tsx (100%) rename {gaztec => playground}/src/components/logPanel/logPanel.tsx (100%) rename {gaztec => playground}/src/components/sidebar/components/addNetworkDialog.tsx (100%) rename {gaztec => playground}/src/components/sidebar/components/addSenderDialog.tsx (100%) rename {gaztec => playground}/src/components/sidebar/components/createAccountDialog.tsx (100%) rename {gaztec => playground}/src/components/sidebar/components/txsPanel.tsx (100%) rename {gaztec => playground}/src/components/sidebar/sidebar.tsx (99%) rename {gaztec => playground}/src/main.tsx (100%) rename {gaztec => playground}/src/utils/constants.ts (100%) rename {gaztec => playground}/src/utils/conversion.ts (100%) rename {gaztec => playground}/src/utils/storage.ts (100%) rename {gaztec => playground}/src/utils/txs.ts (100%) rename {gaztec => playground}/src/vite-env.d.ts (100%) rename {gaztec => playground}/tsconfig.json (100%) rename {gaztec => playground}/vite.config.ts (100%) rename {gaztec => playground}/yarn.lock (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index c99597ff192..a994db0af82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -266,7 +266,7 @@ * **avm:** Interactive debugger ([#11477](https://github.com/AztecProtocol/aztec-packages/issues/11477)) ([53e57d3](https://github.com/AztecProtocol/aztec-packages/commit/53e57d3d52dd477714bc984c4a13bc8e5664877e)) * Consensus layer in spartan ([#11105](https://github.com/AztecProtocol/aztec-packages/issues/11105)) ([55dd03c](https://github.com/AztecProtocol/aztec-packages/commit/55dd03c84c6ef7624ed3512b4d69b95c13b3af90)) * Eccvm sumcheck with commitments to round univariates ([#11206](https://github.com/AztecProtocol/aztec-packages/issues/11206)) ([fe34b05](https://github.com/AztecProtocol/aztec-packages/commit/fe34b0580a308665c655a897c72f06bd05dcd4c4)) -* Gaztec ([#11229](https://github.com/AztecProtocol/aztec-packages/issues/11229)) ([79f810d](https://github.com/AztecProtocol/aztec-packages/commit/79f810dc682d41154eb723e5bdf4c54c0681becb)) +* Aztec Playground ([#11229](https://github.com/AztecProtocol/aztec-packages/issues/11229)) ([79f810d](https://github.com/AztecProtocol/aztec-packages/commit/79f810dc682d41154eb723e5bdf4c54c0681becb)) * Lazy wasm pt. 2 ([#11410](https://github.com/AztecProtocol/aztec-packages/issues/11410)) ([01510f4](https://github.com/AztecProtocol/aztec-packages/commit/01510f45aa5d385a08584df674d9caf9522e6be2)) * Lazy wasm pt.1 ([#11371](https://github.com/AztecProtocol/aztec-packages/issues/11371)) ([864bc6f](https://github.com/AztecProtocol/aztec-packages/commit/864bc6f34431dee17e76c476716821996d2ff9e5)) * Lazy wasm pt3 ([#11435](https://github.com/AztecProtocol/aztec-packages/issues/11435)) ([7068d05](https://github.com/AztecProtocol/aztec-packages/commit/7068d055d91a6e81e6fbb670e17c77ee209a1a80)) diff --git a/barretenberg/ts/CHANGELOG.md b/barretenberg/ts/CHANGELOG.md index 1c4a42691ec..709856b25af 100644 --- a/barretenberg/ts/CHANGELOG.md +++ b/barretenberg/ts/CHANGELOG.md @@ -31,7 +31,7 @@ ### Features -* Gaztec ([#11229](https://github.com/AztecProtocol/aztec-packages/issues/11229)) ([79f810d](https://github.com/AztecProtocol/aztec-packages/commit/79f810dc682d41154eb723e5bdf4c54c0681becb)) +* Aztec Playground ([#11229](https://github.com/AztecProtocol/aztec-packages/issues/11229)) ([79f810d](https://github.com/AztecProtocol/aztec-packages/commit/79f810dc682d41154eb723e5bdf4c54c0681becb)) * Lazy wasm pt.1 ([#11371](https://github.com/AztecProtocol/aztec-packages/issues/11371)) ([864bc6f](https://github.com/AztecProtocol/aztec-packages/commit/864bc6f34431dee17e76c476716821996d2ff9e5)) * Lazy wasm pt3 ([#11435](https://github.com/AztecProtocol/aztec-packages/issues/11435)) ([7068d05](https://github.com/AztecProtocol/aztec-packages/commit/7068d055d91a6e81e6fbb670e17c77ee209a1a80)) * UH recursion in the browser ([#11049](https://github.com/AztecProtocol/aztec-packages/issues/11049)) ([c3c04a4](https://github.com/AztecProtocol/aztec-packages/commit/c3c04a4cb92f0447431160d425bda66a997c0d66)) diff --git a/gaztec/.env b/playground/.env similarity index 100% rename from gaztec/.env rename to playground/.env diff --git a/gaztec/.gitignore b/playground/.gitignore similarity index 100% rename from gaztec/.gitignore rename to playground/.gitignore diff --git a/gaztec/.yarnrc.yml b/playground/.yarnrc.yml similarity index 100% rename from gaztec/.yarnrc.yml rename to playground/.yarnrc.yml diff --git a/gaztec/README.md b/playground/README.md similarity index 98% rename from gaztec/README.md rename to playground/README.md index 90ca9dfb346..83c892adcba 100644 --- a/gaztec/README.md +++ b/playground/README.md @@ -1,4 +1,4 @@ -# GAztec +# Aztec Playground Initial version of an "everything app" that can be used to test and benchmark Aztec. diff --git a/gaztec/eslint.config.js b/playground/eslint.config.js similarity index 100% rename from gaztec/eslint.config.js rename to playground/eslint.config.js diff --git a/gaztec/index.html b/playground/index.html similarity index 88% rename from gaztec/index.html rename to playground/index.html index 89ed3ef775f..7d5b3aca71c 100644 --- a/gaztec/index.html +++ b/playground/index.html @@ -3,7 +3,7 @@ - GAztec + Aztec Playground
diff --git a/playground/netlify.toml b/playground/netlify.toml new file mode 100644 index 00000000000..fa81267935d --- /dev/null +++ b/playground/netlify.toml @@ -0,0 +1,5 @@ +[[headers]] + for = "/*" + [headers.values] + Cross-Origin-Embedder-Policy = "require-corp" + Cross-Origin-Opener-Policy = "same-origin" diff --git a/gaztec/package.json b/playground/package.json similarity index 98% rename from gaztec/package.json rename to playground/package.json index 0d0d6d8d0de..08cbfe557ce 100644 --- a/gaztec/package.json +++ b/playground/package.json @@ -1,5 +1,5 @@ { - "name": "gaztec", + "name": "playground", "packageManager": "yarn@4.5.2", "private": true, "version": "0.0.0", diff --git a/gaztec/src/App.tsx b/playground/src/App.tsx similarity index 100% rename from gaztec/src/App.tsx rename to playground/src/App.tsx diff --git a/gaztec/src/assets/Aztec_logo.png b/playground/src/assets/Aztec_logo.png similarity index 100% rename from gaztec/src/assets/Aztec_logo.png rename to playground/src/assets/Aztec_logo.png diff --git a/gaztec/src/aztecEnv.ts b/playground/src/aztecEnv.ts similarity index 100% rename from gaztec/src/aztecEnv.ts rename to playground/src/aztecEnv.ts diff --git a/gaztec/src/common.styles.tsx b/playground/src/common.styles.tsx similarity index 100% rename from gaztec/src/common.styles.tsx rename to playground/src/common.styles.tsx diff --git a/gaztec/src/components/common/copyToClipboardButton.tsx b/playground/src/components/common/copyToClipboardButton.tsx similarity index 100% rename from gaztec/src/components/common/copyToClipboardButton.tsx rename to playground/src/components/common/copyToClipboardButton.tsx diff --git a/gaztec/src/components/common/fnParameter.tsx b/playground/src/components/common/fnParameter.tsx similarity index 100% rename from gaztec/src/components/common/fnParameter.tsx rename to playground/src/components/common/fnParameter.tsx diff --git a/gaztec/src/components/contract/components/createAuthwitDialog.tsx b/playground/src/components/contract/components/createAuthwitDialog.tsx similarity index 100% rename from gaztec/src/components/contract/components/createAuthwitDialog.tsx rename to playground/src/components/contract/components/createAuthwitDialog.tsx diff --git a/gaztec/src/components/contract/components/deployContractDialog.tsx b/playground/src/components/contract/components/deployContractDialog.tsx similarity index 100% rename from gaztec/src/components/contract/components/deployContractDialog.tsx rename to playground/src/components/contract/components/deployContractDialog.tsx diff --git a/gaztec/src/components/contract/components/registerContractDialog.tsx b/playground/src/components/contract/components/registerContractDialog.tsx similarity index 100% rename from gaztec/src/components/contract/components/registerContractDialog.tsx rename to playground/src/components/contract/components/registerContractDialog.tsx diff --git a/gaztec/src/components/contract/contract.tsx b/playground/src/components/contract/contract.tsx similarity index 100% rename from gaztec/src/components/contract/contract.tsx rename to playground/src/components/contract/contract.tsx diff --git a/gaztec/src/components/contract/dropzone.css b/playground/src/components/contract/dropzone.css similarity index 100% rename from gaztec/src/components/contract/dropzone.css rename to playground/src/components/contract/dropzone.css diff --git a/gaztec/src/components/home/home.tsx b/playground/src/components/home/home.tsx similarity index 100% rename from gaztec/src/components/home/home.tsx rename to playground/src/components/home/home.tsx diff --git a/gaztec/src/components/logPanel/logPanel.tsx b/playground/src/components/logPanel/logPanel.tsx similarity index 100% rename from gaztec/src/components/logPanel/logPanel.tsx rename to playground/src/components/logPanel/logPanel.tsx diff --git a/gaztec/src/components/sidebar/components/addNetworkDialog.tsx b/playground/src/components/sidebar/components/addNetworkDialog.tsx similarity index 100% rename from gaztec/src/components/sidebar/components/addNetworkDialog.tsx rename to playground/src/components/sidebar/components/addNetworkDialog.tsx diff --git a/gaztec/src/components/sidebar/components/addSenderDialog.tsx b/playground/src/components/sidebar/components/addSenderDialog.tsx similarity index 100% rename from gaztec/src/components/sidebar/components/addSenderDialog.tsx rename to playground/src/components/sidebar/components/addSenderDialog.tsx diff --git a/gaztec/src/components/sidebar/components/createAccountDialog.tsx b/playground/src/components/sidebar/components/createAccountDialog.tsx similarity index 100% rename from gaztec/src/components/sidebar/components/createAccountDialog.tsx rename to playground/src/components/sidebar/components/createAccountDialog.tsx diff --git a/gaztec/src/components/sidebar/components/txsPanel.tsx b/playground/src/components/sidebar/components/txsPanel.tsx similarity index 100% rename from gaztec/src/components/sidebar/components/txsPanel.tsx rename to playground/src/components/sidebar/components/txsPanel.tsx diff --git a/gaztec/src/components/sidebar/sidebar.tsx b/playground/src/components/sidebar/sidebar.tsx similarity index 99% rename from gaztec/src/components/sidebar/sidebar.tsx rename to playground/src/components/sidebar/sidebar.tsx index b5b040b3603..142a50a76c8 100644 --- a/gaztec/src/components/sidebar/sidebar.tsx +++ b/playground/src/components/sidebar/sidebar.tsx @@ -244,9 +244,9 @@ export function SidebarComponent() {
- GAztec + Playground
Connect diff --git a/gaztec/src/main.tsx b/playground/src/main.tsx similarity index 100% rename from gaztec/src/main.tsx rename to playground/src/main.tsx diff --git a/gaztec/src/utils/constants.ts b/playground/src/utils/constants.ts similarity index 100% rename from gaztec/src/utils/constants.ts rename to playground/src/utils/constants.ts diff --git a/gaztec/src/utils/conversion.ts b/playground/src/utils/conversion.ts similarity index 100% rename from gaztec/src/utils/conversion.ts rename to playground/src/utils/conversion.ts diff --git a/gaztec/src/utils/storage.ts b/playground/src/utils/storage.ts similarity index 100% rename from gaztec/src/utils/storage.ts rename to playground/src/utils/storage.ts diff --git a/gaztec/src/utils/txs.ts b/playground/src/utils/txs.ts similarity index 100% rename from gaztec/src/utils/txs.ts rename to playground/src/utils/txs.ts diff --git a/gaztec/src/vite-env.d.ts b/playground/src/vite-env.d.ts similarity index 100% rename from gaztec/src/vite-env.d.ts rename to playground/src/vite-env.d.ts diff --git a/gaztec/tsconfig.json b/playground/tsconfig.json similarity index 100% rename from gaztec/tsconfig.json rename to playground/tsconfig.json diff --git a/gaztec/vite.config.ts b/playground/vite.config.ts similarity index 100% rename from gaztec/vite.config.ts rename to playground/vite.config.ts diff --git a/gaztec/yarn.lock b/playground/yarn.lock similarity index 99% rename from gaztec/yarn.lock rename to playground/yarn.lock index f8b6dd718fc..545d938e9e2 100644 --- a/gaztec/yarn.lock +++ b/playground/yarn.lock @@ -5,57 +5,57 @@ __metadata: version: 8 cacheKey: 10c0 -"@aztec/accounts@link:../yarn-project/accounts::locator=gaztec%40workspace%3A.": +"@aztec/accounts@link:../yarn-project/accounts::locator=playground%40workspace%3A.": version: 0.0.0-use.local - resolution: "@aztec/accounts@link:../yarn-project/accounts::locator=gaztec%40workspace%3A." + resolution: "@aztec/accounts@link:../yarn-project/accounts::locator=playground%40workspace%3A." languageName: node linkType: soft -"@aztec/aztec.js@link:../yarn-project/aztec.js::locator=gaztec%40workspace%3A.": +"@aztec/aztec.js@link:../yarn-project/aztec.js::locator=playground%40workspace%3A.": version: 0.0.0-use.local - resolution: "@aztec/aztec.js@link:../yarn-project/aztec.js::locator=gaztec%40workspace%3A." + resolution: "@aztec/aztec.js@link:../yarn-project/aztec.js::locator=playground%40workspace%3A." languageName: node linkType: soft -"@aztec/bb-prover@link:../yarn-project/bb-prover::locator=gaztec%40workspace%3A.": +"@aztec/bb-prover@link:../yarn-project/bb-prover::locator=playground%40workspace%3A.": version: 0.0.0-use.local - resolution: "@aztec/bb-prover@link:../yarn-project/bb-prover::locator=gaztec%40workspace%3A." + resolution: "@aztec/bb-prover@link:../yarn-project/bb-prover::locator=playground%40workspace%3A." languageName: node linkType: soft -"@aztec/circuits.js@link:../yarn-project/circuits.js::locator=gaztec%40workspace%3A.": +"@aztec/circuits.js@link:../yarn-project/circuits.js::locator=playground%40workspace%3A.": version: 0.0.0-use.local - resolution: "@aztec/circuits.js@link:../yarn-project/circuits.js::locator=gaztec%40workspace%3A." + resolution: "@aztec/circuits.js@link:../yarn-project/circuits.js::locator=playground%40workspace%3A." languageName: node linkType: soft -"@aztec/foundation@link:../yarn-project/foundation::locator=gaztec%40workspace%3A.": +"@aztec/foundation@link:../yarn-project/foundation::locator=playground%40workspace%3A.": version: 0.0.0-use.local - resolution: "@aztec/foundation@link:../yarn-project/foundation::locator=gaztec%40workspace%3A." + resolution: "@aztec/foundation@link:../yarn-project/foundation::locator=playground%40workspace%3A." languageName: node linkType: soft -"@aztec/key-store@link:../yarn-project/key-store::locator=gaztec%40workspace%3A.": +"@aztec/key-store@link:../yarn-project/key-store::locator=playground%40workspace%3A.": version: 0.0.0-use.local - resolution: "@aztec/key-store@link:../yarn-project/key-store::locator=gaztec%40workspace%3A." + resolution: "@aztec/key-store@link:../yarn-project/key-store::locator=playground%40workspace%3A." languageName: node linkType: soft -"@aztec/kv-store@link:../yarn-project/kv-store::locator=gaztec%40workspace%3A.": +"@aztec/kv-store@link:../yarn-project/kv-store::locator=playground%40workspace%3A.": version: 0.0.0-use.local - resolution: "@aztec/kv-store@link:../yarn-project/kv-store::locator=gaztec%40workspace%3A." + resolution: "@aztec/kv-store@link:../yarn-project/kv-store::locator=playground%40workspace%3A." languageName: node linkType: soft -"@aztec/pxe@link:../yarn-project/pxe::locator=gaztec%40workspace%3A.": +"@aztec/pxe@link:../yarn-project/pxe::locator=playground%40workspace%3A.": version: 0.0.0-use.local - resolution: "@aztec/pxe@link:../yarn-project/pxe::locator=gaztec%40workspace%3A." + resolution: "@aztec/pxe@link:../yarn-project/pxe::locator=playground%40workspace%3A." languageName: node linkType: soft -"@aztec/simulator@link:../yarn-project/simulator::locator=gaztec%40workspace%3A.": +"@aztec/simulator@link:../yarn-project/simulator::locator=playground%40workspace%3A.": version: 0.0.0-use.local - resolution: "@aztec/simulator@link:../yarn-project/simulator::locator=gaztec%40workspace%3A." + resolution: "@aztec/simulator@link:../yarn-project/simulator::locator=playground%40workspace%3A." languageName: node linkType: soft @@ -2607,46 +2607,6 @@ __metadata: languageName: node linkType: hard -"gaztec@workspace:.": - version: 0.0.0-use.local - resolution: "gaztec@workspace:." - dependencies: - "@aztec/accounts": "link:../yarn-project/accounts" - "@aztec/aztec.js": "link:../yarn-project/aztec.js" - "@aztec/bb-prover": "link:../yarn-project/bb-prover" - "@aztec/circuits.js": "link:../yarn-project/circuits.js" - "@aztec/foundation": "link:../yarn-project/foundation" - "@aztec/key-store": "link:../yarn-project/key-store" - "@aztec/kv-store": "link:../yarn-project/kv-store" - "@aztec/pxe": "link:../yarn-project/pxe" - "@aztec/simulator": "link:../yarn-project/simulator" - "@emotion/react": "npm:^11.14.0" - "@emotion/styled": "npm:^11.14.0" - "@eslint/js": "npm:^9.18.0" - "@fontsource/roboto": "npm:^5.1.1" - "@mui/icons-material": "npm:^6.3.1" - "@mui/material": "npm:^6.3.1" - "@mui/styles": "npm:^6.3.1" - "@types/node": "npm:^22.10.5" - "@types/react": "npm:^19.0.6" - "@types/react-dom": "npm:^19.0.3" - "@vitejs/plugin-react-swc": "npm:^3.7.2" - eslint: "npm:^9.13.0" - eslint-plugin-react-hooks: "npm:^5.1.0" - eslint-plugin-react-refresh: "npm:^0.4.18" - globals: "npm:^15.14.0" - nosleep.js: "npm:^0.12.0" - react: "npm:^18.3.1" - react-dom: "npm:^18.3.1" - react-dropzone: "npm:^14.3.5" - typescript: "npm:~5.7.3" - typescript-eslint: "npm:^8.11.0" - vite: "npm:^6.0.11" - vite-plugin-node-polyfills: "npm:^0.23.0" - vite-plugin-static-copy: "npm:^2.2.0" - languageName: unknown - linkType: soft - "get-intrinsic@npm:^1.2.4, get-intrinsic@npm:^1.2.5, get-intrinsic@npm:^1.2.6": version: 1.2.7 resolution: "get-intrinsic@npm:1.2.7" @@ -3856,6 +3816,46 @@ __metadata: languageName: node linkType: hard +"playground@workspace:.": + version: 0.0.0-use.local + resolution: "playground@workspace:." + dependencies: + "@aztec/accounts": "link:../yarn-project/accounts" + "@aztec/aztec.js": "link:../yarn-project/aztec.js" + "@aztec/bb-prover": "link:../yarn-project/bb-prover" + "@aztec/circuits.js": "link:../yarn-project/circuits.js" + "@aztec/foundation": "link:../yarn-project/foundation" + "@aztec/key-store": "link:../yarn-project/key-store" + "@aztec/kv-store": "link:../yarn-project/kv-store" + "@aztec/pxe": "link:../yarn-project/pxe" + "@aztec/simulator": "link:../yarn-project/simulator" + "@emotion/react": "npm:^11.14.0" + "@emotion/styled": "npm:^11.14.0" + "@eslint/js": "npm:^9.18.0" + "@fontsource/roboto": "npm:^5.1.1" + "@mui/icons-material": "npm:^6.3.1" + "@mui/material": "npm:^6.3.1" + "@mui/styles": "npm:^6.3.1" + "@types/node": "npm:^22.10.5" + "@types/react": "npm:^19.0.6" + "@types/react-dom": "npm:^19.0.3" + "@vitejs/plugin-react-swc": "npm:^3.7.2" + eslint: "npm:^9.13.0" + eslint-plugin-react-hooks: "npm:^5.1.0" + eslint-plugin-react-refresh: "npm:^0.4.18" + globals: "npm:^15.14.0" + nosleep.js: "npm:^0.12.0" + react: "npm:^18.3.1" + react-dom: "npm:^18.3.1" + react-dropzone: "npm:^14.3.5" + typescript: "npm:~5.7.3" + typescript-eslint: "npm:^8.11.0" + vite: "npm:^6.0.11" + vite-plugin-node-polyfills: "npm:^0.23.0" + vite-plugin-static-copy: "npm:^2.2.0" + languageName: unknown + linkType: soft + "possible-typed-array-names@npm:^1.0.0": version: 1.0.0 resolution: "possible-typed-array-names@npm:1.0.0" diff --git a/yarn-project/aztec/CHANGELOG.md b/yarn-project/aztec/CHANGELOG.md index fe986b533b2..161f4e7d944 100644 --- a/yarn-project/aztec/CHANGELOG.md +++ b/yarn-project/aztec/CHANGELOG.md @@ -34,7 +34,7 @@ ### Features -* Gaztec ([#11229](https://github.com/AztecProtocol/aztec-packages/issues/11229)) ([79f810d](https://github.com/AztecProtocol/aztec-packages/commit/79f810dc682d41154eb723e5bdf4c54c0681becb)) +* Aztec Playground ([#11229](https://github.com/AztecProtocol/aztec-packages/issues/11229)) ([79f810d](https://github.com/AztecProtocol/aztec-packages/commit/79f810dc682d41154eb723e5bdf4c54c0681becb)) * Lazy wasm pt. 2 ([#11410](https://github.com/AztecProtocol/aztec-packages/issues/11410)) ([01510f4](https://github.com/AztecProtocol/aztec-packages/commit/01510f45aa5d385a08584df674d9caf9522e6be2)) * Lazy wasm pt3 ([#11435](https://github.com/AztecProtocol/aztec-packages/issues/11435)) ([7068d05](https://github.com/AztecProtocol/aztec-packages/commit/7068d055d91a6e81e6fbb670e17c77ee209a1a80)) From 29ee9aa871464e928e188be456a94e584dda0222 Mon Sep 17 00:00:00 2001 From: saleel Date: Tue, 4 Feb 2025 23:09:32 +0400 Subject: [PATCH 10/17] chore: change log level for block proposal (#11734) Please read [contributing guidelines](CONTRIBUTING.md) and remove this line. --- yarn-project/sequencer-client/src/sequencer/sequencer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/sequencer-client/src/sequencer/sequencer.ts b/yarn-project/sequencer-client/src/sequencer/sequencer.ts index 0b7a475ed86..df39acc7b3e 100644 --- a/yarn-project/sequencer-client/src/sequencer/sequencer.ts +++ b/yarn-project/sequencer-client/src/sequencer/sequencer.ts @@ -253,7 +253,7 @@ export class Sequencer { return; } - this.log.info(`Can propose block ${newBlockNumber} at slot ${slot}`); + this.log.debug(`Can propose block ${newBlockNumber} at slot ${slot}`); const newGlobalVariables = await this.globalsBuilder.buildGlobalVariables( new Fr(newBlockNumber), From 52bbf1432500f7701deda8d75bf6ff454d37b024 Mon Sep 17 00:00:00 2001 From: PhilWindle <60546371+PhilWindle@users.noreply.github.com> Date: Tue, 4 Feb 2025 20:46:19 +0000 Subject: [PATCH 11/17] chore: More scalability for our metrics (#11732) This PR configures more resources for metrics --- spartan/metrics/values/prod.yaml | 28 +++++- spartan/terraform/gke-cluster/cluster/main.tf | 90 +++++++++++++++++++ 2 files changed, 115 insertions(+), 3 deletions(-) diff --git a/spartan/metrics/values/prod.yaml b/spartan/metrics/values/prod.yaml index c2c2b33f5e1..d84f0621192 100644 --- a/spartan/metrics/values/prod.yaml +++ b/spartan/metrics/values/prod.yaml @@ -1,6 +1,17 @@ opentelemetry-collector: + replicaCount: 3 + resources: + requests: + memory: 12Gi + cpu: "1.5" nodeSelector: node-type: infra + pool: spot + tolerations: + - key: "cloud.google.com/gke-spot" + operator: "Equal" + value: "true" + effect: "NoSchedule" ports: jaeger-compact: enabled: false @@ -29,14 +40,21 @@ prometheus: server: resources: requests: - memory: 7Gi - cpu: 1.5 + memory: 26Gi + cpu: "3.5" nodeSelector: node-type: infra + pool: spot + tolerations: + - key: "cloud.google.com/gke-spot" + operator: "Equal" + value: "true" + effect: "NoSchedule" + persistentVolume: enabled: true size: 100Gi - replicaCount: 10 + replicaCount: 3 statefulSet: enabled: true alertmanager: @@ -57,6 +75,10 @@ tempo: # https://artifacthub.io/packages/helm/grafana/grafana grafana: + resources: + requests: + memory: 5Gi + cpu: "1.5" nodeSelector: node-type: infra service: diff --git a/spartan/terraform/gke-cluster/cluster/main.tf b/spartan/terraform/gke-cluster/cluster/main.tf index 4d5e93f0ed7..afa68c485b0 100644 --- a/spartan/terraform/gke-cluster/cluster/main.tf +++ b/spartan/terraform/gke-cluster/cluster/main.tf @@ -273,3 +273,93 @@ resource "google_container_node_pool" "spot_nodes_2core" { auto_upgrade = false } } + +# Create 2 core high memory spot instance node pool with autoscaling, used for metrics +resource "google_container_node_pool" "spot_nodes_2core-highmem" { + name = "${var.cluster_name}-2core-highmem-spot" + location = var.zone + cluster = var.cluster_name + version = var.node_version + # Enable autoscaling + autoscaling { + min_node_count = 0 + max_node_count = 8 + } + + # Node configuration + node_config { + machine_type = "n2-highmem-2" + spot = true + + service_account = var.service_account + oauth_scopes = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + + labels = { + env = "production" + pool = "spot" + local-ssd = "false" + node-type = "infra" + } + tags = ["aztec-gke-node", "spot"] + + # Spot instance termination handler + taint { + key = "cloud.google.com/gke-spot" + value = "true" + effect = "NO_SCHEDULE" + } + } + + # Management configuration + management { + auto_repair = true + auto_upgrade = false + } +} + +# Create 4 core high memory spot instance node pool with autoscaling, used for metrics +resource "google_container_node_pool" "spot_nodes_4core-highmem" { + name = "${var.cluster_name}-4core-highmem-spot" + location = var.zone + cluster = var.cluster_name + version = var.node_version + # Enable autoscaling + autoscaling { + min_node_count = 0 + max_node_count = 8 + } + + # Node configuration + node_config { + machine_type = "n2-highmem-4" + spot = true + + service_account = var.service_account + oauth_scopes = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + + labels = { + env = "production" + pool = "spot" + local-ssd = "false" + node-type = "infra" + } + tags = ["aztec-gke-node", "spot"] + + # Spot instance termination handler + taint { + key = "cloud.google.com/gke-spot" + value = "true" + effect = "NO_SCHEDULE" + } + } + + # Management configuration + management { + auto_repair = true + auto_upgrade = false + } +} From ff52f6373941dbea91f287dfdd88b2d1dc20a5c6 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Wed, 5 Feb 2025 02:23:00 +0000 Subject: [PATCH 12/17] git subrepo push --branch=master barretenberg subrepo: subdir: "barretenberg" merged: "5190efcf76" upstream: origin: "https://github.com/AztecProtocol/barretenberg" branch: "master" commit: "5190efcf76" git-subrepo: version: "0.4.6" origin: "???" commit: "???" [skip ci] --- barretenberg/.gitrepo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/barretenberg/.gitrepo b/barretenberg/.gitrepo index 326579c7396..76edb13bd92 100644 --- a/barretenberg/.gitrepo +++ b/barretenberg/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/AztecProtocol/barretenberg branch = master - commit = 56503f9cc78e45654f431720318316ca2cc9789d - parent = 61614b1a0fa4a766b1ad5090a29f92a122511806 + commit = 5190efcf768c10fd5d5e1502c030f9641a79698f + parent = 52bbf1432500f7701deda8d75bf6ff454d37b024 method = merge cmdver = 0.4.6 From 0720d18580494823f13c7ba5ab956bc3eff12726 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Wed, 5 Feb 2025 02:23:38 +0000 Subject: [PATCH 13/17] chore: replace relative paths to noir-protocol-circuits --- noir-projects/aztec-nr/aztec/Nargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir-projects/aztec-nr/aztec/Nargo.toml b/noir-projects/aztec-nr/aztec/Nargo.toml index 7a1f1af5863..9aa5dcfa319 100644 --- a/noir-projects/aztec-nr/aztec/Nargo.toml +++ b/noir-projects/aztec-nr/aztec/Nargo.toml @@ -5,4 +5,4 @@ compiler_version = ">=0.18.0" type = "lib" [dependencies] -protocol_types = { path = "../../noir-protocol-circuits/crates/types" } +protocol_types = { git="https://github.com/AztecProtocol/aztec-packages", tag="aztec-packages-v0.74.0", directory="noir-projects/noir-protocol-circuits/crates/types" } From e317033c4554c23f8d93605336ea8f31f0fdf9cc Mon Sep 17 00:00:00 2001 From: AztecBot Date: Wed, 5 Feb 2025 02:23:39 +0000 Subject: [PATCH 14/17] git_subrepo.sh: Fix parent in .gitrepo file. [skip ci] --- noir-projects/aztec-nr/.gitrepo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noir-projects/aztec-nr/.gitrepo b/noir-projects/aztec-nr/.gitrepo index 471aaa39c25..2db8ae7f65c 100644 --- a/noir-projects/aztec-nr/.gitrepo +++ b/noir-projects/aztec-nr/.gitrepo @@ -9,4 +9,4 @@ remote = https://github.com/AztecProtocol/aztec-nr commit = afee26788c91ccfa4a9445f05ada2d20f47d396b method = merge cmdver = 0.4.6 - parent = 9b32585286327c18e809255ad12589daf1cd880b + parent = e148b0fee585ca462b176e03192245ccb097eb63 From fada94937d69824484b994223db3ba66f539204e Mon Sep 17 00:00:00 2001 From: AztecBot Date: Wed, 5 Feb 2025 02:23:44 +0000 Subject: [PATCH 15/17] git subrepo push --branch=master noir-projects/aztec-nr subrepo: subdir: "noir-projects/aztec-nr" merged: "cd752e30f9" upstream: origin: "https://github.com/AztecProtocol/aztec-nr" branch: "master" commit: "cd752e30f9" git-subrepo: version: "0.4.6" origin: "???" commit: "???" [skip ci] --- noir-projects/aztec-nr/.gitrepo | 4 ++-- noir-projects/aztec-nr/aztec/Nargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/noir-projects/aztec-nr/.gitrepo b/noir-projects/aztec-nr/.gitrepo index 2db8ae7f65c..e8a25c97e8f 100644 --- a/noir-projects/aztec-nr/.gitrepo +++ b/noir-projects/aztec-nr/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/AztecProtocol/aztec-nr branch = master - commit = afee26788c91ccfa4a9445f05ada2d20f47d396b + commit = cd752e30f96c006f3e9998b13c1667d4377e2356 method = merge cmdver = 0.4.6 - parent = e148b0fee585ca462b176e03192245ccb097eb63 + parent = 73f18a2d85505f2b40b8272a669bcf5772f9133c diff --git a/noir-projects/aztec-nr/aztec/Nargo.toml b/noir-projects/aztec-nr/aztec/Nargo.toml index 9aa5dcfa319..7a1f1af5863 100644 --- a/noir-projects/aztec-nr/aztec/Nargo.toml +++ b/noir-projects/aztec-nr/aztec/Nargo.toml @@ -5,4 +5,4 @@ compiler_version = ">=0.18.0" type = "lib" [dependencies] -protocol_types = { git="https://github.com/AztecProtocol/aztec-packages", tag="aztec-packages-v0.74.0", directory="noir-projects/noir-protocol-circuits/crates/types" } +protocol_types = { path = "../../noir-protocol-circuits/crates/types" } From 255b3d87ae8bc61f7ce10aa21eb249b9ca723318 Mon Sep 17 00:00:00 2001 From: josh crites Date: Wed, 5 Feb 2025 09:44:19 +0000 Subject: [PATCH 16/17] fix(docs): Fix docs previews (#11736) Docs previews broke in [this](https://github.com/AztecProtocol/aztec-packages/pull/11386) PR. This fixes them --- docs/deploy_preview.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deploy_preview.sh b/docs/deploy_preview.sh index 1e8066487bf..1153325203a 100755 --- a/docs/deploy_preview.sh +++ b/docs/deploy_preview.sh @@ -23,7 +23,7 @@ if [ -n "$PR_NUMBER" ]; then fi # Deploy and capture exit code and output -if ! DEPLOY_OUTPUT=$(yarn netlify deploy --dir $(pwd) --site aztec-docs-dev 2>&1); then +if ! DEPLOY_OUTPUT=$(yarn netlify deploy --site aztec-docs-dev 2>&1); then echo "Netlify deploy failed with error:" echo "$DEPLOY_OUTPUT" exit 1 From 7a2870f3684b198d5472ea4bdd7be5a84e812d93 Mon Sep 17 00:00:00 2001 From: sergei iakovenko <105737703+iakovenkos@users.noreply.github.com> Date: Wed, 5 Feb 2025 10:45:27 +0100 Subject: [PATCH 17/17] chore: remove stale zk constants and methods (#11715) We're using sumcheck with disabled rows that does not require all the constants that I introduced a while ago with an implementation of a different witness masking technique. --- .../src/barretenberg/eccvm/eccvm_flavor.hpp | 2 - .../cpp/src/barretenberg/flavor/flavor.hpp | 16 +-- .../relations/auxiliary_relation.hpp | 15 --- .../relations/databus_lookup_relation.hpp | 17 --- .../delta_range_constraint_relation.hpp | 11 -- .../relations/ecc_op_queue_relation.hpp | 15 --- .../relations/ecc_vm/ecc_bools_relation.hpp | 12 -- .../relations/ecc_vm/ecc_lookup_relation.hpp | 13 --- .../relations/ecc_vm/ecc_msm_relation.hpp | 10 -- .../ecc_vm/ecc_point_table_relation.hpp | 8 -- .../relations/ecc_vm/ecc_set_relation.hpp | 13 --- .../ecc_vm/ecc_transcript_relation.hpp | 13 +-- .../relations/ecc_vm/ecc_wnaf_relation.hpp | 12 -- .../relations/elliptic_relation.hpp | 9 -- .../relations/logderiv_lookup_relation.hpp | 9 -- .../relations/permutation_relation.hpp | 10 -- .../relations/poseidon2_external_relation.hpp | 11 -- .../relations/poseidon2_internal_relation.hpp | 11 -- .../barretenberg/relations/relation_types.hpp | 34 ------ .../translator_decomposition_relation.hpp | 58 ---------- ...slator_delta_range_constraint_relation.hpp | 22 ---- .../translator_extra_relations.hpp | 106 +----------------- .../translator_non_native_field_relation.hpp | 14 +-- .../translator_permutation_relation.hpp | 12 +- .../relations/ultra_arithmetic_relation.hpp | 7 -- .../stdlib_circuit_builders/mega_flavor.hpp | 2 - .../stdlib_circuit_builders/ultra_flavor.hpp | 3 - .../ultra_keccak_zk_flavor.hpp | 12 -- .../ultra_zk_flavor.hpp | 13 +-- .../translator_vm/translator_flavor.hpp | 2 - .../barretenberg/vm/avm/generated/flavor.hpp | 2 - .../src/barretenberg/vm2/generated/flavor.hpp | 2 - .../bb-pil-backend/templates/flavor.hpp.hbs | 2 - 33 files changed, 13 insertions(+), 485 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp index ee44fac3dcd..66855d0982d 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp @@ -60,8 +60,6 @@ class ECCVMFlavor { static constexpr size_t NUM_SHIFTED_ENTITIES = 26; // The number of entities in DerivedWitnessEntities that are not going to be shifted. static constexpr size_t NUM_DERIVED_WITNESS_ENTITIES_NON_SHIFTED = 1; - // The total number of witnesses including shifts and derived entities. - static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; // A container to be fed to ShpleminiVerifier to avoid redundant scalar muls, the first number is the index of the // first witness to be shifted. static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS = diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp index 7a1cddb0069..bb779cfc6c4 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp @@ -242,15 +242,11 @@ auto get_unshifted_then_shifted(const auto& all_entities) * @details The "partial length" of a relation is 1 + the degree of the relation, where any challenges used in the * relation are as constants, not as variables.. */ -template constexpr size_t compute_max_partial_relation_length() +template constexpr size_t compute_max_partial_relation_length() { constexpr auto seq = std::make_index_sequence>(); return [](std::index_sequence) { - if constexpr (ZK) { - return std::max({ std::tuple_element_t::ZK_RELATION_LENGTH... }); - } else { - return std::max({ std::tuple_element_t::RELATION_LENGTH... }); - } + return std::max({ std::tuple_element_t::RELATION_LENGTH... }); }(seq); } @@ -259,15 +255,11 @@ template constexpr size_t compute_max_partial_ * @details The "total length" of a relation is 1 + the degree of the relation, where any challenges used in the * relation are regarded as variables. */ -template constexpr size_t compute_max_total_relation_length() +template constexpr size_t compute_max_total_relation_length() { constexpr auto seq = std::make_index_sequence>(); return [](std::index_sequence) { - if constexpr (ZK) { - return std::max({ std::tuple_element_t::ZK_TOTAL_RELATION_LENGTH... }); - } else { - return std::max({ std::tuple_element_t::TOTAL_RELATION_LENGTH... }); - } + return std::max({ std::tuple_element_t::TOTAL_RELATION_LENGTH... }); }(seq); } diff --git a/barretenberg/cpp/src/barretenberg/relations/auxiliary_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/auxiliary_relation.hpp index 653e86ce143..10801c0a275 100644 --- a/barretenberg/cpp/src/barretenberg/relations/auxiliary_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/auxiliary_relation.hpp @@ -39,21 +39,6 @@ template class AuxiliaryRelationImpl { 6, // RAM consistency sub-relation 2 6 // RAM consistency sub-relation 3 }; - /** - * @brief For ZK-Flavors: The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 2, // auxiliary sub-relation; - 2, // ROM consistency sub-relation 1: adjacent values match if adjacent indices match and next access is a read - // operation - 2, // ROM consistency sub-relation 2: index is monotonously increasing - 3, // RAM consistency sub-relation 1: adjacent values match if adjacent indices match and next access is a read - // operation - 2, // RAM consistency sub-relation 2: index is monotonously increasing - 2 // RAM consistency sub-relation 3: next gate access type is boolean - }; static constexpr std::array TOTAL_LENGTH_ADJUSTMENTS{ 1, // auxiliary sub-relation diff --git a/barretenberg/cpp/src/barretenberg/relations/databus_lookup_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/databus_lookup_relation.hpp index efc977a3bd1..969ac3d833e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/databus_lookup_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/databus_lookup_relation.hpp @@ -62,23 +62,6 @@ template class DatabusLookupRelationImpl { LOOKUP_SUBREL_LENGTH // log-derivative lookup argument subrelation (bus_idx 2) }; - static constexpr size_t INVERSE_SUBREL_WITNESS_DEGREE = 4; // witness degree of inverse correctness subrelation - static constexpr size_t LOOKUP_SUBREL_WITNESS_DEGREE = 4; // witness degree of log-deriv lookup subrelation - - /** - * @brief For ZK-Flavors: Upper bound on the degrees of subrelations considered as polynomials only in witness - * polynomials, i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree - * does not exceed the subrelation partial degree, which is given by LENGTH - 1 in this case. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - INVERSE_SUBREL_WITNESS_DEGREE, // inverse polynomial correctness subrelation (bus_idx 0) - LOOKUP_SUBREL_WITNESS_DEGREE, // log-derivative lookup argument subrelation (bus_idx 0) - INVERSE_SUBREL_WITNESS_DEGREE, // inverse polynomial correctness subrelation (bus_idx 1) - LOOKUP_SUBREL_WITNESS_DEGREE, // log-derivative lookup argument subrelation (bus_idx 1) - INVERSE_SUBREL_WITNESS_DEGREE, // inverse polynomial correctness subrelation (bus_idx 2) - LOOKUP_SUBREL_WITNESS_DEGREE // log-derivative lookup argument subrelation (bus_idx 2) - }; - static constexpr bool INVERSE_SUBREL_LIN_INDEPENDENT = true; // to be satisfied independently at each row static constexpr bool LOOKUP_SUBREL_LIN_INDEPENDENT = false; // to be satisfied as a sum across all rows diff --git a/barretenberg/cpp/src/barretenberg/relations/delta_range_constraint_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/delta_range_constraint_relation.hpp index f8153988724..c34b933cb61 100644 --- a/barretenberg/cpp/src/barretenberg/relations/delta_range_constraint_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/delta_range_constraint_relation.hpp @@ -13,17 +13,6 @@ template class DeltaRangeConstraintRelationImpl { 6, // range constrain sub-relation 3 6 // range constrain sub-relation 4 }; - /** - * @brief For ZK-Flavors: The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 3, // range constrain sub-relation 1 - 3, // range constrain sub-relation 2 - 3, // range constrain sub-relation 3 - 3 // range constrain sub-relation 4 - }; /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_op_queue_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_op_queue_relation.hpp index 355efe8476e..535f7ca6722 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_op_queue_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_op_queue_relation.hpp @@ -17,21 +17,6 @@ template class EccOpQueueRelationImpl { 3, // op-queue-wire vanishes sub-relation 3 3 // op-queue-wire vanishes sub-relation 4 }; - /** - * @brief For ZK-Flavors: The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 1, // wire - op-queue-wire consistency sub-relation 1 - 1, // wire - op-queue-wire consistency sub-relation 2 - 1, // wire - op-queue-wire consistency sub-relation 3 - 1, // wire - op-queue-wire consistency sub-relation 4 - 1, // op-queue-wire vanishes sub-relation 1 - 1, // op-queue-wire vanishes sub-relation 2 - 1, // op-queue-wire vanishes sub-relation 3 - 1 // op-queue-wire vanishes sub-relation 4 - }; template inline static bool skip([[maybe_unused]] const AllEntities& in) { diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_bools_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_bools_relation.hpp index 211aeb9a786..7d06fd12190 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_bools_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_bools_relation.hpp @@ -20,18 +20,6 @@ template class ECCVMBoolsRelationImpl { static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, }; - /** - * @brief For ZK-Flavors: Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - }; - - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 5; template static void accumulate(ContainerOverSubrelations& accumulator, diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp index 04486374550..d0b3f9d2d8a 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_lookup_relation.hpp @@ -20,19 +20,6 @@ template class ECCVMLookupRelationImpl { LENGTH, // grand product construction sub-relation LENGTH // left-shiftable polynomial sub-relation }; - /** - * @brief For ZK-Flavors: Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - LENGTH - 1, // grand product construction sub-relation - LENGTH - 1 // left-shiftable polynomial sub-relation - }; - - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 17; static constexpr std::array SUBRELATION_LINEARLY_INDEPENDENT = { true, false }; diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.hpp index 22926ca59ec..0e2bcad6f40 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation.hpp @@ -40,16 +40,6 @@ template class ECCVMMSMRelationImpl { static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }; - /** - * @brief Upper bound on the degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }; - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 15; template static void accumulate(ContainerOverSubrelations& accumulator, diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.hpp index 213a29a0f27..43c4c4a0928 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_point_table_relation.hpp @@ -19,16 +19,8 @@ namespace bb { template class ECCVMPointTableRelationImpl { public: using FF = FF_; - static constexpr size_t ZK_RELATION_LENGTH = 11; static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ 6, 6, 6, 6, 6, 6 }; - /** - * @brief For ZK-Flavors: Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ 5, 5, 5, 5, 5, 5 }; template static void accumulate(ContainerOverSubrelations& accumulator, diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.hpp index d0e0ab35a23..1a5aff69369 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_set_relation.hpp @@ -16,19 +16,6 @@ template class ECCVMSetRelationImpl { 22, // grand product construction sub-relation 3 // left-shiftable polynomial sub-relation }; - /** - * @brief For ZK-Flavors: Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 21, // grand product construction sub-relation - 1 // left-shiftable polynomial sub-relation - }; - - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 43; template static Accumulator convert_to_wnaf(const auto& s0, const auto& s1) { diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.hpp index fcb9f73e48b..e46af5c69a3 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_transcript_relation.hpp @@ -33,18 +33,7 @@ template class ECCVMTranscriptRelationImpl { static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; - /** - * @brief Upper bound on the degrees of subrelations considered as polynomials only in -witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does -not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - }; - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 15; + template static void accumulate(ContainerOverSubrelations& accumulator, const AllEntities& in, diff --git a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp index f6e6c07b5bf..b47ddf5cc49 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_wnaf_relation.hpp @@ -38,18 +38,6 @@ template class ECCVMWnafRelationImpl { static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, }; - /** - * @brief For ZK-Flavors: Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - }; - - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 9; template static void accumulate(ContainerOverSubrelations& accumulator, diff --git a/barretenberg/cpp/src/barretenberg/relations/elliptic_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/elliptic_relation.hpp index aa2812ec139..3b7966ba860 100644 --- a/barretenberg/cpp/src/barretenberg/relations/elliptic_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/elliptic_relation.hpp @@ -13,15 +13,6 @@ template class EllipticRelationImpl { 6, // x-coordinate sub-relation 6, // y-coordinate sub-relation }; - /** - * @brief For ZK-Flavors: The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 3, // x-coordinate sub-relation - 3, // y-coordinate sub-relation (because of point doubling) - }; /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero diff --git a/barretenberg/cpp/src/barretenberg/relations/logderiv_lookup_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/logderiv_lookup_relation.hpp index 40699095590..46fbf47bbcb 100644 --- a/barretenberg/cpp/src/barretenberg/relations/logderiv_lookup_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/logderiv_lookup_relation.hpp @@ -22,15 +22,6 @@ template class LogDerivLookupRelationImpl { LENGTH, // inverse construction sub-relation LENGTH // log derivative lookup argument sub-relation }; - /** - * @brief For ZK-Flavors: The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 2, // inverse construction sub-relation - 3, // log derivative lookup argument sub-relation - }; // Note: the required correction for the second sub-relation is technically +1 but the two corrections must agree // due to the way the relation algebra is written so both are set to +2. diff --git a/barretenberg/cpp/src/barretenberg/relations/permutation_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/permutation_relation.hpp index 58438a3c03d..06aba09959e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/permutation_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/permutation_relation.hpp @@ -35,16 +35,6 @@ template class UltraPermutationRelationImpl { 0 // left-shiftable polynomial sub-relation }; - /** - * @brief For ZK-Flavors: The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 5, // grand product construction sub-relation - 1 // left-shiftable polynomial sub-relation - }; - /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero * diff --git a/barretenberg/cpp/src/barretenberg/relations/poseidon2_external_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/poseidon2_external_relation.hpp index 9bd988d273f..fadd4a46b8e 100644 --- a/barretenberg/cpp/src/barretenberg/relations/poseidon2_external_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/poseidon2_external_relation.hpp @@ -12,17 +12,6 @@ template class Poseidon2ExternalRelationImpl { 7, // external poseidon2 round sub-relation for third value 7, // external poseidon2 round sub-relation for fourth value }; - /** - * @brief For ZK-Flavors: The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 5, // external poseidon2 round sub-relation for first value - 5, // external poseidon2 round sub-relation for second value - 5, // external poseidon2 round sub-relation for third value - 5, // external poseidon2 round sub-relation for fourth value - }; /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero diff --git a/barretenberg/cpp/src/barretenberg/relations/poseidon2_internal_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/poseidon2_internal_relation.hpp index 8f9d2ec7baa..11c866752d7 100644 --- a/barretenberg/cpp/src/barretenberg/relations/poseidon2_internal_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/poseidon2_internal_relation.hpp @@ -14,17 +14,6 @@ template class Poseidon2InternalRelationImpl { 7, // internal poseidon2 round sub-relation for third value 7, // internal poseidon2 round sub-relation for fourth value }; - /** - * @brief For ZK-Flavors: The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 5, // external poseidon2 round sub-relation for first value - 5, // external poseidon2 round sub-relation for second value - 5, // external poseidon2 round sub-relation for third value - 5, // external poseidon2 round sub-relation for fourth value - }; /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero diff --git a/barretenberg/cpp/src/barretenberg/relations/relation_types.hpp b/barretenberg/cpp/src/barretenberg/relations/relation_types.hpp index faf646505f7..d340223077d 100644 --- a/barretenberg/cpp/src/barretenberg/relations/relation_types.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/relation_types.hpp @@ -30,10 +30,6 @@ concept HasSubrelationLinearlyIndependentMember = requires(T) { template concept HasParameterLengthAdjustmentsMember = requires { T::TOTAL_LENGTH_ADJUSTMENTS; }; -// The concept needed to adjust the sumcheck univariate lengths in the case of ZK Flavors and to avoid adding redundant -// constants to the relations that are not used by ZK flavors -template -concept HasWitnessDegrees = requires { T::SUBRELATION_WITNESS_DEGREES; }; /** * @brief Check whether a given subrelation is linearly independent from the other subrelations. @@ -70,27 +66,6 @@ consteval std::array c return RelationImpl::SUBRELATION_PARTIAL_LENGTHS; } }; -/** - * @brief This metod adjusts the subrelation partial lengths to ZK Flavors. - * - * @tparam RelationImpl - * @return consteval - */ -template -consteval std::array compute_zk_partial_subrelation_lengths() -{ - if constexpr (HasWitnessDegrees) { - constexpr size_t NUM_SUBRELATIONS = RelationImpl::SUBRELATION_PARTIAL_LENGTHS.size(); - std::array result; - for (size_t idx = 0; idx < NUM_SUBRELATIONS; idx++) { - result[idx] = - RelationImpl::SUBRELATION_PARTIAL_LENGTHS[idx] + RelationImpl::SUBRELATION_WITNESS_DEGREES[idx]; - } - return result; - } else { - return RelationImpl::SUBRELATION_PARTIAL_LENGTHS; - } -}; /** * @brief Get the subrelation accumulators for the Protogalaxy combiner calculation. @@ -164,18 +139,12 @@ template class Relation : public RelationImpl { static constexpr std::array SUBRELATION_TOTAL_LENGTHS = compute_total_subrelation_lengths(); - // Compute the subrelation partial lengths adjusted to ZK - static constexpr std::array ZK_PARTIAL_LENGTHS = - compute_zk_partial_subrelation_lengths(); static constexpr size_t RELATION_LENGTH = *std::max_element(RelationImpl::SUBRELATION_PARTIAL_LENGTHS.begin(), RelationImpl::SUBRELATION_PARTIAL_LENGTHS.end()); static constexpr size_t TOTAL_RELATION_LENGTH = *std::max_element(SUBRELATION_TOTAL_LENGTHS.begin(), SUBRELATION_TOTAL_LENGTHS.end()); - // Determine the maximum subrelation length in the case if ZK Flavors - static constexpr size_t ZK_TOTAL_RELATION_LENGTH = - *std::max_element(ZK_PARTIAL_LENGTHS.begin(), ZK_PARTIAL_LENGTHS.end()); template using ProtogalaxyTupleOfUnivariatesOverSubrelationsNoOptimisticSkipping = @@ -188,9 +157,6 @@ template class Relation : public RelationImpl { NUM_KEYS - 1>; using SumcheckTupleOfUnivariatesOverSubrelations = TupleOfUnivariates; - // The container constructor for sumcheck univariates corresponding to each subrelation in ZK Flavor's relations - using ZKSumcheckTupleOfUnivariatesOverSubrelations = - TupleOfUnivariates()>; using SumcheckArrayOfValuesOverSubrelations = ArrayOfValues; diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.hpp index d71ef18f80f..a5f4956edbc 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_decomposition_relation.hpp @@ -61,65 +61,7 @@ template class TranslatorDecompositionRelationImpl { 3, // decomposition of z1 into 2 limbs subrelation 3 // decomposition of z2 into 2 limbs subrelation }; - /** - * @brief Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 2, // decomposition of P.x limb 0 into microlimbs subrelation - 2, // decomposition of P.x limb 1 into microlimbs subrelation - 2, // decomposition of P.x limb 2 into microlimbs subrelation - 2, // decomposition of P.x limb 3 into microlimbs subrelation - 2, // decomposition of P.y limb 0 into microlimbs subrelation - 2, // decomposition of P.y limb 1 into microlimbs subrelation - 2, // decomposition of P.y limb 2 into microlimbs subrelation - 2, // decomposition of P.y limb 3 into microlimbs subrelation - 2, // decomposition of z1 limb 0 into microlimbs subrelation - 2, // decomposition of z2 limb 0 into microlimbs subrelation - 2, // decomposition of z1 limb 1 into microlimbs subrelation - 2, // decomposition of z2 limb 1 into microlimbs subrelation - 2, // decomposition of accumulator limb 0 into microlimbs subrelation - 2, // decomposition of accumulator limb 1 into microlimbs subrelation - 2, // decomposition of accumulator limb 2 into microlimbs subrelation - 2, // decomposition of accumulator limb 3 into microlimbs subrelation - 2, // decomposition of quotient limb 0 into microlimbs subrelation - 2, // decomposition of quotient limb 1 into microlimbs subrelation - 2, // decomposition of quotient limb 2 into microlimbs subrelation - 2, // decomposition of quotient limb 3 into microlimbs subrelation - 2, // decomposition of low relation wide limb into microlimbs subrelation - 2, // decomposition of high relation wide limb into microlimbs subrelation - 2, // stricter constraint on highest microlimb of P.x limb 0 subrelation - 2, // stricter constraint on highest microlimb of P.x limb 1 subrelation - 2, // stricter constraint on highest microlimb of P.x limb 2 subrelation - 2, // stricter constraint on highest microlimb of P.x limb 3 subrelation - 2, // stricter constraint on highest microlimb of P.y limb 0 subrelation - 2, // stricter constraint on highest microlimb of P.y limb 1 subrelation - 2, // stricter constraint on highest microlimb of P.y limb 2 subrelation - 2, // stricter constraint on highest microlimb of P.y limb 3 subrelation - 2, // stricter constraint on highest microlimb of z1 limb 0 subrelation - 2, // stricter constraint on highest microlimb of z2 limb 0 subrelation - 2, // stricter constraint on highest microlimb of z1 limb 1 subrelation - 2, // stricter constraint on highest microlimb of z2 limb 1 subrelation - 2, // stricter constraint on highest microlimb of accumulator limb 0 subrelation - 2, // stricter constraint on highest microlimb of accumulator limb 1 subrelation - 2, // stricter constraint on highest microlimb of accumulator limb 2 subrelation - 2, // stricter constraint on highest microlimb of accumulator limb 3 subrelation - 2, // stricter constraint on highest microlimb of quotient limb 0 subrelation - 2, // stricter constraint on highest microlimb of quotient limb 1 subrelation - 2, // stricter constraint on highest microlimb of quotient limb 2 subrelation - 2, // stricter constraint on highest microlimb of quotient limb 3 subrelation - 2, // decomposition of x_lo into 2 limbs subrelation - 2, // decomposition of x_hi into 2 limbs subrelation - 2, // decomposition of y_lo into 2 limbs subrelation - 2, // decomposition of y_hi into 2 limbs subrelation - 2, // decomposition of z1 into 2 limbs subrelation - 2 // decomposition of z2 into 2 limbs subrelation - }; - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 5; /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero * diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp index 448e95ca085..1515598dc88 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_delta_range_constraint_relation.hpp @@ -23,28 +23,6 @@ template class TranslatorDeltaRangeConstraintRelationImpl { 3 // ordered_range_constraints_4 ends with defined maximum value subrelation }; - /** - * @brief Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 5, // ordered_range_constraints_0 step in {0,1,2,3} subrelation - 5, // ordered_range_constraints_1 step in {0,1,2,3} subrelation - 5, // ordered_range_constraints_2 step in {0,1,2,3} subrelation - 5, // ordered_range_constraints_3 step in {0,1,2,3} subrelation - 5, // ordered_range_constraints_4 step in {0,1,2,3} subrelation - 2, // ordered_range_constraints_0 ends with defined maximum value subrelation - 2, // ordered_range_constraints_1 ends with defined maximum value subrelation - 2, // ordered_range_constraints_2 ends with defined maximum value subrelation - 2, // ordered_range_constraints_3 ends with defined maximum value subrelation - 2 // ordered_range_constraints_4 ends with defined maximum value subrelation - - }; - - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 11; /** * @brief Expression for the generalized permutation sort relation diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.hpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.hpp index d114a4cabd8..7692d7133fd 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_extra_relations.hpp @@ -12,17 +12,7 @@ template class TranslatorOpcodeConstraintRelationImpl { static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ 7 // opcode constraint relation }; - /** - * @brief Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 6 // opcode constraint relation - }; - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 13; + /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero * @@ -49,7 +39,6 @@ polynomials, template class TranslatorAccumulatorTransferRelationImpl { public: using FF = FF_; - static constexpr size_t ZK_RELATION_LENGTH = 5; // 1 + polynomial degree of this relation static constexpr size_t RELATION_LENGTH = 3; // degree((SOME_LAGRANGE)(A-B)) = 2 @@ -68,27 +57,7 @@ template class TranslatorAccumulatorTransferRelationImpl { 3 // accumulator limb 3 is equal to given result at the end of accumulation subrelation }; - /** - * @brief For ZK-Flavors: Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 2, // transfer accumulator limb 0 at even index subrelation - 2, // transfer accumulator limb 1 at even index subrelation - 2, // transfer accumulator limb 2 at even index subrelation - 2, // transfer accumulator limb 3 at even index subrelation - 2, // accumulator limb 0 is zero at the start of accumulation subrelation - 2, // accumulator limb 1 is zero at the start of accumulation subrelation - 2, // accumulator limb 2 is zero at the start of accumulation subrelation - 2, // accumulator limb 3 is zero at the start of accumulation subrelation - 2, // accumulator limb 0 is equal to given result at the end of accumulation subrelation - 2, // accumulator limb 1 is equal to given result at the end of accumulation subrelation - 2, // accumulator limb 2 is equal to given result at the end of accumulation subrelation - 2 // accumulator limb 3 is equal to given result at the end of accumulation subrelation - }; /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero * @@ -129,7 +98,6 @@ template class TranslatorZeroConstraintsRelationImpl { // 1 + polynomial degree of this relation static constexpr size_t RELATION_LENGTH = 3; // degree((some lagrange)(A)) = 2 - static constexpr size_t ZK_RELATION_LENGTH = 5; static constexpr std::array SUBRELATION_PARTIAL_LENGTHS{ 3, // p_x_low_limbs_range_constraint_0 is zero outside of the minicircuit 3, // p_x_low_limbs_range_constraint_1 is zero outside of the minicircuit @@ -197,79 +165,7 @@ template class TranslatorZeroConstraintsRelationImpl { 3, // quotient_high_limbs_range_constraint_tail is zero outside of the minicircuit }; - /** - * @brief For ZK-Flavors: Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 2, // p_x_low_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // p_x_low_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // p_x_low_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // p_x_low_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // p_x_low_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // p_x_high_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // p_x_high_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // p_x_high_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // p_x_high_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // p_x_high_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // p_y_low_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // p_y_low_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // p_y_low_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // p_y_low_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // p_y_low_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // p_y_high_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // p_y_high_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // p_y_high_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // p_y_high_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // p_y_high_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // z_low_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // z_low_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // z_low_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // z_low_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // z_low_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // z_high_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // z_high_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // z_high_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // z_high_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // z_high_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // accumulator_low_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // accumulator_low_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // accumulator_low_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // accumulator_low_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // accumulator_low_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // accumulator_high_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // accumulator_high_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // accumulator_high_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // accumulator_high_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // accumulator_high_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // quotient_low_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // quotient_low_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // quotient_low_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // quotient_low_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // quotient_low_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // quotient_high_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // quotient_high_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // quotient_high_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // quotient_high_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // quotient_high_limbs_range_constraint_4 is zero outside of the minicircuit - 2, // relation_wide_limbs_range_constraint_0 is zero outside of the minicircuit - 2, // relation_wide_limbs_range_constraint_1 is zero outside of the minicircuit - 2, // relation_wide_limbs_range_constraint_2 is zero outside of the minicircuit - 2, // relation_wide_limbs_range_constraint_3 is zero outside of the minicircuit - 2, // p_x_low_limbs_range_constraint_tail is zero outside of the minicircuit - 2, // p_x_high_limbs_range_constraint_tail is zero outside of the minicircuit - 2, // p_y_low_limbs_range_constraint_tail is zero outside of the minicircuit - 2, // p_y_high_limbs_range_constraint_tail is zero outside of the minicircuit - 2, // z_low_limbs_range_constraint_tail is zero outside of the minicircuit - 2, // z_high_limbs_range_constraint_tail is zero outside of the minicircuit - 2, // accumulator_low_limbs_range_constraint_tail is zero outside of the minicircuit - 2, // accumulator_high_limbs_range_constraint_tail is zero outside of the minicircuit - 2, // quotient_low_limbs_range_constraint_tail is zero outside of the minicircuit - 2, // quotient_high_limbs_range_constraint_tail is zero outside of the minicircuit - }; /** * @brief Might return true if the contribution from all subrelations for the provided inputs is identically zero * diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.hpp index 468a5c3ae08..b94fa346e97 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_non_native_field_relation.hpp @@ -14,19 +14,7 @@ template class TranslatorNonNativeFieldRelationImpl { 3, // Higher wide limb subrelation (checks result is 0 in higher mod 2¹³⁶), 3 // Prime subrelation (checks result in native field) }; - /** - * @brief Upper bound on the degrees of subrelations considered as polynomials only in witness -polynomials, - * i.e. all selectors and public polynomials are treated as constants. The subrelation witness degree does not - * exceed the subrelation partial degree given by SUBRELATION_PARTIAL_LENGTH - 1. - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 2, // Lower wide limb subrelation (checks result is 0 mod 2¹³⁶) - 2, // Higher wide limb subrelation (checks result is 0 in higher mod 2¹³⁶), - 2 // Prime subrelation (checks result in native field) - }; - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 5; + /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero * diff --git a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.hpp index 5279ca98d12..b5b6f276ab5 100644 --- a/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/translator_vm/translator_permutation_relation.hpp @@ -13,17 +13,7 @@ template class TranslatorPermutationRelationImpl { 7, // grand product construction sub-relation 3 // left-shiftable polynomial sub-relation }; - /** - * @brief The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ - 6, // grand product construction sub-relation - 1 // left-shiftable polynomial sub-relation - }; - // Max among {SUBRELATION_PARTIAL_LENGTH + SUBRELATION_WITNESS_DEGREE} - static constexpr size_t ZK_RELATION_LENGTH = 13; + inline static auto& get_grand_product_polynomial(auto& in) { return in.z_perm; } inline static auto& get_shifted_grand_product_polynomial(auto& in) { return in.z_perm_shift; } diff --git a/barretenberg/cpp/src/barretenberg/relations/ultra_arithmetic_relation.hpp b/barretenberg/cpp/src/barretenberg/relations/ultra_arithmetic_relation.hpp index dfb74d3a512..efa18235246 100644 --- a/barretenberg/cpp/src/barretenberg/relations/ultra_arithmetic_relation.hpp +++ b/barretenberg/cpp/src/barretenberg/relations/ultra_arithmetic_relation.hpp @@ -12,13 +12,6 @@ template class UltraArithmeticRelationImpl { 5 // secondary arithmetic sub-relation }; - /** - * @brief For ZK-Flavors: The degrees of subrelations considered as polynomials only in witness polynomials, - * i.e. all selectors and public polynomials are treated as constants. - * - */ - static constexpr std::array SUBRELATION_WITNESS_DEGREES{ 2, 2 }; - /** * @brief Returns true if the contribution from all subrelations for the provided inputs is identically zero * diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp index 1bf82af322a..f3162aa4f4f 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp @@ -78,8 +78,6 @@ class MegaFlavor { // length = 3 static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH = MAX_PARTIAL_RELATION_LENGTH + 1; static constexpr size_t NUM_RELATIONS = std::tuple_size_v; - // The total number of witnesses including shifts and derived entities. - static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_WITNESSES; // For instances of this flavour, used in folding, we need a unique sumcheck batching challenges for each // subrelation. This is because using powers of alpha would increase the degree of Protogalaxy polynomial $G$ (the diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp index 2ed5aa7003a..85d817eea2b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp @@ -60,9 +60,6 @@ class UltraFlavor { static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS = RepeatedCommitmentsData( NUM_PRECOMPUTED_ENTITIES, NUM_PRECOMPUTED_ENTITIES + NUM_WITNESS_ENTITIES, NUM_SHIFTED_WITNESSES); - // The total number of witnesses including shifts and derived entities. - static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_WITNESSES; - // define the tuple of Relations that comprise the Sumcheck relation // Note: made generic for use in MegaRecursive. template diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak_zk_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak_zk_flavor.hpp index b461e64698c..22695ea3a0f 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak_zk_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak_zk_flavor.hpp @@ -4,18 +4,6 @@ namespace bb { -/*! -\brief Child class of UltraFlavor that runs with ZK Sumcheck. -\details -Most of the properties of UltraFlavor are -inherited without any changes, except for the MAX_PARTIAL_RELATION_LENGTH which is now computed as a maximum of -SUBRELATION_PARTIAL_LENGTHS incremented by the corresponding SUBRELATION_WITNESS_DEGREES over all relations included in -UltraFlavor, which also affects the size of ExtendedEdges univariate containers. -Moreover, the container SumcheckTupleOfTuplesOfUnivariates is resized to reflect that masked -witness polynomials are of degree at most \f$2\f$ in each variable, and hence, for any subrelation, the corresponding -univariate accumuluator size has to be increased by the subrelation's witness degree. See more in -\ref docs/src/sumcheck-outline.md "Sumcheck Outline". -*/ class UltraKeccakZKFlavor : public UltraKeccakFlavor { public: // This flavor runs with ZK Sumcheck diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_zk_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_zk_flavor.hpp index 31e3c830578..c5b10e22e7b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_zk_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_zk_flavor.hpp @@ -7,14 +7,11 @@ namespace bb { /*! \brief Child class of UltraFlavor that runs with ZK Sumcheck. \details -Most of the properties of UltraFlavor are -inherited without any changes, except for the MAX_PARTIAL_RELATION_LENGTH which is now computed as a maximum of -SUBRELATION_PARTIAL_LENGTHS incremented by the corresponding SUBRELATION_WITNESS_DEGREES over all relations included in -UltraFlavor, which also affects the size of ExtendedEdges univariate containers. -Moreover, the container SumcheckTupleOfTuplesOfUnivariates is resized to reflect that masked -witness polynomials are of degree at most \f$2\f$ in each variable, and hence, for any subrelation, the corresponding -univariate accumuluator size has to be increased by the subrelation's witness degree. See more in -\ref docs/src/sumcheck-outline.md "Sumcheck Outline". +Most of the properties of UltraFlavor are inherited without any changes. However, the BATCHED_RELATION_PARTIAL_LENGTH is +incremented by 1, as we are using the sumcheck with disabled rows, where the main Honk relation is multiplied by a sum +of multilinear Lagranges. Additionally, the transcript contains extra elements, such as commitments and evaluations of +Libra polynomials used in Sumcheck to make it ZK, as well as a commitment and an evaluation of a hiding polynomials that +turns the PCS stage ZK. */ class UltraZKFlavor : public UltraFlavor { public: diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp index 2dd0f7a249f..02c9620009f 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp @@ -83,8 +83,6 @@ class TranslatorFlavor { static constexpr size_t NUM_PRECOMPUTED_ENTITIES = 7; // The total number of witness entities not including shifts. static constexpr size_t NUM_WITNESS_ENTITIES = 91; - // The total number of witnesses including shifts and derived entities. - static constexpr size_t NUM_ALL_WITNESS_ENTITIES = 177; static constexpr size_t NUM_WIRES_NON_SHIFTED = 1; static constexpr size_t NUM_SHIFTED_WITNESSES = 86; static constexpr size_t NUM_CONCATENATED = NUM_CONCATENATED_WIRES * CONCATENATION_GROUP_SIZE; diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index 0f9307bfd12..d8beb9b415c 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -97,8 +97,6 @@ class AvmFlavor { // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for // the unshifted and one for the shifted static constexpr size_t NUM_ALL_ENTITIES = 813; - // The total number of witnesses including shifts and derived entities. - static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; // Need to be templated for recursive verifier template diff --git a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor.hpp index b74d954b275..243de435825 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/generated/flavor.hpp @@ -82,8 +82,6 @@ class AvmFlavor { // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for // the unshifted and one for the shifted static constexpr size_t NUM_ALL_ENTITIES = 466; - // The total number of witnesses including shifts and derived entities. - static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; // Need to be templated for recursive verifier template diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs index cd6287ae75a..41478a97888 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs @@ -73,8 +73,6 @@ class AvmFlavor { static constexpr size_t NUM_WIRES = NUM_WITNESS_ENTITIES + NUM_PRECOMPUTED_ENTITIES; // We have two copies of the witness entities, so we subtract the number of fixed ones (they have no shift), one for the unshifted and one for the shifted static constexpr size_t NUM_ALL_ENTITIES = {{len all_cols_and_shifts}}; - // The total number of witnesses including shifts and derived entities. - static constexpr size_t NUM_ALL_WITNESS_ENTITIES = NUM_WITNESS_ENTITIES + NUM_SHIFTED_ENTITIES; // Need to be templated for recursive verifier template