diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp index 2394a6ace34..a1ad1ae1e26 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp @@ -227,9 +227,13 @@ class AvmFlavor { static constexpr size_t NUM_FRS_COM = field_conversion::calc_num_bn254_frs(); static constexpr size_t NUM_FRS_FR = field_conversion::calc_num_bn254_frs(); - static_assert(AVM_PROOF_LENGTH_IN_FIELDS == - (NUM_WITNESS_ENTITIES + 2) * NUM_FRS_COM + (NUM_ALL_ENTITIES + 1) * NUM_FRS_FR + - CONST_PROOF_SIZE_LOG_N * (NUM_FRS_COM + NUM_FRS_FR * BATCHED_RELATION_PARTIAL_LENGTH), + // After any circuit changes, hover `COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS` in your IDE + // to see its value and then update `AVM_PROOF_LENGTH_IN_FIELDS` in constants.nr. + static constexpr size_t COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS = + (NUM_WITNESS_ENTITIES + 2) * NUM_FRS_COM + (NUM_ALL_ENTITIES + 1) * NUM_FRS_FR + + CONST_PROOF_SIZE_LOG_N * (NUM_FRS_COM + NUM_FRS_FR * BATCHED_RELATION_PARTIAL_LENGTH); + + static_assert(AVM_PROOF_LENGTH_IN_FIELDS == COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS, "\nUnexpected AVM proof length. This might be due to some changes in the\n" "AVM circuit layout. In this case, modify AVM_PROOF_LENGTH_IN_FIELDS \n" "in constants.nr accordingly."); diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp index e96b9ed2408..266fca913ec 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/relations/alu.hpp @@ -21,6 +21,7 @@ template class aluImpl { [[maybe_unused]] const RelationParameters&, [[maybe_unused]] const FF& scaling_factor) { + const auto constants_MEM_TAG_U1 = FF(1); const auto constants_MEM_TAG_U8 = FF(2); const auto constants_MEM_TAG_U16 = FF(3); const auto constants_MEM_TAG_U32 = FF(4); @@ -123,12 +124,13 @@ template class aluImpl { { using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>; auto tmp = - (new_term.alu_in_tag - ((((((new_term.alu_u1_tag + (constants_MEM_TAG_U8 * new_term.alu_u8_tag)) + - (constants_MEM_TAG_U16 * new_term.alu_u16_tag)) + - (constants_MEM_TAG_U32 * new_term.alu_u32_tag)) + - (constants_MEM_TAG_U64 * new_term.alu_u64_tag)) + - (constants_MEM_TAG_U128 * new_term.alu_u128_tag)) + - (constants_MEM_TAG_FF * new_term.alu_ff_tag))); + (new_term.alu_in_tag - + (((((((constants_MEM_TAG_U1 * new_term.alu_u1_tag) + (constants_MEM_TAG_U8 * new_term.alu_u8_tag)) + + (constants_MEM_TAG_U16 * new_term.alu_u16_tag)) + + (constants_MEM_TAG_U32 * new_term.alu_u32_tag)) + + (constants_MEM_TAG_U64 * new_term.alu_u64_tag)) + + (constants_MEM_TAG_U128 * new_term.alu_u128_tag)) + + (constants_MEM_TAG_FF * new_term.alu_ff_tag))); tmp *= scaling_factor; std::get<9>(evals) += typename Accumulator::View(tmp); } diff --git a/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp b/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp index e2f56615a2d..34cd685ff47 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm/generated/verifier.cpp @@ -144,7 +144,6 @@ bool AvmVerifier::verify_proof(const HonkProof& proof, // Execute ZeroMorph rounds. See https://hackmd.io/dlf9xEwhTQyE3hiGbq4FsA?view for a complete description of the // unrolled protocol. - auto opening_claim = ZeroMorph::verify(circuit_size, commitments.get_unshifted(), commitments.get_to_be_shifted(), diff --git a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp index 12044ddd711..fa46aa6be38 100644 --- a/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/aztec_constants.hpp @@ -34,7 +34,7 @@ #define PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH 691 #define PUBLIC_CONTEXT_INPUTS_LENGTH 42 #define AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS 66 -#define AVM_PROOF_LENGTH_IN_FIELDS 3802 +#define AVM_PROOF_LENGTH_IN_FIELDS 3812 #define MEM_TAG_U1 1 #define MEM_TAG_U8 2 #define MEM_TAG_U16 3 diff --git a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs index 69d22c1dcc3..b14c281ae4b 100644 --- a/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs +++ b/bb-pilcom/bb-pil-backend/templates/flavor.hpp.hbs @@ -106,9 +106,13 @@ class {{name}}Flavor { static constexpr size_t NUM_FRS_COM = field_conversion::calc_num_bn254_frs(); static constexpr size_t NUM_FRS_FR = field_conversion::calc_num_bn254_frs(); - static_assert(AVM_PROOF_LENGTH_IN_FIELDS == - (NUM_WITNESS_ENTITIES + 2) * NUM_FRS_COM + (NUM_ALL_ENTITIES + 1) * NUM_FRS_FR + - CONST_PROOF_SIZE_LOG_N * (NUM_FRS_COM + NUM_FRS_FR * BATCHED_RELATION_PARTIAL_LENGTH), + // After any circuit changes, hover `COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS` in your IDE + // to see its value and then update `AVM_PROOF_LENGTH_IN_FIELDS` in constants.nr. + static constexpr size_t COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS = + (NUM_WITNESS_ENTITIES + 2) * NUM_FRS_COM + (NUM_ALL_ENTITIES + 1) * NUM_FRS_FR + + CONST_PROOF_SIZE_LOG_N * (NUM_FRS_COM + NUM_FRS_FR * BATCHED_RELATION_PARTIAL_LENGTH); + + static_assert(AVM_PROOF_LENGTH_IN_FIELDS == COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS, "\nUnexpected AVM proof length. This might be due to some changes in the\n" "AVM circuit layout. In this case, modify AVM_PROOF_LENGTH_IN_FIELDS \n" "in constants.nr accordingly."); diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index 00b0c35db4f..de90972406b 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -130,8 +130,6 @@ library Constants { uint256 internal constant L2_GAS_PER_LOG_BYTE = 4; uint256 internal constant L2_GAS_PER_NOTE_HASH = 32; uint256 internal constant L2_GAS_PER_NULLIFIER = 64; - uint256 internal constant CANONICAL_KEY_REGISTRY_ADDRESS = - 6823425185167517386380694778823032861295161686691976789058601691508103815523; uint256 internal constant CANONICAL_AUTH_REGISTRY_ADDRESS = 19361441716519463065948254497947932755739298943049449145365332870925554042208; uint256 internal constant DEPLOYER_CONTRACT_ADDRESS = diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr index 64bfb79730e..bf12d310027 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -291,7 +291,10 @@ global VERIFICATION_KEY_LENGTH_IN_FIELDS = 128; // The length is 2 + AvmFlavor::NUM_PRECOMPUTED_ENTITIES * 4 global AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS = 2 + 16 * 4; -global AVM_PROOF_LENGTH_IN_FIELDS = 3802; +// `AVM_PROOF_LENGTH_IN_FIELDS` must be updated when AVM circuit changes. +// To determine latest value, hover `COMPUTED_AVM_PROOF_LENGTH_IN_FIELDS` +// in barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp +global AVM_PROOF_LENGTH_IN_FIELDS = 3812; /** * Enumerate the hash_indices which are used for pedersen hashing. * We start from 1 to avoid the default generators. The generator indices are listed diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index f3b2c7a8162..cd29259bb60 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -200,7 +200,7 @@ export const NESTED_RECURSIVE_PROOF_LENGTH = 439; export const TUBE_PROOF_LENGTH = 439; export const VERIFICATION_KEY_LENGTH_IN_FIELDS = 128; export const AVM_VERIFICATION_KEY_LENGTH_IN_FIELDS = 66; -export const AVM_PROOF_LENGTH_IN_FIELDS = 3802; +export const AVM_PROOF_LENGTH_IN_FIELDS = 3812; export const MEM_TAG_U1 = 1; export const MEM_TAG_U8 = 2; export const MEM_TAG_U16 = 3;