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: move out_hash inside tx_effect_hash #7489

Merged
merged 6 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
63 changes: 54 additions & 9 deletions l1-contracts/src/core/libraries/decoders/TxsDecoder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ library TxsDecoder {
bytes32 noteEncryptedLogsHash;
bytes32 encryptedLogsHash;
bytes32 unencryptedLogsHash;
bytes32 txOutHash;
}

/**
Expand Down Expand Up @@ -105,7 +106,7 @@ library TxsDecoder {
* transactionFee,
* noteHashesKernel,
* nullifiersKernel,
* l2ToL1MsgsKernel,
* txOutHash, |=> Computed below from l2tol1msgs
* publicDataUpdateRequestsKernel,
* noteEncryptedLogsLength,
* encryptedLogsLength,
Expand Down Expand Up @@ -179,6 +180,8 @@ library TxsDecoder {
// UNENCRYPTED LOGS HASH
(vars.unencryptedLogsHash, offset, vars.kernelUnencryptedLogsLength) =
computeKernelUnencryptedLogsHash(offset, _body);
// TX LEVEL OUT HASH
(vars.txOutHash) = computeTxOutHash(offsets.l2ToL1Msgs, _body);

// We throw to ensure that the byte len we charge for DA gas in the kernels matches the actual chargable log byte len
// Without this check, the user may provide the kernels with a lower log len than reality
Expand Down Expand Up @@ -230,12 +233,7 @@ library TxsDecoder {
counts.nullifier * 0x20,
Constants.NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP
),
sliceAndPadRight(
_body,
offsets.l2ToL1Msgs,
counts.l2ToL1Msgs * 0x20,
Constants.L2_TO_L1_MSGS_NUM_BYTES_PER_BASE_ROLLUP
),
vars.txOutHash,
sliceAndPadRight(
_body,
offsets.publicData,
Expand All @@ -257,7 +255,7 @@ library TxsDecoder {
// We pad base leaves with hashes of empty tx effect.
for (uint256 i = numTxEffects; i < vars.baseLeaves.length; i++) {
// Value taken from tx_effect.test.ts "hash of empty tx effect matches snapshot" test case
vars.baseLeaves[i] = hex"00e8b31e302d11fbf7da124b537ba2d44f88e165da03c6557e2b0f6dc486e025";
vars.baseLeaves[i] = hex"00f0aa51fc81f8242316fcf2cb3b28196241ed3fa26dd320a959bce6c529b270";
}
}

Expand Down Expand Up @@ -518,7 +516,7 @@ library TxsDecoder {

/**
* @notice Computes the root for a binary unbalanced Merkle-tree given the leaves.
* @dev Filled in greedily with subtrees. Useful for txsEffectHash and outHash tree.
* @dev Filled in greedily with subtrees. Useful for txsEffectsHash and outHash tree.
* @param _leaves - The 32 bytes leafs to build the tree of.
* @return The root of the Merkle tree.
*/
Expand Down Expand Up @@ -550,6 +548,27 @@ library TxsDecoder {
return root;
}

/**
* @notice Computes the root for the binary variable height Merkle-tree made of one tx's L2 to L1 msgs.
* @dev Mimics compute_kernel_out_hash in base_rollup.
* TODO(#7218): Revert to fixed height tree for outbox
* @param _data - The blob of data containing l2 to l1 msgs.
* @return The root of the Merkle tree.
*/
function computeTxOutHash(uint256 _start, bytes calldata _data) internal pure returns (bytes32) {
uint256 offset = _start;
// The stored offsets.l2ToL1Msgs does not include the single byte storing the num of msgs, hence -1
uint32 numMsgs = uint32(read1(_data, _start - 1));
uint256 numMsgsToPad = computeNumMsgsToPad(uint32(numMsgs));
bytes32[] memory leavesInMsgTree = new bytes32[](numMsgs + numMsgsToPad);
for (uint256 i = 0; i < numMsgs; i++) {
leavesInMsgTree[i] = bytes32(slice(_data, offset, 0x20));
offset += 0x20;
}
bytes32 outHash = computeRoot(leavesInMsgTree);
return outHash;
}

