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 12, 2024
1 parent 1a06968 commit 1146e5d
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`] = `"0x086b4890110c751f01df5eb163b250f10c90a4f38e73e07e3b5a58685456eaa9"`;
exports[`PublicCallStackItem Computes a callstack item hash 1`] = `"0x136e4fbb5848d4f0735de90a19cac7828672facd1d952f73c0c8af3c82d6d7d9"`;

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

exports[`PublicCallStackItem computes hash 1`] = `Fr<0x198bebc3ae39ac7041b6f6cf91cf2055e577494f8f2145d81601b192f71e762a>`;
exports[`PublicCallStackItem computes hash 1`] = `Fr<0x1d19d7085ee1f6b76d275f7601e06bcd5cc83af2a4a59574f5f4d778ac846cbd>`;
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<0x153eea640dd0a53eaa029301381962507fb89e348d42d6f3335107644c6541b9>`;
exports[`PublicCircuitPublicInputs computes empty item hash 1`] = `Fr<0x0f1eb4e352e8dab6cbab3c63b6d8f3cd2cd90cc7ae5ff142e4dfa2b3e28e01c1>`;

exports[`PublicCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x2ae2a860d511acb274dca33de7a64693fe2948275ed149e2db832dd6ce21fc36>`;
exports[`PublicCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x0f2a7dd87db45394e5b7bf45035f05b9ed84e10c6d22c1f8f6e79fcfbac43e66>`;
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<0x01ffec73ac535628f98088b70f766f47989801a0dfc754cf4996f505cfd8f082>,
"address": AztecAddress<0x2be073a97730b61e19bf6f6648413d9abab90ef065ea7c149a1d8f7635aec291>,
"instance": {
"address": AztecAddress<0x01ffec73ac535628f98088b70f766f47989801a0dfc754cf4996f505cfd8f082>,
"contractClassId": Fr<0x2c32fd0ebccda2e20057f37fa2e6085c07d9a1236a72a54f58c724418f7b4438>,
"address": AztecAddress<0x2be073a97730b61e19bf6f6648413d9abab90ef065ea7c149a1d8f7635aec291>,
"contractClassId": Fr<0x2c6b365b1dc110add3663a88aa076b36b7237d676a68bb9d44cf2e8a8b04e86e>,
"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<0x2c32fd0ebccda2e20057f37fa2e6085c07d9a1236a72a54f58c724418f7b4438>,
"id": Fr<0x2c6b365b1dc110add3663a88aa076b36b7237d676a68bb9d44cf2e8a8b04e86e>,
"privateFunctions": [
{
"isInternal": false,
Expand All @@ -27,7 +27,7 @@ exports[`GasToken returns canonical protocol contract 2`] = `
},
],
"privateFunctionsRoot": Fr<0x13b29c3f4a96eb14d5d3539a6308ff9736ad5d67e3f61ffbb7da908e14980828>,
"publicBytecodeCommitment": Fr<0x1c5e1c199e3affad8f3d3ec7db3e3b40639b3c0ef82351506ceb25cde3b04924>,
"publicBytecodeCommitment": Fr<0x023582901a973bf0180121fd7d5f1055edf9424f60735ee900f05522fbe7df61>,
"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 @@ -605,7 +605,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 1146e5d

Please sign in to comment.