Skip to content

Commit

Permalink
Merge 4b02c8b into 09e317d
Browse files Browse the repository at this point in the history
  • Loading branch information
MirandaWood authored Aug 12, 2024
2 parents 09e317d + 4b02c8b commit 015b06b
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 74 deletions.
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 @@ -281,9 +281,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
18 changes: 9 additions & 9 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": "0x0a5e13310d0c5b768e262a51b698d6aa3fb7f45e5d64708d7d3bfc3e8d3fc64a",
"archive": "0x0b97584f2e175ce708df94c14fee5e53d1c92cd5308346c6eabb79005ccf6733",
"body": "0x00000000",
"txsEffectsHash": "0x00d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf2",
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6",
"decodedHeader": {
"contentCommitment": {
"inHash": "0x00089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c",
"outHash": "0x0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c3",
"outHash": "0x00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb",
"numTxs": 2,
"txsEffectsHash": "0x00d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf2"
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6"
},
"globalVariables": {
"blockNumber": 1,
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000005",
"chainId": 31337,
"timestamp": 1723019086,
"timestamp": 1723460388,
"version": 1,
"coinbase": "0x6e255429b3eecd76bc5123d4539de205bfc8ed04",
"feeRecipient": "0x3020f3cce26a2e314fa3cade1dc808c87e6deab7b1c90a86c383428189c062b1",
"coinbase": "0x92c3bc662a41b5406370e6e30b6e4541c9c223e3",
"feeRecipient": "0x2af4d139729812fa69edfc27fc2d19b3d2616c9e4ec2313efb66fb2f234d59da",
"gasFees": {
"feePerDaGas": 0,
"feePerL2Gas": 0
Expand Down Expand Up @@ -56,8 +56,8 @@
}
}
},
"header": "0x1200a06aae1368abe36530b585bd7a4d2ba4de5037b82076412691a187d7621e00000001000000000000000000000000000000000000000000000000000000000000000200d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf200089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c314f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000100b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000008019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000010023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001000000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000066b32f4e6e255429b3eecd76bc5123d4539de205bfc8ed043020f3cce26a2e314fa3cade1dc808c87e6deab7b1c90a86c383428189c062b1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00e3c26b1e5dbca4734754e663ec588ed9e101588a8ece487c82934f559cfedd",
"header": "0x1200a06aae1368abe36530b585bd7a4d2ba4de5037b82076412691a187d7621e00000001000000000000000000000000000000000000000000000000000000000000000200e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb14f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000100b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000008019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000010023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001000000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000066b9eb2492c3bc662a41b5406370e6e30b6e4541c9c223e32af4d139729812fa69edfc27fc2d19b3d2616c9e4ec2313efb66fb2f234d59da000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00330b9ccec92816ea3dd5fefce65cdb3803cf663cf2959f403501ff1f27a73c",
"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": "0x2b5b19f8f6282401f17498335c43653551c57ff4b1bd98d00d1429d79c50d293",
"archive": "0x1d77208270a6eca3c2b56adaad130b28e2fa111d6bc325ce3cc52b6a68f4894f",
"body": "0x00000000",
"txsEffectsHash": "0x00d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf2",
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6",
"decodedHeader": {
"contentCommitment": {
"inHash": "0x00089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c",
"outHash": "0x0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c3",
"outHash": "0x00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb",
"numTxs": 2,
"txsEffectsHash": "0x00d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf2"
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6"
},
"globalVariables": {
"blockNumber": 2,
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000006",
"chainId": 31337,
"timestamp": 1723019098,
"timestamp": 1723460400,
"version": 1,
"coinbase": "0x6e255429b3eecd76bc5123d4539de205bfc8ed04",
"feeRecipient": "0x3020f3cce26a2e314fa3cade1dc808c87e6deab7b1c90a86c383428189c062b1",
"coinbase": "0x92c3bc662a41b5406370e6e30b6e4541c9c223e3",
"feeRecipient": "0x2af4d139729812fa69edfc27fc2d19b3d2616c9e4ec2313efb66fb2f234d59da",
"gasFees": {
"feePerDaGas": 0,
"feePerL2Gas": 0
}
},
"lastArchive": {
"nextAvailableLeafIndex": 2,
"root": "0x0a5e13310d0c5b768e262a51b698d6aa3fb7f45e5d64708d7d3bfc3e8d3fc64a"
"root": "0x0b97584f2e175ce708df94c14fee5e53d1c92cd5308346c6eabb79005ccf6733"
},
"stateReference": {
"l1ToL2MessageTree": {
Expand All @@ -56,8 +56,8 @@
}
}
},
"header": "0x0a5e13310d0c5b768e262a51b698d6aa3fb7f45e5d64708d7d3bfc3e8d3fc64a00000002000000000000000000000000000000000000000000000000000000000000000200d09e7feff5a1049661763ded52742f02aac5d9793b27a40d6b9c60a668bdf200089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c0007638bb56b6dda2b64b8f76841114ac3a87a1820030e2e16772c4d294879c314f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000200b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000010019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000018023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001800000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000066b32f5a6e255429b3eecd76bc5123d4539de205bfc8ed043020f3cce26a2e314fa3cade1dc808c87e6deab7b1c90a86c383428189c062b1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x009806b2a395a75e618221b9a39c98be96c7a4053616894d9bc92bbd35c92eb0",
"header": "0x0b97584f2e175ce708df94c14fee5e53d1c92cd5308346c6eabb79005ccf673300000002000000000000000000000000000000000000000000000000000000000000000200e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb14f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000200b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000010019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000018023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001800000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000066b9eb3092c3bc662a41b5406370e6e30b6e4541c9c223e32af4d139729812fa69edfc27fc2d19b3d2616c9e4ec2313efb66fb2f234d59da000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x006ccf0ce5551a2a07b16c10a4b208bd30403231409d44cedac9b6d489b9f212",
"numTxs": 0
}
}
16 changes: 8 additions & 8 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

0 comments on commit 015b06b

Please sign in to comment.