/**
* @notice Wrapper around the slicing to avoid some stack too deep
* @param _data - The data to slice
Expand Down Expand Up @@ -619,6 +638,32 @@ library TxsDecoder {
return uint256(uint32(bytes4(slice(_data, _offset, 4))));
}

/**
* @notice Pads L2 to L1 messages to the next power of 2 - simple algo as we only have a max of 8 msgs
* @param _numL2toL1Msgs - num of msgs (currently between 0 and MAX_L2_TO_L1_MSGS_PER_TX = 8)
* @return Num msgs to pad
*/
function computeNumMsgsToPad(uint32 _numL2toL1Msgs) internal pure returns (uint32) {
// We handle the edge case of 0 msgs by padding by 1 - this ensures computeRoot() gives a result of 0
if (_numL2toL1Msgs == 0 || _numL2toL1Msgs == 1) {
return 1;
}

uint32 v = _numL2toL1Msgs;

// the following rounds _numL2toL1Msgs up to the next power of 2 (works only for 4 bytes value!)
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
// We dont expect to have MAX_L2_TO_L1_MSGS_PER_TX greater than 8 bits, so commented out the below to save gas
// v |= v >> 8;
// v |= v >> 16;
v++;

return v - _numL2toL1Msgs;
}

function computeNumTxEffectsToPad(uint32 _numTxEffects) internal pure returns (uint32) {
// 2 is the minimum number of tx effects so we have to handle the following 2 cases separately
if (_numTxEffects == 0) {
Expand Down
6 changes: 3 additions & 3 deletions l1-contracts/test/Rollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ contract RollupTest is DecoderBase {
// The below is a little janky - we know that this test deals with full txs with equal numbers
// of msgs or txs with no messages, so the division works
// TODO edit full.messages to include information about msgs per tx?
uint256 subTreeHeight = merkleTestUtil.calculateTreeHeightFromSize(
full.messages.l2ToL1Messages.length == 0 ? 0 : full.messages.l2ToL1Messages.length / numTxs
);
uint256 subTreeHeight = full.messages.l2ToL1Messages.length == 0
? 0
: merkleTestUtil.calculateTreeHeightFromSize(full.messages.l2ToL1Messages.length / numTxs);
uint256 outHashTreeHeight = merkleTestUtil.calculateTreeHeightFromSize(numTxs);
uint256 numMessagesWithPadding = numTxs * Constants.MAX_L2_TO_L1_MSGS_PER_TX;

Expand Down
53 changes: 53 additions & 0 deletions l1-contracts/test/decoders/Decoders.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,21 @@ contract DecodersTest is DecoderBase {
assertEq(logsHash, referenceLogsHashFromIteration3, "Incorrect logs hash");
}

function testComputeTxOutHash() public {
// A tx with no msgs should give an out hash of 0
bytes memory encodedMsgs = abi.encodePacked(hex"00");
bytes32 outHash = txsHelper.computeTxOutHash(encodedMsgs);
assertEq(outHash, 0, "Incorrect tx empty out hash");
// Mimics test_3_elems test in .nr, with msg hashes of value 10, 11, and 12
bytes32[3] memory msgs = [bytes32(hex"0a"), bytes32(hex"0b"), bytes32(hex"0c")];
encodedMsgs = abi.encodePacked(hex"03", msgs);
outHash = txsHelper.computeTxOutHash(encodedMsgs);
bytes32 firstNode = Hash.sha256ToField(bytes.concat(msgs[0], msgs[1]));
bytes32 secondNode = Hash.sha256ToField(bytes.concat(msgs[2], bytes32(0)));
bytes32 expectedOutHash = Hash.sha256ToField(bytes.concat(firstNode, secondNode));
assertEq(outHash, expectedOutHash, "Incorrect tx out hash");
}

function testTxsDecoderCorrectlyComputesNumTxEffectsToPad() public {
// Minimum num txs is 2 so when there are no real txs we need to pad to 2
uint32 numTxEffects = 0;
Expand All @@ -337,4 +352,42 @@ contract DecodersTest is DecoderBase {
paddedNumTxEffects = txsHelper.computeNumTxEffectsToPad(numTxEffects);
assertEq(paddedNumTxEffects, 0, "Incorrect number of tx effects to pad");
}

function testTxsDecoderCorrectlyComputesNumMsgsToPad() public {
uint32 numMsgs = 0;
uint32 numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 1, "Incorrect number of msgs to pad");

numMsgs = 1;
numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 2 ** 1 - numMsgs, "Incorrect number of msgs to pad");

numMsgs = 2;
numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 0, "Incorrect number of msgs to pad");

numMsgs = 3;
numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 2 ** 2 - numMsgs, "Incorrect number of msgs to pad");

numMsgs = 4;
numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 0, "Incorrect number of msgs to pad");

