From ce192f0804d1d00ecf800198a4a5fda5a364a502 Mon Sep 17 00:00:00 2001 From: David Banks <47112877+dbanks12@users.noreply.github.com> Date: Thu, 16 May 2024 13:56:31 -0400 Subject: [PATCH] chore: lower max public bytecode to 20k (#6477) --- .../cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp | 6 +++--- l1-contracts/src/core/libraries/ConstantsGen.sol | 2 +- .../noir-protocol-circuits/crates/types/src/constants.nr | 2 +- yarn-project/circuits.js/src/constants.gen.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp b/barretenberg/cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp index c56cc0dfc54..0a1ad1a01c2 100644 --- a/barretenberg/cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp +++ b/barretenberg/cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp @@ -13,7 +13,7 @@ const size_t MAX_PUBLIC_DATA_READS_PER_CALL = 16; const size_t MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 32; const size_t MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 2; const size_t MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL = 2; -const size_t MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL = 1; +const size_t MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL = 16; const size_t MAX_NOTE_ENCRYPTED_LOGS_PER_CALL = 16; const size_t MAX_ENCRYPTED_LOGS_PER_CALL = 4; const size_t MAX_UNENCRYPTED_LOGS_PER_CALL = 4; @@ -27,7 +27,7 @@ const size_t MAX_NEW_L2_TO_L1_MSGS_PER_TX = 2; const size_t MAX_NOTE_HASH_READ_REQUESTS_PER_TX = 128; const size_t MAX_NULLIFIER_READ_REQUESTS_PER_TX = 8; const size_t MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 8; -const size_t MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX = 4; +const size_t MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX = 64; const size_t MAX_NOTE_ENCRYPTED_LOGS_PER_TX = 64; const size_t MAX_ENCRYPTED_LOGS_PER_TX = 8; const size_t MAX_UNENCRYPTED_LOGS_PER_TX = 8; @@ -64,7 +64,7 @@ const size_t MAX_ARGS_LENGTH = ARGS_HASH_CHUNK_COUNT * ARGS_HASH_CHUNK_LENGTH; const size_t INITIAL_L2_BLOCK_NUM = 1; const size_t BLOB_SIZE_IN_BYTES = 31 * 4096; const size_t NESTED_CALL_L2_GAS_BUFFER = 20000; -const size_t MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 32000; +const size_t MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 20000; const size_t MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS = 3000; const size_t MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS = 3000; const size_t REGISTERER_PRIVATE_FUNCTION_BROADCASTED_ADDITIONAL_FIELDS = 19; diff --git a/l1-contracts/src/core/libraries/ConstantsGen.sol b/l1-contracts/src/core/libraries/ConstantsGen.sol index 4aeefe97ccc..1ae61e2cbec 100644 --- a/l1-contracts/src/core/libraries/ConstantsGen.sol +++ b/l1-contracts/src/core/libraries/ConstantsGen.sol @@ -77,7 +77,7 @@ library Constants { uint256 internal constant INITIAL_L2_BLOCK_NUM = 1; uint256 internal constant BLOB_SIZE_IN_BYTES = 31 * 4096; uint256 internal constant NESTED_CALL_L2_GAS_BUFFER = 20000; - uint256 internal constant MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 32000; + uint256 internal constant MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 20000; uint256 internal constant MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS = 3000; uint256 internal constant MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS = 3000; uint256 internal constant REGISTERER_PRIVATE_FUNCTION_BROADCASTED_ADDITIONAL_FIELDS = 19; 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 a39b851d223..bd8748c2b4e 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/constants.nr @@ -106,7 +106,7 @@ global BLOB_SIZE_IN_BYTES: Field = 31 * 4096; global NESTED_CALL_L2_GAS_BUFFER = 20000; // CONTRACT CLASS CONSTANTS -global MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS: u64 = 32000; +global MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS: u64 = 20000; // Bytecode size for private functions is per function, not for the entire contract. // Note that private functions bytecode includes a mix of acir and brillig. global MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS: u64 = 3000; diff --git a/yarn-project/circuits.js/src/constants.gen.ts b/yarn-project/circuits.js/src/constants.gen.ts index 563f1b3cb40..f21806ca868 100644 --- a/yarn-project/circuits.js/src/constants.gen.ts +++ b/yarn-project/circuits.js/src/constants.gen.ts @@ -63,7 +63,7 @@ export const INITIALIZATION_SLOT_SEPARATOR = 1000_000_000; export const INITIAL_L2_BLOCK_NUM = 1; export const BLOB_SIZE_IN_BYTES = 31 * 4096; export const NESTED_CALL_L2_GAS_BUFFER = 20000; -export const MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 32000; +export const MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 20000; export const MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS = 3000; export const MAX_PACKED_BYTECODE_SIZE_PER_UNCONSTRAINED_FUNCTION_IN_FIELDS = 3000; export const REGISTERER_PRIVATE_FUNCTION_BROADCASTED_ADDITIONAL_FIELDS = 19;