@aztec/stdlib 3.0.0-nightly.20250924 → 3.0.0-nightly.20250926
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_accumulated_data.d.ts +1 -0
- package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.js +4 -0
- package/dest/avm/index.d.ts +0 -1
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +0 -1
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +18 -0
- package/dest/file-store/s3.d.ts +25 -0
- package/dest/file-store/s3.d.ts.map +1 -0
- package/dest/file-store/s3.js +187 -0
- package/dest/interfaces/aztec-node-admin.d.ts +6 -0
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/pxe.d.ts +5 -179
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/pxe.js +2 -59
- package/dest/interfaces/slasher.d.ts +4 -0
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +1 -0
- package/dest/interfaces/validator.d.ts +6 -1
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +2 -1
- package/dest/rollup/avm_proof_data.d.ts +2 -12
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/avm_proof_data.js +0 -24
- package/dest/rollup/base_rollup_hints.d.ts +15 -16
- package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
- package/dest/rollup/base_rollup_hints.js +24 -25
- package/dest/rollup/block_root_rollup_private_inputs.d.ts +13 -13
- package/dest/rollup/block_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/block_root_rollup_private_inputs.js +20 -20
- package/dest/rollup/index.d.ts +1 -1
- package/dest/rollup/index.d.ts.map +1 -1
- package/dest/rollup/index.js +1 -1
- package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts +1 -1
- package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/public_tx_base_rollup_private_inputs.js +2 -2
- package/dest/rollup/{state_diff_hints.d.ts → tree_snapshot_diff_hints.d.ts} +22 -38
- package/dest/rollup/tree_snapshot_diff_hints.d.ts.map +1 -0
- package/dest/rollup/tree_snapshot_diff_hints.js +75 -0
- package/dest/rollup/tx_rollup_public_inputs.d.ts +4 -4
- package/dest/rollup/tx_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/tx_rollup_public_inputs.js +7 -7
- package/dest/tests/factories.d.ts +4 -4
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +20 -25
- package/package.json +9 -8
- package/src/avm/avm_accumulated_data.ts +10 -0
- package/src/avm/index.ts +0 -1
- package/src/file-store/factory.ts +15 -0
- package/src/file-store/s3.ts +186 -0
- package/src/interfaces/pxe.ts +8 -80
- package/src/interfaces/slasher.ts +2 -0
- package/src/interfaces/validator.ts +5 -1
- package/src/rollup/avm_proof_data.ts +2 -31
- package/src/rollup/base_rollup_hints.ts +20 -21
- package/src/rollup/block_root_rollup_private_inputs.ts +14 -14
- package/src/rollup/index.ts +1 -1
- package/src/rollup/public_tx_base_rollup_private_inputs.ts +3 -2
- package/src/rollup/{state_diff_hints.ts → tree_snapshot_diff_hints.ts} +26 -41
- package/src/rollup/tx_rollup_public_inputs.ts +4 -4
- package/src/tests/factories.ts +25 -37
- package/dest/avm/public_data_hint.d.ts +0 -16
- package/dest/avm/public_data_hint.d.ts.map +0 -1
- package/dest/avm/public_data_hint.js +0 -27
- package/dest/rollup/state_diff_hints.d.ts.map +0 -1
- package/dest/rollup/state_diff_hints.js +0 -85
- package/src/avm/public_data_hint.ts +0 -38
package/dest/tests/factories.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlobAccumulatorPublicInputs, FinalBlobAccumulatorPublicInputs } from '@aztec/blob-lib';
|
|
2
2
|
import { makeBatchedBlobAccumulator, makeSpongeBlob } from '@aztec/blob-lib/testing';
|
|
3
|
-
import { ARCHIVE_HEIGHT, AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, AZTEC_MAX_EPOCH_DURATION, CIVC_PROOF_LENGTH, CONTRACT_CLASS_LOG_SIZE_IN_FIELDS, FIXED_DA_GAS, FIXED_L2_GAS, GeneratorIndex,
|
|
3
|
+
import { ARCHIVE_HEIGHT, AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, AZTEC_MAX_EPOCH_DURATION, CIVC_PROOF_LENGTH, CONTRACT_CLASS_LOG_SIZE_IN_FIELDS, FIXED_DA_GAS, FIXED_L2_GAS, GeneratorIndex, L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_CALL, MAX_ENQUEUED_CALLS_PER_TX, MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_L2_TO_L1_MSGS_PER_CALL, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PRIVATE_LOGS_PER_CALL, MAX_PRIVATE_LOGS_PER_TX, MAX_PROTOCOL_CONTRACTS, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH, NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH, NULLIFIER_TREE_HEIGHT, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, NUM_BASE_PARITY_PER_ROOT_PARITY, NUM_MSGS_PER_BASE_PARITY, PRIVATE_LOG_SIZE_IN_FIELDS, PUBLIC_DATA_TREE_HEIGHT, RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
4
4
|
import { makeHalfFullTuple, makeTuple } from '@aztec/foundation/array';
|
|
5
5
|
import { compact, padArrayEnd } from '@aztec/foundation/collection';
|
|
6
6
|
import { SchnorrSignature, poseidon2HashWithSeparator, sha256 } from '@aztec/foundation/crypto';
|
|
@@ -11,7 +11,6 @@ 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
13
|
import { AvmAccumulatedData, AvmAccumulatedDataArrayLengths, AvmAppendLeavesHint, AvmBytecodeCommitmentHint, AvmCircuitInputs, AvmCircuitPublicInputs, AvmCommitCheckpointHint, AvmContractClassHint, AvmContractInstanceHint, AvmCreateCheckpointHint, AvmExecutionHints, AvmGetLeafPreimageHintNullifierTree, AvmGetLeafPreimageHintPublicDataTree, AvmGetLeafValueHint, AvmGetPreviousValueIndexHint, AvmGetSiblingPathHint, AvmProtocolContractAddressHint, AvmRevertCheckpointHint, AvmSequentialInsertHintNullifierTree, AvmSequentialInsertHintPublicDataTree, AvmTxHint, RevertCode } from '../avm/index.js';
|
|
14
|
-
import { PublicDataHint } from '../avm/public_data_hint.js';
|
|
15
14
|
import { PublicDataRead } from '../avm/public_data_read.js';
|
|
16
15
|
import { PublicDataWrite } from '../avm/public_data_write.js';
|
|
17
16
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
@@ -43,7 +42,6 @@ import { ProofData } from '../proofs/index.js';
|
|
|
43
42
|
import { Proof } from '../proofs/proof.js';
|
|
44
43
|
import { ProvingRequestType } from '../proofs/proving_request_type.js';
|
|
45
44
|
import { makeRecursiveProof } from '../proofs/recursive_proof.js';
|
|
46
|
-
import { AvmProofData } from '../rollup/avm_proof_data.js';
|
|
47
45
|
import { PrivateBaseRollupHints, PublicBaseRollupHints } from '../rollup/base_rollup_hints.js';
|
|
48
46
|
import { BlockConstantData } from '../rollup/block_constant_data.js';
|
|
49
47
|
import { BlockMergeRollupPrivateInputs } from '../rollup/block_merge_rollup_private_inputs.js';
|
|
@@ -56,7 +54,7 @@ import { EpochConstantData } from '../rollup/epoch_constant_data.js';
|
|
|
56
54
|
import { PrivateTxBaseRollupPrivateInputs } from '../rollup/private_tx_base_rollup_private_inputs.js';
|
|
57
55
|
import { PublicTxBaseRollupPrivateInputs } from '../rollup/public_tx_base_rollup_private_inputs.js';
|
|
58
56
|
import { RootRollupPublicInputs } from '../rollup/root_rollup_public_inputs.js';
|
|
59
|
-
import {
|
|
57
|
+
import { TreeSnapshotDiffHints } from '../rollup/tree_snapshot_diff_hints.js';
|
|
60
58
|
import { TxMergeRollupPrivateInputs } from '../rollup/tx_merge_rollup_private_inputs.js';
|
|
61
59
|
import { TxRollupPublicInputs } from '../rollup/tx_rollup_public_inputs.js';
|
|
62
60
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
@@ -534,7 +532,7 @@ export function makeBlockRootFirstRollupPrivateInputs(seed = 0) {
|
|
|
534
532
|
return new BlockRootFirstRollupPrivateInputs(makeProofData(seed, makeParityPublicInputs), [
|
|
535
533
|
makeProofData(seed + 0x1000, makeTxRollupPublicInputs),
|
|
536
534
|
makeProofData(seed + 0x2000, makeTxRollupPublicInputs)
|
|
537
|
-
], makeAppendOnlyTreeSnapshot(seed + 0x3000), makeSiblingPath(seed + 0x4000,
|
|
535
|
+
], makeAppendOnlyTreeSnapshot(seed + 0x3000), makeSiblingPath(seed + 0x4000, L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH), makeSiblingPath(seed + 0x5000, ARCHIVE_HEIGHT));
|
|
538
536
|
}
|
|
539
537
|
export function makeBlockRootSingleTxRollupPrivateInputs(seed = 0) {
|
|
540
538
|
return new BlockRootSingleTxRollupPrivateInputs(makeProofData(seed + 0x1000, makeTxRollupPublicInputs), makeSiblingPath(seed + 0x4000, ARCHIVE_HEIGHT));
|
|
@@ -578,20 +576,18 @@ export function makeBlockRootSingleTxRollupPrivateInputs(seed = 0) {
|
|
|
578
576
|
return new PublicDataTreeLeafPreimage(makePublicDataTreeLeaf(seed), new Fr(seed + 2), BigInt(seed + 3));
|
|
579
577
|
}
|
|
580
578
|
/**
|
|
581
|
-
* Creates an instance of
|
|
579
|
+
* Creates an instance of TreeSnapshotDiffHints with arbitrary values based on the provided seed.
|
|
582
580
|
* @param seed - The seed to use for generating the hints.
|
|
583
|
-
* @returns A
|
|
584
|
-
*/ export function
|
|
581
|
+
* @returns A TreeSnapshotDiffHints object.
|
|
582
|
+
*/ export function makeTreeSnapshotDiffHints(seed = 1) {
|
|
585
583
|
const nullifierPredecessorPreimages = makeTuple(MAX_NULLIFIERS_PER_TX, (x)=>makeNullifierLeafPreimage(x), seed + 0x1000);
|
|
586
584
|
const nullifierPredecessorMembershipWitnesses = makeTuple(MAX_NULLIFIERS_PER_TX, (x)=>makeMembershipWitness(NULLIFIER_TREE_HEIGHT, x), seed + 0x2000);
|
|
587
585
|
const sortedNullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, fr, seed + 0x3000);
|
|
588
586
|
const sortedNullifierIndexes = makeTuple(MAX_NULLIFIERS_PER_TX, (i)=>i, seed + 0x4000);
|
|
589
|
-
const
|
|
590
|
-
const
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
const feeWriteSiblingPath = makeTuple(PUBLIC_DATA_TREE_HEIGHT, fr, seed + 0x9000);
|
|
594
|
-
return new PrivateBaseStateDiffHints(nullifierPredecessorPreimages, nullifierPredecessorMembershipWitnesses, sortedNullifiers, sortedNullifierIndexes, noteHashSubtreeSiblingPath, nullifierSubtreeSiblingPath, feeWriteLowLeafPreimage, feeWriteLowLeafMembershipWitness, feeWriteSiblingPath);
|
|
587
|
+
const noteHashSubtreeRootSiblingPath = makeTuple(NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH, fr, seed + 0x5000);
|
|
588
|
+
const nullifierSubtreeRootSiblingPath = makeTuple(NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH, fr, seed + 0x6000);
|
|
589
|
+
const feePayerBalanceMembershipWitness = makeMembershipWitness(PUBLIC_DATA_TREE_HEIGHT, seed + 0x8000);
|
|
590
|
+
return new TreeSnapshotDiffHints(noteHashSubtreeRootSiblingPath, nullifierPredecessorPreimages, nullifierPredecessorMembershipWitnesses, sortedNullifiers, sortedNullifierIndexes, nullifierSubtreeRootSiblingPath, feePayerBalanceMembershipWitness);
|
|
595
591
|
}
|
|
596
592
|
function makeVkData(seed = 1) {
|
|
597
593
|
return new VkData(VerificationKeyData.makeFakeHonk(), seed, makeTuple(VK_TREE_HEIGHT, fr, seed + 0x100));
|
|
@@ -605,17 +601,17 @@ function makeContractClassLogFields(seed = 1) {
|
|
|
605
601
|
function makePrivateBaseRollupHints(seed = 1) {
|
|
606
602
|
const start = makePartialStateReference(seed + 0x100);
|
|
607
603
|
const startSpongeBlob = makeSpongeBlob(seed + 0x200);
|
|
608
|
-
const
|
|
609
|
-
const
|
|
604
|
+
const treeSnapshotDiffHints = makeTreeSnapshotDiffHints(seed + 0x600);
|
|
605
|
+
const anchorBlockArchiveSiblingPath = makeSiblingPath(seed + 0x9000, ARCHIVE_HEIGHT);
|
|
610
606
|
const contractClassLogsFields = makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, makeContractClassLogFields, seed + 0x800);
|
|
611
607
|
const constants = makeBlockConstantData(0x100);
|
|
612
|
-
const
|
|
608
|
+
const feePayerBalanceLeafPreimage = PublicDataTreeLeafPreimage.empty();
|
|
613
609
|
return PrivateBaseRollupHints.from({
|
|
614
610
|
start,
|
|
615
611
|
startSpongeBlob,
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
612
|
+
treeSnapshotDiffHints,
|
|
613
|
+
feePayerBalanceLeafPreimage,
|
|
614
|
+
anchorBlockArchiveSiblingPath,
|
|
619
615
|
contractClassLogsFields,
|
|
620
616
|
constants
|
|
621
617
|
});
|
|
@@ -624,7 +620,7 @@ function makePublicBaseRollupHints(seed = 1) {
|
|
|
624
620
|
return PublicBaseRollupHints.from({
|
|
625
621
|
startSpongeBlob: makeSpongeBlob(seed),
|
|
626
622
|
lastArchive: makeAppendOnlyTreeSnapshot(seed + 0x1000),
|
|
627
|
-
|
|
623
|
+
anchorBlockArchiveSiblingPath: makeSiblingPath(seed + 0x2000, ARCHIVE_HEIGHT),
|
|
628
624
|
contractClassLogsFields: makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, makeContractClassLogFields, seed + 0x3000),
|
|
629
625
|
proverId: fr(seed + 0x4000)
|
|
630
626
|
});
|
|
@@ -635,12 +631,9 @@ export function makePrivateTxBaseRollupPrivateInputs(seed = 0) {
|
|
|
635
631
|
hints: makePrivateBaseRollupHints(seed + 0x100)
|
|
636
632
|
});
|
|
637
633
|
}
|
|
638
|
-
function makeAvmProofData(seed = 1) {
|
|
639
|
-
return new AvmProofData(makeAvmCircuitPublicInputs(seed), makeRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, seed + 0x100), makeVkData(seed + 0x200));
|
|
640
|
-
}
|
|
641
634
|
export function makePublicTxBaseRollupPrivateInputs(seed = 0) {
|
|
642
635
|
const publicTubeProofData = makeProofData(seed, makePrivateToPublicKernelCircuitPublicInputs, RECURSIVE_ROLLUP_HONK_PROOF_LENGTH);
|
|
643
|
-
const avmProofData =
|
|
636
|
+
const avmProofData = makeProofData(seed + 0x100, makeAvmCircuitPublicInputs, AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED);
|
|
644
637
|
const hints = makePublicBaseRollupHints(seed + 0x200);
|
|
645
638
|
return PublicTxBaseRollupPrivateInputs.from({
|
|
646
639
|
publicTubeProofData,
|
|
@@ -948,6 +941,7 @@ export function makeAvmProtocolContractDerivedAddressesHint(seed = 0) {
|
|
|
948
941
|
// Create avm output.
|
|
949
942
|
const avmOutput = AvmCircuitPublicInputs.empty();
|
|
950
943
|
// Assign data from hints.
|
|
944
|
+
avmOutput.protocolContractTreeRoot = protocolContractTreeRoot;
|
|
951
945
|
avmOutput.startTreeSnapshots.l1ToL2MessageTree = newL1ToL2Snapshot;
|
|
952
946
|
avmOutput.endTreeSnapshots.l1ToL2MessageTree = newL1ToL2Snapshot;
|
|
953
947
|
// Assign data from private.
|
|
@@ -968,6 +962,7 @@ export function makeAvmProtocolContractDerivedAddressesHint(seed = 0) {
|
|
|
968
962
|
avmOutput.accumulatedData.nullifiers = padArrayEnd(nonRevertibleData.nullifiers.concat(revertibleData.nullifiers).filter((n)=>!n.isEmpty()), Fr.ZERO, MAX_NULLIFIERS_PER_TX);
|
|
969
963
|
avmOutput.accumulatedData.l2ToL1Msgs = revertibleData.l2ToL1Msgs;
|
|
970
964
|
avmOutput.accumulatedData.publicDataWrites = makeTuple(MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, (i)=>new PublicDataWrite(new Fr(i), new Fr(i + 10)), seed + 0x2000);
|
|
965
|
+
avmOutput.accumulatedDataArrayLengths = avmOutput.accumulatedData.getArrayLengths();
|
|
971
966
|
avmOutput.gasSettings = gasSettings;
|
|
972
967
|
const avmCircuitInputs = await makeAvmCircuitInputs(seed + 0x3000, {
|
|
973
968
|
publicInputs: avmOutput
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20250926",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -69,13 +69,14 @@
|
|
|
69
69
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/
|
|
76
|
-
"@aztec/
|
|
77
|
-
"@aztec/
|
|
78
|
-
"@aztec/
|
|
72
|
+
"@aws-sdk/client-s3": "^3.892.0",
|
|
73
|
+
"@aztec/bb.js": "3.0.0-nightly.20250926",
|
|
74
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250926",
|
|
75
|
+
"@aztec/constants": "3.0.0-nightly.20250926",
|
|
76
|
+
"@aztec/ethereum": "3.0.0-nightly.20250926",
|
|
77
|
+
"@aztec/foundation": "3.0.0-nightly.20250926",
|
|
78
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250926",
|
|
79
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20250926",
|
|
79
80
|
"@google-cloud/storage": "^7.15.0",
|
|
80
81
|
"axios": "^1.9.0",
|
|
81
82
|
"json-stringify-deterministic": "1.0.12",
|
|
@@ -22,6 +22,7 @@ import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
|
22
22
|
import { inspect } from 'util';
|
|
23
23
|
import { z } from 'zod';
|
|
24
24
|
|
|
25
|
+
import { countAccumulatedItems } from '../kernel/utils/index.js';
|
|
25
26
|
import { FlatPublicLogs } from '../logs/public_log.js';
|
|
26
27
|
import { ScopedL2ToL1Message } from '../messaging/l2_to_l1_message.js';
|
|
27
28
|
import { PublicDataWrite } from './public_data_write.js';
|
|
@@ -184,6 +185,15 @@ export class AvmAccumulatedData {
|
|
|
184
185
|
.join(', ')}],
|
|
185
186
|
}`;
|
|
186
187
|
}
|
|
188
|
+
|
|
189
|
+
getArrayLengths() {
|
|
190
|
+
return new AvmAccumulatedDataArrayLengths(
|
|
191
|
+
countAccumulatedItems(this.noteHashes),
|
|
192
|
+
countAccumulatedItems(this.nullifiers),
|
|
193
|
+
countAccumulatedItems(this.l2ToL1Msgs),
|
|
194
|
+
countAccumulatedItems(this.publicDataWrites),
|
|
195
|
+
);
|
|
196
|
+
}
|
|
187
197
|
}
|
|
188
198
|
|
|
189
199
|
/**
|
package/src/avm/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from './avm_accumulated_data.js';
|
|
|
3
3
|
export * from './avm_circuit_public_inputs.js';
|
|
4
4
|
export * from './revert_code.js';
|
|
5
5
|
export * from './public_data_write.js';
|
|
6
|
-
export * from './public_data_hint.js';
|
|
7
6
|
export * from './public_data_update_request.js';
|
|
8
7
|
export * from './contract_storage_update_request.js';
|
|
9
8
|
export * from './contract_storage_read.js';
|
|
@@ -4,9 +4,11 @@ import { GoogleCloudFileStore } from './gcs.js';
|
|
|
4
4
|
import { HttpFileStore } from './http.js';
|
|
5
5
|
import type { FileStore, ReadOnlyFileStore } from './interface.js';
|
|
6
6
|
import { LocalFileStore } from './local.js';
|
|
7
|
+
import { S3FileStore } from './s3.js';
|
|
7
8
|
|
|
8
9
|
const supportedExamples = [
|
|
9
10
|
`gs://bucket-name/path/to/store`,
|
|
11
|
+
`s3://bucket-name/path/to/store`,
|
|
10
12
|
`file:///absolute/local/path/to/store`,
|
|
11
13
|
`https://host/path`,
|
|
12
14
|
];
|
|
@@ -39,6 +41,19 @@ export async function createFileStore(
|
|
|
39
41
|
} catch {
|
|
40
42
|
throw new Error(`Invalid google cloud store definition: '${config}'.`);
|
|
41
43
|
}
|
|
44
|
+
} else if (config.startsWith('s3://')) {
|
|
45
|
+
try {
|
|
46
|
+
const url = new URL(config);
|
|
47
|
+
const bucket = url.host;
|
|
48
|
+
const path = url.pathname.replace(/^\/+/, '');
|
|
49
|
+
const endpoint = url.searchParams.get('endpoint');
|
|
50
|
+
const publicBaseUrl = url.searchParams.get('publicBaseUrl') ?? undefined;
|
|
51
|
+
logger.info(`Creating S3 file store at ${bucket} ${path}`);
|
|
52
|
+
const store = new S3FileStore(bucket, path, { endpoint: endpoint ?? undefined, publicBaseUrl });
|
|
53
|
+
return store;
|
|
54
|
+
} catch {
|
|
55
|
+
throw new Error(`Invalid S3 store definition: '${config}'.`);
|
|
56
|
+
}
|
|
42
57
|
} else {
|
|
43
58
|
throw new Error(`Unknown file store config: '${config}'. Supported values are ${supportedExamples.join(', ')}.`);
|
|
44
59
|
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
GetObjectCommand,
|
|
5
|
+
type GetObjectCommandOutput,
|
|
6
|
+
HeadObjectCommand,
|
|
7
|
+
PutObjectCommand,
|
|
8
|
+
S3Client,
|
|
9
|
+
} from '@aws-sdk/client-s3';
|
|
10
|
+
import { createReadStream, createWriteStream } from 'fs';
|
|
11
|
+
import { mkdir } from 'fs/promises';
|
|
12
|
+
import { dirname, join } from 'path';
|
|
13
|
+
import { Readable } from 'stream';
|
|
14
|
+
import { finished } from 'stream/promises';
|
|
15
|
+
import { createGzip } from 'zlib';
|
|
16
|
+
|
|
17
|
+
import type { FileStore, FileStoreSaveOptions } from './interface.js';
|
|
18
|
+
|
|
19
|
+
function normalizeBasePath(path: string): string {
|
|
20
|
+
return path?.replace(/^\/+|\/+$/g, '') ?? '';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class S3FileStore implements FileStore {
|
|
24
|
+
private readonly s3: S3Client;
|
|
25
|
+
private readonly region: string;
|
|
26
|
+
private readonly endpoint?: string;
|
|
27
|
+
private readonly publicBaseUrl?: string;
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
private readonly bucketName: string,
|
|
31
|
+
private readonly basePath: string,
|
|
32
|
+
opts: { endpoint?: string; publicBaseUrl?: string },
|
|
33
|
+
private readonly log: Logger = createLogger('stdlib:s3-file-store'),
|
|
34
|
+
) {
|
|
35
|
+
this.endpoint = opts.endpoint;
|
|
36
|
+
this.region = this.endpoint ? 'auto' : (process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION ?? 'us-east-1');
|
|
37
|
+
this.publicBaseUrl = opts.publicBaseUrl;
|
|
38
|
+
|
|
39
|
+
const clientOptions: any = {};
|
|
40
|
+
if (this.endpoint) {
|
|
41
|
+
clientOptions.region = 'auto';
|
|
42
|
+
clientOptions.endpoint = this.endpoint;
|
|
43
|
+
clientOptions.forcePathStyle = true;
|
|
44
|
+
} else {
|
|
45
|
+
clientOptions.region = this.region;
|
|
46
|
+
}
|
|
47
|
+
this.s3 = new S3Client(clientOptions);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public async save(path: string, data: Buffer, opts: FileStoreSaveOptions = {}): Promise<string> {
|
|
51
|
+
const key = this.getFullPath(path);
|
|
52
|
+
const shouldCompress = !opts.compress;
|
|
53
|
+
const body = shouldCompress ? (await import('zlib')).gzipSync(data) : data;
|
|
54
|
+
const put = new PutObjectCommand({
|
|
55
|
+
Bucket: this.bucketName,
|
|
56
|
+
Key: key,
|
|
57
|
+
Body: body,
|
|
58
|
+
ContentEncoding: shouldCompress ? 'gzip' : undefined,
|
|
59
|
+
CacheControl: opts.metadata?.['Cache-control'],
|
|
60
|
+
Metadata: this.extractUserMetadata(opts.metadata),
|
|
61
|
+
});
|
|
62
|
+
await this.s3.send(put);
|
|
63
|
+
return this.buildReturnedUrl(key, !!opts.public);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public async upload(destPath: string, srcPath: string, opts: FileStoreSaveOptions = {}): Promise<string> {
|
|
67
|
+
const key = this.getFullPath(destPath);
|
|
68
|
+
const shouldCompress = opts.compress !== false; // default true like GCS impl
|
|
69
|
+
|
|
70
|
+
await mkdir(dirname(srcPath), { recursive: true }).catch(() => undefined);
|
|
71
|
+
|
|
72
|
+
const source = createReadStream(srcPath);
|
|
73
|
+
const bodyStream = shouldCompress ? source.pipe(createGzip()) : source;
|
|
74
|
+
const put = new PutObjectCommand({
|
|
75
|
+
Bucket: this.bucketName,
|
|
76
|
+
Key: key,
|
|
77
|
+
Body: bodyStream as any,
|
|
78
|
+
ContentEncoding: shouldCompress ? 'gzip' : undefined,
|
|
79
|
+
CacheControl: opts.metadata?.['Cache-control'],
|
|
80
|
+
Metadata: this.extractUserMetadata(opts.metadata),
|
|
81
|
+
});
|
|
82
|
+
await this.s3.send(put);
|
|
83
|
+
return this.buildReturnedUrl(key, !!opts.public);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public async read(pathOrUrlStr: string): Promise<Buffer> {
|
|
87
|
+
const { bucket, key } = this.getBucketAndKey(pathOrUrlStr);
|
|
88
|
+
const out: GetObjectCommandOutput = await this.s3.send(new GetObjectCommand({ Bucket: bucket, Key: key }));
|
|
89
|
+
const stream = out.Body as Readable;
|
|
90
|
+
const chunks: Buffer[] = [];
|
|
91
|
+
for await (const chunk of stream) {
|
|
92
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
93
|
+
}
|
|
94
|
+
return Buffer.concat(chunks);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public async download(pathOrUrlStr: string, destPath: string): Promise<void> {
|
|
98
|
+
const { bucket, key } = this.getBucketAndKey(pathOrUrlStr);
|
|
99
|
+
const out: GetObjectCommandOutput = await this.s3.send(new GetObjectCommand({ Bucket: bucket, Key: key }));
|
|
100
|
+
await mkdir(dirname(destPath), { recursive: true });
|
|
101
|
+
const write = createWriteStream(destPath);
|
|
102
|
+
await finished((out.Body as Readable).pipe(write));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public async exists(pathOrUrlStr: string): Promise<boolean> {
|
|
106
|
+
try {
|
|
107
|
+
const { bucket, key } = this.getBucketAndKey(pathOrUrlStr);
|
|
108
|
+
await this.s3.send(new HeadObjectCommand({ Bucket: bucket, Key: key }));
|
|
109
|
+
return true;
|
|
110
|
+
} catch (err: any) {
|
|
111
|
+
const code = err?.$metadata?.httpStatusCode ?? err?.name ?? err?.Code;
|
|
112
|
+
if (code === 404 || code === 'NotFound' || code === 'NoSuchKey') {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
this.log.warn(`Error checking existence for ${pathOrUrlStr}: ${err?.message ?? String(err)}`);
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private extractUserMetadata(meta?: Record<string, string>): Record<string, string> | undefined {
|
|
121
|
+
if (!meta) {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
const { ['Cache-control']: _ignored, ...rest } = meta;
|
|
125
|
+
return Object.keys(rest).length ? rest : undefined;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private buildReturnedUrl(key: string, makePublic: boolean): string {
|
|
129
|
+
if (!makePublic) {
|
|
130
|
+
return `s3://${this.bucketName}/${key}`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (this.publicBaseUrl) {
|
|
134
|
+
const base = this.publicBaseUrl.replace(/\/$/, '');
|
|
135
|
+
// key already includes basePath via getFullPath, so do not prefix basePath again
|
|
136
|
+
const full = key.replace(/^\/+/, '');
|
|
137
|
+
return `${base}/${full}`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Try to synthesize a URL from endpoint if available (works for public R2 buckets)
|
|
141
|
+
if (this.endpoint) {
|
|
142
|
+
try {
|
|
143
|
+
const url = new URL(this.endpoint);
|
|
144
|
+
return `https://${this.bucketName}.${url.host}/${key}`;
|
|
145
|
+
} catch {
|
|
146
|
+
// fallthrough
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Fallback to AWS style URL if region looks valid
|
|
151
|
+
return `https://${this.bucketName}.s3.${this.region}.amazonaws.com/${key}`;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private getBucketAndKey(pathOrUrlStr: string): { bucket: string; key: string } {
|
|
155
|
+
if (URL.canParse(pathOrUrlStr)) {
|
|
156
|
+
const url = new URL(pathOrUrlStr);
|
|
157
|
+
if (url.protocol === 's3:') {
|
|
158
|
+
return { bucket: url.host, key: url.pathname.replace(/^\/+/, '') };
|
|
159
|
+
}
|
|
160
|
+
// For https URLs, try to infer virtual-hosted or path-style
|
|
161
|
+
if (url.protocol === 'https:' || url.protocol === 'http:') {
|
|
162
|
+
// If the URL matches the configured publicBaseUrl host, map back to our bucket and key
|
|
163
|
+
if (this.publicBaseUrl && url.host === new URL(this.publicBaseUrl).host) {
|
|
164
|
+
return { bucket: this.bucketName, key: url.pathname.replace(/^\/+/, '') };
|
|
165
|
+
}
|
|
166
|
+
const hostParts = url.host.split('.');
|
|
167
|
+
if (hostParts.length > 3 && (hostParts[1] === 's3' || hostParts[hostParts.length - 2] === 'r2')) {
|
|
168
|
+
// virtual hosted
|
|
169
|
+
return { bucket: hostParts[0], key: url.pathname.replace(/^\/+/, '') };
|
|
170
|
+
} else if (this.endpoint && url.host === new URL(this.endpoint).host) {
|
|
171
|
+
// path-style at custom endpoint
|
|
172
|
+
const [bucket, ...rest] = url.pathname.replace(/^\/+/, '').split('/');
|
|
173
|
+
return { bucket, key: rest.join('/') };
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Treat as path
|
|
178
|
+
return { bucket: this.bucketName, key: this.getFullPath(pathOrUrlStr) };
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private getFullPath(path: string): string {
|
|
182
|
+
const base = normalizeBasePath(this.basePath);
|
|
183
|
+
const rel = path.replace(/^\/+/, '');
|
|
184
|
+
return base ? join(base, rel) : rel;
|
|
185
|
+
}
|
|
186
|
+
}
|
package/src/interfaces/pxe.ts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { ApiSchemaFor, ZodFor } from '@aztec/foundation/schemas';
|
|
3
2
|
|
|
4
3
|
import { z } from 'zod';
|
|
5
4
|
|
|
6
|
-
import { type AbiType, AbiTypeSchema, type ContractArtifact
|
|
5
|
+
import { type AbiType, AbiTypeSchema, type ContractArtifact } from '../abi/abi.js';
|
|
7
6
|
import type { EventSelector } from '../abi/event_selector.js';
|
|
8
7
|
import { AuthWitness } from '../auth_witness/auth_witness.js';
|
|
9
8
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
10
9
|
import {
|
|
11
10
|
CompleteAddress,
|
|
12
11
|
type ContractClassWithId,
|
|
13
|
-
ContractClassWithIdSchema,
|
|
14
12
|
type ContractInstanceWithAddress,
|
|
15
|
-
ContractInstanceWithAddressSchema,
|
|
16
13
|
type PartialAddress,
|
|
17
14
|
type ProtocolContractAddresses,
|
|
18
|
-
ProtocolContractAddressesSchema,
|
|
19
15
|
} from '../contract/index.js';
|
|
20
16
|
import { UniqueNote } from '../note/extended_note.js';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
17
|
+
import type { NotesFilter } from '../note/notes_filter.js';
|
|
18
|
+
import { schemas } from '../schemas/schemas.js';
|
|
23
19
|
import { SimulationOverrides, TxExecutionRequest, TxSimulationResult } from '../tx/index.js';
|
|
24
20
|
import { TxProfileResult, UtilitySimulationResult } from '../tx/profiling.js';
|
|
25
21
|
import { TxProvingResult } from '../tx/proven_tx.js';
|
|
@@ -241,6 +237,11 @@ export interface PXE {
|
|
|
241
237
|
numBlocks: number,
|
|
242
238
|
recipients: AztecAddress[],
|
|
243
239
|
): Promise<T[]>;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Stops the PXE's job queue.
|
|
243
|
+
*/
|
|
244
|
+
stop(): Promise<void>;
|
|
244
245
|
}
|
|
245
246
|
// docs:end:pxe-interface
|
|
246
247
|
|
|
@@ -281,76 +282,3 @@ export interface ContractClassMetadata {
|
|
|
281
282
|
isContractClassPubliclyRegistered: boolean;
|
|
282
283
|
artifact?: ContractArtifact | undefined;
|
|
283
284
|
}
|
|
284
|
-
|
|
285
|
-
export const ContractMetadataSchema = z.object({
|
|
286
|
-
contractInstance: z.union([ContractInstanceWithAddressSchema, z.undefined()]),
|
|
287
|
-
isContractInitialized: z.boolean(),
|
|
288
|
-
isContractPublished: z.boolean(),
|
|
289
|
-
}) satisfies ZodFor<ContractMetadata>;
|
|
290
|
-
|
|
291
|
-
export const ContractClassMetadataSchema = z.object({
|
|
292
|
-
contractClass: z.union([ContractClassWithIdSchema, z.undefined()]),
|
|
293
|
-
isContractClassPubliclyRegistered: z.boolean(),
|
|
294
|
-
artifact: z.union([ContractArtifactSchema, z.undefined()]),
|
|
295
|
-
}) satisfies ZodFor<ContractClassMetadata>;
|
|
296
|
-
|
|
297
|
-
const PXEInfoSchema = z.object({
|
|
298
|
-
pxeVersion: z.string(),
|
|
299
|
-
protocolContractAddresses: ProtocolContractAddressesSchema,
|
|
300
|
-
}) satisfies ZodFor<PXEInfo>;
|
|
301
|
-
|
|
302
|
-
export const PXESchema: ApiSchemaFor<PXE> = {
|
|
303
|
-
registerAccount: z.function().args(schemas.Fr, schemas.Fr).returns(CompleteAddress.schema),
|
|
304
|
-
getRegisteredAccounts: z.function().returns(z.array(CompleteAddress.schema)),
|
|
305
|
-
registerSender: z.function().args(schemas.AztecAddress).returns(schemas.AztecAddress),
|
|
306
|
-
getSenders: z.function().returns(z.array(schemas.AztecAddress)),
|
|
307
|
-
removeSender: z.function().args(schemas.AztecAddress).returns(z.void()),
|
|
308
|
-
registerContractClass: z.function().args(ContractArtifactSchema).returns(z.void()),
|
|
309
|
-
registerContract: z
|
|
310
|
-
.function()
|
|
311
|
-
.args(z.object({ instance: ContractInstanceWithAddressSchema, artifact: z.optional(ContractArtifactSchema) }))
|
|
312
|
-
.returns(z.void()),
|
|
313
|
-
updateContract: z.function().args(schemas.AztecAddress, ContractArtifactSchema).returns(z.void()),
|
|
314
|
-
getContracts: z.function().returns(z.array(schemas.AztecAddress)),
|
|
315
|
-
proveTx: z.function().args(TxExecutionRequest.schema).returns(TxProvingResult.schema),
|
|
316
|
-
profileTx: z
|
|
317
|
-
.function()
|
|
318
|
-
.args(
|
|
319
|
-
TxExecutionRequest.schema,
|
|
320
|
-
z.union([z.literal('gates'), z.literal('full'), z.literal('execution-steps')]),
|
|
321
|
-
optional(z.boolean()),
|
|
322
|
-
optional(schemas.AztecAddress),
|
|
323
|
-
)
|
|
324
|
-
.returns(TxProfileResult.schema),
|
|
325
|
-
simulateTx: z
|
|
326
|
-
.function()
|
|
327
|
-
.args(
|
|
328
|
-
TxExecutionRequest.schema,
|
|
329
|
-
z.boolean(),
|
|
330
|
-
optional(z.boolean()),
|
|
331
|
-
optional(z.boolean()),
|
|
332
|
-
optional(SimulationOverrides.schema),
|
|
333
|
-
optional(z.array(schemas.AztecAddress)),
|
|
334
|
-
)
|
|
335
|
-
.returns(TxSimulationResult.schema),
|
|
336
|
-
getNotes: z.function().args(NotesFilterSchema).returns(z.array(UniqueNote.schema)),
|
|
337
|
-
|
|
338
|
-
simulateUtility: z
|
|
339
|
-
.function()
|
|
340
|
-
.args(
|
|
341
|
-
z.string(),
|
|
342
|
-
z.array(z.any()),
|
|
343
|
-
schemas.AztecAddress,
|
|
344
|
-
optional(z.array(AuthWitness.schema)),
|
|
345
|
-
optional(schemas.AztecAddress),
|
|
346
|
-
optional(z.array(schemas.AztecAddress)),
|
|
347
|
-
)
|
|
348
|
-
.returns(UtilitySimulationResult.schema),
|
|
349
|
-
getPXEInfo: z.function().returns(PXEInfoSchema),
|
|
350
|
-
getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
|
|
351
|
-
getContractClassMetadata: z.function().args(schemas.Fr, optional(z.boolean())).returns(ContractClassMetadataSchema),
|
|
352
|
-
getPrivateEvents: z
|
|
353
|
-
.function()
|
|
354
|
-
.args(schemas.AztecAddress, EventMetadataDefinitionSchema, z.number(), z.number(), z.array(schemas.AztecAddress))
|
|
355
|
-
.returns(z.array(AbiDecodedSchema)),
|
|
356
|
-
};
|
|
@@ -24,6 +24,7 @@ export interface SlasherConfig {
|
|
|
24
24
|
slashOffenseExpirationRounds: number; // Number of rounds after which pending offenses expire
|
|
25
25
|
slashMaxPayloadSize: number; // Maximum number of offenses to include in a single slash payload
|
|
26
26
|
slashGracePeriodL2Slots: number; // Number of L2 slots to wait after genesis before slashing for most offenses
|
|
27
|
+
slashExecuteRoundsLookBack: number; // How many rounds to look back when searching for a round to execute
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const SlasherConfigSchema = z.object({
|
|
@@ -44,5 +45,6 @@ export const SlasherConfigSchema = z.object({
|
|
|
44
45
|
slashMaxPayloadSize: z.number(),
|
|
45
46
|
slashGracePeriodL2Slots: z.number(),
|
|
46
47
|
slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
|
|
48
|
+
slashExecuteRoundsLookBack: z.number(),
|
|
47
49
|
slashSelfAllowed: z.boolean().optional(),
|
|
48
50
|
}) satisfies ZodFor<SlasherConfig>;
|
|
@@ -32,11 +32,14 @@ export interface ValidatorClientConfig {
|
|
|
32
32
|
/** Interval between polling for new attestations from peers */
|
|
33
33
|
attestationPollingIntervalMs: number;
|
|
34
34
|
|
|
35
|
-
/**
|
|
35
|
+
/** Whether to re-execute transactions in a block proposal before attesting */
|
|
36
36
|
validatorReexecute: boolean;
|
|
37
37
|
|
|
38
38
|
/** Will re-execute until this many milliseconds are left in the slot */
|
|
39
39
|
validatorReexecuteDeadlineMs: number;
|
|
40
|
+
|
|
41
|
+
/** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
|
|
42
|
+
alwaysReexecuteBlockProposals?: boolean;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
export type ValidatorClientFullConfig = ValidatorClientConfig &
|
|
@@ -50,6 +53,7 @@ export const ValidatorClientConfigSchema = z.object({
|
|
|
50
53
|
attestationPollingIntervalMs: z.number().min(0),
|
|
51
54
|
validatorReexecute: z.boolean(),
|
|
52
55
|
validatorReexecuteDeadlineMs: z.number().min(0),
|
|
56
|
+
alwaysReexecuteBlockProposals: z.boolean().optional(),
|
|
53
57
|
}) satisfies ZodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>;
|
|
54
58
|
|
|
55
59
|
export interface Validator {
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
3
|
|
|
5
4
|
import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
|
|
6
|
-
import {
|
|
7
|
-
import { VkData } from '../vks/vk_data.js';
|
|
5
|
+
import type { ProofData } from '../proofs/proof_data.js';
|
|
8
6
|
|
|
9
|
-
export
|
|
10
|
-
constructor(
|
|
11
|
-
public publicInputs: AvmCircuitPublicInputs,
|
|
12
|
-
public proof: RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>,
|
|
13
|
-
public vkData: VkData,
|
|
14
|
-
) {}
|
|
15
|
-
|
|
16
|
-
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
17
|
-
const reader = BufferReader.asReader(buffer);
|
|
18
|
-
return new AvmProofData(
|
|
19
|
-
reader.readObject(AvmCircuitPublicInputs),
|
|
20
|
-
RecursiveProof.fromBuffer(reader),
|
|
21
|
-
reader.readObject(VkData),
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
toBuffer() {
|
|
26
|
-
return serializeToBuffer(this.publicInputs, this.proof, this.vkData);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static empty() {
|
|
30
|
-
return new AvmProofData(
|
|
31
|
-
AvmCircuitPublicInputs.empty(),
|
|
32
|
-
makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
33
|
-
VkData.empty(),
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
7
|
+
export type AvmProofData = ProofData<AvmCircuitPublicInputs, typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
|
|
37
8
|
|
|
38
9
|
// TODO(#14234)[Unconditional PIs validation]: remove this function.
|
|
39
10
|
export function enhanceProofWithPiValidationFlag(proof: Fr[], skipPublicInputsValidation: boolean): Fr[] {
|