Skip to content

Commit

Permalink
test: fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Mar 13, 2024
1 parent c0a0965 commit 6331507
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 37 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PrivateCallStackItem computes empty item hash 1`] = `Fr<0x1c3b67cab2bc3dc2106cfeddd8ea68b8d445849f20ed3b9286ad684542aae25d>`;
exports[`PrivateCallStackItem computes empty item hash 1`] = `Fr<0x19196a5f02621a64ce289fb09fada7fd650a6874cb63e7d10c0d9a9bf5a366f5>`;

exports[`PrivateCallStackItem computes hash 1`] = `Fr<0x22029fc3a0b18b8f9fe4d5cdb237b9b5580c9dd2368299936d8deedf13d742c3>`;
exports[`PrivateCallStackItem computes hash 1`] = `Fr<0x0094610c51e8fd109091d6d7835670d25d0035ff207de051503fd9a9e7cc1c00>`;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PrivateCircuitPublicInputs computes empty inputs hash 1`] = `Fr<0x2745ec62624afeb19b86af3d440db1f8c3432e1d17a074c75cb8f44999fd3fae>`;
exports[`PrivateCircuitPublicInputs computes empty inputs hash 1`] = `Fr<0x2b5ba01a6b73b68b4f44196e2dea49afd4076333e2dee8eddc9186e080f18201>`;

