@aztec/stdlib 0.82.2 → 0.82.3-nightly.20250330

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dest/avm/avm.d.ts +919 -1252
  2. package/dest/avm/avm.d.ts.map +1 -1
  3. package/dest/avm/avm.js +138 -111
  4. package/dest/avm/avm_proving_request.d.ts +400 -575
  5. package/dest/avm/avm_proving_request.d.ts.map +1 -1
  6. package/dest/block/l2_block_downloader/l2_block_stream.d.ts +1 -0
  7. package/dest/block/l2_block_downloader/l2_block_stream.d.ts.map +1 -1
  8. package/dest/block/l2_block_downloader/l2_block_stream.js +6 -0
  9. package/dest/config/config.d.ts +1 -1
  10. package/dest/config/config.d.ts.map +1 -1
  11. package/dest/config/config.js +1 -2
  12. package/dest/database-version/version_manager.d.ts +4 -2
  13. package/dest/database-version/version_manager.d.ts.map +1 -1
  14. package/dest/database-version/version_manager.js +13 -9
  15. package/dest/epoch-helpers/index.d.ts +2 -0
  16. package/dest/epoch-helpers/index.d.ts.map +1 -1
  17. package/dest/epoch-helpers/index.js +3 -0
  18. package/dest/file-store/factory.d.ts +7 -0
  19. package/dest/file-store/factory.d.ts.map +1 -0
  20. package/dest/file-store/factory.js +46 -0
  21. package/dest/file-store/gcs.d.ts +22 -0
  22. package/dest/file-store/gcs.d.ts.map +1 -0
  23. package/dest/file-store/gcs.js +115 -0
  24. package/dest/file-store/http.d.ts +15 -0
  25. package/dest/file-store/http.d.ts.map +1 -0
  26. package/dest/file-store/http.js +53 -0
  27. package/dest/file-store/index.d.ts +3 -0
  28. package/dest/file-store/index.d.ts.map +1 -0
  29. package/dest/file-store/index.js +2 -0
  30. package/dest/file-store/interface.d.ts +24 -0
  31. package/dest/file-store/interface.d.ts.map +1 -0
  32. package/dest/file-store/interface.js +1 -0
  33. package/dest/file-store/local.d.ts +16 -0
  34. package/dest/file-store/local.d.ts.map +1 -0
  35. package/dest/file-store/local.js +40 -0
  36. package/dest/interfaces/aztec-node-admin.d.ts +9 -1
  37. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  38. package/dest/interfaces/aztec-node-admin.js +2 -1
  39. package/dest/interfaces/aztec-node.d.ts +3 -0
  40. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  41. package/dest/interfaces/aztec-node.js +2 -0
  42. package/dest/interfaces/p2p.d.ts +2 -0
  43. package/dest/interfaces/p2p.d.ts.map +1 -1
  44. package/dest/interfaces/p2p.js +2 -1
  45. package/dest/interfaces/prover-node.d.ts +4 -0
  46. package/dest/interfaces/prover-node.d.ts.map +1 -1
  47. package/dest/interfaces/prover-node.js +5 -1
  48. package/dest/interfaces/proving-job.d.ts +400 -575
  49. package/dest/interfaces/proving-job.d.ts.map +1 -1
  50. package/dest/interfaces/pxe.d.ts +5 -4
  51. package/dest/interfaces/pxe.d.ts.map +1 -1
  52. package/dest/interfaces/pxe.js +1 -1
  53. package/dest/interfaces/service.d.ts +3 -0
  54. package/dest/interfaces/service.d.ts.map +1 -1
  55. package/dest/interfaces/service.js +7 -0
  56. package/dest/interfaces/world_state.d.ts +13 -15
  57. package/dest/interfaces/world_state.d.ts.map +1 -1
  58. package/dest/snapshots/download.d.ts +9 -0
  59. package/dest/snapshots/download.d.ts.map +1 -0
  60. package/dest/snapshots/download.js +37 -0
  61. package/dest/snapshots/index.d.ts +4 -0
  62. package/dest/snapshots/index.d.ts.map +1 -0
  63. package/dest/snapshots/index.js +3 -0
  64. package/dest/snapshots/types.d.ts +97 -0
  65. package/dest/snapshots/types.d.ts.map +1 -0
  66. package/dest/snapshots/types.js +27 -0
  67. package/dest/snapshots/upload.d.ts +5 -0
  68. package/dest/snapshots/upload.d.ts.map +1 -0
  69. package/dest/snapshots/upload.js +37 -0
  70. package/dest/tests/factories.d.ts +13 -7
  71. package/dest/tests/factories.d.ts.map +1 -1
  72. package/dest/tests/factories.js +37 -25
  73. package/dest/tests/mocks.d.ts +2 -1
  74. package/dest/tests/mocks.d.ts.map +1 -1
  75. package/dest/tests/mocks.js +5 -1
  76. package/dest/trees/merkle_tree_id.d.ts +8 -0
  77. package/dest/trees/merkle_tree_id.d.ts.map +1 -1
  78. package/dest/trees/merkle_tree_id.js +10 -0
  79. package/dest/trees/nullifier_leaf.d.ts +11 -2
  80. package/dest/trees/nullifier_leaf.d.ts.map +1 -1
  81. package/dest/trees/nullifier_leaf.js +12 -7
  82. package/dest/trees/nullifier_membership_witness.d.ts +7 -7
  83. package/dest/trees/public_data_leaf.d.ts +13 -0
  84. package/dest/trees/public_data_leaf.d.ts.map +1 -1
  85. package/dest/trees/public_data_leaf.js +6 -0
  86. package/dest/trees/public_data_witness.d.ts +7 -7
  87. package/dest/validators/index.d.ts +3 -0
  88. package/dest/validators/index.d.ts.map +1 -0
  89. package/dest/validators/index.js +1 -0
  90. package/dest/validators/schemas.d.ts +342 -0
  91. package/dest/validators/schemas.d.ts.map +1 -0
  92. package/dest/validators/schemas.js +40 -0
  93. package/dest/validators/types.d.ts +39 -0
  94. package/dest/validators/types.d.ts.map +1 -0
  95. package/dest/validators/types.js +1 -0
  96. package/package.json +11 -7
  97. package/src/avm/avm.ts +131 -106
  98. package/src/block/l2_block_downloader/l2_block_stream.ts +6 -0
  99. package/src/config/config.ts +2 -2
  100. package/src/database-version/version_manager.ts +12 -8
  101. package/src/epoch-helpers/index.ts +8 -0
  102. package/src/file-store/factory.ts +61 -0
  103. package/src/file-store/gcs.ts +121 -0
  104. package/src/file-store/http.ts +58 -0
  105. package/src/file-store/index.ts +2 -0
  106. package/src/file-store/interface.ts +19 -0
  107. package/src/file-store/local.ts +46 -0
  108. package/src/interfaces/aztec-node-admin.ts +11 -1
  109. package/src/interfaces/aztec-node.ts +7 -0
  110. package/src/interfaces/p2p.ts +4 -0
  111. package/src/interfaces/prover-node.ts +10 -0
  112. package/src/interfaces/pxe.ts +12 -5
  113. package/src/interfaces/service.ts +13 -0
  114. package/src/interfaces/world_state.ts +17 -15
  115. package/src/snapshots/download.ts +60 -0
  116. package/src/snapshots/index.ts +3 -0
  117. package/src/snapshots/types.ts +58 -0
  118. package/src/snapshots/upload.ts +53 -0
  119. package/src/tests/factories.ts +74 -54
  120. package/src/tests/mocks.ts +7 -0
  121. package/src/trees/merkle_tree_id.ts +12 -0
  122. package/src/trees/nullifier_leaf.ts +9 -5
  123. package/src/trees/public_data_leaf.ts +9 -0
  124. package/src/validators/index.ts +3 -0
  125. package/src/validators/schemas.ts +53 -0
  126. package/src/validators/types.ts +37 -0