numMsgs = 5;
numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 2 ** 3 - numMsgs, "Incorrect number of msgs to pad");

numMsgs = 6;
numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 2 ** 3 - numMsgs, "Incorrect number of msgs to pad");

numMsgs = 7;
numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 2 ** 3 - numMsgs, "Incorrect number of msgs to pad");

numMsgs = 7;
numMsgsToPad = txsHelper.computeNumMsgsToPad(numMsgs);
assertEq(numMsgsToPad, 2 ** 3 - numMsgs, "Incorrect number of msgs to pad");
}
}
8 changes: 8 additions & 0 deletions l1-contracts/test/decoders/helpers/TxsDecoderHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ contract TxsDecoderHelper {
return TxsDecoder.computeKernelEncryptedLogsHash(0, _kernelLogs);
}

function computeTxOutHash(bytes calldata _kernelMsgs) external pure returns (bytes32) {
return TxsDecoder.computeTxOutHash(1, _kernelMsgs);
}

function computeNumTxEffectsToPad(uint32 _numTxEffects) external pure returns (uint32) {
return TxsDecoder.computeNumTxEffectsToPad(_numTxEffects);
}

function computeNumMsgsToPad(uint32 _numL2toL1Msgs) external pure returns (uint32) {
return TxsDecoder.computeNumMsgsToPad(_numL2toL1Msgs);
}

