@aztec/stdlib 0.82.2 → 0.82.3-nightly.20250403
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.
- package/dest/avm/avm.d.ts +4648 -1474
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +182 -109
- package/dest/avm/avm_proving_request.d.ts +1867 -498
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/l2_block_downloader/l2_block_stream.d.ts +10 -12
- package/dest/block/l2_block_downloader/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_downloader/l2_block_stream.js +45 -11
- package/dest/config/config.d.ts +2 -2
- package/dest/config/config.d.ts.map +1 -1
- package/dest/config/config.js +4 -5
- package/dest/contract/interfaces/node-info.d.ts +2 -2
- package/dest/contract/interfaces/node-info.d.ts.map +1 -1
- package/dest/contract/interfaces/node-info.js +1 -1
- package/dest/database-version/version_manager.d.ts +4 -2
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +13 -9
- package/dest/epoch-helpers/index.d.ts +2 -0
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +3 -0
- package/dest/file-store/factory.d.ts +7 -0
- package/dest/file-store/factory.d.ts.map +1 -0
- package/dest/file-store/factory.js +46 -0
- package/dest/file-store/gcs.d.ts +22 -0
- package/dest/file-store/gcs.d.ts.map +1 -0
- package/dest/file-store/gcs.js +115 -0
- package/dest/file-store/http.d.ts +15 -0
- package/dest/file-store/http.d.ts.map +1 -0
- package/dest/file-store/http.js +53 -0
- package/dest/file-store/index.d.ts +3 -0
- package/dest/file-store/index.d.ts.map +1 -0
- package/dest/file-store/index.js +2 -0
- package/dest/file-store/interface.d.ts +24 -0
- package/dest/file-store/interface.d.ts.map +1 -0
- package/dest/file-store/interface.js +1 -0
- package/dest/file-store/local.d.ts +16 -0
- package/dest/file-store/local.d.ts.map +1 -0
- package/dest/file-store/local.js +40 -0
- package/dest/interfaces/aztec-node-admin.d.ts +9 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -1
- package/dest/interfaces/aztec-node.d.ts +3 -0
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +2 -0
- package/dest/interfaces/p2p.d.ts +2 -0
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +2 -1
- package/dest/interfaces/prover-client.d.ts +3 -3
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +6 -4
- package/dest/interfaces/prover-node.d.ts +4 -0
- package/dest/interfaces/prover-node.d.ts.map +1 -1
- package/dest/interfaces/prover-node.js +5 -1
- package/dest/interfaces/proving-job.d.ts +1866 -497
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/pxe.d.ts +7 -6
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/pxe.js +1 -1
- package/dest/interfaces/service.d.ts +3 -0
- package/dest/interfaces/service.d.ts.map +1 -1
- package/dest/interfaces/service.js +7 -0
- package/dest/interfaces/world_state.d.ts +13 -15
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/keys/derivation.d.ts +1 -1
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +10 -2
- package/dest/logs/index.d.ts +2 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +2 -1
- package/dest/logs/pending_tagged_log.d.ts +17 -0
- package/dest/logs/pending_tagged_log.d.ts.map +1 -0
- package/dest/logs/pending_tagged_log.js +45 -0
- package/dest/logs/{l1_payload/shared_secret_derivation.d.ts → shared_secret_derivation.d.ts} +4 -3
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -0
- package/dest/logs/{l1_payload/shared_secret_derivation.js → shared_secret_derivation.js} +3 -5
- package/dest/logs/tx_scoped_l2_log.d.ts +6 -1
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +12 -4
- package/dest/note/note.d.ts +45 -4
- package/dest/note/note.d.ts.map +1 -1
- package/dest/note/note.js +51 -4
- package/dest/proofs/proof.d.ts.map +1 -1
- package/dest/proofs/proof.js +33 -7
- package/dest/snapshots/download.d.ts +9 -0
- package/dest/snapshots/download.d.ts.map +1 -0
- package/dest/snapshots/download.js +37 -0
- package/dest/snapshots/index.d.ts +4 -0
- package/dest/snapshots/index.d.ts.map +1 -0
- package/dest/snapshots/index.js +3 -0
- package/dest/snapshots/types.d.ts +97 -0
- package/dest/snapshots/types.d.ts.map +1 -0
- package/dest/snapshots/types.js +27 -0
- package/dest/snapshots/upload.d.ts +5 -0
- package/dest/snapshots/upload.d.ts.map +1 -0
- package/dest/snapshots/upload.js +37 -0
- package/dest/tests/factories.d.ts +21 -7
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +78 -30
- package/dest/tests/mocks.d.ts +2 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +5 -1
- package/dest/trees/merkle_tree_id.d.ts +8 -0
- package/dest/trees/merkle_tree_id.d.ts.map +1 -1
- package/dest/trees/merkle_tree_id.js +10 -0
- package/dest/trees/nullifier_leaf.d.ts +49 -15
- package/dest/trees/nullifier_leaf.d.ts.map +1 -1
- package/dest/trees/nullifier_leaf.js +45 -22
- package/dest/trees/nullifier_membership_witness.d.ts +34 -18
- package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
- package/dest/trees/protocol_contract_leaf.d.ts +0 -1
- package/dest/trees/protocol_contract_leaf.d.ts.map +1 -1
- package/dest/trees/protocol_contract_leaf.js +0 -3
- package/dest/trees/public_data_leaf.d.ts +59 -25
- package/dest/trees/public_data_leaf.d.ts.map +1 -1
- package/dest/trees/public_data_leaf.js +41 -30
- package/dest/trees/public_data_witness.d.ts +42 -24
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/trees/public_data_witness.js +6 -6
- package/dest/validators/index.d.ts +3 -0
- package/dest/validators/index.d.ts.map +1 -0
- package/dest/validators/index.js +1 -0
- package/dest/validators/schemas.d.ts +342 -0
- package/dest/validators/schemas.d.ts.map +1 -0
- package/dest/validators/schemas.js +40 -0
- package/dest/validators/types.d.ts +39 -0
- package/dest/validators/types.d.ts.map +1 -0
- package/dest/validators/types.js +1 -0
- package/dest/versioning/versioning.d.ts +1 -1
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +6 -6
- package/package.json +11 -8
- package/src/avm/avm.ts +183 -104
- package/src/block/l2_block_downloader/l2_block_stream.ts +64 -29
- package/src/config/config.ts +6 -6
- package/src/contract/interfaces/node-info.ts +3 -3
- package/src/database-version/version_manager.ts +12 -8
- package/src/epoch-helpers/index.ts +8 -0
- package/src/file-store/factory.ts +61 -0
- package/src/file-store/gcs.ts +121 -0
- package/src/file-store/http.ts +58 -0
- package/src/file-store/index.ts +2 -0
- package/src/file-store/interface.ts +19 -0
- package/src/file-store/local.ts +46 -0
- package/src/interfaces/aztec-node-admin.ts +11 -1
- package/src/interfaces/aztec-node.ts +7 -0
- package/src/interfaces/p2p.ts +4 -0
- package/src/interfaces/prover-client.ts +9 -7
- package/src/interfaces/prover-node.ts +10 -0
- package/src/interfaces/pxe.ts +14 -7
- package/src/interfaces/service.ts +13 -0
- package/src/interfaces/world_state.ts +17 -15
- package/src/keys/derivation.ts +12 -6
- package/src/logs/index.ts +2 -1
- package/src/logs/pending_tagged_log.ts +43 -0
- package/src/logs/{l1_payload/shared_secret_derivation.ts → shared_secret_derivation.ts} +4 -11
- package/src/logs/tx_scoped_l2_log.ts +13 -4
- package/src/note/note.ts +61 -5
- package/src/proofs/proof.ts +39 -5
- package/src/snapshots/download.ts +60 -0
- package/src/snapshots/index.ts +3 -0
- package/src/snapshots/types.ts +58 -0
- package/src/snapshots/upload.ts +55 -0
- package/src/tests/factories.ts +137 -53
- package/src/tests/mocks.ts +7 -0
- package/src/trees/merkle_tree_id.ts +12 -0
- package/src/trees/nullifier_leaf.ts +48 -21
- package/src/trees/protocol_contract_leaf.ts +0 -4
- package/src/trees/public_data_leaf.ts +40 -29
- package/src/trees/public_data_witness.ts +6 -6
- package/src/validators/index.ts +3 -0
- package/src/validators/schemas.ts +53 -0
- package/src/validators/types.ts +37 -0
- package/src/versioning/versioning.ts +8 -14
- package/dest/event/event.d.ts +0 -24
- package/dest/event/event.d.ts.map +0 -1
- package/dest/event/event.js +0 -13
- package/dest/event/event_metadata.d.ts +0 -38
- package/dest/event/event_metadata.d.ts.map +0 -1
- package/dest/event/event_metadata.js +0 -45
- package/dest/event/index.d.ts +0 -4
- package/dest/event/index.d.ts.map +0 -1
- package/dest/event/index.js +0 -3
- package/dest/event/l1_event_payload.d.ts +0 -52
- package/dest/event/l1_event_payload.d.ts.map +0 -1
- package/dest/event/l1_event_payload.js +0 -64
- package/dest/logs/l1_payload/encrypted_log_payload.d.ts +0 -50
- package/dest/logs/l1_payload/encrypted_log_payload.d.ts.map +0 -1
- package/dest/logs/l1_payload/encrypted_log_payload.js +0 -140
- package/dest/logs/l1_payload/encryption_util.d.ts +0 -24
- package/dest/logs/l1_payload/encryption_util.d.ts.map +0 -1
- package/dest/logs/l1_payload/encryption_util.js +0 -46
- package/dest/logs/l1_payload/index.d.ts +0 -3
- package/dest/logs/l1_payload/index.d.ts.map +0 -1
- package/dest/logs/l1_payload/index.js +0 -2
- package/dest/logs/l1_payload/payload.d.ts +0 -60
- package/dest/logs/l1_payload/payload.d.ts.map +0 -1
- package/dest/logs/l1_payload/payload.js +0 -61
- package/dest/logs/l1_payload/shared_secret_derivation.d.ts.map +0 -1
- package/src/event/event.ts +0 -16
- package/src/event/event_metadata.ts +0 -56
- package/src/event/index.ts +0 -3
- package/src/event/l1_event_payload.ts +0 -87
- package/src/logs/l1_payload/encrypted_log_payload.ts +0 -202
- package/src/logs/l1_payload/encryption_util.ts +0 -54
- package/src/logs/l1_payload/index.ts +0 -2
- package/src/logs/l1_payload/payload.ts +0 -73
package/src/tests/factories.ts
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
import { type FieldsOf, makeHalfFullTuple, makeTuple } from '@aztec/foundation/array';
|
|
45
45
|
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
46
46
|
import { compact } from '@aztec/foundation/collection';
|
|
47
|
-
import { SchnorrSignature, poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
|
|
47
|
+
import { SchnorrSignature, poseidon2HashWithSeparator, sha256 } from '@aztec/foundation/crypto';
|
|
48
48
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
49
49
|
import { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
|
|
50
50
|
import type { Bufferable } from '@aztec/foundation/serialize';
|
|
@@ -55,7 +55,6 @@ import { ContractStorageRead } from '../avm/contract_storage_read.js';
|
|
|
55
55
|
import { ContractStorageUpdateRequest } from '../avm/contract_storage_update_request.js';
|
|
56
56
|
import {
|
|
57
57
|
AvmAccumulatedData,
|
|
58
|
-
AvmAppendTreeHint,
|
|
59
58
|
AvmBytecodeCommitmentHint,
|
|
60
59
|
AvmCircuitInputs,
|
|
61
60
|
AvmCircuitPublicInputs,
|
|
@@ -63,10 +62,13 @@ import {
|
|
|
63
62
|
AvmContractInstanceHint,
|
|
64
63
|
AvmEnqueuedCallHint,
|
|
65
64
|
AvmExecutionHints,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
AvmGetLeafPreimageHintNullifierTree,
|
|
66
|
+
AvmGetLeafPreimageHintPublicDataTree,
|
|
67
|
+
AvmGetLeafValueHint,
|
|
68
|
+
AvmGetPreviousValueIndexHint,
|
|
69
|
+
AvmGetSiblingPathHint,
|
|
70
|
+
AvmSequentialInsertHintNullifierTree,
|
|
71
|
+
AvmSequentialInsertHintPublicDataTree,
|
|
70
72
|
RevertCode,
|
|
71
73
|
} from '../avm/index.js';
|
|
72
74
|
import { PublicDataHint } from '../avm/public_data_hint.js';
|
|
@@ -144,7 +146,8 @@ import { PublicTubeData } from '../rollup/public_tube_data.js';
|
|
|
144
146
|
import { RootRollupInputs, RootRollupPublicInputs } from '../rollup/root_rollup.js';
|
|
145
147
|
import { PrivateBaseStateDiffHints } from '../rollup/state_diff_hints.js';
|
|
146
148
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
147
|
-
import {
|
|
149
|
+
import { MerkleTreeId } from '../trees/merkle_tree_id.js';
|
|
150
|
+
import { NullifierLeaf, NullifierLeafPreimage } from '../trees/nullifier_leaf.js';
|
|
148
151
|
import { PublicDataTreeLeaf, PublicDataTreeLeafPreimage } from '../trees/public_data_leaf.js';
|
|
149
152
|
import { BlockHeader } from '../tx/block_header.js';
|
|
150
153
|
import { CallContext } from '../tx/call_context.js';
|
|
@@ -990,13 +993,31 @@ export function makePublicDataTreeLeaf(seed = 0): PublicDataTreeLeaf {
|
|
|
990
993
|
return new PublicDataTreeLeaf(new Fr(seed), new Fr(seed + 1));
|
|
991
994
|
}
|
|
992
995
|
|
|
996
|
+
/**
|
|
997
|
+
* Makes arbitrary nullifier leaf.
|
|
998
|
+
* @param seed - The seed to use for generating the nullifier leaf.
|
|
999
|
+
* @returns A nullifier leaf.
|
|
1000
|
+
*/
|
|
1001
|
+
export function makeNullifierLeaf(seed = 0): NullifierLeaf {
|
|
1002
|
+
return new NullifierLeaf(new Fr(seed));
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Makes arbitrary nullifier leaf preimages.
|
|
1007
|
+
* @param seed - The seed to use for generating the nullifier leaf preimage.
|
|
1008
|
+
* @returns A nullifier leaf preimage.
|
|
1009
|
+
*/
|
|
1010
|
+
export function makeNullifierLeafPreimage(seed = 0): NullifierLeafPreimage {
|
|
1011
|
+
return new NullifierLeafPreimage(makeNullifierLeaf(seed), new Fr(seed + 1), BigInt(seed + 2));
|
|
1012
|
+
}
|
|
1013
|
+
|
|
993
1014
|
/**
|
|
994
1015
|
* Makes arbitrary public data tree leaf preimages.
|
|
995
1016
|
* @param seed - The seed to use for generating the public data tree leaf preimage.
|
|
996
1017
|
* @returns A public data tree leaf preimage.
|
|
997
1018
|
*/
|
|
998
1019
|
export function makePublicDataTreeLeafPreimage(seed = 0): PublicDataTreeLeafPreimage {
|
|
999
|
-
return new PublicDataTreeLeafPreimage(
|
|
1020
|
+
return new PublicDataTreeLeafPreimage(makePublicDataTreeLeaf(seed), new Fr(seed + 2), BigInt(seed + 3));
|
|
1000
1021
|
}
|
|
1001
1022
|
|
|
1002
1023
|
/**
|
|
@@ -1007,7 +1028,7 @@ export function makePublicDataTreeLeafPreimage(seed = 0): PublicDataTreeLeafPrei
|
|
|
1007
1028
|
export function makePrivateBaseStateDiffHints(seed = 1): PrivateBaseStateDiffHints {
|
|
1008
1029
|
const nullifierPredecessorPreimages = makeTuple(
|
|
1009
1030
|
MAX_NULLIFIERS_PER_TX,
|
|
1010
|
-
x =>
|
|
1031
|
+
x => makeNullifierLeafPreimage(x),
|
|
1011
1032
|
seed + 0x1000,
|
|
1012
1033
|
);
|
|
1013
1034
|
|
|
@@ -1261,51 +1282,102 @@ export async function makeContractInstanceFromClassId(
|
|
|
1261
1282
|
}).withAddress(address);
|
|
1262
1283
|
}
|
|
1263
1284
|
|
|
1264
|
-
export function
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1285
|
+
export function makeAvmGetSiblingPathHint(seed = 0): AvmGetSiblingPathHint {
|
|
1286
|
+
// We want a possibly large index, but non-random.
|
|
1287
|
+
const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
|
|
1288
|
+
return new AvmGetSiblingPathHint(
|
|
1289
|
+
makeAppendOnlyTreeSnapshot(seed),
|
|
1290
|
+
/*treeId=*/ (seed + 1) % 5,
|
|
1291
|
+
/*index=*/ index,
|
|
1292
|
+
makeArray(seed % 64, i => new Fr(i), seed + 10),
|
|
1269
1293
|
);
|
|
1270
1294
|
}
|
|
1271
1295
|
|
|
1272
|
-
export function
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1296
|
+
export function makeAvmGetPreviousValueIndexHint(seed = 0): AvmGetPreviousValueIndexHint {
|
|
1297
|
+
// We want a possibly large index, but non-random.
|
|
1298
|
+
const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
|
|
1299
|
+
const value = new Fr(BigInt(`0x${sha256(Buffer.from((seed + 2).toString())).toString('hex')}`) % (1n << 128n));
|
|
1300
|
+
return new AvmGetPreviousValueIndexHint(
|
|
1301
|
+
makeAppendOnlyTreeSnapshot(seed),
|
|
1302
|
+
/*treeId=*/ (seed + 1) % 5,
|
|
1303
|
+
value,
|
|
1304
|
+
index,
|
|
1305
|
+
/*alreadyPresent=*/ index % 2n === 0n,
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
export function makeAvmGetLeafPreimageHintPublicDataTree(seed = 0): AvmGetLeafPreimageHintPublicDataTree {
|
|
1310
|
+
// We want a possibly large index, but non-random.
|
|
1311
|
+
const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
|
|
1312
|
+
return new AvmGetLeafPreimageHintPublicDataTree(
|
|
1313
|
+
makeAppendOnlyTreeSnapshot(seed),
|
|
1314
|
+
/*index=*/ index,
|
|
1315
|
+
/*leafPreimage=*/ makePublicDataTreeLeafPreimage(seed + 3),
|
|
1278
1316
|
);
|
|
1279
1317
|
}
|
|
1280
1318
|
|
|
1281
|
-
export function
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1319
|
+
export function makeAvmGetLeafPreimageHintNullifierTree(seed = 0): AvmGetLeafPreimageHintNullifierTree {
|
|
1320
|
+
// We want a possibly large index, but non-random.
|
|
1321
|
+
const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
|
|
1322
|
+
return new AvmGetLeafPreimageHintNullifierTree(
|
|
1323
|
+
makeAppendOnlyTreeSnapshot(seed),
|
|
1324
|
+
/*index=*/ index,
|
|
1325
|
+
/*leafPreimage=*/ makeNullifierLeafPreimage(seed + 3),
|
|
1286
1326
|
);
|
|
1287
1327
|
}
|
|
1288
1328
|
|
|
1289
|
-
export function
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1329
|
+
export function makeAvmGetLeafValueHint(seed = 0): AvmGetLeafValueHint {
|
|
1330
|
+
// We want a possibly large index, but non-random.
|
|
1331
|
+
const index = BigInt(`0x${sha256(Buffer.from(seed.toString())).toString('hex')}`) % (1n << 64n);
|
|
1332
|
+
return new AvmGetLeafValueHint(
|
|
1333
|
+
makeAppendOnlyTreeSnapshot(seed),
|
|
1334
|
+
/*treeId=*/ (seed + 1) % 5,
|
|
1335
|
+
/*index=*/ index,
|
|
1336
|
+
/*value=*/ new Fr(seed + 3),
|
|
1293
1337
|
);
|
|
1294
1338
|
}
|
|
1295
1339
|
|
|
1296
|
-
export function
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
makeArray(
|
|
1340
|
+
export function makeAvmSequentialInsertHintPublicDataTree(seed = 0): AvmSequentialInsertHintPublicDataTree {
|
|
1341
|
+
const lowLeavesWitnessData = {
|
|
1342
|
+
leaf: makePublicDataTreeLeafPreimage(seed + 3),
|
|
1343
|
+
index: BigInt(seed + 4),
|
|
1344
|
+
path: makeArray(seed % 64, i => new Fr(i), seed + 5),
|
|
1345
|
+
};
|
|
1346
|
+
const insertionWitnessData = {
|
|
1347
|
+
leaf: makePublicDataTreeLeafPreimage(seed + 6),
|
|
1348
|
+
index: BigInt(seed + 7),
|
|
1349
|
+
path: makeArray(seed % 64, i => new Fr(i), seed + 8),
|
|
1350
|
+
};
|
|
1351
|
+
|
|
1352
|
+
return new AvmSequentialInsertHintPublicDataTree(
|
|
1353
|
+
makeAppendOnlyTreeSnapshot(seed),
|
|
1354
|
+
makeAppendOnlyTreeSnapshot(seed + 1),
|
|
1355
|
+
MerkleTreeId.PUBLIC_DATA_TREE,
|
|
1356
|
+
makePublicDataTreeLeaf(seed + 2),
|
|
1357
|
+
lowLeavesWitnessData,
|
|
1358
|
+
insertionWitnessData,
|
|
1301
1359
|
);
|
|
1302
1360
|
}
|
|
1303
1361
|
|
|
1304
|
-
export function
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
makeArray(
|
|
1362
|
+
export function makeAvmSequentialInsertHintNullifierTree(seed = 0): AvmSequentialInsertHintNullifierTree {
|
|
1363
|
+
const lowLeavesWitnessData = {
|
|
1364
|
+
leaf: makeNullifierLeafPreimage(seed + 3),
|
|
1365
|
+
index: BigInt(seed + 4),
|
|
1366
|
+
path: makeArray(seed % 64, i => new Fr(i), seed + 5),
|
|
1367
|
+
};
|
|
1368
|
+
const insertionWitnessData = {
|
|
1369
|
+
leaf: makeNullifierLeafPreimage(seed + 6),
|
|
1370
|
+
index: BigInt(seed + 7),
|
|
1371
|
+
path: makeArray(seed % 64, i => new Fr(i), seed + 8),
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
return new AvmSequentialInsertHintNullifierTree(
|
|
1375
|
+
makeAppendOnlyTreeSnapshot(seed),
|
|
1376
|
+
makeAppendOnlyTreeSnapshot(seed + 1),
|
|
1377
|
+
MerkleTreeId.NULLIFIER_TREE,
|
|
1378
|
+
makeNullifierLeaf(seed + 2),
|
|
1379
|
+
lowLeavesWitnessData,
|
|
1380
|
+
insertionWitnessData,
|
|
1309
1381
|
);
|
|
1310
1382
|
}
|
|
1311
1383
|
|
|
@@ -1373,13 +1445,25 @@ export async function makeAvmExecutionHints(
|
|
|
1373
1445
|
contractInstances: makeArray(baseLength + 2, makeAvmContractInstanceHint, seed + 0x4700),
|
|
1374
1446
|
contractClasses: makeArray(baseLength + 5, makeAvmContractClassHint, seed + 0x4900),
|
|
1375
1447
|
bytecodeCommitments: await makeArrayAsync(baseLength + 5, makeAvmBytecodeCommitmentHint, seed + 0x4900),
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1448
|
+
getSiblingPathHints: makeArray(baseLength + 5, makeAvmGetSiblingPathHint, seed + 0x4b00),
|
|
1449
|
+
getPreviousValueIndexHints: makeArray(baseLength + 5, makeAvmGetPreviousValueIndexHint, seed + 0x4d00),
|
|
1450
|
+
getLeafPreimageHintPublicDataTree: makeArray(
|
|
1451
|
+
baseLength + 5,
|
|
1452
|
+
makeAvmGetLeafPreimageHintPublicDataTree,
|
|
1453
|
+
seed + 0x4f00,
|
|
1454
|
+
),
|
|
1455
|
+
getLeafPreimageHintNullifierTree: makeArray(baseLength + 5, makeAvmGetLeafPreimageHintNullifierTree, seed + 0x5100),
|
|
1456
|
+
getLeafValueHints: makeArray(baseLength + 5, makeAvmGetLeafValueHint, seed + 0x5300),
|
|
1457
|
+
sequentialInsertHintsPublicDataTree: makeArray(
|
|
1458
|
+
baseLength + 5,
|
|
1459
|
+
makeAvmSequentialInsertHintPublicDataTree,
|
|
1460
|
+
seed + 0x5500,
|
|
1461
|
+
),
|
|
1462
|
+
sequentialInsertHintsNullifierTree: makeArray(
|
|
1463
|
+
baseLength + 5,
|
|
1464
|
+
makeAvmSequentialInsertHintNullifierTree,
|
|
1465
|
+
seed + 0x5700,
|
|
1466
|
+
),
|
|
1383
1467
|
...overrides,
|
|
1384
1468
|
};
|
|
1385
1469
|
|
|
@@ -1388,13 +1472,13 @@ export async function makeAvmExecutionHints(
|
|
|
1388
1472
|
fields.contractInstances,
|
|
1389
1473
|
fields.contractClasses,
|
|
1390
1474
|
fields.bytecodeCommitments,
|
|
1391
|
-
fields.
|
|
1392
|
-
fields.
|
|
1393
|
-
fields.
|
|
1394
|
-
fields.
|
|
1395
|
-
fields.
|
|
1396
|
-
fields.
|
|
1397
|
-
fields.
|
|
1475
|
+
fields.getSiblingPathHints,
|
|
1476
|
+
fields.getPreviousValueIndexHints,
|
|
1477
|
+
fields.getLeafPreimageHintPublicDataTree,
|
|
1478
|
+
fields.getLeafPreimageHintNullifierTree,
|
|
1479
|
+
fields.getLeafValueHints,
|
|
1480
|
+
fields.sequentialInsertHintsPublicDataTree,
|
|
1481
|
+
fields.sequentialInsertHintsNullifierTree,
|
|
1398
1482
|
);
|
|
1399
1483
|
}
|
|
1400
1484
|
|
package/src/tests/mocks.ts
CHANGED
|
@@ -73,6 +73,7 @@ export const mockTx = async (
|
|
|
73
73
|
{
|
|
74
74
|
numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2,
|
|
75
75
|
numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2,
|
|
76
|
+
numberOfRevertibleNullifiers = 0,
|
|
76
77
|
hasPublicTeardownCallRequest = false,
|
|
77
78
|
publicCalldataSize = 2,
|
|
78
79
|
feePayer,
|
|
@@ -80,6 +81,7 @@ export const mockTx = async (
|
|
|
80
81
|
}: {
|
|
81
82
|
numberOfNonRevertiblePublicCallRequests?: number;
|
|
82
83
|
numberOfRevertiblePublicCallRequests?: number;
|
|
84
|
+
numberOfRevertibleNullifiers?: number;
|
|
83
85
|
hasPublicTeardownCallRequest?: boolean;
|
|
84
86
|
publicCalldataSize?: number;
|
|
85
87
|
feePayer?: AztecAddress;
|
|
@@ -123,6 +125,11 @@ export const mockTx = async (
|
|
|
123
125
|
.withPublicCallRequests(publicCallRequests.slice(numberOfRevertiblePublicCallRequests))
|
|
124
126
|
.build();
|
|
125
127
|
|
|
128
|
+
for (let i = 0; i < numberOfRevertibleNullifiers; i++) {
|
|
129
|
+
const revertibleNullifier = new Nullifier(new Fr(seed + 2 + i), 0, Fr.ZERO);
|
|
130
|
+
revertibleBuilder.pushNullifier(revertibleNullifier.value);
|
|
131
|
+
}
|
|
132
|
+
|
|
126
133
|
data.forPublic.revertibleAccumulatedData = revertibleBuilder
|
|
127
134
|
.withPublicCallRequests(publicCallRequests.slice(0, numberOfRevertiblePublicCallRequests))
|
|
128
135
|
.build();
|
|
@@ -40,3 +40,15 @@ export type TreeHeights = typeof TREE_HEIGHTS;
|
|
|
40
40
|
export function getTreeHeight<TID extends MerkleTreeId>(treeId: TID): TreeHeights[TID] {
|
|
41
41
|
return TREE_HEIGHTS[treeId];
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
const TREE_NAMES = {
|
|
45
|
+
[MerkleTreeId.NULLIFIER_TREE]: 'NULLIFIER_TREE' as const,
|
|
46
|
+
[MerkleTreeId.NOTE_HASH_TREE]: 'NOTE_HASH_TREE' as const,
|
|
47
|
+
[MerkleTreeId.PUBLIC_DATA_TREE]: 'PUBLIC_DATA_TREE' as const,
|
|
48
|
+
[MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: 'L1_TO_L2_MESSAGE_TREE' as const,
|
|
49
|
+
[MerkleTreeId.ARCHIVE]: 'ARCHIVE' as const,
|
|
50
|
+
} as const;
|
|
51
|
+
|
|
52
|
+
export function getTreeName<TID extends MerkleTreeId>(treeId: TID): (typeof TREE_NAMES)[TID] {
|
|
53
|
+
return TREE_NAMES[treeId];
|
|
54
|
+
}
|
|
@@ -15,11 +15,11 @@ export class NullifierLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
15
15
|
/**
|
|
16
16
|
* Leaf value inside the indexed tree's linked list.
|
|
17
17
|
*/
|
|
18
|
-
public
|
|
18
|
+
public leaf: NullifierLeaf,
|
|
19
19
|
/**
|
|
20
|
-
* Next
|
|
20
|
+
* Next nullifier inside the indexed tree's linked list.
|
|
21
21
|
*/
|
|
22
|
-
public
|
|
22
|
+
public nextKey: Fr,
|
|
23
23
|
/**
|
|
24
24
|
* Index of the next leaf in the indexed tree's linked list.
|
|
25
25
|
*/
|
|
@@ -29,21 +29,23 @@ export class NullifierLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
29
29
|
static get schema() {
|
|
30
30
|
return z
|
|
31
31
|
.object({
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
leaf: NullifierLeaf.schema,
|
|
33
|
+
nextKey: schemas.Fr,
|
|
34
34
|
nextIndex: schemas.BigInt,
|
|
35
35
|
})
|
|
36
|
-
.transform(
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
.transform(({ leaf, nextKey, nextIndex }) => new NullifierLeafPreimage(leaf, nextKey, nextIndex));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static get leafSchema() {
|
|
40
|
+
return NullifierLeaf.schema;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
getKey(): bigint {
|
|
42
|
-
return this.
|
|
44
|
+
return this.leaf.getKey();
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
getNextKey(): bigint {
|
|
46
|
-
return this.
|
|
48
|
+
return this.nextKey.toBigInt();
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
getNextIndex(): bigint {
|
|
@@ -51,7 +53,7 @@ export class NullifierLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
asLeaf(): NullifierLeaf {
|
|
54
|
-
return
|
|
56
|
+
return this.leaf;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
toBuffer(): Buffer {
|
|
@@ -60,8 +62,8 @@ export class NullifierLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
60
62
|
|
|
61
63
|
toHashInputs(): Buffer[] {
|
|
62
64
|
return [
|
|
63
|
-
|
|
64
|
-
Buffer.from(this.
|
|
65
|
+
...this.leaf.toHashInputs(),
|
|
66
|
+
Buffer.from(this.nextKey.toBuffer()),
|
|
65
67
|
Buffer.from(toBufferBE(this.nextIndex, 32)),
|
|
66
68
|
];
|
|
67
69
|
}
|
|
@@ -71,28 +73,32 @@ export class NullifierLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
clone(): NullifierLeafPreimage {
|
|
74
|
-
return new NullifierLeafPreimage(this.
|
|
76
|
+
return new NullifierLeafPreimage(this.leaf.clone(), this.nextKey, this.nextIndex);
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
static random() {
|
|
78
|
-
return new NullifierLeafPreimage(
|
|
80
|
+
return new NullifierLeafPreimage(NullifierLeaf.random(), Fr.random(), BigInt(Math.floor(Math.random() * 1000)));
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
static empty(): NullifierLeafPreimage {
|
|
82
|
-
return new NullifierLeafPreimage(
|
|
84
|
+
return new NullifierLeafPreimage(NullifierLeaf.empty(), Fr.zero(), 0n);
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
static fromBuffer(buffer: Buffer | BufferReader): NullifierLeafPreimage {
|
|
86
88
|
const reader = BufferReader.asReader(buffer);
|
|
87
|
-
return new NullifierLeafPreimage(
|
|
89
|
+
return new NullifierLeafPreimage(
|
|
90
|
+
NullifierLeaf.fromBuffer(reader),
|
|
91
|
+
reader.readObject(Fr),
|
|
92
|
+
toBigIntBE(reader.readBytes(32)),
|
|
93
|
+
);
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
static fromLeaf(leaf: NullifierLeaf, nextKey: bigint, nextIndex: bigint): NullifierLeafPreimage {
|
|
91
|
-
return new NullifierLeafPreimage(leaf
|
|
97
|
+
return new NullifierLeafPreimage(leaf, new Fr(nextKey), nextIndex);
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
static clone(preimage: NullifierLeafPreimage): NullifierLeafPreimage {
|
|
95
|
-
return
|
|
101
|
+
return preimage.clone();
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
104
|
|
|
@@ -115,6 +121,22 @@ export class NullifierLeaf implements IndexedTreeLeaf {
|
|
|
115
121
|
return this.nullifier.toBuffer();
|
|
116
122
|
}
|
|
117
123
|
|
|
124
|
+
clone(): NullifierLeaf {
|
|
125
|
+
return new NullifierLeaf(new Fr(this.nullifier));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
toHashInputs(): Buffer[] {
|
|
129
|
+
return [Buffer.from(this.nullifier.toBuffer())];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static empty(): NullifierLeaf {
|
|
133
|
+
return new NullifierLeaf(Fr.ZERO);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
static random(): NullifierLeaf {
|
|
137
|
+
return new NullifierLeaf(Fr.random());
|
|
138
|
+
}
|
|
139
|
+
|
|
118
140
|
isEmpty(): boolean {
|
|
119
141
|
return this.nullifier.isZero();
|
|
120
142
|
}
|
|
@@ -127,7 +149,12 @@ export class NullifierLeaf implements IndexedTreeLeaf {
|
|
|
127
149
|
return new NullifierLeaf(new Fr(key));
|
|
128
150
|
}
|
|
129
151
|
|
|
130
|
-
static fromBuffer(buf: Buffer): NullifierLeaf {
|
|
131
|
-
|
|
152
|
+
static fromBuffer(buf: Buffer | BufferReader): NullifierLeaf {
|
|
153
|
+
const reader = BufferReader.asReader(buf);
|
|
154
|
+
return new NullifierLeaf(reader.readObject(Fr));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static get schema() {
|
|
158
|
+
return z.object({ nullifier: schemas.Fr }).transform(({ nullifier }) => new NullifierLeaf(nullifier));
|
|
132
159
|
}
|
|
133
160
|
}
|
|
@@ -89,10 +89,6 @@ export class ProtocolContractLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
89
89
|
toBigIntBE(reader.readBytes(32)),
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
static fromLeaf(leaf: ProtocolContractLeaf, nextKey: bigint, nextIndex: bigint): ProtocolContractLeafPreimage {
|
|
94
|
-
return new ProtocolContractLeafPreimage(leaf.address, new Fr(nextKey), nextIndex);
|
|
95
|
-
}
|
|
96
92
|
}
|
|
97
93
|
|
|
98
94
|
/**
|
|
@@ -13,17 +13,13 @@ import { z } from 'zod';
|
|
|
13
13
|
export class PublicDataTreeLeafPreimage implements IndexedTreeLeafPreimage {
|
|
14
14
|
constructor(
|
|
15
15
|
/**
|
|
16
|
-
* The slot
|
|
16
|
+
* The leaf (slot, value).
|
|
17
17
|
*/
|
|
18
|
-
public
|
|
19
|
-
/**
|
|
20
|
-
* The value of the leaf
|
|
21
|
-
*/
|
|
22
|
-
public value: Fr,
|
|
18
|
+
public leaf: PublicDataTreeLeaf,
|
|
23
19
|
/**
|
|
24
|
-
* Next
|
|
20
|
+
* Next key (slot) inside the indexed tree's linked list.
|
|
25
21
|
*/
|
|
26
|
-
public
|
|
22
|
+
public nextKey: Fr,
|
|
27
23
|
/**
|
|
28
24
|
* Index of the next leaf in the indexed tree's linked list.
|
|
29
25
|
*/
|
|
@@ -33,22 +29,23 @@ export class PublicDataTreeLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
33
29
|
static get schema() {
|
|
34
30
|
return z
|
|
35
31
|
.object({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
nextSlot: schemas.Fr,
|
|
32
|
+
leaf: PublicDataTreeLeaf.schema,
|
|
33
|
+
nextKey: schemas.Fr,
|
|
39
34
|
nextIndex: schemas.BigInt,
|
|
40
35
|
})
|
|
41
|
-
.transform(
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
.transform(({ leaf, nextKey, nextIndex }) => new PublicDataTreeLeafPreimage(leaf, nextKey, nextIndex));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static get leafSchema() {
|
|
40
|
+
return PublicDataTreeLeaf.schema;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
getKey(): bigint {
|
|
47
|
-
return this.
|
|
44
|
+
return this.leaf.getKey();
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
getNextKey(): bigint {
|
|
51
|
-
return this.
|
|
48
|
+
return this.nextKey.toBigInt();
|
|
52
49
|
}
|
|
53
50
|
|
|
54
51
|
getNextIndex(): bigint {
|
|
@@ -56,7 +53,7 @@ export class PublicDataTreeLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
asLeaf(): PublicDataTreeLeaf {
|
|
59
|
-
return
|
|
56
|
+
return this.leaf;
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
toBuffer(): Buffer {
|
|
@@ -65,45 +62,42 @@ export class PublicDataTreeLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
65
62
|
|
|
66
63
|
toHashInputs(): Buffer[] {
|
|
67
64
|
return [
|
|
68
|
-
|
|
69
|
-
Buffer.from(this.value.toBuffer()),
|
|
65
|
+
...this.leaf.toHashInputs(),
|
|
70
66
|
Buffer.from(toBufferBE(this.nextIndex, 32)),
|
|
71
|
-
Buffer.from(this.
|
|
67
|
+
Buffer.from(this.nextKey.toBuffer()),
|
|
72
68
|
];
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
clone(): PublicDataTreeLeafPreimage {
|
|
76
|
-
return new PublicDataTreeLeafPreimage(this.
|
|
72
|
+
return new PublicDataTreeLeafPreimage(this.leaf.clone(), this.nextKey, this.nextIndex);
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
static random() {
|
|
80
76
|
return new PublicDataTreeLeafPreimage(
|
|
81
|
-
|
|
82
|
-
Fr.random(),
|
|
77
|
+
PublicDataTreeLeaf.buildDummy(BigInt(Math.floor(Math.random() * 1000))),
|
|
83
78
|
Fr.random(),
|
|
84
79
|
BigInt(Math.floor(Math.random() * 1000)),
|
|
85
80
|
);
|
|
86
81
|
}
|
|
87
82
|
|
|
88
83
|
static empty(): PublicDataTreeLeafPreimage {
|
|
89
|
-
return new PublicDataTreeLeafPreimage(
|
|
84
|
+
return new PublicDataTreeLeafPreimage(PublicDataTreeLeaf.empty(), Fr.ZERO, 0n);
|
|
90
85
|
}
|
|
91
86
|
|
|
92
87
|
static fromBuffer(buffer: Buffer | BufferReader): PublicDataTreeLeafPreimage {
|
|
93
88
|
const reader = BufferReader.asReader(buffer);
|
|
94
|
-
const
|
|
95
|
-
const value = Fr.fromBuffer(reader);
|
|
89
|
+
const value = PublicDataTreeLeaf.fromBuffer(reader);
|
|
96
90
|
const nextIndex = toBigIntBE(reader.readBytes(32));
|
|
97
91
|
const nextSlot = Fr.fromBuffer(reader);
|
|
98
|
-
return new PublicDataTreeLeafPreimage(
|
|
92
|
+
return new PublicDataTreeLeafPreimage(value, nextSlot, nextIndex);
|
|
99
93
|
}
|
|
100
94
|
|
|
101
95
|
static fromLeaf(leaf: PublicDataTreeLeaf, nextKey: bigint, nextIndex: bigint): PublicDataTreeLeafPreimage {
|
|
102
|
-
return new PublicDataTreeLeafPreimage(leaf
|
|
96
|
+
return new PublicDataTreeLeafPreimage(leaf, new Fr(nextKey), nextIndex);
|
|
103
97
|
}
|
|
104
98
|
|
|
105
99
|
static clone(preimage: PublicDataTreeLeafPreimage): PublicDataTreeLeafPreimage {
|
|
106
|
-
return
|
|
100
|
+
return preimage.clone();
|
|
107
101
|
}
|
|
108
102
|
}
|
|
109
103
|
|
|
@@ -130,6 +124,14 @@ export class PublicDataTreeLeaf implements IndexedTreeLeaf {
|
|
|
130
124
|
return serializeToBuffer([this.slot, this.value]);
|
|
131
125
|
}
|
|
132
126
|
|
|
127
|
+
clone(): PublicDataTreeLeaf {
|
|
128
|
+
return new PublicDataTreeLeaf(this.slot, this.value);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
toHashInputs(): Buffer[] {
|
|
132
|
+
return [this.slot.toBuffer(), this.value.toBuffer()];
|
|
133
|
+
}
|
|
134
|
+
|
|
133
135
|
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
134
136
|
const reader = BufferReader.asReader(buffer);
|
|
135
137
|
return new PublicDataTreeLeaf(Fr.fromBuffer(reader), Fr.fromBuffer(reader));
|
|
@@ -161,4 +163,13 @@ export class PublicDataTreeLeaf implements IndexedTreeLeaf {
|
|
|
161
163
|
static empty(): PublicDataTreeLeaf {
|
|
162
164
|
return new PublicDataTreeLeaf(Fr.ZERO, Fr.ZERO);
|
|
163
165
|
}
|
|
166
|
+
|
|
167
|
+
static get schema() {
|
|
168
|
+
return z
|
|
169
|
+
.object({
|
|
170
|
+
slot: schemas.Fr,
|
|
171
|
+
value: schemas.Fr,
|
|
172
|
+
})
|
|
173
|
+
.transform(({ slot, value }) => new PublicDataTreeLeaf(slot, value));
|
|
174
|
+
}
|
|
164
175
|
}
|
|
@@ -50,10 +50,10 @@ export class PublicDataWitness {
|
|
|
50
50
|
public toFields(): Fr[] {
|
|
51
51
|
return [
|
|
52
52
|
new Fr(this.index),
|
|
53
|
-
new Fr(this.leafPreimage.slot),
|
|
54
|
-
new Fr(this.leafPreimage.value),
|
|
53
|
+
new Fr(this.leafPreimage.leaf.slot),
|
|
54
|
+
new Fr(this.leafPreimage.leaf.value),
|
|
55
55
|
new Fr(this.leafPreimage.nextIndex),
|
|
56
|
-
new Fr(this.leafPreimage.
|
|
56
|
+
new Fr(this.leafPreimage.nextKey),
|
|
57
57
|
...this.siblingPath.toFields(),
|
|
58
58
|
];
|
|
59
59
|
}
|
|
@@ -65,9 +65,9 @@ export class PublicDataWitness {
|
|
|
65
65
|
// TODO(#12874): remove the stupid as string conversion by modifying ForeignCallOutput type in acvm.js
|
|
66
66
|
return [
|
|
67
67
|
new Fr(this.index).toString() as string,
|
|
68
|
-
new Fr(this.leafPreimage.slot).toString() as string,
|
|
69
|
-
new Fr(this.leafPreimage.value).toString() as string,
|
|
70
|
-
new Fr(this.leafPreimage.
|
|
68
|
+
new Fr(this.leafPreimage.leaf.slot).toString() as string,
|
|
69
|
+
new Fr(this.leafPreimage.leaf.value).toString() as string,
|
|
70
|
+
new Fr(this.leafPreimage.nextKey).toString() as string,
|
|
71
71
|
new Fr(this.leafPreimage.nextIndex).toString() as string,
|
|
72
72
|
this.siblingPath.toFields().map(fr => fr.toString()) as string[],
|
|
73
73
|
];
|