Skip to content

Commit

Permalink
feat: zip and propagate private logs (#10210)
Browse files Browse the repository at this point in the history
- Merge `note_encrypted_logs` and `encrypted_logs` into `private_logs`.
- Propagate the fixed-size data of private logs instead of their hashes.
- We don't have to re-hash the logs everywhere to check that they match
the hashes in the public inputs anymore.
  - Change to L2 gas for private logs to be 0 because of the above.
- Private reset kernel circuit silos contract address to the first field
of private logs.
- Which allows us to remove `randomness` and masked address for non-note
logs.

---------

Co-authored-by: Nicolás Venturo <[email protected]>
  • Loading branch information
LeilaWang and nventuro authored Nov 29, 2024
1 parent 849fb94 commit 5c32747
Show file tree
Hide file tree
Showing 201 changed files with 2,959 additions and 5,370 deletions.
29 changes: 14 additions & 15 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ library Constants {
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;
uint256 internal constant MAX_ENCRYPTED_LOGS_PER_CALL = 4;
uint256 internal constant MAX_PRIVATE_LOGS_PER_CALL = 16;
uint256 internal constant MAX_UNENCRYPTED_LOGS_PER_CALL = 4;
uint256 internal constant MAX_CONTRACT_CLASS_LOGS_PER_CALL = 1;
uint256 internal constant ARCHIVE_HEIGHT = 29;
Expand Down Expand Up @@ -67,8 +66,7 @@ library Constants {
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;
uint256 internal constant MAX_ENCRYPTED_LOGS_PER_TX = 8;
uint256 internal constant MAX_PRIVATE_LOGS_PER_TX = 64;
uint256 internal constant MAX_UNENCRYPTED_LOGS_PER_TX = 8;
uint256 internal constant MAX_CONTRACT_CLASS_LOGS_PER_TX = 1;
uint256 internal constant NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP = 16;
Expand All @@ -92,7 +90,7 @@ library Constants {
uint256 internal constant FUNCTION_SELECTOR_NUM_BYTES = 4;
uint256 internal constant INITIALIZATION_SLOT_SEPARATOR = 1000000000;
uint256 internal constant INITIAL_L2_BLOCK_NUM = 1;
uint256 internal constant PRIVATE_LOG_SIZE_IN_BYTES = 576;
uint256 internal constant PRIVATE_LOG_SIZE_IN_FIELDS = 18;
uint256 internal constant BLOB_SIZE_IN_BYTES = 126976;
uint256 internal constant AZTEC_MAX_EPOCH_DURATION = 32;
uint256 internal constant GENESIS_ARCHIVE_ROOT =
Expand Down Expand Up @@ -131,6 +129,7 @@ library Constants {
uint256 internal constant L2_GAS_PER_NULLIFIER_READ_REQUEST = 2400;
uint256 internal constant L2_GAS_PER_L1_TO_L2_MSG_READ_REQUEST = 1170;
uint256 internal constant L2_GAS_PER_LOG_BYTE = 4;
uint256 internal constant L2_GAS_PER_PRIVATE_LOG = 0;
uint256 internal constant L2_GAS_PER_L2_TO_L1_MSG = 200;
uint256 internal constant MAX_PROTOCOL_CONTRACTS = 7;
uint256 internal constant CANONICAL_AUTH_REGISTRY_ADDRESS = 1;
Expand Down Expand Up @@ -179,11 +178,10 @@ library Constants {
uint256 internal constant PARTIAL_STATE_REFERENCE_LENGTH = 6;
uint256 internal constant READ_REQUEST_LENGTH = 2;
uint256 internal constant TREE_LEAF_READ_REQUEST_LENGTH = 2;
uint256 internal constant PRIVATE_LOG_DATA_LENGTH = 20;
uint256 internal constant SCOPED_PRIVATE_LOG_DATA_LENGTH = 21;
uint256 internal constant LOG_HASH_LENGTH = 3;
uint256 internal constant SCOPED_LOG_HASH_LENGTH = 4;
uint256 internal constant ENCRYPTED_LOG_HASH_LENGTH = 4;
uint256 internal constant SCOPED_ENCRYPTED_LOG_HASH_LENGTH = 5;
uint256 internal constant NOTE_LOG_HASH_LENGTH = 4;
uint256 internal constant NOTE_HASH_LENGTH = 2;
uint256 internal constant SCOPED_NOTE_HASH_LENGTH = 3;
uint256 internal constant NULLIFIER_LENGTH = 3;
Expand All @@ -202,24 +200,24 @@ library Constants {
uint256 internal constant TOTAL_FEES_LENGTH = 1;
uint256 internal constant TOTAL_MANA_USED_LENGTH = 1;
uint256 internal constant HEADER_LENGTH = 25;
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 491;
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 731;
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 867;
uint256 internal constant PRIVATE_CONTEXT_INPUTS_LENGTH = 38;
uint256 internal constant FEE_RECIPIENT_LENGTH = 2;
uint256 internal constant AGGREGATION_OBJECT_LENGTH = 16;
uint256 internal constant SCOPED_READ_REQUEST_LEN = 3;
uint256 internal constant PUBLIC_DATA_READ_LENGTH = 3;
uint256 internal constant PRIVATE_VALIDATION_REQUESTS_LENGTH = 772;
uint256 internal constant COMBINED_ACCUMULATED_DATA_LENGTH = 550;
uint256 internal constant COMBINED_ACCUMULATED_DATA_LENGTH = 1476;
uint256 internal constant TX_CONSTANT_DATA_LENGTH = 35;
uint256 internal constant COMBINED_CONSTANT_DATA_LENGTH = 44;
uint256 internal constant PRIVATE_ACCUMULATED_DATA_LENGTH = 1036;
uint256 internal constant PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 1850;
uint256 internal constant PRIVATE_TO_PUBLIC_ACCUMULATED_DATA_LENGTH = 548;
uint256 internal constant PRIVATE_ACCUMULATED_DATA_LENGTH = 2084;
uint256 internal constant PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 2898;
uint256 internal constant PRIVATE_TO_PUBLIC_ACCUMULATED_DATA_LENGTH = 1476;
uint256 internal constant PRIVATE_TO_AVM_ACCUMULATED_DATA_LENGTH = 160;
uint256 internal constant NUM_PRIVATE_TO_AVM_ACCUMULATED_DATA_ARRAYS = 3;
uint256 internal constant PRIVATE_TO_PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 1141;
uint256 internal constant KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 606;
uint256 internal constant PRIVATE_TO_PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 2997;
uint256 internal constant KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 1532;
uint256 internal constant CONSTANT_ROLLUP_DATA_LENGTH = 13;
uint256 internal constant BASE_OR_MERGE_PUBLIC_INPUTS_LENGTH = 31;
uint256 internal constant BLOCK_ROOT_OR_BLOCK_MERGE_PUBLIC_INPUTS_LENGTH = 90;
Expand All @@ -228,6 +226,7 @@ library Constants {
uint256 internal constant NOTE_HASHES_NUM_BYTES_PER_BASE_ROLLUP = 2048;
uint256 internal constant NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
uint256 internal constant PUBLIC_DATA_WRITES_NUM_BYTES_PER_BASE_ROLLUP = 4096;
uint256 internal constant PRIVATE_LOGS_NUM_BYTES_PER_BASE_ROLLUP = 36864;
uint256 internal constant CONTRACTS_NUM_BYTES_PER_BASE_ROLLUP = 32;
uint256 internal constant CONTRACT_DATA_NUM_BYTES_PER_BASE_ROLLUP = 64;
uint256 internal constant CONTRACT_DATA_NUM_BYTES_PER_BASE_ROLLUP_UNPADDED = 52;
Expand Down
Loading

0 comments on commit 5c32747

Please sign in to comment.