function computeUnbalancedRoot(bytes32[] memory _leaves) external pure returns (bytes32) {
return TxsDecoder.computeUnbalancedRoot(_leaves);
}
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,24 +8,24 @@
"l2ToL1Messages": []
},
"block": {
"archive": "0x15e53fc73037ad67a12a7af9a828218445cd4252d356f854d2a44b3e64d2262c",
"archive": "0x2d9d4655a6fd1c031557c03f8a95089d4d1ef097164b18e9b8eac3ed5efd6897",
"body": "0x00000000",
"txsEffectsHash": "0x00d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf2",
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6",
"decodedHeader": {
"contentCommitment": {
"inHash": "0x00089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c",
"outHash": "0x0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c3",
"outHash": "0x00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb",
"numTxs": 2,
"txsEffectsHash": "0x00d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf2"
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6"
},
"globalVariables": {
"blockNumber": 1,
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000001",
"chainId": 31337,
"timestamp": 0,
"version": 1,
"coinbase": "0x56496111355717b87a7e9ecde62b1fc8741933d7",
"feeRecipient": "0x30312153fedef883087dc5281903c6d005a7c0e98a4f604b0ab93953c162e50e",
"coinbase": "0xdb59aa78df10a886e7987fedcf49ae50541b0f91",
"feeRecipient": "0x2eca3f1c9be9eef0c92d6f57fc6283f91d3bb957d4b876d425ba152859fbbf98",
"gasFees": {
"feePerDaGas": 0,
"feePerL2Gas": 0
Expand Down Expand Up @@ -56,8 +56,8 @@
}
}
},
"header": "0x1200a06aae1368abe36530b585bd7a4d2ba4de5037b82076412691a187d7621e00000001000000000000000000000000000000000000000000000000000000000000000200d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf200089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c314f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000100b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000008019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000010023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001000000000000000000000000000000000000000000000000000000000000007a69000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000056496111355717b87a7e9ecde62b1fc8741933d730312153fedef883087dc5281903c6d005a7c0e98a4f604b0ab93953c162e50e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00010682db7186e580231f059cb12d74d3e8d1ab7428fcf0fb893af85b297ea5",
"header": "0x1200a06aae1368abe36530b585bd7a4d2ba4de5037b82076412691a187d7621e00000001000000000000000000000000000000000000000000000000000000000000000200e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb14f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000100b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000008019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000010023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001000000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000db59aa78df10a886e7987fedcf49ae50541b0f912eca3f1c9be9eef0c92d6f57fc6283f91d3bb957d4b876d425ba152859fbbf98000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x0047f06fa9d1ed5ea7587c7db00eefb3d0585b22184af926a6407278e46f2eb3",
"numTxs": 0
}
}
20 changes: 10 additions & 10 deletions l1-contracts/test/fixtures/empty_block_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@
"l2ToL1Messages": []
},
"block": {
"archive": "0x1900f7c4305f805f10fd6940dc654405720621d2a40b3b076969c5bc51ba6475",
"archive": "0x2d3c9875a57056f615056d2a6a45437ec7b8d87da3ec41bf54c51f9a442c6bc9",
"body": "0x00000000",
"txsEffectsHash": "0x00d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf2",
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6",
"decodedHeader": {
"contentCommitment": {
"inHash": "0x00089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c",
"outHash": "0x0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c3",
"outHash": "0x00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb",
"numTxs": 2,
"txsEffectsHash": "0x00d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf2"
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6"
},
"globalVariables": {
"blockNumber": 2,
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000002",
"chainId": 31337,
"timestamp": 1722938948,
"timestamp": 1723020124,
"version": 1,
"coinbase": "0x56496111355717b87a7e9ecde62b1fc8741933d7",
"feeRecipient": "0x30312153fedef883087dc5281903c6d005a7c0e98a4f604b0ab93953c162e50e",
"coinbase": "0xdb59aa78df10a886e7987fedcf49ae50541b0f91",
"feeRecipient": "0x2eca3f1c9be9eef0c92d6f57fc6283f91d3bb957d4b876d425ba152859fbbf98",
"gasFees": {
"feePerDaGas": 0,
"feePerL2Gas": 0
}
},
"lastArchive": {
"nextAvailableLeafIndex": 2,
"root": "0x15e53fc73037ad67a12a7af9a828218445cd4252d356f854d2a44b3e64d2262c"
"root": "0x2d9d4655a6fd1c031557c03f8a95089d4d1ef097164b18e9b8eac3ed5efd6897"
},
"stateReference": {
"l1ToL2MessageTree": {
Expand All @@ -56,8 +56,8 @@
}
}
},
"header": "0x15e53fc73037ad67a12a7af9a828218445cd4252d356f854d2a44b3e64d2262c00000002000000000000000000000000000000000000000000000000000000000000000200d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf200089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c314f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000200b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000010019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000018023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001800000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000066b1f64456496111355717b87a7e9ecde62b1fc8741933d730312153fedef883087dc5281903c6d005a7c0e98a4f604b0ab93953c162e50e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00dc15ea88fb4abf65ab3e6de30cdf91c104afb5cb14296a138c28d768b34aa5",
"header": "0x2d9d4655a6fd1c031557c03f8a95089d4d1ef097164b18e9b8eac3ed5efd689700000002000000000000000000000000000000000000000000000000000000000000000200e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb14f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000200b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000010019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000018023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001800000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000066b3335cdb59aa78df10a886e7987fedcf49ae50541b0f912eca3f1c9be9eef0c92d6f57fc6283f91d3bb957d4b876d425ba152859fbbf98000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00e438ef12f5ad7b6b0ca91e3234534e4e19cebe22b7474fedc0bc3a8ed89613",
"numTxs": 0
}
}
14 changes: 7 additions & 7 deletions l1-contracts/test/fixtures/mixed_block_1.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 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 @@ -132,14 +132,14 @@ impl BaseRollupInputs {
let siloed_l2_to_l1_msgs = self.kernel_data.public_inputs.end.l2_to_l1_msgs.map(
|message: ScopedL2ToL1Message| silo_l2_to_l1_message(message, self.kernel_data.public_inputs.constants.tx_context.version, self.kernel_data.public_inputs.constants.tx_context.chain_id)
);
let out_hash = compute_kernel_out_hash(siloed_l2_to_l1_msgs);
let tx_effects_hash = compute_tx_effects_hash(
self.kernel_data.public_inputs.end,
self.kernel_data.public_inputs.revert_code,
transaction_fee,
all_public_data_update_requests,
siloed_l2_to_l1_msgs
out_hash
);
let out_hash = compute_kernel_out_hash(siloed_l2_to_l1_msgs);

// Perform membership checks that the notes provided exist within the historical trees data
self.perform_archive_membership_checks();
Expand Down Expand Up @@ -1082,12 +1082,7 @@ mod tests {
#[test]
unconstrained fn empty_block_out_hash() {
let outputs = BaseRollupInputsBuilder::new().execute();
// For now setting an empty out hash to be H(0,0) to keep consistent
// with prev work.
let hash_input_flattened = [0; 64];
let sha_digest = std::hash::sha256(hash_input_flattened);
let expected_out_hash = field_from_bytes_32_trunc(sha_digest);
assert_eq(outputs.out_hash, expected_out_hash);
assert_eq(outputs.out_hash, 0);
}

#[test]
Expand Down
Loading
Loading