exports[`PrivateCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x05eec129252f2229777f96446c2901e660c6e01e196000b57c99fb3aec43b160>`;
exports[`PrivateCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x25f066a8adb3889b9ebf162d7af91352a77200965cbc7900831b745e31342fb4>`;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PublicCallStackItem Computes a callstack item hash 1`] = `"0x187836686ed01f12180ef08c419e4ac8514d9c60e6a38b4a56d893fa90c83a5d"`;
exports[`PublicCallStackItem Computes a callstack item hash 1`] = `"0x1cec0b51f9394405a626c3b77081c96f1bdcb8bacf96960ae4749068f9b4da0d"`;

exports[`PublicCallStackItem Computes a callstack item request hash 1`] = `"0x1a1194c14f229b72d31669b06e3984d6f0f5edd4d5204ceda0ff30f25e910e83"`;
exports[`PublicCallStackItem Computes a callstack item request hash 1`] = `"0x00edd2f10c0cdf776ee2fff3c799bae6df5771f5013a2d5d7154601dffdcf869"`;

exports[`PublicCallStackItem computes hash 1`] = `Fr<0x0ef0cbf32ad96d5f6c7577b023a3b4f9a9cd5d53a8c9eb268324183aaa1437ff>`;
exports[`PublicCallStackItem computes hash 1`] = `Fr<0x002e34c7c46791fe0616effcbc5e9558eaaa69748c028e3ce36b34cdba695d2b>`;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PublicCircuitPublicInputs computes empty item hash 1`] = `Fr<0x1c9942cee14a4f84b3e606f553b2ab3151c395822ee7ffd51759d5822375d6c9>`;
exports[`PublicCircuitPublicInputs computes empty item hash 1`] = `Fr<0x083ac560a513d670a7f50f0a3052d42cb9816b7b643e62025b8278652ad637ab>`;

exports[`PublicCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x1135d901dacdffe956b9cd85c976a2c5fe311018164a3ec612ff8ed89f8d56cb>`;
exports[`PublicCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x26612d7a1afd04b2023d9a766f7c44042ebdfbd606e4b347fd4c201040c53658>`;
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ PrivateKernelInnerCircuitPublicInputs {
"inHash": Buffer<0x0000000000000000000000000000000000000000000000000000000000000000>,
"outHash": Buffer<0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71>,
"txTreeHeight": Fr<0x0000000000000000000000000000000000000000000000000000000000000001>,
"txsEffectsHash": Buffer<0x0cad04c3a06c5f97d6d094af228a4a7b761a1d38df3665978a0d762dc469c942>,
"txsEffectsHash": Buffer<0x448fc3aa205c28118e73ea04e5fd503e91a5ff0445d90e87a54c568760aa9581>,
},
"globalVariables": {
"blockNumber": "0x0000000000000000000000000000000000000000000000000000000000000003",
"chainId": "0x0000000000000000000000000000000000000000000000000000000000007a69",
"coinbase": "0x0000000000000000000000000000000000000000",
"feeRecipient": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x0000000000000000000000000000000000000000000000000000000065eb877a",
"timestamp": "0x0000000000000000000000000000000000000000000000000000000065f02cc4",
"version": "0x0000000000000000000000000000000000000000000000000000000000000001",
},
"lastArchive": AppendOnlyTreeSnapshot {
"nextAvailableLeafIndex": 3,
"root": Fr<0x1030919bf145ee4734f98c79b7afc25bcc6a930e1dc04c72eb5c4b9e09c35d46>,
"root": Fr<0x1d0040aabf056db63f2b7625c6eea73c582ef824344ad94d697bdfd86f3e95ff>,
},
"state": StateReference {
"l1ToL2MessageTree": AppendOnlyTreeSnapshot {
Expand All @@ -60,11 +60,11 @@ PrivateKernelInnerCircuitPublicInputs {
"partial": PartialStateReference {
"noteHashTree": AppendOnlyTreeSnapshot {
"nextAvailableLeafIndex": 384,
"root": Fr<0x229639c5f9187f3c44fa0eb2e8a64646e29f1268363740671c821e919585c76b>,
"root": Fr<0x22a43bb3c4925b391c63cc66f5f10f766d5b90084a82b8efce02b1f16065169f>,
},
"nullifierTree": AppendOnlyTreeSnapshot {
"nextAvailableLeafIndex": 512,
"root": Fr<0x0a17c7e333d7bdd626e86629674447bab07b373ea73dd6458318faea4c25e391>,
"root": Fr<0x056cd3cc8e081d1a451afc99affd18f8120e76cf34da1cb4c63e15062de82a2b>,
},
"publicDataTree": AppendOnlyTreeSnapshot {
"nextAvailableLeafIndex": 256,
Expand Down Expand Up @@ -352,7 +352,7 @@ PrivateKernelInnerCircuitPublicInputs {
SideEffectLinkedToNoteHash {
"counter": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
"noteHash": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
"value": Fr<0x1c99b3cc8b40ecf8a0467e913a1da927dffdcb1e2e75c3b15b460248c3da9eb6>,
"value": Fr<0x013662003171c1acbc3e0133f44b70cb273e0331042d7a1f936548846cfdbfe9>,
},
SideEffectLinkedToNoteHash {
"counter": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
Expand Down Expand Up @@ -1846,8 +1846,8 @@ PrivateKernelTailCircuitPublicInputs {
"end": PrivateAccumulatedRevertibleData {
"encryptedLogPreimagesLength": Fr<0x0000000000000000000000000000000000000000000000000000000000000138>,
"encryptedLogsHash": [
Fr<0x0000000000000000000000000000000061f5a418c428fb1975c2e8b76f482ebf>,
Fr<0x0000000000000000000000000000000072ccf265f6aeee4d2c8891ff291e2bd6>,
Fr<0x0000000000000000000000000000000066d06d5c85b0589e680afcb7bb5bfc94>,
Fr<0x000000000000000000000000000000008261394008a9906d449a3ded719ae66f>,
],
"newL2ToL1Msgs": [
Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
Expand All @@ -1856,7 +1856,7 @@ PrivateKernelTailCircuitPublicInputs {
"newNoteHashes": [
SideEffect {
"counter": Fr<0x0000000000000000000000000000000000000000000000000000000000000002>,
"value": Fr<0x072c4b0da6f03ff188d150944f5454ad2bdcf33165792b512c1a96fa228ef942>,
"value": Fr<0x2b79780b248bad130d40258e4578de16288ed68442c006c3ebf82009c7f7ee24>,
},
SideEffect {
"counter": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
Expand Down Expand Up @@ -2083,12 +2083,12 @@ PrivateKernelTailCircuitPublicInputs {
SideEffectLinkedToNoteHash {
"counter": Fr<0x0000000000000000000000000000000000000000000000000000000000000001>,
"noteHash": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
"value": Fr<0x103b591beaebdb709340d6ee8cfaf69acc0b785c8173747f2aec03be183fe86f>,
"value": Fr<0x0c5f77d84cfee8ed8b7824f61a88aaee6915599ac39bb7ae8b2f732467695e8f>,
},
SideEffectLinkedToNoteHash {
"counter": Fr<0x0000000000000000000000000000000000000000000000000000000000000003>,
"noteHash": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
"value": Fr<0x064dd0ecbabee0ee83581becef6195951cf972f6e68023ed41c14757d55c9e7e>,
"value": Fr<0x0160b7df7e45c89c5c42287dd41a6c59cbc0c9fa5a74ad8bfa453bd3aa815c15>,
},
SideEffectLinkedToNoteHash {
"counter": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
Expand Down Expand Up @@ -2540,7 +2540,7 @@ PrivateKernelTailCircuitPublicInputs {
SideEffectLinkedToNoteHash {
"counter": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
"noteHash": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
"value": Fr<0x1ed72effef28948e615c3ddb240c1f8e05d99f72a498152689c7d7313d3d5258>,
"value": Fr<0x210f9c98fe63acc9807540d387db22bad528207c1a0e92219344f17ab73d99c1>,
},
SideEffectLinkedToNoteHash {
"counter": Fr<0x0000000000000000000000000000000000000000000000000000000000000000>,
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

exports[`GasToken returns canonical protocol contract 1`] = `
{
"address": AztecAddress<0x2b3035985f1a4ed792a70cde88b7fee0f90f361b9e7f5842343fe67530906597>,
"address": AztecAddress<0x3031fab05a85bdca590affa67854fd9fe2fd2f87118bc25f664e2fb0443a8ed8>,
"instance": {
"address": AztecAddress<0x2b3035985f1a4ed792a70cde88b7fee0f90f361b9e7f5842343fe67530906597>,
"contractClassId": Fr<0x065cf6dd52fb349293d583cfc8ac8f4553770e7aa48ed37a5adf679fdbee7be4>,
"address": AztecAddress<0x3031fab05a85bdca590affa67854fd9fe2fd2f87118bc25f664e2fb0443a8ed8>,
"contractClassId": Fr<0x2126f223ecb60919e889e0192822d017db6fa0e46791f5b5cda3757701fecfc5>,
"initializationHash": Fr<0x0bf6e812f14bb029f7cb9c8da8367dd97c068e788d4f21007fd97014eba8cf9f>,
"portalContractAddress": EthAddress<0x0000000000000000000000000000000000000000>,
"publicKeysHash": Fr<0x27b1d0839a5b23baf12a8d195b18ac288fcf401afb2f70b8a4b529ede5fa9fed>,
Expand All @@ -18,7 +18,7 @@ exports[`GasToken returns canonical protocol contract 1`] = `
exports[`GasToken returns canonical protocol contract 2`] = `
{
"artifactHash": Fr<0x076fb6d7493b075a880eeed90fec7c4c01e0a24d442522449e4d56c26357205f>,
"id": Fr<0x065cf6dd52fb349293d583cfc8ac8f4553770e7aa48ed37a5adf679fdbee7be4>,
"id": Fr<0x2126f223ecb60919e889e0192822d017db6fa0e46791f5b5cda3757701fecfc5>,
"privateFunctions": [
{
"isInternal": false,
Expand All @@ -27,7 +27,7 @@ exports[`GasToken returns canonical protocol contract 2`] = `
},
],
"privateFunctionsRoot": Fr<0x13b29c3f4a96eb14d5d3539a6308ff9736ad5d67e3f61ffbb7da908e14980828>,
"publicBytecodeCommitment": Fr<0x18485f6c7fc11c817ccb544ba30e0c4f9c83742b3d6318d68037290e4e8c1c51>,
"publicBytecodeCommitment": Fr<0x1c220315e672398f017b49ceb31dcfe39aafe9965998ee57f5f58ccc0cd04623>,
"version": 1,
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
GlobalVariables,
Header,
MAX_NEW_L2_TO_L1_MSGS_PER_TX,
MAX_NEW_NOTE_HASHES_PER_TX,
MAX_NEW_NULLIFIERS_PER_TX,
MAX_NON_REVERTIBLE_NOTE_HASHES_PER_TX,
MAX_NON_REVERTIBLE_NULLIFIERS_PER_TX,
Expand All @@ -25,8 +26,10 @@ import {
PublicDataUpdateRequest,
PublicKernelCircuitPublicInputs,
RootRollupPublicInputs,
SideEffect,
SideEffectLinkedToNoteHash,
StateReference,
sideEffectCmp,
} from '@aztec/circuits.js';
import {
fr,
Expand Down Expand Up @@ -128,13 +131,25 @@ describe('sequencer/solo_block_builder', () => {
await expectsDb.appendLeaves(
MerkleTreeId.NOTE_HASH_TREE,
txs.flatMap(tx =>
[...tx.data.endNonRevertibleData.newNoteHashes, ...tx.data.end.newNoteHashes].map(l => l.value.toBuffer()),
padArrayEnd(
[...tx.data.endNonRevertibleData.newNoteHashes, ...tx.data.end.newNoteHashes]
.filter(x => !x.isEmpty())
.sort(sideEffectCmp),
SideEffect.empty(),
MAX_NEW_NOTE_HASHES_PER_TX,
).map(l => l.value.toBuffer()),
),
);
await expectsDb.batchInsert(
MerkleTreeId.NULLIFIER_TREE,
txs.flatMap(tx =>
[...tx.data.endNonRevertibleData.newNullifiers, ...tx.data.end.newNullifiers].map(x => x.value.toBuffer()),
padArrayEnd(
[...tx.data.endNonRevertibleData.newNullifiers, ...tx.data.end.newNullifiers]
.filter(x => !x.isEmpty())
.sort(sideEffectCmp),
SideEffectLinkedToNoteHash.empty(),
MAX_NEW_NULLIFIERS_PER_TX,
).map(x => x.value.toBuffer()),
),
NULLIFIER_SUBTREE_HEIGHT,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ class PublicExecutionResultBuilder {
contractStorageReads: [],
unencryptedLogs: new FunctionL2Logs([]),
startSideEffectCounter: Fr.ZERO,
endSideEffectCounter: new Fr(Math.max(...this._contractStorageUpdateRequests.map(r => r.sideEffectCounter ?? 0))),
endSideEffectCounter: Fr.ZERO,
reverted: this._reverted,
revertReason: this._revertReason,
};
Expand Down

0 comments on commit 6331507

Please sign in to comment.