Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: squash transient note logs #6268

Merged
merged 33 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
32634be
feat: log hashes struct, tracking lens inside circuit
MirandaWood May 8, 2024
6b3cf5f
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 8, 2024
d8097d1
chore: merge fixes + snaps
MirandaWood May 8, 2024
e8771dc
feat: stop tracking extra log lens in circuit
MirandaWood May 8, 2024
cb4058d
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 8, 2024
540fd8a
chore: merge fix + snaps
MirandaWood May 8, 2024
f8bc8bb
feat: noteloghash separation and transient removal
MirandaWood May 10, 2024
ff8ece9
chore: update tests, fixtures, fmt
MirandaWood May 13, 2024
ad521f7
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 13, 2024
f4427dc
chore: merge fixes + constants updates
MirandaWood May 13, 2024
5342064
fix: small e2e fixes, priv->pub note log fixes, comments
MirandaWood May 13, 2024
707eaa1
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 13, 2024
c6acc4d
chore: nargo fmt contexts
MirandaWood May 13, 2024
82fc9a2
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 14, 2024
3c1e499
fix: merge fixes, circuits.js test fixes, log len updates
MirandaWood May 14, 2024
a979a71
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 14, 2024
4c01cf7
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 14, 2024
24a5dbd
fix: merge fixes + increase bench test timeout
MirandaWood May 14, 2024
360021e
feat: address comments
MirandaWood May 14, 2024
8ab5d10
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 15, 2024
75f2867
feat: address final comments
MirandaWood May 15, 2024
b9b9425
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 15, 2024
a77a9f3
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 15, 2024
76a2ddb
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 15, 2024
a70b23b
fix: merge fixes
MirandaWood May 15, 2024
ff2efaa
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 15, 2024
18de2b7
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 15, 2024
96bb755
fix: reapply transient log changes to new reset circuit
MirandaWood May 15, 2024
b8f28d2
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 15, 2024
41fdde0
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 15, 2024
4625f9e
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 16, 2024
560f0df
Merge remote-tracking branch 'origin' into mw/note-logs
MirandaWood May 16, 2024
17a8b24
feat: address comments, merge fixes, update fixtures
MirandaWood May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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_NOTE_ENCRYPTED_LOGS_PER_CALL = 16;
const size_t MAX_ENCRYPTED_LOGS_PER_CALL = 4;
const size_t MAX_UNENCRYPTED_LOGS_PER_CALL = 4;
const size_t MAX_NEW_NOTE_HASHES_PER_TX = 64;
Expand All @@ -27,6 +28,7 @@ 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_NOTE_ENCRYPTED_LOGS_PER_TX = 64;
const size_t MAX_ENCRYPTED_LOGS_PER_TX = 8;
const size_t MAX_UNENCRYPTED_LOGS_PER_TX = 8;
const size_t NUM_ENCRYPTED_LOGS_HASHES_PER_TX = 1;
Expand Down Expand Up @@ -94,6 +96,8 @@ const size_t NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH = 3;
const size_t SCOPED_NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH = NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH + 1;
const size_t PARTIAL_STATE_REFERENCE_LENGTH = 6;
const size_t READ_REQUEST_LENGTH = 2;
const size_t LOG_HASH_LENGTH = 3;
const size_t NOTE_LOG_HASH_LENGTH = 4;
const size_t NOTE_HASH_LENGTH = 2;
const size_t SCOPED_NOTE_HASH_LENGTH = NOTE_HASH_LENGTH + 2;
const size_t NULLIFIER_LENGTH = 3;
Expand All @@ -112,17 +116,17 @@ const size_t PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH =
(NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_CALL) + (NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_CALL) +
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL + MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL + 1 +
(L2_TO_L1_MESSAGE_LENGTH * MAX_NEW_L2_TO_L1_MSGS_PER_CALL) + 2 +
(SIDE_EFFECT_LENGTH * MAX_ENCRYPTED_LOGS_PER_CALL) + (SIDE_EFFECT_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + 2 +
HEADER_LENGTH + TX_CONTEXT_LENGTH;
(NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_CALL) + (LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_CALL) +
(LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + 2 + HEADER_LENGTH + TX_CONTEXT_LENGTH;
const size_t PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH =
CALL_CONTEXT_LENGTH + 2 + (READ_REQUEST_LENGTH * MAX_NULLIFIER_READ_REQUESTS_PER_CALL) +
(READ_REQUEST_LENGTH * MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL) +
(CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH * MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL) +
(CONTRACT_STORAGE_READ_LENGTH * MAX_PUBLIC_DATA_READS_PER_CALL) + MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL +
(NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_CALL) + (NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_CALL) +
(L2_TO_L1_MESSAGE_LENGTH * MAX_NEW_L2_TO_L1_MSGS_PER_CALL) + 2 +
(SIDE_EFFECT_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + 1 + HEADER_LENGTH + GLOBAL_VARIABLES_LENGTH +
AZTEC_ADDRESS_LENGTH + /* revert_code */ 1 + 2 * GAS_LENGTH + /* transaction_fee */ 1;
(L2_TO_L1_MESSAGE_LENGTH * MAX_NEW_L2_TO_L1_MSGS_PER_CALL) + 2 + (LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) +
1 + HEADER_LENGTH + GLOBAL_VARIABLES_LENGTH + AZTEC_ADDRESS_LENGTH + /* revert_code */ 1 + 2 * GAS_LENGTH +
/* transaction_fee */ 1;
const size_t PRIVATE_CALL_STACK_ITEM_LENGTH =
AZTEC_ADDRESS_LENGTH + FUNCTION_DATA_LENGTH + PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH;
const size_t PUBLIC_CONTEXT_INPUTS_LENGTH =
Expand All @@ -137,24 +141,24 @@ const size_t VALIDATION_REQUESTS_LENGTH =
(PUBLIC_DATA_READ_LENGTH * MAX_PUBLIC_DATA_READS_PER_TX);
const size_t PUBLIC_DATA_UPDATE_REQUEST_LENGTH = 2;
const size_t COMBINED_ACCUMULATED_DATA_LENGTH =
MAX_NEW_NOTE_HASHES_PER_TX + MAX_NEW_NULLIFIERS_PER_TX + MAX_NEW_L2_TO_L1_MSGS_PER_TX + 4 +
MAX_NEW_NOTE_HASHES_PER_TX + MAX_NEW_NULLIFIERS_PER_TX + MAX_NEW_L2_TO_L1_MSGS_PER_TX + 5 +
(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + GAS_LENGTH;
const size_t COMBINED_CONSTANT_DATA_LENGTH = HEADER_LENGTH + TX_CONTEXT_LENGTH + GLOBAL_VARIABLES_LENGTH;
const size_t CALLER_CONTEXT_LENGTH = 2 * AZTEC_ADDRESS_LENGTH;
const size_t CALL_REQUEST_LENGTH = 1 + AZTEC_ADDRESS_LENGTH + CALLER_CONTEXT_LENGTH + 2;
const size_t PRIVATE_ACCUMULATED_DATA_LENGTH =
(SCOPED_NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_TX) + (SCOPED_NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_TX) +
(MAX_NEW_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH) + (SIDE_EFFECT_LENGTH * MAX_ENCRYPTED_LOGS_PER_TX) +
(SIDE_EFFECT_LENGTH * MAX_UNENCRYPTED_LOGS_PER_TX) + 2 +
(CALL_REQUEST_LENGTH * MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX) +
(MAX_NEW_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH) +
(NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_TX) + (LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_TX) +
(LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_TX) + 2 + (CALL_REQUEST_LENGTH * MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX) +
(CALL_REQUEST_LENGTH * MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX);
const size_t PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH =
1 + VALIDATION_REQUESTS_LENGTH + PRIVATE_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH +
CALL_REQUEST_LENGTH + AZTEC_ADDRESS_LENGTH;
const size_t PUBLIC_ACCUMULATED_DATA_LENGTH =
(MAX_NEW_NOTE_HASHES_PER_TX * NOTE_HASH_LENGTH) + (MAX_NEW_NULLIFIERS_PER_TX * NULLIFIER_LENGTH) +
(MAX_NEW_L2_TO_L1_MSGS_PER_TX * 1) + (MAX_ENCRYPTED_LOGS_PER_TX * SIDE_EFFECT_LENGTH) +
(MAX_UNENCRYPTED_LOGS_PER_TX * SIDE_EFFECT_LENGTH) + 2 +
(MAX_NEW_L2_TO_L1_MSGS_PER_TX * 1) + (NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_TX) +
(MAX_ENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_UNENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + 2 +
(MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) +
(MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX * CALL_REQUEST_LENGTH) + GAS_LENGTH;
const size_t PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH =
Expand Down
28 changes: 16 additions & 12 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ library Constants {
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 2;
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL = 2;
uint256 internal constant MAX_NULLIFIER_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_UNENCRYPTED_LOGS_PER_CALL = 4;
uint256 internal constant MAX_NEW_NOTE_HASHES_PER_TX = 64;
Expand All @@ -39,6 +40,7 @@ library Constants {
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_TX = 8;
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 8;
uint256 internal constant MAX_NULLIFIER_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_UNENCRYPTED_LOGS_PER_TX = 8;
uint256 internal constant NUM_ENCRYPTED_LOGS_HASHES_PER_TX = 1;
Expand Down Expand Up @@ -123,6 +125,8 @@ library Constants {
NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH + 1;
uint256 internal constant PARTIAL_STATE_REFERENCE_LENGTH = 6;
uint256 internal constant READ_REQUEST_LENGTH = 2;
uint256 internal constant LOG_HASH_LENGTH = 3;
uint256 internal constant NOTE_LOG_HASH_LENGTH = 4;
uint256 internal constant NOTE_HASH_LENGTH = 2;
uint256 internal constant SCOPED_NOTE_HASH_LENGTH = NOTE_HASH_LENGTH + 2;
uint256 internal constant NULLIFIER_LENGTH = 3;
Expand All @@ -143,8 +147,9 @@ library Constants {
+ (NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_CALL) + MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL
+ MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL + 1
+ (L2_TO_L1_MESSAGE_LENGTH * MAX_NEW_L2_TO_L1_MSGS_PER_CALL) + 2
+ (SIDE_EFFECT_LENGTH * MAX_ENCRYPTED_LOGS_PER_CALL)
+ (SIDE_EFFECT_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + 2 + HEADER_LENGTH + TX_CONTEXT_LENGTH;
+ (NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_CALL)
+ (LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_CALL)
+ (LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + 2 + HEADER_LENGTH + TX_CONTEXT_LENGTH;
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = CALL_CONTEXT_LENGTH + 2
+ (READ_REQUEST_LENGTH * MAX_NULLIFIER_READ_REQUESTS_PER_CALL)
+ (READ_REQUEST_LENGTH * MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL)
Expand All @@ -153,9 +158,8 @@ library Constants {
+ MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL + (NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_CALL)
+ (NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_CALL)
+ (L2_TO_L1_MESSAGE_LENGTH * MAX_NEW_L2_TO_L1_MSGS_PER_CALL) + 2
+ (SIDE_EFFECT_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + 1 + HEADER_LENGTH
+ GLOBAL_VARIABLES_LENGTH + AZTEC_ADDRESS_LENGTH /* revert_code */ + 1 + 2 * GAS_LENGTH /* transaction_fee */
+ 1;
+ (LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_CALL) + 1 + HEADER_LENGTH + GLOBAL_VARIABLES_LENGTH
+ AZTEC_ADDRESS_LENGTH /* revert_code */ + 1 + 2 * GAS_LENGTH /* transaction_fee */ + 1;
uint256 internal constant PRIVATE_CALL_STACK_ITEM_LENGTH =
AZTEC_ADDRESS_LENGTH + FUNCTION_DATA_LENGTH + PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH;
uint256 internal constant PUBLIC_CONTEXT_INPUTS_LENGTH =
Expand All @@ -170,7 +174,7 @@ library Constants {
+ (PUBLIC_DATA_READ_LENGTH * MAX_PUBLIC_DATA_READS_PER_TX);
uint256 internal constant PUBLIC_DATA_UPDATE_REQUEST_LENGTH = 2;
uint256 internal constant COMBINED_ACCUMULATED_DATA_LENGTH = MAX_NEW_NOTE_HASHES_PER_TX
+ MAX_NEW_NULLIFIERS_PER_TX + MAX_NEW_L2_TO_L1_MSGS_PER_TX + 4
+ MAX_NEW_NULLIFIERS_PER_TX + MAX_NEW_L2_TO_L1_MSGS_PER_TX + 5
+ (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH) + GAS_LENGTH;
uint256 internal constant COMBINED_CONSTANT_DATA_LENGTH =
HEADER_LENGTH + TX_CONTEXT_LENGTH + GLOBAL_VARIABLES_LENGTH;
Expand All @@ -181,19 +185,19 @@ library Constants {
SCOPED_NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_TX
) + (SCOPED_NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_TX)
+ (MAX_NEW_L2_TO_L1_MSGS_PER_TX * SCOPED_L2_TO_L1_MESSAGE_LENGTH)
+ (SIDE_EFFECT_LENGTH * MAX_ENCRYPTED_LOGS_PER_TX)
+ (SIDE_EFFECT_LENGTH * MAX_UNENCRYPTED_LOGS_PER_TX) + 2
+ (CALL_REQUEST_LENGTH * MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX)
+ (NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_TX)
+ (LOG_HASH_LENGTH * MAX_ENCRYPTED_LOGS_PER_TX) + (LOG_HASH_LENGTH * MAX_UNENCRYPTED_LOGS_PER_TX)
+ 2 + (CALL_REQUEST_LENGTH * MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX)
+ (CALL_REQUEST_LENGTH * MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX);
uint256 internal constant PRIVATE_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 1
+ VALIDATION_REQUESTS_LENGTH + PRIVATE_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH
+ CALL_REQUEST_LENGTH + AZTEC_ADDRESS_LENGTH;
uint256 internal constant PUBLIC_ACCUMULATED_DATA_LENGTH = (
MAX_NEW_NOTE_HASHES_PER_TX * NOTE_HASH_LENGTH
) + (MAX_NEW_NULLIFIERS_PER_TX * NULLIFIER_LENGTH) + (MAX_NEW_L2_TO_L1_MSGS_PER_TX * 1)
+ (MAX_ENCRYPTED_LOGS_PER_TX * SIDE_EFFECT_LENGTH)
+ (MAX_UNENCRYPTED_LOGS_PER_TX * SIDE_EFFECT_LENGTH) + 2
+ (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH)
+ (NOTE_LOG_HASH_LENGTH * MAX_NOTE_ENCRYPTED_LOGS_PER_TX)
+ (MAX_ENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH) + (MAX_UNENCRYPTED_LOGS_PER_TX * LOG_HASH_LENGTH)
+ 2 + (MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX * PUBLIC_DATA_UPDATE_REQUEST_LENGTH)
+ (MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX * CALL_REQUEST_LENGTH) + GAS_LENGTH;
uint256 internal constant PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = VALIDATION_REQUESTS_LENGTH
+ PUBLIC_ACCUMULATED_DATA_LENGTH + PUBLIC_ACCUMULATED_DATA_LENGTH + COMBINED_CONSTANT_DATA_LENGTH
Expand Down
Loading
Loading