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: blobs 2. #10188

Merged
merged 71 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
b4033be
Revert "fix: Revert "feat: blobs. (#9302)" (#10187)"
MirandaWood Nov 25, 2024
de14c32
chore: comments/renaming in Rollup.sol
MirandaWood Nov 27, 2024
b75a6f7
feat: give up and make blob oracle for simulation
MirandaWood Nov 27, 2024
3391096
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Nov 27, 2024
624c36d
fix: post merge fixes, fmt, fixtures
MirandaWood Nov 28, 2024
ccb82b2
chore: dummy change to fix ci runner
MirandaWood Nov 28, 2024
fe6fa68
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Nov 28, 2024
64586d8
fix: do horrible things to reduce contract size
MirandaWood Nov 28, 2024
21e8c3a
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Nov 28, 2024
24f2f0e
chore: post merge fixes, add libs to gen contracts, comments
MirandaWood Nov 28, 2024
566c2fc
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Nov 29, 2024
fc03321
feat: integrate private logs, add blob oracle issue num, regen fixtur…
MirandaWood Nov 30, 2024
5c5a655
chore: update proof fixture
MirandaWood Nov 30, 2024
4bd1312
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 2, 2024
f5aac25
fix: revert merge changes, compile time down from 90 to 10 mins (#10341)
MirandaWood Dec 3, 2024
d4bf371
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 3, 2024
78ca2ab
chore: post merge fixes, fmt
MirandaWood Dec 3, 2024
18a66b0
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 3, 2024
b14a892
chore: post merge fixes + update proof fixture
MirandaWood Dec 3, 2024
25d5ba0
chore: some orch cleanup
MirandaWood Dec 3, 2024
a325000
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 3, 2024
933191b
chore: remake consts after merge
MirandaWood Dec 3, 2024
64a4724
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 4, 2024
07449a3
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 4, 2024
5dd97e3
feat: redo blob publishing
MirandaWood Dec 4, 2024
359758f
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 4, 2024
6c0a22a
feat: rearrange all blob l1 logic, replicate in ts
MirandaWood Dec 5, 2024
681b53a
feat: add gas estimation for blob txs, cleanup contracts, increase he…
MirandaWood Dec 5, 2024
1153bf8
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 5, 2024
8511d52
chore: typos, comments clarifications
MirandaWood Dec 5, 2024
ede52a6
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 5, 2024
4d927d2
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 5, 2024
c44e158
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 6, 2024
5506aa2
chore: fix bad noir merge formatting
MirandaWood Dec 6, 2024
f71874b
fix: change slot overrides after merge
MirandaWood Dec 6, 2024
110692f
chore: update timeouts, comment, grab custom error from ext lib
MirandaWood Dec 6, 2024
389a596
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 6, 2024
dff8962
chore: post merge formatting
MirandaWood Dec 6, 2024
a01595d
chore: add leolib abi to error handling
MirandaWood Dec 6, 2024
9a89e75
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 6, 2024
5f5a10d
chore: inc test timeout after sync
MirandaWood Dec 7, 2024
c8c8758
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 7, 2024
03f4ce1
chore: inc timeout
MirandaWood Dec 7, 2024
7fd775f
chore: increase! those! timeouts!
MirandaWood Dec 7, 2024
a9bfda5
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 7, 2024
ba713cd
chore: header -> block_header to match merge
MirandaWood Dec 7, 2024
2daaa48
chore: guess what.
MirandaWood Dec 8, 2024
c6cde5d
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 9, 2024
ec0d50d
chore: fixture + comment out slower test
MirandaWood Dec 9, 2024
be805b6
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 10, 2024
09bcff3
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 10, 2024
949090f
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 11, 2024
a74377b
chore: remove some warnings from blob code
MirandaWood Dec 11, 2024
426f376
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 11, 2024
dc2955f
chore: post merge formatting
MirandaWood Dec 11, 2024
aa3d368
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 12, 2024
728d784
chore: remake constants after merge
MirandaWood Dec 12, 2024
0332bb8
fix: bad merge
MirandaWood Dec 12, 2024
59148e2
chore: proof fixture
MirandaWood Dec 12, 2024
76da0d4
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 12, 2024
e8685ac
feat: reduce the number unconstrained boundary hops in bloblib (#10603)
TomAFrench Dec 12, 2024
7827a73
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 13, 2024
e6fc5b5
fix: add temp brillig skip to run CI
MirandaWood Dec 13, 2024
c423c90
chore: update prover.tomls, ensure block-root is populated
MirandaWood Dec 13, 2024
f420a79
chore: add brillig gates skip to earthfile
MirandaWood Dec 13, 2024
36efe51
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 13, 2024
313c3d8
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 13, 2024
448187e
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 13, 2024
436b7d6
chore: reenable test
MirandaWood Dec 13, 2024
f096e25
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 13, 2024
b8699a2
Merge remote-tracking branch 'origin/master' into mw/blob-circuit-2
MirandaWood Dec 13, 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
9 changes: 4 additions & 5 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ library Constants {
uint256 internal constant TOTAL_MANA_USED_LENGTH = 1;
uint256 internal constant HEADER_LENGTH = 25;
uint256 internal constant HEADER_LENGTH_BYTES = 648;
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;
Expand Down Expand Up @@ -283,10 +283,9 @@ library Constants {
uint256 internal constant NULLIFIERS_PREFIX = 4;
uint256 internal constant L2_L1_MSGS_PREFIX = 5;
uint256 internal constant PUBLIC_DATA_UPDATE_REQUESTS_PREFIX = 6;
uint256 internal constant NOTE_ENCRYPTED_LOGS_PREFIX = 7;
uint256 internal constant ENCRYPTED_LOGS_PREFIX = 8;
uint256 internal constant UNENCRYPTED_LOGS_PREFIX = 9;
uint256 internal constant CONTRACT_CLASS_LOGS_PREFIX = 10;
uint256 internal constant PRIVATE_LOGS_PREFIX = 7;
uint256 internal constant UNENCRYPTED_LOGS_PREFIX = 8;
uint256 internal constant CONTRACT_CLASS_LOGS_PREFIX = 9;
uint256 internal constant PROOF_TYPE_PLONK = 0;
uint256 internal constant PROOF_TYPE_HONK = 1;
uint256 internal constant PROOF_TYPE_OINK = 2;
Expand Down
16 changes: 8 additions & 8 deletions l1-contracts/test/fixtures/empty_block_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"l2ToL1Messages": []
},
"block": {
"archive": "0x03045313de9acdebd8022d977fb2adb7392647594a313779e85b5d4769f197dd",
"blockHash": "0x173c64317cbbac27e05d358b9fc86c19338cf4fbf48255265b0dc988f8e56e29",
"archive": "0x2e558c94bd1a3d8512eaf74c297f8a5b28ca14c79636a9f81e0538804b21ff6c",
"blockHash": "0x20e7264407d9dad46301cd1ac2720619fa899e0dc07e2aeaaf1f58a9fe0d9b42",
"body": "0x00000000",
"decodedHeader": {
"contentCommitment": {
Expand All @@ -22,13 +22,13 @@
"blockNumber": 1,
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000012",
"chainId": 31337,
"timestamp": 1732759415,
"timestamp": 1732961424,
"version": 1,
"coinbase": "0x94eaefaa0efecae32a0511a2ed0fb15b84f4de3d",
"feeRecipient": "0x0a437721cc9f47cd1fad72dea39afdb76894539e33a1e1dce690ac676d81c2fa",
"coinbase": "0x2cf4a1c62581a88edae4234f887da6b9551ab171",
"feeRecipient": "0x0339e43debc9c5093c6862f6dea7ff66fcd7f45c01f87dfa61f802d30530ea4e",
"gasFees": {
"feePerDaGas": 0,
"feePerL2Gas": 54153598980
"feePerL2Gas": 54153588500
}
},
"totalFees": "0x0000000000000000000000000000000000000000000000000000000000000000",
Expand Down Expand Up @@ -58,8 +58,8 @@
}
}
},
"header": "0x0237797d6a2c04d20d4fa06b74482bd970ccd51a43d9b05b57e9b91fa1ae1cae000000010000000000000000000000000000000000000000000000000000000000000002001cedbd7ea5309ef9d1d159209835409bf41b6b1802597a52fa70cc82e934d900089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb2e33ee2008411c04b99c24b313513d097a0d21a5040b6193d1f978b8226892d6000000101fd848aa69e1633722fe249a5b7f53b094f1c9cef9f5c694b073fd1cc5850dfb000000800c499b373a1f0fe1b510a63563546d2d39e206895056a5af0143c5f30d6390730000010023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000000800000000000000000000000000000000000000000000000000000000000007a69000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000006747cf7794eaefaa0efecae32a0511a2ed0fb15b84f4de3d0a437721cc9f47cd1fad72dea39afdb76894539e33a1e1dce690ac676d81c2fa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c9bce580400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x008269e39b10daf0851f6ac81df8476f8d60b53fb8a0002de0182c7e11545e5b",
"header": "0x0237797d6a2c04d20d4fa06b74482bd970ccd51a43d9b05b57e9b91fa1ae1cae000000010000000000000000000000000000000000000000000000000000000000000002001cedbd7ea5309ef9d1d159209835409bf41b6b1802597a52fa70cc82e934d900089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb2e33ee2008411c04b99c24b313513d097a0d21a5040b6193d1f978b8226892d6000000101fd848aa69e1633722fe249a5b7f53b094f1c9cef9f5c694b073fd1cc5850dfb000000800c499b373a1f0fe1b510a63563546d2d39e206895056a5af0143c5f30d6390730000010023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000000800000000000000000000000000000000000000000000000000000000000007a6900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000674ae4902cf4a1c62581a88edae4234f887da6b9551ab1710339e43debc9c5093c6862f6dea7ff66fcd7f45c01f87dfa61f802d30530ea4e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c9bce2f1400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x005838c184fb9da5be8d12382acd314219bbf72275c7242738bcb5c334f509ef",
"blobInputs": "0x01010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c4440140ac4f3ee53aedc4865073ae7fb664e7401d10eadbe3bbcc266c35059f14826bb0000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"numTxs": 0
}
Expand Down
18 changes: 9 additions & 9 deletions l1-contracts/test/fixtures/empty_block_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"l2ToL1Messages": []
},
"block": {
"archive": "0x2454519574be7eba54e456596b3bb51d478360ad71813550e30c0e0f2d427052",
"blockHash": "0x04246a2ff3b6e6c2347af3e3846bcfaaad8486301b2a89dbbe8e1654bc066144",
"archive": "0x02d998d1be2b2024b668f2581679e28a526abf15d7375aa2e7b969766f6b4150",
"blockHash": "0x29787560359b663bf91fd4877518fa25dbb2423dd20290dd15577c1ea8598d6f",
"body": "0x00000000",
"decodedHeader": {
"contentCommitment": {
Expand All @@ -22,20 +22,20 @@
"blockNumber": 2,
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000013",
"chainId": 31337,
"timestamp": 1732759439,
"timestamp": 1732961448,
"version": 1,
"coinbase": "0x94eaefaa0efecae32a0511a2ed0fb15b84f4de3d",
"feeRecipient": "0x0a437721cc9f47cd1fad72dea39afdb76894539e33a1e1dce690ac676d81c2fa",
"coinbase": "0x2cf4a1c62581a88edae4234f887da6b9551ab171",
"feeRecipient": "0x0339e43debc9c5093c6862f6dea7ff66fcd7f45c01f87dfa61f802d30530ea4e",
"gasFees": {
"feePerDaGas": 0,
"feePerL2Gas": 54153598980
"feePerL2Gas": 54153588500
}
},
"totalFees": "0x0000000000000000000000000000000000000000000000000000000000000000",
"totalManaUsed": "0x0000000000000000000000000000000000000000000000000000000000000000",
"lastArchive": {
"nextAvailableLeafIndex": 2,
"root": "0x03045313de9acdebd8022d977fb2adb7392647594a313779e85b5d4769f197dd"
"root": "0x2e558c94bd1a3d8512eaf74c297f8a5b28ca14c79636a9f81e0538804b21ff6c"
},
"stateReference": {
"l1ToL2MessageTree": {
Expand All @@ -58,8 +58,8 @@
}
}
},
"header": "0x03045313de9acdebd8022d977fb2adb7392647594a313779e85b5d4769f197dd000000020000000000000000000000000000000000000000000000000000000000000002001cedbd7ea5309ef9d1d159209835409bf41b6b1802597a52fa70cc82e934d900089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb2e33ee2008411c04b99c24b313513d097a0d21a5040b6193d1f978b8226892d6000000201fd848aa69e1633722fe249a5b7f53b094f1c9cef9f5c694b073fd1cc5850dfb000001000c499b373a1f0fe1b510a63563546d2d39e206895056a5af0143c5f30d6390730000018023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000000800000000000000000000000000000000000000000000000000000000000007a69000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000013000000000000000000000000000000000000000000000000000000006747cf8f94eaefaa0efecae32a0511a2ed0fb15b84f4de3d0a437721cc9f47cd1fad72dea39afdb76894539e33a1e1dce690ac676d81c2fa00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c9bce580400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x003095d5b1a2dba66ec9f4acc30b371bd7e0a10d4d7b6d47fde328df74650050",
"header": "0x2e558c94bd1a3d8512eaf74c297f8a5b28ca14c79636a9f81e0538804b21ff6c000000020000000000000000000000000000000000000000000000000000000000000002001cedbd7ea5309ef9d1d159209835409bf41b6b1802597a52fa70cc82e934d900089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb2e33ee2008411c04b99c24b313513d097a0d21a5040b6193d1f978b8226892d6000000201fd848aa69e1633722fe249a5b7f53b094f1c9cef9f5c694b073fd1cc5850dfb000001000c499b373a1f0fe1b510a63563546d2d39e206895056a5af0143c5f30d6390730000018023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000000800000000000000000000000000000000000000000000000000000000000007a6900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001300000000000000000000000000000000000000000000000000000000674ae4a82cf4a1c62581a88edae4234f887da6b9551ab1710339e43debc9c5093c6862f6dea7ff66fcd7f45c01f87dfa61f802d30530ea4e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c9bce2f1400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x001a7690dc1e32dee9ec361537f5cf2034e9c79310bffe596a6d67e4784134bb",
"blobInputs": "0x01010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c4440140ac4f3ee53aedc4865073ae7fb664e7401d10eadbe3bbcc266c35059f14826bb0000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"numTxs": 0
}
Expand Down
22 changes: 11 additions & 11 deletions l1-contracts/test/fixtures/mixed_block_1.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions l1-contracts/test/fixtures/mixed_block_2.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use types::{
abis::sponge_blob::SpongeBlob,
constants::{BLOB_PUBLIC_INPUTS, BLOBS_PER_BLOCK, FIELDS_PER_BLOB},
};
// TODO(BLOB_ORACLE): this was added to save simulation time (~1min in ACVM, ~3mins in wasm -> 500ms).
// TODO(#10323): this was added to save simulation time (~1min in ACVM, ~3mins in wasm -> 500ms).
// The use of bignum adds a lot of unconstrained code which overloads limits when simulating.
// If/when simulation times of unconstrained are improved, remove this.
pub unconstrained fn evaluate_blobs(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ mod tests {
private_base_rollup::PrivateBaseRollupInputs,
state_diff_hints::PrivateBaseStateDiffHints,
},
components::{append_tx_effects_for_blob, TX_EFFECTS_BLOB_HASH_INPUT_FIELDS},
components::{
append_tx_effects_for_blob, encode_blob_prefix, TX_EFFECTS_BLOB_HASH_INPUT_FIELDS,
},
};
use dep::types::{
abis::{
Expand All @@ -245,14 +247,14 @@ mod tests {
},
address::{AztecAddress, EthAddress},
constants::{
ARCHIVE_HEIGHT, CONTRACT_CLASS_LOGS_PREFIX, ENCRYPTED_LOGS_PREFIX, L2_L1_MSGS_PREFIX,
MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX,
MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NOTE_ENCRYPTED_LOGS_PREFIX,
NOTE_HASH_SUBTREE_HEIGHT, NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, NOTE_HASH_TREE_HEIGHT,
NOTES_PREFIX, NULLIFIER_SUBTREE_HEIGHT, NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH,
NULLIFIER_TREE_HEIGHT, NULLIFIERS_PREFIX, PRIVATE_KERNEL_EMPTY_INDEX,
PUBLIC_DATA_TREE_HEIGHT, REVERT_CODE_PREFIX, TUBE_VK_INDEX, TX_FEE_PREFIX,
TX_START_PREFIX, UNENCRYPTED_LOGS_PREFIX,
ARCHIVE_HEIGHT, CONTRACT_CLASS_LOGS_PREFIX, L2_L1_MSGS_PREFIX, MAX_L2_TO_L1_MSGS_PER_TX,
MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX,
MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NOTE_HASH_SUBTREE_HEIGHT,
NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, NOTE_HASH_TREE_HEIGHT, NOTES_PREFIX,
NULLIFIER_SUBTREE_HEIGHT, NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, NULLIFIER_TREE_HEIGHT,
NULLIFIERS_PREFIX, PRIVATE_KERNEL_EMPTY_INDEX, PRIVATE_LOG_SIZE_IN_FIELDS,
PRIVATE_LOGS_PREFIX, PUBLIC_DATA_TREE_HEIGHT, REVERT_CODE_PREFIX, TUBE_VK_INDEX,
TX_FEE_PREFIX, TX_START_PREFIX, UNENCRYPTED_LOGS_PREFIX,
},
data::{public_data_hint::PublicDataHint, PublicDataTreeLeaf, PublicDataTreeLeafPreimage},
hash::silo_l2_to_l1_message,
Expand Down Expand Up @@ -859,12 +861,25 @@ mod tests {

#[test]
unconstrained fn fuller_tx_effects_sponge() {
let NUM_NOTES = 50;
let NUM_NOTES = 25;
let NUM_NULLIFIERS = 3;
let NUM_MSGS = 5;
let NUM_ENC_LOGS = 4;
let NUM_PRIV_EVENT_LOGS = 4;
let NUM_UNENC_LOGS = 6;
let NUM_CC_LOGS = 1;
let TOTAL_BLOB_FIELDS = 2 // revert code and tx fee
+ NUM_NOTES
+ 1 // notes and prefix
+ NUM_NULLIFIERS
+ 1 // nullifiers and prefix
+ NUM_MSGS
+ 1 // L2 to L1 msgs and prefix
+ NUM_UNENC_LOGS
+ 1 // unenc. logs and prefix
+ NUM_CC_LOGS
+ 1 // contract class logs and prefix
+ (NUM_NOTES + NUM_PRIV_EVENT_LOGS) * PRIVATE_LOG_SIZE_IN_FIELDS
+ 1; // private logs and prefix
let mut builder = PrivateBaseRollupInputsBuilder::new();
builder.tube_data.set_gas_used(100, 200);
builder.constants.global_variables.gas_fees.fee_per_da_gas = 1;
Expand All @@ -886,7 +901,7 @@ mod tests {
// Copied from public data test below:
builder.pre_existing_public_data[0] =
PublicDataTreeLeafPreimage { slot: 20, value: 40, next_slot: 0, next_index: 0 };
builder.tube_data.append_encrypted_log_hashes(NUM_ENC_LOGS);
builder.tube_data.append_private_logs(NUM_PRIV_EVENT_LOGS);
builder.tube_data.append_unencrypted_log_hashes(NUM_UNENC_LOGS);
// Below will only work with NUM_CC_LOGS=1
builder.tube_data.add_contract_class_log_hash(1, 2);
Expand All @@ -895,11 +910,19 @@ mod tests {
let mut reconstructed_tx_effects = [0; TX_EFFECTS_BLOB_HASH_INPUT_FIELDS];
// Initial field = TX_START_PREFIX | 0 | txlen[0] txlen[1] | 0 | REVERT_CODE_PREFIX | 0 | revert_code
// revert code = 0
// fields appended here = 128 = offset once appending complete
let total_blob_fields_bytes = (TOTAL_BLOB_FIELDS as Field).to_be_bytes::<2>();
reconstructed_tx_effects[0] = field_from_bytes(
array_concat(
TX_START_PREFIX.to_be_bytes::<8>(),
[0, 0, 128, 0, REVERT_CODE_PREFIX, 0, 0],
[
0,
total_blob_fields_bytes[0],
total_blob_fields_bytes[1],
0,
REVERT_CODE_PREFIX,
0,
0,
],
),
true,
);
Expand All @@ -910,7 +933,7 @@ mod tests {
);
// notes
let mut offset = 2;
let notes_prefix = field_from_bytes([NOTES_PREFIX, 0, NUM_NOTES as u8], true);
let notes_prefix = encode_blob_prefix(NOTES_PREFIX, NUM_NOTES);
reconstructed_tx_effects[offset] = notes_prefix;
offset += 1;
for i in 0..NUM_NOTES {
Expand All @@ -919,16 +942,15 @@ mod tests {
}
offset += NUM_NOTES;
// nullifiers
let nullifiers_prefix =
field_from_bytes([NULLIFIERS_PREFIX, 0, NUM_NULLIFIERS as u8], true);
let nullifiers_prefix = encode_blob_prefix(NULLIFIERS_PREFIX, NUM_NULLIFIERS);
reconstructed_tx_effects[offset] = nullifiers_prefix;
offset += 1;
for i in 0..NUM_NULLIFIERS {
reconstructed_tx_effects[offset + i] = builder.nullifiers.storage()[i].value;
}
offset += NUM_NULLIFIERS;
// l2 to l1 msgs
let l2_to_l1_msgs_prefix = field_from_bytes([L2_L1_MSGS_PREFIX, 0, NUM_MSGS as u8], true);
let l2_to_l1_msgs_prefix = encode_blob_prefix(L2_L1_MSGS_PREFIX, NUM_MSGS);
reconstructed_tx_effects[offset] = l2_to_l1_msgs_prefix;
offset += 1;
for i in 0..NUM_MSGS {
Expand All @@ -939,32 +961,20 @@ mod tests {
);
}
offset += NUM_MSGS;
// note logs
let note_encrypted_logs_prefix =
field_from_bytes([NOTE_ENCRYPTED_LOGS_PREFIX, 0, NUM_NOTES as u8], true);
reconstructed_tx_effects[offset] = note_encrypted_logs_prefix;
offset += 1;
for i in 0..NUM_NOTES {
reconstructed_tx_effects[offset + i] =
builder.tube_data.note_encrypted_logs_hashes.storage()[i].value();
}
offset += NUM_NOTES;
// enc logs
let encrypted_logs_prefix =
field_from_bytes([ENCRYPTED_LOGS_PREFIX, 0, NUM_ENC_LOGS as u8], true);
reconstructed_tx_effects[offset] = encrypted_logs_prefix;
// private logs
let total_private_logs_len = (NUM_NOTES + NUM_PRIV_EVENT_LOGS) * PRIVATE_LOG_SIZE_IN_FIELDS;
let private_logs_prefix = encode_blob_prefix(PRIVATE_LOGS_PREFIX, total_private_logs_len);
reconstructed_tx_effects[offset] = private_logs_prefix;
offset += 1;
for i in 0..NUM_ENC_LOGS {
reconstructed_tx_effects[offset + i] = types::hash::silo_encrypted_log_hash(builder
.tube_data
.encrypted_logs_hashes
.storage()[i]
.expose_to_public());
for i in 0..NUM_NOTES + NUM_PRIV_EVENT_LOGS {
for j in 0..PRIVATE_LOG_SIZE_IN_FIELDS {
reconstructed_tx_effects[offset + i * PRIVATE_LOG_SIZE_IN_FIELDS + j] =
builder.tube_data.private_logs.storage()[i].inner.log.fields[j];
}
}
offset += NUM_ENC_LOGS;
offset += total_private_logs_len;
// unenc logs
let unencrypted_logs_prefix =
field_from_bytes([UNENCRYPTED_LOGS_PREFIX, 0, NUM_UNENC_LOGS as u8], true);
let unencrypted_logs_prefix = encode_blob_prefix(UNENCRYPTED_LOGS_PREFIX, NUM_UNENC_LOGS);
reconstructed_tx_effects[offset] = unencrypted_logs_prefix;
offset += 1;
for i in 0..NUM_UNENC_LOGS {
Expand All @@ -975,7 +985,7 @@ mod tests {
offset += NUM_UNENC_LOGS;
// cc logs
let contract_class_logs_prefix =
field_from_bytes([CONTRACT_CLASS_LOGS_PREFIX, 0, NUM_CC_LOGS as u8], true);
encode_blob_prefix(CONTRACT_CLASS_LOGS_PREFIX, NUM_CC_LOGS);
reconstructed_tx_effects[offset] = contract_class_logs_prefix;
offset += 1;
for i in 0..NUM_CC_LOGS {
Expand All @@ -985,8 +995,8 @@ mod tests {
}
offset += NUM_CC_LOGS;

// Sanity check - if this fails change the above use of 128
assert(offset == 128);
// Sanity check
assert(offset == TOTAL_BLOB_FIELDS);

let mut expected_sponge = outputs.start_sponge_blob;
expected_sponge.absorb(reconstructed_tx_effects, offset);
Expand Down
Loading
Loading