Skip to content

Commit

Permalink
refactor: reduce note and nullifier constants
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Jul 1, 2024
1 parent 09eedf2 commit 6051624
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions barretenberg/cpp/pil/avm/constants.pil
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ namespace constants(256);
// Lengths of kernel output vectors
// (vectors in PublicCircuitPublicInputs to be processed by kernel)
// Read requests
pol MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 32;
pol MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 32;
pol MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 16;
pol MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 16;
pol MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL = 32;
pol MAX_PUBLIC_DATA_READS_PER_CALL = 32;
// Emitting Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#define MAX_NEW_L2_TO_L1_MSGS_PER_CALL 2
#define MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL 32
#define MAX_PUBLIC_DATA_READS_PER_CALL 32
#define MAX_NOTE_HASH_READ_REQUESTS_PER_CALL 32
#define MAX_NULLIFIER_READ_REQUESTS_PER_CALL 32
#define MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL 32
#define MAX_NOTE_HASH_READ_REQUESTS_PER_CALL 16
#define MAX_NULLIFIER_READ_REQUESTS_PER_CALL 16
#define MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL 16
#define MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL 16
#define MAX_UNENCRYPTED_LOGS_PER_CALL 4
#define AZTEC_ADDRESS_LENGTH 1
Expand All @@ -30,5 +30,5 @@
#define STATE_REFERENCE_LENGTH 8
#define TOTAL_FEES_LENGTH 1
#define HEADER_LENGTH 23
#define PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH 578
#define PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH 482
#define PUBLIC_CONTEXT_INPUTS_LENGTH 41
24 changes: 12 additions & 12 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ library Constants {
uint256 internal constant MAX_NEW_L2_TO_L1_MSGS_PER_CALL = 2;
uint256 internal constant MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL = 32;
uint256 internal constant MAX_PUBLIC_DATA_READS_PER_CALL = 32;
uint256 internal constant MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 32;
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 32;
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL = 32;
uint256 internal constant MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 16;
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 16;
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL = 16;
uint256 internal constant MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL = 16;
uint256 internal constant MAX_KEY_VALIDATION_REQUESTS_PER_CALL = 16;
uint256 internal constant MAX_NOTE_ENCRYPTED_LOGS_PER_CALL = 16;
Expand All @@ -39,9 +39,9 @@ library Constants {
uint256 internal constant MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = 64;
uint256 internal constant MAX_PUBLIC_DATA_READS_PER_TX = 64;
uint256 internal constant MAX_NEW_L2_TO_L1_MSGS_PER_TX = 8;
uint256 internal constant MAX_NOTE_HASH_READ_REQUESTS_PER_TX = 128;
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_TX = 128;
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 128;
uint256 internal constant MAX_NOTE_HASH_READ_REQUESTS_PER_TX = 64;
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_TX = 64;
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 64;
uint256 internal constant MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_TX = 64;
uint256 internal constant MAX_KEY_VALIDATION_REQUESTS_PER_TX = 64;
uint256 internal constant MAX_NOTE_ENCRYPTED_LOGS_PER_TX = 64;
Expand Down Expand Up @@ -149,22 +149,22 @@ library Constants {
uint256 internal constant TX_REQUEST_LENGTH = 13;
uint256 internal constant TOTAL_FEES_LENGTH = 1;
uint256 internal constant HEADER_LENGTH = 23;
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 457;
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 578;
uint256 internal constant PRIVATE_CALL_STACK_ITEM_LENGTH = 460;
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 393;
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 482;
uint256 internal constant PRIVATE_CALL_STACK_ITEM_LENGTH = 396;
uint256 internal constant PUBLIC_CONTEXT_INPUTS_LENGTH = 41;
uint256 internal constant AGGREGATION_OBJECT_LENGTH = 16;
uint256 internal constant SCOPED_READ_REQUEST_LEN = 3;
uint256 internal constant PUBLIC_DATA_READ_LENGTH = 2;
uint256 internal constant VALIDATION_REQUESTS_LENGTH = 1602;
uint256 internal constant VALIDATION_REQUESTS_LENGTH = 1026;
uint256 internal constant PUBLIC_DATA_UPDATE_REQUEST_LENGTH = 3;
uint256 internal constant COMBINED_ACCUMULATED_DATA_LENGTH = 333;
uint256 internal constant COMBINED_CONSTANT_DATA_LENGTH = 40;
uint256 internal constant CALL_REQUEST_LENGTH = 7;
uint256 internal constant PRIVATE_ACCUMULATED_DATA_LENGTH = 1152;
uint256 internal constant PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 2803;
uint256 internal constant PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 2227;
uint256 internal constant PUBLIC_ACCUMULATED_DATA_LENGTH = 983;
uint256 internal constant PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 3834;
uint256 internal constant PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 3258;
uint256 internal constant KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 383;
uint256 internal constant CONSTANT_ROLLUP_DATA_LENGTH = 14;
uint256 internal constant BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH = 31;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ global MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL: u32 = 16;
global MAX_NEW_L2_TO_L1_MSGS_PER_CALL: u32 = 2;
global MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL: u32 = 32;
global MAX_PUBLIC_DATA_READS_PER_CALL: u32 = 32;
global MAX_NOTE_HASH_READ_REQUESTS_PER_CALL: u32 = 32;
global MAX_NULLIFIER_READ_REQUESTS_PER_CALL: u32 = 32;
global MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL: u32 = 32;
global MAX_NOTE_HASH_READ_REQUESTS_PER_CALL: u32 = 16;
global MAX_NULLIFIER_READ_REQUESTS_PER_CALL: u32 = 16;
global MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL: u32 = 16;
global MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL: u32 = 16;
global MAX_KEY_VALIDATION_REQUESTS_PER_CALL: u32 = 16;
global MAX_NOTE_ENCRYPTED_LOGS_PER_CALL: u32 = 16;
Expand All @@ -53,9 +53,9 @@ global PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX: u32 = 1;
global MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX: u32 = 64; // MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX + PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX;
global MAX_PUBLIC_DATA_READS_PER_TX: u32 = 64;
global MAX_NEW_L2_TO_L1_MSGS_PER_TX: u32 = 8;
global MAX_NOTE_HASH_READ_REQUESTS_PER_TX: u32 = 128;
global MAX_NULLIFIER_READ_REQUESTS_PER_TX: u32 = 128;
global MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX: u32 = 128;
global MAX_NOTE_HASH_READ_REQUESTS_PER_TX: u32 = 64;
global MAX_NULLIFIER_READ_REQUESTS_PER_TX: u32 = 64;
global MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX: u32 = 64;
global MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_TX: u32 = 64;
// TODO: for large multisends we might run out of key validation requests here but not dealing with this now as
// databus will hopefully make the issue go away.
Expand All @@ -66,7 +66,7 @@ global MAX_UNENCRYPTED_LOGS_PER_TX: u32 = 8;
// docs:end:constants

// KERNEL CIRCUIT PRIVATE INPUTS CONSTANTS
// global MAX_PUBLIC_DATA_HINTS: u32 = MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX + MAX_PUBLIC_DATA_READS_PER_TX;
// global MAX_PUBLIC_DATA_HINTS: u32 = MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX + MAX_PUBLIC_DATA_READS_PER_TX;
// FIX: Sadly, writing this as above causes a type error in type_conversion.ts.
global MAX_PUBLIC_DATA_HINTS: u32 = 128;

Expand Down
24 changes: 12 additions & 12 deletions yarn-project/circuits.js/src/constants.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export const MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL = 16;
export const MAX_NEW_L2_TO_L1_MSGS_PER_CALL = 2;
export const MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL = 32;
export const MAX_PUBLIC_DATA_READS_PER_CALL = 32;
export const MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 32;
export const MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 32;
export const MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL = 32;
export const MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 16;
export const MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 16;
export const MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL = 16;
export const MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL = 16;
export const MAX_KEY_VALIDATION_REQUESTS_PER_CALL = 16;
export const MAX_NOTE_ENCRYPTED_LOGS_PER_CALL = 16;
Expand All @@ -25,9 +25,9 @@ export const PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = 1;
export const MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX = 64;
export const MAX_PUBLIC_DATA_READS_PER_TX = 64;
export const MAX_NEW_L2_TO_L1_MSGS_PER_TX = 8;
export const MAX_NOTE_HASH_READ_REQUESTS_PER_TX = 128;
export const MAX_NULLIFIER_READ_REQUESTS_PER_TX = 128;
export const MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 128;
export const MAX_NOTE_HASH_READ_REQUESTS_PER_TX = 64;
export const MAX_NULLIFIER_READ_REQUESTS_PER_TX = 64;
export const MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 64;
export const MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_TX = 64;
export const MAX_KEY_VALIDATION_REQUESTS_PER_TX = 64;
export const MAX_NOTE_ENCRYPTED_LOGS_PER_TX = 64;
Expand Down Expand Up @@ -133,22 +133,22 @@ export const TX_CONTEXT_LENGTH = 9;
export const TX_REQUEST_LENGTH = 13;
export const TOTAL_FEES_LENGTH = 1;
export const HEADER_LENGTH = 23;
export const PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 457;
export const PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 578;
export const PRIVATE_CALL_STACK_ITEM_LENGTH = 460;
export const PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 393;
export const PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 482;
export const PRIVATE_CALL_STACK_ITEM_LENGTH = 396;
export const PUBLIC_CONTEXT_INPUTS_LENGTH = 41;
export const AGGREGATION_OBJECT_LENGTH = 16;
export const SCOPED_READ_REQUEST_LEN = 3;
export const PUBLIC_DATA_READ_LENGTH = 2;
export const VALIDATION_REQUESTS_LENGTH = 1602;
export const VALIDATION_REQUESTS_LENGTH = 1026;
export const PUBLIC_DATA_UPDATE_REQUEST_LENGTH = 3;
export const COMBINED_ACCUMULATED_DATA_LENGTH = 333;
export const COMBINED_CONSTANT_DATA_LENGTH = 40;
export const CALL_REQUEST_LENGTH = 7;
export const PRIVATE_ACCUMULATED_DATA_LENGTH = 1152;
export const PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 2803;
export const PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 2227;
export const PUBLIC_ACCUMULATED_DATA_LENGTH = 983;
export const PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 3834;
export const PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 3258;
export const KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 383;
export const CONSTANT_ROLLUP_DATA_LENGTH = 14;
export const BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH = 31;
Expand Down

0 comments on commit 6051624

Please sign in to comment.