@@ -3,14 +3,14 @@ import { ARCHIVE_HEIGHT, AVM_PROOF_LENGTH_IN_FIELDS, AZTEC_MAX_EPOCH_DURATION, B
3
3
  import { makeHalfFullTuple, makeTuple } from '@aztec/foundation/array';
4
4
  import { toBufferBE } from '@aztec/foundation/bigint-buffer';
5
5
  import { compact } from '@aztec/foundation/collection';
6
- import { SchnorrSignature, poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
6
+ import { SchnorrSignature, poseidon2HashWithSeparator, sha256 } from '@aztec/foundation/crypto';
7
7
  import { EthAddress } from '@aztec/foundation/eth-address';
8
8
  import { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
9
9
  import { MembershipWitness } from '@aztec/foundation/trees';
10
10
  import { FunctionSelector } from '../abi/function_selector.js';
11
11
  import { ContractStorageRead } from '../avm/contract_storage_read.js';
12
12
  import { ContractStorageUpdateRequest } from '../avm/contract_storage_update_request.js';
13
- import { AvmAccumulatedData, AvmAppendTreeHint, AvmBytecodeCommitmentHint, AvmCircuitInputs, AvmCircuitPublicInputs, AvmContractClassHint, AvmContractInstanceHint, AvmEnqueuedCallHint, AvmExecutionHints, AvmNullifierReadTreeHint, AvmNullifierWriteTreeHint, AvmPublicDataReadTreeHint, AvmPublicDataWriteTreeHint, RevertCode } from '../avm/index.js';
13
+ import { AvmAccumulatedData, AvmBytecodeCommitmentHint, AvmCircuitInputs, AvmCircuitPublicInputs, AvmContractClassHint, AvmContractInstanceHint, AvmEnqueuedCallHint, AvmExecutionHints, AvmGetLeafPreimageHintNullifierTree, AvmGetLeafPreimageHintPublicDataTree, AvmGetLeafValueHint, AvmGetPreviousValueIndexHint, AvmGetSiblingPathHint, RevertCode } from '../avm/index.js';
14
14
  import { PublicDataHint } from '../avm/public_data_hint.js';
15
15
  import { PublicDataRead } from '../avm/public_data_read.js';
16
16
  import { PublicDataWrite } from '../avm/public_data_write.js';
@@ -60,7 +60,7 @@ import { PublicTubeData } from '../rollup/public_tube_data.js';
60
60
  import { RootRollupInputs, RootRollupPublicInputs } from '../rollup/root_rollup.js';
61
61
  import { PrivateBaseStateDiffHints } from '../rollup/state_diff_hints.js';
62
62
  import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
63
- import { NullifierLeafPreimage } from '../trees/nullifier_leaf.js';
63
+ import { NullifierLeaf, NullifierLeafPreimage } from '../trees/nullifier_leaf.js';
64
64
  import { PublicDataTreeLeaf, PublicDataTreeLeafPreimage } from '../trees/public_data_leaf.js';
65
65
  import { BlockHeader } from '../tx/block_header.js';
66
66
  import { CallContext } from '../tx/call_context.js';
@@ -574,6 +574,13 @@ function makeTreeSnapshots(seed = 0) {
574
574
  */ export function makePublicDataTreeLeaf(seed = 0) {
575
575
  return new PublicDataTreeLeaf(new Fr(seed), new Fr(seed + 1));
576
576
  }
577
+ /**
578
+ * Makes arbitrary nullifier leaf.
579
+ * @param seed - The seed to use for generating the nullifier leaf.
580
+ * @returns A nullifier leaf.
581
+ */ export function makeNullifierLeaf(seed = 0) {
582
+ return new NullifierLeaf(new Fr(seed));
583
+ }
577
584
  /**
578
585
  * Makes arbitrary public data tree leaf preimages.
579
586
  * @param seed - The seed to use for generating the public data tree leaf preimage.
@@ -757,24 +764,31 @@ export async function makeContractInstanceFromClassId(classId, seed = 0, overrid
757
764
  publicKeys
758
765
  }).withAddress(address);
759
766
  }
760
- export function makeAvmTreeHints(seed = 0) {
761
- return new AvmAppendTreeHint(new Fr(seed), new Fr(seed + 1), makeArray(10, (i)=>new Fr(i), seed + 0x1000));
762
- }
763
- export function makeAvmNullifierReadTreeHints(seed = 0) {
764
- const lowNullifierPreimage = new NullifierLeafPreimage(new Fr(seed), new Fr(seed + 1), BigInt(seed + 2));
765
- return new AvmNullifierReadTreeHint(lowNullifierPreimage, new Fr(seed + 1), makeArray(10, (i)=>new Fr(i), seed + 0x1000));
767
+ export function makeAvmGetSiblingPathHint(seed = 0) {
768
+ // We want a possibly large index, but non-random.
769
+ const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
770
+ return new AvmGetSiblingPathHint(makeAppendOnlyTreeSnapshot(seed), /*treeId=*/ (seed + 1) % 5, /*index=*/ index, makeArray(seed % 64, (i)=>new Fr(i), seed + 10));
766
771
  }
767
- export function makeAvmPublicDataReadTreeHints(seed = 0) {
768
- return new AvmPublicDataReadTreeHint(new PublicDataTreeLeafPreimage(new Fr(seed), new Fr(seed + 1), new Fr(seed + 2), BigInt(seed + 3)), new Fr(seed + 1), makeArray(10, (i)=>new Fr(i), seed + 0x1000));
772
+ export function makeAvmGetPreviousValueIndexHint(seed = 0) {
773
+ // We want a possibly large index, but non-random.
774
+ const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
775
+ const value = new Fr(BigInt(`0x${sha256(Buffer.from((seed + 2).toString())).toString('hex')}`) % (1n << 128n));
776
+ return new AvmGetPreviousValueIndexHint(makeAppendOnlyTreeSnapshot(seed), /*treeId=*/ (seed + 1) % 5, value, index, /*alreadyPresent=*/ index % 2n === 0n);
769
777
  }
770
- export function makeAvmNullifierInsertionTreeHints(seed = 0) {
771
- return new AvmNullifierWriteTreeHint(makeAvmNullifierReadTreeHints(seed), makeArray(20, (i)=>new Fr(i), seed + 0x1000));
778
+ export function makeAvmGetLeafPreimageHintPublicDataTree(seed = 0) {
779
+ // We want a possibly large index, but non-random.
780
+ const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
781
+ return new AvmGetLeafPreimageHintPublicDataTree(makeAppendOnlyTreeSnapshot(seed), /*index=*/ index, /*leaf=*/ makePublicDataTreeLeaf(seed + 3), /*nextIndex=*/ index + 1n, /*nextValue*/ new Fr(seed + 0x500));
772
782
  }
773
- export function makeAvmStorageReadTreeHints(seed = 0) {
774
- return new AvmPublicDataReadTreeHint(new PublicDataTreeLeafPreimage(new Fr(seed), new Fr(seed + 1), new Fr(seed + 2), BigInt(seed + 3)), new Fr(seed + 1), makeArray(10, (i)=>new Fr(i), seed + 0x1000));
783
+ export function makeAvmGetLeafPreimageHintNullifierTree(seed = 0) {
784
+ // We want a possibly large index, but non-random.
785
+ const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
786
+ return new AvmGetLeafPreimageHintNullifierTree(makeAppendOnlyTreeSnapshot(seed), /*index=*/ index, /*leaf=*/ makeNullifierLeaf(seed + 3), /*nextIndex=*/ index + 1n, /*nextValue*/ new Fr(seed + 0x500));
775
787
  }
776
- export function makeAvmStorageUpdateTreeHints(seed = 0) {
777
- return new AvmPublicDataWriteTreeHint(makeAvmStorageReadTreeHints(seed), new PublicDataTreeLeafPreimage(new Fr(seed), new Fr(seed + 1), new Fr(seed + 2), BigInt(seed + 3)), makeArray(20, (i)=>new Fr(i), seed + 0x1000));
788
+ export function makeAvmGetLeafValueHint(seed = 0) {
789
+ // We want a possibly large index, but non-random.
790
+ const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
791
+ return new AvmGetLeafValueHint(makeAppendOnlyTreeSnapshot(seed), /*treeId=*/ (seed + 1) % 5, /*index=*/ index, /*value=*/ new Fr(seed + 3));
778
792
  }
779
793
  /**
780
794
  * Makes arbitrary AvmContractInstanceHint.
@@ -811,16 +825,14 @@ export function makeAvmEnqueuedCallHint(seed = 0) {
811
825
  contractInstances: makeArray(baseLength + 2, makeAvmContractInstanceHint, seed + 0x4700),
812
826
  contractClasses: makeArray(baseLength + 5, makeAvmContractClassHint, seed + 0x4900),
813
827
  bytecodeCommitments: await makeArrayAsync(baseLength + 5, makeAvmBytecodeCommitmentHint, seed + 0x4900),
814
- publicDataReads: makeArray(baseLength + 7, makeAvmStorageReadTreeHints, seed + 0x4900),
815
- publicDataWrites: makeArray(baseLength + 8, makeAvmStorageUpdateTreeHints, seed + 0x4a00),
816
- nullifierReads: makeArray(baseLength + 9, makeAvmNullifierReadTreeHints, seed + 0x4b00),
817
- nullifierWrites: makeArray(baseLength + 10, makeAvmNullifierInsertionTreeHints, seed + 0x4c00),
818
- noteHashReads: makeArray(baseLength + 11, makeAvmTreeHints, seed + 0x4d00),
819
- noteHashWrites: makeArray(baseLength + 12, makeAvmTreeHints, seed + 0x4e00),
820
- l1ToL2MessageReads: makeArray(baseLength + 13, makeAvmTreeHints, seed + 0x4f00),
828
+ getSiblingPathHints: makeArray(baseLength + 5, makeAvmGetSiblingPathHint, seed + 0x4b00),
829
+ getPreviousValueIndexHints: makeArray(baseLength + 5, makeAvmGetPreviousValueIndexHint, seed + 0x4d00),
830
+ getLeafPreimageHintPublicDataTree: makeArray(baseLength + 5, makeAvmGetLeafPreimageHintPublicDataTree, seed + 0x4f00),
831
+ getLeafPreimageHintNullifierTree: makeArray(baseLength + 5, makeAvmGetLeafPreimageHintNullifierTree, seed + 0x5100),
832
+ getLeafValueHints: makeArray(baseLength + 5, makeAvmGetLeafValueHint, seed + 0x5300),
821
833
  ...overrides
822
834
  };
823
- return new AvmExecutionHints(fields.enqueuedCalls, fields.contractInstances, fields.contractClasses, fields.bytecodeCommitments, fields.publicDataReads, fields.publicDataWrites, fields.nullifierReads, fields.nullifierWrites, fields.noteHashReads, fields.noteHashWrites, fields.l1ToL2MessageReads);
835
+ return new AvmExecutionHints(fields.enqueuedCalls, fields.contractInstances, fields.contractClasses, fields.bytecodeCommitments, fields.getSiblingPathHints, fields.getPreviousValueIndexHints, fields.getLeafPreimageHintPublicDataTree, fields.getLeafPreimageHintNullifierTree, fields.getLeafValueHints);
824
836
  }
825
837
  /**
826
838
  * Creates arbitrary AvmCircuitInputs.
@@ -13,9 +13,10 @@ import { TxHash } from '../tx/tx_hash.js';
13
13
  export declare const randomTxHash: () => TxHash;
14
14
  export declare const randomExtendedNote: ({ note, recipient, contractAddress, txHash, storageSlot, }?: Partial<ExtendedNote>) => Promise<ExtendedNote>;
15
15
  export declare const randomUniqueNote: ({ note, recipient, contractAddress, txHash, storageSlot, nonce, }?: Partial<UniqueNote>) => Promise<UniqueNote>;
16
- export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRequests, numberOfRevertiblePublicCallRequests, hasPublicTeardownCallRequest, publicCalldataSize, feePayer, clientIvcProof, }?: {
16
+ export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRequests, numberOfRevertiblePublicCallRequests, numberOfRevertibleNullifiers, hasPublicTeardownCallRequest, publicCalldataSize, feePayer, clientIvcProof, }?: {
17
17
  numberOfNonRevertiblePublicCallRequests?: number;
18
18
  numberOfRevertiblePublicCallRequests?: number;
19
+ numberOfRevertibleNullifiers?: number;
19
20
  hasPublicTeardownCallRequest?: boolean;
20
21
  publicCalldataSize?: number;
21
22
  feePayer?: AztecAddress;
@@ -1 +1 @@
1
- {"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAe,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAUxE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,a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,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,gBAkDF,CAAC;AAEF,eAAO,MAAM,eAAe,gCAC2E,CAAC;AAkBxG,eAAO,MAAM,eAAe,gDAgB3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAO,gBAWxC,CAAC;AAEH,eAAO,MAAM,iCAAiC,UACtC;IAAE,eAAe,CAAC,EAAE,EAAE,CAAA;CAAE,YACpB,YAAY,KACrB,QAAQ,2BAA2B,CAUrC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;EAIlC,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,EAAE,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAyBD,eAAO,MAAM,iBAAiB,aAAoB,2BAA2B,KAAG,QAAQ,aAAa,CAGpG,CAAC;AAGF,eAAO,MAAM,oBAAoB,aAAoB,2BAA2B,KAAG,QAAQ,gBAAgB,CAG1G,CAAC"}
@@ -32,7 +32,7 @@ export const randomExtendedNote = async ({ note = Note.random(), recipient = und
32
32
  export const randomUniqueNote = async ({ note = Note.random(), recipient = undefined, contractAddress = undefined, txHash = randomTxHash(), storageSlot = Fr.random(), nonce = Fr.random() } = {})=>{
33
33
  return new UniqueNote(note, recipient ?? await AztecAddress.random(), contractAddress ?? await AztecAddress.random(), storageSlot, txHash, nonce);
34
34
  };
35
- export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, hasPublicTeardownCallRequest = false, publicCalldataSize = 2, feePayer, clientIvcProof = ClientIvcProof.empty() } = {})=>{
35
+ export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertibleNullifiers = 0, hasPublicTeardownCallRequest = false, publicCalldataSize = 2, feePayer, clientIvcProof = ClientIvcProof.empty() } = {})=>{
36
36
  const totalPublicCallRequests = numberOfNonRevertiblePublicCallRequests + numberOfRevertiblePublicCallRequests + (hasPublicTeardownCallRequest ? 1 : 0);
37
37
  const isForPublic = totalPublicCallRequests > 0;
38
38
  const data = PrivateKernelTailCircuitPublicInputs.empty();
@@ -60,6 +60,10 @@ export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests
60
60
  data.forPublic.publicTeardownCallRequest = publicCallRequests.pop();
61
61
  }
62
62
  data.forPublic.nonRevertibleAccumulatedData = nonRevertibleBuilder.pushNullifier(firstNullifier.value).withPublicCallRequests(publicCallRequests.slice(numberOfRevertiblePublicCallRequests)).build();
63
+ for(let i = 0; i < numberOfRevertibleNullifiers; i++){
64
+ const revertibleNullifier = new Nullifier(new Fr(seed + 2 + i), 0, Fr.ZERO);
65
+ revertibleBuilder.pushNullifier(revertibleNullifier.value);
66
+ }
63
67
  data.forPublic.revertibleAccumulatedData = revertibleBuilder.withPublicCallRequests(publicCallRequests.slice(0, numberOfRevertiblePublicCallRequests)).build();
64
68
  }
65
69
  return new Tx(data, clientIvcProof, [], publicFunctionCalldata);
@@ -19,5 +19,13 @@ declare const TREE_HEIGHTS: {
19
19
  };
20
20
  export type TreeHeights = typeof TREE_HEIGHTS;
21
21
  export declare function getTreeHeight<TID extends MerkleTreeId>(treeId: TID): TreeHeights[TID];
22
+ declare const TREE_NAMES: {
23
+ readonly 0: "NULLIFIER_TREE";
24
+ readonly 1: "NOTE_HASH_TREE";
25
+ readonly 2: "PUBLIC_DATA_TREE";
26
+ readonly 3: "L1_TO_L2_MESSAGE_TREE";
27
+ readonly 4: "ARCHIVE";
28
+ };
29
+ export declare function getTreeName<TID extends MerkleTreeId>(treeId: TID): (typeof TREE_NAMES)[TID];
22
30
  export {};
23
31
  //# sourceMappingURL=merkle_tree_id.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"merkle_tree_id.d.ts","sourceRoot":"","sources":["../../src/trees/merkle_tree_id.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,oBAAY,YAAY;IACtB,cAAc,IAAoB,CAAE,IAAI;IACxC,cAAc,IAAoB,CAAE,IAAI;IACxC,gBAAgB,IAAsB,CAAE,IAAI;IAC5C,qBAAqB,IAA2B,CAAE,IAAI;IACtD,OAAO,IAAkB;CAC1B;AAED,eAAO,MAAM,aAAa,sBAEzB,CAAC;AAEF,QAAA,MAAM,YAAY;;;;;;CAMR,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC;AAE9C,wBAAgB,aAAa,CAAC,GAAG,SAAS,YAAY,EAAE,MAAM,EAAE,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAErF"}
1
+ {"version":3,"file":"merkle_tree_id.d.ts","sourceRoot":"","sources":["../../src/trees/merkle_tree_id.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,oBAAY,YAAY;IACtB,cAAc,IAAoB,CAAE,IAAI;IACxC,cAAc,IAAoB,CAAE,IAAI;IACxC,gBAAgB,IAAsB,CAAE,IAAI;IAC5C,qBAAqB,IAA2B,CAAE,IAAI;IACtD,OAAO,IAAkB;CAC1B;AAED,eAAO,MAAM,aAAa,sBAEzB,CAAC;AAEF,QAAA,MAAM,YAAY;;;;;;CAMR,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC;AAE9C,wBAAgB,aAAa,CAAC,GAAG,SAAS,YAAY,EAAE,MAAM,EAAE,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAErF;AAED,QAAA,MAAM,UAAU;;;;;;CAMN,CAAC;AAEX,wBAAgB,WAAW,CAAC,GAAG,SAAS,YAAY,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,GAAG,CAAC,CAE3F"}
@@ -23,3 +23,13 @@ const TREE_HEIGHTS = {
23
23
  export function getTreeHeight(treeId) {
24
24
  return TREE_HEIGHTS[treeId];
25
25
  }
26
+ const TREE_NAMES = {
27
+ [MerkleTreeId.NULLIFIER_TREE]: 'NULLIFIER_TREE',
28
+ [MerkleTreeId.NOTE_HASH_TREE]: 'NOTE_HASH_TREE',
29
+ [MerkleTreeId.PUBLIC_DATA_TREE]: 'PUBLIC_DATA_TREE',
30
+ [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: 'L1_TO_L2_MESSAGE_TREE',
31
+ [MerkleTreeId.ARCHIVE]: 'ARCHIVE'
32
+ };
33
+ export function getTreeName(treeId) {
34
+ return TREE_NAMES[treeId];
35
+ }
@@ -72,17 +72,26 @@ export declare class NullifierLeaf implements IndexedTreeLeaf {
72
72
  /**
73
73
  * Nullifier value.
74
74
  */
75
- nullifier: Fr;
75
+ value: Fr;
76
76
  constructor(
77
77
  /**
78
78
  * Nullifier value.
79
79
  */
80
- nullifier: Fr);
80
+ value: Fr);
81
81
  getKey(): bigint;
82
82
  toBuffer(): Buffer;
83
83
  isEmpty(): boolean;
84
84
  updateTo(_another: NullifierLeaf): NullifierLeaf;
85
85
  static buildDummy(key: bigint): NullifierLeaf;
86
86
  static fromBuffer(buf: Buffer): NullifierLeaf;
87
+ static get schema(): z.ZodEffects<z.ZodObject<{
88
+ value: z.ZodType<Fr, any, string>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ value: Fr;
91
+ }, {
92
+ value: string;
93
+ }>, NullifierLeaf, {
94
+ value: string;
95
+ }>;
87
96
  }
88
97
  //# sourceMappingURL=nullifier_leaf.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nullifier_leaf.d.ts","sourceRoot":"","sources":["../../src/trees/nullifier_leaf.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA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OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,qBAAqB;IAI/F,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,qBAAqB,GAAG,qBAAqB;CAGrE;AAED;;GAEG;AACH,qBAAa,aAAc,YAAW,eAAe;IAEjD;;OAEG;IACI,KAAK,EAAE,EAAE;;IAHhB;;OAEG;IACI,KAAK,EAAE,EAAE;IAGlB,MAAM,IAAI,MAAM;IAIhB,QAAQ,IAAI,MAAM;IAIlB,OAAO,IAAI,OAAO;IAIlB,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa;IAIhD,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa;IAI7C,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa;IAI7C,MAAM,KAAK,MAAM;;;;;;;;OAEhB;CACF"}
@@ -67,7 +67,7 @@ import { z } from 'zod';
67
67
  return new NullifierLeafPreimage(reader.readObject(Fr), reader.readObject(Fr), toBigIntBE(reader.readBytes(32)));
68
68
  }
69
69
  static fromLeaf(leaf, nextKey, nextIndex) {
70
- return new NullifierLeafPreimage(leaf.nullifier, new Fr(nextKey), nextIndex);
70
+ return new NullifierLeafPreimage(leaf.value, new Fr(nextKey), nextIndex);
71
71
  }
72
72
  static clone(preimage) {
73
73
  return new NullifierLeafPreimage(preimage.nullifier, preimage.nextNullifier, preimage.nextIndex);
@@ -76,20 +76,20 @@ import { z } from 'zod';
76
76
  /**
77
77
  * A nullifier to be inserted in the nullifier tree.
78
78
  */ export class NullifierLeaf {
79
- nullifier;
79
+ value;
80
80
  constructor(/**
81
81
  * Nullifier value.
82
- */ nullifier){
83
- this.nullifier = nullifier;
82
+ */ value){
83
+ this.value = value;
84
84
  }
85
85
  getKey() {
86
- return this.nullifier.toBigInt();
86
+ return this.value.toBigInt();
87
87
  }
88
88
  toBuffer() {
89
- return this.nullifier.toBuffer();
89
+ return this.value.toBuffer();
90
90
  }
91
91
  isEmpty() {
92
- return this.nullifier.isZero();
92
+ return this.value.isZero();
93
93
  }
94
94
  updateTo(_another) {
95
95
  throw new Error('Nullifiers are create only');
@@ -100,4 +100,9 @@ import { z } from 'zod';
100
100
  static fromBuffer(buf) {
101
101
  return new NullifierLeaf(Fr.fromBuffer(buf));
102
102
  }
103
+ static get schema() {
104
+ return z.object({
105
+ value: schemas.Fr
106
+ }).transform(({ value })=>new NullifierLeaf(value));
107
+ }
103
108
  }
@@ -77,30 +77,30 @@ export declare class NullifierMembershipWitness {
77
77
  }>;
78
78
  }, "strip", z.ZodTypeAny, {
79
79
  index: bigint;
80
- siblingPath: SiblingPath<40>;
81
80
  leafPreimage: NullifierLeafPreimage;
81
+ siblingPath: SiblingPath<40>;
82
82
  }, {
83
83
  index: string | number | bigint;
84
- siblingPath: string | {
85
- type: "Buffer";
86
- data: number[];
87
- };
88
84
  leafPreimage: {
89
85
  nullifier: string;
90
86
  nextNullifier: string;
91
87
  nextIndex: string | number | bigint;
92
88
  };
93
- }>, NullifierMembershipWitness, {
94
- index: string | number | bigint;
95
89
  siblingPath: string | {
96
90
  type: "Buffer";
97
91
  data: number[];
98
92
  };
93
+ }>, NullifierMembershipWitness, {
94
+ index: string | number | bigint;
99
95
  leafPreimage: {
100
96
  nullifier: string;
101
97
  nextNullifier: string;
102
98
  nextIndex: string | number | bigint;
103
99
  };
100
+ siblingPath: string | {
101
+ type: "Buffer";
102
+ data: number[];
103
+ };
104
104
  }>;
105
105
  static random(): NullifierMembershipWitness;
106
106
  /**
@@ -106,5 +106,18 @@ export declare class PublicDataTreeLeaf implements IndexedTreeLeaf {
106
106
  updateTo(another: PublicDataTreeLeaf): PublicDataTreeLeaf;
107
107
  static buildDummy(key: bigint): PublicDataTreeLeaf;
108
108
  static empty(): PublicDataTreeLeaf;
109
+ static get schema(): z.ZodEffects<z.ZodObject<{
110
+ slot: z.ZodType<Fr, any, string>;
111
+ value: z.ZodType<Fr, any, string>;
112
+ }, "strip", z.ZodTypeAny, {
113
+ value: Fr;
114
+ slot: Fr;
115
+ }, {
116
+ value: string;
117
+ slot: string;
118
+ }>, PublicDataTreeLeaf, {
119
+ value: string;
120
+ slot: string;
121
+ }>;
109
122
  }
110
123
  //# sourceMappingURL=public_data_leaf.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public_data_leaf.d.ts","sourceRoot":"","sources":["../../src/trees/public_data_leaf.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAExF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,uBAAuB;IAEtE;;OAEG;IACI,IAAI,EAAE,EAAE;IACf;;OAEG;IACI,KAAK,EAAE,EAAE;IAChB;;OAEG;IACI,QAAQ,EAAE,EAAE;IACnB;;OAEG;IACI,SAAS,EAAE,MAAM;;IAfxB;;OAEG;IACI,IAAI,EAAE,EAAE;IACf;;OAEG;IACI,KAAK,EAAE,EAAE;IAChB;;OAEG;IACI,QAAQ,EAAE,EAAE;IACnB;;OAEG;IACI,SAAS,EAAE,MAAM;IAG1B,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;OAWhB;IAED,MAAM,IAAI,MAAM;IAIhB,UAAU,IAAI,MAAM;IAIpB,YAAY,IAAI,MAAM;IAItB,MAAM,IAAI,kBAAkB;IAI5B,QAAQ,IAAI,MAAM;IAIlB,YAAY,IAAI,MAAM,EAAE;IASxB,KAAK,IAAI,0BAA0B;IAInC,MAAM,CAAC,MAAM;IASb,MAAM,CAAC,KAAK,IAAI,0BAA0B;IAI1C,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,0BAA0B;IAS5E,MAAM,CAAC,QAAQ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MAAM,CAAC,KAAK,IAAI,kBAAkB;IAIlC,MAAM,KAAK,MAAM;;;;;;;;;;;;OAOhB;CACF"}
@@ -127,4 +127,10 @@ import { z } from 'zod';
127
127
  static empty() {
128
128
  return new PublicDataTreeLeaf(Fr.ZERO, Fr.ZERO);
129
129
  }
130
+ static get schema() {
131
+ return z.object({
132
+ slot: schemas.Fr,
133
+ value: schemas.Fr
134
+ }).transform(({ slot, value })=>new PublicDataTreeLeaf(slot, value));
135
+ }
130
136
  }
@@ -84,32 +84,32 @@ export declare class PublicDataWitness {
84
84
  }>;
85
85
  }, "strip", z.ZodTypeAny, {
86
86
  index: bigint;
87
- siblingPath: SiblingPath<40>;
88
87
  leafPreimage: PublicDataTreeLeafPreimage;
88
+ siblingPath: SiblingPath<40>;
89
89
  }, {
90
90
  index: string | number | bigint;
91
- siblingPath: string | {
92
- type: "Buffer";
93
- data: number[];
94
- };
95
91
  leafPreimage: {
96
92
  value: string;
97
93
  slot: string;
98
94
  nextIndex: string | number | bigint;
99
95
  nextSlot: string;
100
96
  };
101
- }>, PublicDataWitness, {
102
- index: string | number | bigint;
103
97
  siblingPath: string | {
104
98
  type: "Buffer";
105
99
  data: number[];
106
100
  };
101
+ }>, PublicDataWitness, {
102
+ index: string | number | bigint;
107
103
  leafPreimage: {
108
104
  value: string;
109
105
  slot: string;
110
106
  nextIndex: string | number | bigint;
111
107
  nextSlot: string;
112
108
  };
109
+ siblingPath: string | {
110
+ type: "Buffer";
111
+ data: number[];
112
+ };
113
113
  }>;
114
114
  /**
115
115
  * Returns a field array representation of a public data witness.
@@ -0,0 +1,3 @@
1
+ export type * from './types.js';
2
+ export * from './schemas.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validators/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC;AAEhC,cAAc,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './schemas.js';