@aztec/prover-client 3.0.0-nightly.20250925 → 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/orchestrator/block-building-helpers.d.ts +0 -2
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +28 -50
- package/dest/orchestrator/block-proving-state.d.ts +3 -3
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +6 -6
- package/dest/orchestrator/checkpoint-proving-state.d.ts +4 -4
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +8 -8
- package/dest/orchestrator/epoch-proving-state.d.ts +2 -2
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +2 -2
- package/dest/orchestrator/orchestrator.js +8 -8
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +4 -2
- package/package.json +15 -15
- package/src/orchestrator/block-building-helpers.ts +50 -90
- package/src/orchestrator/block-proving-state.ts +8 -5
- package/src/orchestrator/checkpoint-proving-state.ts +12 -6
- package/src/orchestrator/epoch-proving-state.ts +5 -5
- package/src/orchestrator/orchestrator.ts +12 -12
- package/src/orchestrator/tx-proving-state.ts +3 -2
|
@@ -2,7 +2,6 @@ import { BatchedBlobAccumulator, Blob, SpongeBlob } from '@aztec/blob-lib';
|
|
|
2
2
|
import { BLS12Point, Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { type Bufferable, type Tuple } from '@aztec/foundation/serialize';
|
|
4
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
5
|
-
import { PublicDataHint } from '@aztec/stdlib/avm';
|
|
6
5
|
import { Body, L2BlockHeader } from '@aztec/stdlib/block';
|
|
7
6
|
import type { MerkleTreeWriteOperations, PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
8
7
|
import { ProofData, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
@@ -19,7 +18,6 @@ type BaseTreeNames = 'NoteHashTree' | 'ContractTree' | 'NullifierTree' | 'Public
|
|
|
19
18
|
*/
|
|
20
19
|
export type TreeNames = BaseTreeNames | 'L1ToL2MessageTree' | 'Archive';
|
|
21
20
|
export declare const insertSideEffectsAndBuildBaseRollupHints: (tx: ProcessedTx, lastArchive: AppendOnlyTreeSnapshot, newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, startSpongeBlob: SpongeBlob, proverId: Fr, db: MerkleTreeWriteOperations) => Promise<PublicBaseRollupHints | PrivateBaseRollupHints>;
|
|
22
|
-
export declare function getPublicDataHint(db: MerkleTreeWriteOperations, leafSlot: bigint): Promise<PublicDataHint>;
|
|
23
21
|
export declare function getCivcProofFromTx(tx: Tx | ProcessedTx): RecursiveProof<2076>;
|
|
24
22
|
export declare function getPublicTubePrivateInputsFromTx(tx: Tx | ProcessedTx): PublicTubePrivateInputs;
|
|
25
23
|
export declare const buildBlobHints: (blobFields: Fr[]) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-building-helpers.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-building-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,sBAAsB,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAkBxF,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAgC,MAAM,6BAA6B,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAyD,MAAM,yBAAyB,CAAC;AAInH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"block-building-helpers.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-building-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,s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AC,CAY/B;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,qBAAqB,EACnC,aAAa,EAAE,GAAG,CAAC,YAAY,EAAE,sBAAsB,CAAC,QASzD;AAqBD,wBAAgB,UAAU,CAAC,EAAE,EAAE,WAAW,QAczC;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,EAAE,YAAY,SAAS,MAAM,EAC3E,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,6BAA6B,CAAC,CAAC,EAAE,YAAY,CAAC,EAClF,OAAO,CAAC,EAAE,MAAM,8BAKjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BatchedBlob, Blob, SpongeBlob } from '@aztec/blob-lib';
|
|
2
|
-
import { ARCHIVE_HEIGHT, CIVC_PROOF_LENGTH, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NOTE_HASH_SUBTREE_HEIGHT,
|
|
2
|
+
import { ARCHIVE_HEIGHT, CIVC_PROOF_LENGTH, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NOTE_HASH_SUBTREE_HEIGHT, NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH, NULLIFIER_SUBTREE_HEIGHT, NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH, NULLIFIER_TREE_HEIGHT, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, PUBLIC_DATA_TREE_HEIGHT } from '@aztec/constants';
|
|
3
3
|
import { makeTuple } from '@aztec/foundation/array';
|
|
4
4
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
5
5
|
import { sha256ToField, sha256Trunc } from '@aztec/foundation/crypto';
|
|
@@ -9,12 +9,11 @@ import { MembershipWitness, MerkleTreeCalculator, computeUnbalancedMerkleTreeRoo
|
|
|
9
9
|
import { getVkData } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
10
10
|
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
11
11
|
import { computeFeePayerBalanceLeafSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
12
|
-
import { PublicDataHint } from '@aztec/stdlib/avm';
|
|
13
12
|
import { Body, L2BlockHeader, getBlockBlobFields } from '@aztec/stdlib/block';
|
|
14
13
|
import { ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
15
14
|
import { Proof, ProofData, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
16
|
-
import { BlockConstantData, PrivateBaseRollupHints,
|
|
17
|
-
import { AppendOnlyTreeSnapshot, MerkleTreeId, NullifierLeafPreimage, PublicDataTreeLeaf,
|
|
15
|
+
import { BlockConstantData, PrivateBaseRollupHints, PublicBaseRollupHints, PublicTubePrivateInputs, TreeSnapshotDiffHints } from '@aztec/stdlib/rollup';
|
|
16
|
+
import { AppendOnlyTreeSnapshot, MerkleTreeId, NullifierLeafPreimage, PublicDataTreeLeaf, getTreeHeight } from '@aztec/stdlib/trees';
|
|
18
17
|
import { BlockHeader, ContentCommitment, GlobalVariables, PartialStateReference, StateReference } from '@aztec/stdlib/tx';
|
|
19
18
|
import { VkData } from '@aztec/stdlib/vks';
|
|
20
19
|
import { Attributes, runInSpan } from '@aztec/telemetry-client';
|
|
@@ -23,36 +22,28 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan('BlockBuilderH
|
|
|
23
22
|
span.setAttribute(Attributes.TX_HASH, tx.hash.toString());
|
|
24
23
|
// Get trees info before any changes hit
|
|
25
24
|
const start = new PartialStateReference(await getTreeSnapshot(MerkleTreeId.NOTE_HASH_TREE, db), await getTreeSnapshot(MerkleTreeId.NULLIFIER_TREE, db), await getTreeSnapshot(MerkleTreeId.PUBLIC_DATA_TREE, db));
|
|
26
|
-
// Get the subtree sibling
|
|
27
|
-
const
|
|
28
|
-
const noteHashSubtreeSiblingPath = makeTuple(NOTE_HASH_SUBTREE_SIBLING_PATH_LENGTH, (i)=>i < noteHashSubtreeSiblingPathArray.length ? noteHashSubtreeSiblingPathArray[i] : Fr.ZERO);
|
|
25
|
+
// Get the note hash subtree root sibling path for insertion.
|
|
26
|
+
const noteHashSubtreeRootSiblingPath = assertLength(await getSubtreeSiblingPath(MerkleTreeId.NOTE_HASH_TREE, NOTE_HASH_SUBTREE_HEIGHT, db), NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH);
|
|
29
27
|
// Update the note hash trees with the new items being inserted to get the new roots
|
|
30
28
|
// that will be used by the next iteration of the base rollup circuit, skipping the empty ones
|
|
31
29
|
const noteHashes = padArrayEnd(tx.txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX);
|
|
32
30
|
await db.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, noteHashes);
|
|
33
|
-
// Create data hint for reading fee payer initial balance in Fee Juice
|
|
34
|
-
const leafSlot = await computeFeePayerBalanceLeafSlot(tx.data.feePayer);
|
|
35
|
-
const feePayerFeeJuiceBalanceReadHint = await getPublicDataHint(db, leafSlot.toBigInt());
|
|
36
31
|
// The read witnesses for a given TX should be generated before the writes of the same TX are applied.
|
|
37
32
|
// All reads that refer to writes in the same tx are transient and can be simplified out.
|
|
38
33
|
const txPublicDataUpdateRequestInfo = await processPublicDataUpdateRequests(tx, db);
|
|
39
34
|
// Update the nullifier tree, capturing the low nullifier info for each individual operation
|
|
40
|
-
const { lowLeavesWitnessData: nullifierWitnessLeaves, newSubtreeSiblingPath:
|
|
35
|
+
const { lowLeavesWitnessData: nullifierWitnessLeaves, newSubtreeSiblingPath: nullifiersSubtreeRootSiblingPath, sortedNewLeaves: sortedNullifiers, sortedNewLeavesIndexes } = await db.batchInsert(MerkleTreeId.NULLIFIER_TREE, padArrayEnd(tx.txEffect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX).map((n)=>n.toBuffer()), NULLIFIER_SUBTREE_HEIGHT);
|
|
41
36
|
if (nullifierWitnessLeaves === undefined) {
|
|
42
37
|
throw new Error(`Could not craft nullifier batch insertion proofs`);
|
|
43
38
|
}
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
const nullifierSubtreeSiblingPathArray = nullifiersSubtreeSiblingPath.toFields();
|
|
47
|
-
const nullifierSubtreeSiblingPath = makeTuple(NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, (i)=>i < nullifierSubtreeSiblingPathArray.length ? nullifierSubtreeSiblingPathArray[i] : Fr.ZERO);
|
|
39
|
+
const blockHash = await tx.data.constants.anchorBlockHeader.hash();
|
|
40
|
+
const anchorBlockArchiveSiblingPath = (await getMembershipWitnessFor(blockHash, MerkleTreeId.ARCHIVE, ARCHIVE_HEIGHT, db)).siblingPath;
|
|
48
41
|
const contractClassLogsFields = makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, (i)=>tx.txEffect.contractClassLogs[i]?.fields || ContractClassLogFields.empty());
|
|
49
42
|
if (tx.avmProvingRequest) {
|
|
50
|
-
const blockHash = await tx.data.constants.anchorBlockHeader.hash();
|
|
51
|
-
const archiveRootMembershipWitness = await getMembershipWitnessFor(blockHash, MerkleTreeId.ARCHIVE, ARCHIVE_HEIGHT, db);
|
|
52
43
|
return PublicBaseRollupHints.from({
|
|
53
44
|
startSpongeBlob,
|
|
54
45
|
lastArchive,
|
|
55
|
-
|
|
46
|
+
anchorBlockArchiveSiblingPath,
|
|
56
47
|
contractClassLogsFields,
|
|
57
48
|
proverId
|
|
58
49
|
});
|
|
@@ -60,22 +51,24 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan('BlockBuilderH
|
|
|
60
51
|
if (txPublicDataUpdateRequestInfo.lowPublicDataWritesMembershipWitnesses.length > 1 || txPublicDataUpdateRequestInfo.lowPublicDataWritesPreimages.length > 1 || txPublicDataUpdateRequestInfo.publicDataWritesSiblingPaths.length > 1) {
|
|
61
52
|
throw new Error(`More than one public data write in a private only tx`);
|
|
62
53
|
}
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
|
|
54
|
+
// Get hints for reading fee payer's balance in the public data tree.
|
|
55
|
+
const feePayerBalanceMembershipWitness = txPublicDataUpdateRequestInfo.lowPublicDataWritesMembershipWitnesses[0];
|
|
56
|
+
const feePayerBalanceLeafPreimage = txPublicDataUpdateRequestInfo.lowPublicDataWritesPreimages[0];
|
|
57
|
+
const leafSlot = await computeFeePayerBalanceLeafSlot(tx.data.feePayer);
|
|
58
|
+
if (!feePayerBalanceMembershipWitness || !leafSlot.equals(feePayerBalanceLeafPreimage?.leaf.slot)) {
|
|
59
|
+
throw new Error(`Cannot find the public data tree leaf for the fee payer's balance`);
|
|
60
|
+
}
|
|
61
|
+
// Extract witness objects from returned data
|
|
62
|
+
const nullifierPredecessorMembershipWitnessesWithoutPadding = nullifierWitnessLeaves.map((l)=>MembershipWitness.fromBufferArray(l.index, assertLength(l.siblingPath.toBufferArray(), NULLIFIER_TREE_HEIGHT)));
|
|
63
|
+
const treeSnapshotDiffHints = TreeSnapshotDiffHints.from({
|
|
64
|
+
noteHashSubtreeRootSiblingPath,
|
|
65
|
+
nullifierPredecessorPreimages: padArrayEnd(nullifierWitnessLeaves.map((l)=>l.leafPreimage), NullifierLeafPreimage.empty(), MAX_NULLIFIERS_PER_TX),
|
|
68
66
|
nullifierPredecessorMembershipWitnesses: makeTuple(MAX_NULLIFIERS_PER_TX, (i)=>i < nullifierPredecessorMembershipWitnessesWithoutPadding.length ? nullifierPredecessorMembershipWitnessesWithoutPadding[i] : makeEmptyMembershipWitness(NULLIFIER_TREE_HEIGHT)),
|
|
69
|
-
sortedNullifiers:
|
|
70
|
-
sortedNullifierIndexes:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
feeWriteLowLeafPreimage,
|
|
74
|
-
feeWriteLowLeafMembershipWitness,
|
|
75
|
-
feeWriteSiblingPath
|
|
67
|
+
sortedNullifiers: assertLength(sortedNullifiers.map((n)=>Fr.fromBuffer(n)), MAX_NULLIFIERS_PER_TX),
|
|
68
|
+
sortedNullifierIndexes: assertLength(sortedNewLeavesIndexes, MAX_NULLIFIERS_PER_TX),
|
|
69
|
+
nullifierSubtreeRootSiblingPath: assertLength(nullifiersSubtreeRootSiblingPath.toFields(), NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH),
|
|
70
|
+
feePayerBalanceMembershipWitness
|
|
76
71
|
});
|
|
77
|
-
const blockHash = await tx.data.constants.anchorBlockHeader.hash();
|
|
78
|
-
const archiveRootMembershipWitness = await getMembershipWitnessFor(blockHash, MerkleTreeId.ARCHIVE, ARCHIVE_HEIGHT, db);
|
|
79
72
|
const constants = BlockConstantData.from({
|
|
80
73
|
lastArchive,
|
|
81
74
|
l1ToL2TreeSnapshot: newL1ToL2MessageTreeSnapshot,
|
|
@@ -87,29 +80,14 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan('BlockBuilderH
|
|
|
87
80
|
return PrivateBaseRollupHints.from({
|
|
88
81
|
start,
|
|
89
82
|
startSpongeBlob,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
treeSnapshotDiffHints,
|
|
84
|
+
feePayerBalanceLeafPreimage,
|
|
85
|
+
anchorBlockArchiveSiblingPath,
|
|
93
86
|
contractClassLogsFields,
|
|
94
87
|
constants
|
|
95
88
|
});
|
|
96
89
|
}
|
|
97
90
|
});
|
|
98
|
-
export async function getPublicDataHint(db, leafSlot) {
|
|
99
|
-
const { index } = await db.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot) ?? {};
|
|
100
|
-
if (index === undefined) {
|
|
101
|
-
throw new Error(`Cannot find the previous value index for public data ${leafSlot}.`);
|
|
102
|
-
}
|
|
103
|
-
const siblingPath = await db.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, index);
|
|
104
|
-
const membershipWitness = new MembershipWitness(PUBLIC_DATA_TREE_HEIGHT, index, siblingPath.toTuple());
|
|
105
|
-
const leafPreimage = await db.getLeafPreimage(MerkleTreeId.PUBLIC_DATA_TREE, index);
|
|
106
|
-
if (!leafPreimage) {
|
|
107
|
-
throw new Error(`Cannot find the leaf preimage for public data tree at index ${index}.`);
|
|
108
|
-
}
|
|
109
|
-
const exists = leafPreimage.leaf.slot.toBigInt() === leafSlot;
|
|
110
|
-
const value = exists ? leafPreimage.leaf.value : Fr.ZERO;
|
|
111
|
-
return new PublicDataHint(new Fr(leafSlot), value, membershipWitness, leafPreimage);
|
|
112
|
-
}
|
|
113
91
|
export function getCivcProofFromTx(tx) {
|
|
114
92
|
const proofFields = tx.clientIvcProof.proof;
|
|
115
93
|
const numPublicInputs = proofFields.length - CIVC_PROOF_LENGTH;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SpongeBlob } from '@aztec/blob-lib';
|
|
2
|
-
import { type ARCHIVE_HEIGHT, type
|
|
2
|
+
import { type ARCHIVE_HEIGHT, type L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, type NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { type Tuple } from '@aztec/foundation/serialize';
|
|
5
5
|
import { type TreeNodeLocation } from '@aztec/foundation/trees';
|
|
@@ -29,7 +29,7 @@ export declare class BlockProvingState {
|
|
|
29
29
|
readonly lastArchiveTreeSnapshot: AppendOnlyTreeSnapshot;
|
|
30
30
|
private readonly lastArchiveSiblingPath;
|
|
31
31
|
private readonly lastL1ToL2MessageTreeSnapshot;
|
|
32
|
-
private readonly
|
|
32
|
+
private readonly lastL1ToL2MessageSubtreeRootSiblingPath;
|
|
33
33
|
readonly newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot;
|
|
34
34
|
private readonly headerOfLastBlockInPreviousCheckpoint;
|
|
35
35
|
private readonly startSpongeBlob;
|
|
@@ -43,7 +43,7 @@ export declare class BlockProvingState {
|
|
|
43
43
|
private txs;
|
|
44
44
|
private isFirstBlock;
|
|
45
45
|
private error;
|
|
46
|
-
constructor(index: number, blockNumber: number, totalNumTxs: number, constants: CheckpointConstantData, timestamp: UInt64, lastArchiveTreeSnapshot: AppendOnlyTreeSnapshot, lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>, lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
46
|
+
constructor(index: number, blockNumber: number, totalNumTxs: number, constants: CheckpointConstantData, timestamp: UInt64, lastArchiveTreeSnapshot: AppendOnlyTreeSnapshot, lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>, lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>, newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, headerOfLastBlockInPreviousCheckpoint: BlockHeader, startSpongeBlob: SpongeBlob, parentCheckpoint: CheckpointProvingState);
|
|
47
47
|
get epochNumber(): number;
|
|
48
48
|
addNewTx(tx: TxProvingState): number;
|
|
49
49
|
isAcceptingTxs(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,
|
|
1
|
+
{"version":3,"file":"block-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,6CAA6C,EAElD,KAAK,yCAAyC,EAE/C,MAAM,kBAAkB,CAAC;AAC1B,OAA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BAA6B,CAC1C,oBAAoB,EACpB,OAAO,yCAAyC,CACjD;IAKI,yBAAyB,CAAC,KAAK,EAAE,MAAM;IAUvC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,6BAA6B,CAAC,kBAAkB,CAAC;IASlG,yBAAyB;IASzB,kBAAkB,CAAC,aAAa,EAAE,6BAA6B,CAAC,kBAAkB,CAAC;IAInF,wBAAwB;IASxB,uBAAuB,CAC5B,aAAa,EAAE,6BAA6B,CAC1C,uBAAuB,EACvB,OAAO,yCAAyC,CACjD,GACA,gBAAgB;IAKZ,wBAAwB;IAIxB,mBAAmB,CAAC,WAAW,EAAE,WAAW;IAI5C,mBAAmB;IAInB,kBAAkB;IAkBlB,kBAAkB;IAIlB,gBAAgB,CAAC,aAAa,EAAE,UAAU;IAI1C,gBAAgB;IAIhB,kBAAkB;IAIlB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB;IAI5C,oBAAoB,CAAC,aAAa,EAAE,gBAAgB;IASpD,+BAA+B;;;;;;;;;;IAuE/B,mBAAmB;IAWnB,iBAAiB,CAAC,OAAO,EAAE,MAAM;IAI3B,6BAA6B;IAQnC,qBAAqB,CAAC,QAAQ,EAAE,gBAAgB;IAKhD,yBAAyB;IAMzB,oBAAoB;IAIpB,UAAU;IAIV,WAAW;IAIX,QAAQ;IAIR,MAAM,CAAC,MAAM,EAAE,MAAM;CAgB7B"}
|
|
@@ -18,7 +18,7 @@ import { buildHeaderFromCircuitOutputs, toProofData } from './block-building-hel
|
|
|
18
18
|
lastArchiveTreeSnapshot;
|
|
19
19
|
lastArchiveSiblingPath;
|
|
20
20
|
lastL1ToL2MessageTreeSnapshot;
|
|
21
|
-
|
|
21
|
+
lastL1ToL2MessageSubtreeRootSiblingPath;
|
|
22
22
|
newL1ToL2MessageTreeSnapshot;
|
|
23
23
|
headerOfLastBlockInPreviousCheckpoint;
|
|
24
24
|
startSpongeBlob;
|
|
@@ -32,7 +32,7 @@ import { buildHeaderFromCircuitOutputs, toProofData } from './block-building-hel
|
|
|
32
32
|
txs;
|
|
33
33
|
isFirstBlock;
|
|
34
34
|
error;
|
|
35
|
-
constructor(index, blockNumber, totalNumTxs, constants, timestamp, lastArchiveTreeSnapshot, lastArchiveSiblingPath, lastL1ToL2MessageTreeSnapshot,
|
|
35
|
+
constructor(index, blockNumber, totalNumTxs, constants, timestamp, lastArchiveTreeSnapshot, lastArchiveSiblingPath, lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, newL1ToL2MessageTreeSnapshot, headerOfLastBlockInPreviousCheckpoint, startSpongeBlob, parentCheckpoint){
|
|
36
36
|
this.index = index;
|
|
37
37
|
this.blockNumber = blockNumber;
|
|
38
38
|
this.totalNumTxs = totalNumTxs;
|
|
@@ -41,7 +41,7 @@ import { buildHeaderFromCircuitOutputs, toProofData } from './block-building-hel
|
|
|
41
41
|
this.lastArchiveTreeSnapshot = lastArchiveTreeSnapshot;
|
|
42
42
|
this.lastArchiveSiblingPath = lastArchiveSiblingPath;
|
|
43
43
|
this.lastL1ToL2MessageTreeSnapshot = lastL1ToL2MessageTreeSnapshot;
|
|
44
|
-
this.
|
|
44
|
+
this.lastL1ToL2MessageSubtreeRootSiblingPath = lastL1ToL2MessageSubtreeRootSiblingPath;
|
|
45
45
|
this.newL1ToL2MessageTreeSnapshot = newL1ToL2MessageTreeSnapshot;
|
|
46
46
|
this.headerOfLastBlockInPreviousCheckpoint = headerOfLastBlockInPreviousCheckpoint;
|
|
47
47
|
this.startSpongeBlob = startSpongeBlob;
|
|
@@ -238,12 +238,12 @@ import { buildHeaderFromCircuitOutputs, toProofData } from './block-building-hel
|
|
|
238
238
|
if (!leftRollup) {
|
|
239
239
|
return {
|
|
240
240
|
rollupType: 'rollup-block-root-first-empty-tx',
|
|
241
|
-
inputs: new BlockRootEmptyTxFirstRollupPrivateInputs(l1ToL2Roots, this.lastArchiveTreeSnapshot, this.headerOfLastBlockInPreviousCheckpoint.state, this.constants, this.startSpongeBlob, this.timestamp, this.
|
|
241
|
+
inputs: new BlockRootEmptyTxFirstRollupPrivateInputs(l1ToL2Roots, this.lastArchiveTreeSnapshot, this.headerOfLastBlockInPreviousCheckpoint.state, this.constants, this.startSpongeBlob, this.timestamp, this.lastL1ToL2MessageSubtreeRootSiblingPath, this.lastArchiveSiblingPath)
|
|
242
242
|
};
|
|
243
243
|
} else if (!rightRollup) {
|
|
244
244
|
return {
|
|
245
245
|
rollupType: 'rollup-block-root-first-single-tx',
|
|
246
|
-
inputs: new BlockRootSingleTxFirstRollupPrivateInputs(l1ToL2Roots, leftRollup, this.lastL1ToL2MessageTreeSnapshot, this.
|
|
246
|
+
inputs: new BlockRootSingleTxFirstRollupPrivateInputs(l1ToL2Roots, leftRollup, this.lastL1ToL2MessageTreeSnapshot, this.lastL1ToL2MessageSubtreeRootSiblingPath, this.lastArchiveSiblingPath)
|
|
247
247
|
};
|
|
248
248
|
} else {
|
|
249
249
|
return {
|
|
@@ -251,7 +251,7 @@ import { buildHeaderFromCircuitOutputs, toProofData } from './block-building-hel
|
|
|
251
251
|
inputs: new BlockRootFirstRollupPrivateInputs(l1ToL2Roots, [
|
|
252
252
|
leftRollup,
|
|
253
253
|
rightRollup
|
|
254
|
-
], this.lastL1ToL2MessageTreeSnapshot, this.
|
|
254
|
+
], this.lastL1ToL2MessageTreeSnapshot, this.lastL1ToL2MessageSubtreeRootSiblingPath, this.lastArchiveSiblingPath)
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BatchedBlobAccumulator, type FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
|
-
import { type ARCHIVE_HEIGHT, type
|
|
2
|
+
import { type ARCHIVE_HEIGHT, type L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, type NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
5
5
|
import { type TreeNodeLocation } from '@aztec/foundation/trees';
|
|
@@ -23,9 +23,9 @@ export declare class CheckpointProvingState {
|
|
|
23
23
|
private readonly lastArchiveSiblingPath;
|
|
24
24
|
private readonly l1ToL2Messages;
|
|
25
25
|
private readonly lastL1ToL2MessageTreeSnapshot;
|
|
26
|
-
private readonly
|
|
26
|
+
private readonly lastL1ToL2MessageSubtreeRootSiblingPath;
|
|
27
27
|
private readonly newL1ToL2MessageTreeSnapshot;
|
|
28
|
-
private readonly
|
|
28
|
+
private readonly newL1ToL2MessageSubtreeRootSiblingPath;
|
|
29
29
|
parentEpoch: EpochProvingState;
|
|
30
30
|
private onBlobAccumulatorSet;
|
|
31
31
|
private blockProofs;
|
|
@@ -35,7 +35,7 @@ export declare class CheckpointProvingState {
|
|
|
35
35
|
private endBlobAccumulator;
|
|
36
36
|
private error;
|
|
37
37
|
readonly firstBlockNumber: number;
|
|
38
|
-
constructor(index: number, constants: CheckpointConstantData, totalNumBlocks: number, totalNumBlobFields: number, finalBlobBatchingChallenges: FinalBlobBatchingChallenges, headerOfLastBlockInPreviousCheckpoint: BlockHeader, lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>, l1ToL2Messages: Fr[], lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
38
|
+
constructor(index: number, constants: CheckpointConstantData, totalNumBlocks: number, totalNumBlobFields: number, finalBlobBatchingChallenges: FinalBlobBatchingChallenges, headerOfLastBlockInPreviousCheckpoint: BlockHeader, lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>, l1ToL2Messages: Fr[], lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>, newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>, parentEpoch: EpochProvingState, onBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void);
|
|
39
39
|
get epochNumber(): number;
|
|
40
40
|
startNewBlock(blockNumber: number, timestamp: UInt64, totalNumTxs: number, lastArchiveTreeSnapshot: AppendOnlyTreeSnapshot, lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>): BlockProvingState;
|
|
41
41
|
isAcceptingBlocks(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/checkpoint-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEtB,KAAK,2BAA2B,EAEjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,
|
|
1
|
+
{"version":3,"file":"checkpoint-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/checkpoint-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEtB,KAAK,2BAA2B,EAEjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,6CAA6C,EAClD,KAAK,yCAAyC,EAE/C,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAc,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,KAAK,gBAAgB,EAAuB,MAAM,yBAAyB,CAAC;AACrF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAs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BAAgB;IAI5C,yBAAyB,CAAC,aAAa,EAAE,gBAAgB;IASzD,2BAA2B,IAAI,WAAW;IAIpC,6BAA6B;IA8BnC,iCAAiC,CAAC,WAAW,EAAE,MAAM;IAKrD,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB;IAI/C,wBAAwB;IAKxB,WAAW;IAIX,QAAQ;IAKR,MAAM;IAIN,MAAM,CAAC,MAAM,EAAE,MAAM;CAW7B"}
|
|
@@ -17,9 +17,9 @@ export class CheckpointProvingState {
|
|
|
17
17
|
lastArchiveSiblingPath;
|
|
18
18
|
l1ToL2Messages;
|
|
19
19
|
lastL1ToL2MessageTreeSnapshot;
|
|
20
|
-
|
|
20
|
+
lastL1ToL2MessageSubtreeRootSiblingPath;
|
|
21
21
|
newL1ToL2MessageTreeSnapshot;
|
|
22
|
-
|
|
22
|
+
newL1ToL2MessageSubtreeRootSiblingPath;
|
|
23
23
|
parentEpoch;
|
|
24
24
|
onBlobAccumulatorSet;
|
|
25
25
|
blockProofs;
|
|
@@ -30,8 +30,8 @@ export class CheckpointProvingState {
|
|
|
30
30
|
error;
|
|
31
31
|
firstBlockNumber;
|
|
32
32
|
constructor(index, constants, totalNumBlocks, totalNumBlobFields, finalBlobBatchingChallenges, headerOfLastBlockInPreviousCheckpoint, lastArchiveSiblingPath, l1ToL2Messages, // The snapshot and sibling path before the new l1 to l2 message subtree is inserted.
|
|
33
|
-
lastL1ToL2MessageTreeSnapshot,
|
|
34
|
-
newL1ToL2MessageTreeSnapshot,
|
|
33
|
+
lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, // The snapshot and sibling path after the new l1 to l2 message subtree is inserted.
|
|
34
|
+
newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath, parentEpoch, onBlobAccumulatorSet){
|
|
35
35
|
this.index = index;
|
|
36
36
|
this.constants = constants;
|
|
37
37
|
this.totalNumBlocks = totalNumBlocks;
|
|
@@ -41,9 +41,9 @@ export class CheckpointProvingState {
|
|
|
41
41
|
this.lastArchiveSiblingPath = lastArchiveSiblingPath;
|
|
42
42
|
this.l1ToL2Messages = l1ToL2Messages;
|
|
43
43
|
this.lastL1ToL2MessageTreeSnapshot = lastL1ToL2MessageTreeSnapshot;
|
|
44
|
-
this.
|
|
44
|
+
this.lastL1ToL2MessageSubtreeRootSiblingPath = lastL1ToL2MessageSubtreeRootSiblingPath;
|
|
45
45
|
this.newL1ToL2MessageTreeSnapshot = newL1ToL2MessageTreeSnapshot;
|
|
46
|
-
this.
|
|
46
|
+
this.newL1ToL2MessageSubtreeRootSiblingPath = newL1ToL2MessageSubtreeRootSiblingPath;
|
|
47
47
|
this.parentEpoch = parentEpoch;
|
|
48
48
|
this.onBlobAccumulatorSet = onBlobAccumulatorSet;
|
|
49
49
|
this.blocks = [];
|
|
@@ -62,12 +62,12 @@ export class CheckpointProvingState {
|
|
|
62
62
|
// Otherwise, we use the snapshot and sibling path after the new l1 to l2 messages are inserted, which will always
|
|
63
63
|
// happen in the first block.
|
|
64
64
|
const lastL1ToL2MessageTreeSnapshot = index === 0 ? this.lastL1ToL2MessageTreeSnapshot : this.newL1ToL2MessageTreeSnapshot;
|
|
65
|
-
const
|
|
65
|
+
const lastL1ToL2MessageSubtreeRootSiblingPath = index === 0 ? this.lastL1ToL2MessageSubtreeRootSiblingPath : this.newL1ToL2MessageSubtreeRootSiblingPath;
|
|
66
66
|
const startSpongeBlob = index === 0 ? SpongeBlob.init(this.totalNumBlobFields) : this.blocks[index - 1]?.getEndSpongeBlob();
|
|
67
67
|
if (!startSpongeBlob) {
|
|
68
68
|
throw new Error('Cannot start a new block before the trees have progressed from the tx effects in the previous block.');
|
|
69
69
|
}
|
|
70
|
-
const block = new BlockProvingState(index, blockNumber, totalNumTxs, this.constants, timestamp, lastArchiveTreeSnapshot, lastArchiveSiblingPath, lastL1ToL2MessageTreeSnapshot,
|
|
70
|
+
const block = new BlockProvingState(index, blockNumber, totalNumTxs, this.constants, timestamp, lastArchiveTreeSnapshot, lastArchiveSiblingPath, lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, this.newL1ToL2MessageTreeSnapshot, this.headerOfLastBlockInPreviousCheckpoint, startSpongeBlob, this);
|
|
71
71
|
this.blocks[index] = block;
|
|
72
72
|
return block;
|
|
73
73
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BatchedBlob, type FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
|
-
import type { ARCHIVE_HEIGHT,
|
|
2
|
+
import type { ARCHIVE_HEIGHT, L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
3
3
|
import type { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
5
5
|
import { type TreeNodeLocation } from '@aztec/foundation/trees';
|
|
@@ -41,7 +41,7 @@ export declare class EpochProvingState {
|
|
|
41
41
|
private provingStateLifecycle;
|
|
42
42
|
readonly cachedTubeProofs: Map<string, Promise<PublicInputsAndRecursiveProof<PrivateToPublicKernelCircuitPublicInputs, 535>>>;
|
|
43
43
|
constructor(epochNumber: number, totalNumCheckpoints: number, finalBlobBatchingChallenges: FinalBlobBatchingChallenges, onCheckpointBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void, completionCallback: (result: ProvingResult) => void, rejectionCallback: (reason: string) => void);
|
|
44
|
-
startNewCheckpoint(checkpointIndex: number, constants: CheckpointConstantData, totalNumBlocks: number, totalNumBlobFields: number, previousBlockHeader: BlockHeader, lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>, l1ToL2Messages: Fr[], lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
44
|
+
startNewCheckpoint(checkpointIndex: number, constants: CheckpointConstantData, totalNumBlocks: number, totalNumBlobFields: number, previousBlockHeader: BlockHeader, lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>, l1ToL2Messages: Fr[], lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>, newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>): CheckpointProvingState;
|
|
45
45
|
getCheckpointProvingState(index: number): CheckpointProvingState | undefined;
|
|
46
46
|
getCheckpointProvingStateByBlockNumber(blockNumber: number): CheckpointProvingState | undefined;
|
|
47
47
|
getBlockProvingStateByBlockNumber(blockNumber: number): import("./block-proving-state.js").BlockProvingState | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epoch-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/epoch-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA0B,KAAK,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACxG,OAAO,KAAK,EACV,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"epoch-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/epoch-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA0B,KAAK,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACxG,OAAO,KAAK,EACV,cAAc,EACd,6CAA6C,EAE7C,yCAAyC,EAC1C,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,KAAK,gBAAgB,EAAuB,MAAM,yBAAyB,CAAC;AACrF,OAAO,KAAK,EAAE,6BAA6B,EAAE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AAO,yCAAyC,CACjD;IAKU,mBAAmB;IAwBnB,mBAAmB;IAOzB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB;IAI5C,8BAA8B,CAAC,aAAa,EAAE,gBAAgB;IAS9D,mBAAmB;IAWnB,0BAA0B;IAI1B,mBAAmB,IAAI;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,YAAY,EAAE,sBAAsB,CAAC;QAAC,iBAAiB,EAAE,WAAW,CAAA;KAAE;IAc7G,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB;IAKpD,oBAAoB;IAMpB,MAAM;IAMN,MAAM,CAAC,MAAM,EAAE,MAAM;IAUrB,OAAO,CAAC,MAAM,EAAE,aAAa;CAerC"}
|
|
@@ -47,11 +47,11 @@ var PROVING_STATE_LIFECYCLE = /*#__PURE__*/ function(PROVING_STATE_LIFECYCLE) {
|
|
|
47
47
|
}
|
|
48
48
|
// Adds a block to the proving state, returns its index
|
|
49
49
|
// Will update the proving life cycle if this is the last block
|
|
50
|
-
startNewCheckpoint(checkpointIndex, constants, totalNumBlocks, totalNumBlobFields, previousBlockHeader, lastArchiveSiblingPath, l1ToL2Messages, lastL1ToL2MessageTreeSnapshot,
|
|
50
|
+
startNewCheckpoint(checkpointIndex, constants, totalNumBlocks, totalNumBlobFields, previousBlockHeader, lastArchiveSiblingPath, l1ToL2Messages, lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath) {
|
|
51
51
|
if (checkpointIndex >= this.totalNumCheckpoints) {
|
|
52
52
|
throw new Error(`Unable to start a new checkpoint at index ${checkpointIndex}. Expected at most ${this.totalNumCheckpoints} checkpoints.`);
|
|
53
53
|
}
|
|
54
|
-
const checkpoint = new CheckpointProvingState(checkpointIndex, constants, totalNumBlocks, totalNumBlobFields, this.finalBlobBatchingChallenges, previousBlockHeader, lastArchiveSiblingPath, l1ToL2Messages, lastL1ToL2MessageTreeSnapshot,
|
|
54
|
+
const checkpoint = new CheckpointProvingState(checkpointIndex, constants, totalNumBlocks, totalNumBlobFields, this.finalBlobBatchingChallenges, previousBlockHeader, lastArchiveSiblingPath, l1ToL2Messages, lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath, this, this.onCheckpointBlobAccumulatorSet);
|
|
55
55
|
this.checkpoints[checkpointIndex] = checkpoint;
|
|
56
56
|
if (this.checkpoints.filter((c)=>!!c).length === this.totalNumCheckpoints) {
|
|
57
57
|
this.provingStateLifecycle = 1;
|
|
@@ -5,7 +5,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
}
|
|
7
7
|
import { BlobAccumulatorPublicInputs } from '@aztec/blob-lib';
|
|
8
|
-
import { L1_TO_L2_MSG_SUBTREE_HEIGHT,
|
|
8
|
+
import { L1_TO_L2_MSG_SUBTREE_HEIGHT, L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, NUM_BASE_PARITY_PER_ROOT_PARITY } from '@aztec/constants';
|
|
9
9
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
10
10
|
import { AbortError } from '@aztec/foundation/error';
|
|
11
11
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -93,8 +93,8 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
93
93
|
// Get archive sibling path before any block in this checkpoint lands.
|
|
94
94
|
const lastArchiveSiblingPath = await getLastSiblingPath(MerkleTreeId.ARCHIVE, db);
|
|
95
95
|
// Insert all the l1 to l2 messages into the db. And get the states before and after the insertion.
|
|
96
|
-
const { lastL1ToL2MessageTreeSnapshot,
|
|
97
|
-
this.provingState.startNewCheckpoint(checkpointIndex, constants, totalNumBlocks, totalNumBlobFields, headerOfLastBlockInPreviousCheckpoint, lastArchiveSiblingPath, l1ToL2Messages, lastL1ToL2MessageTreeSnapshot,
|
|
96
|
+
const { lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath } = await this.updateL1ToL2MessageTree(l1ToL2Messages, db);
|
|
97
|
+
this.provingState.startNewCheckpoint(checkpointIndex, constants, totalNumBlocks, totalNumBlobFields, headerOfLastBlockInPreviousCheckpoint, lastArchiveSiblingPath, l1ToL2Messages, lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath);
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* Starts off a new block
|
|
@@ -392,16 +392,16 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
392
392
|
async updateL1ToL2MessageTree(l1ToL2Messages, db) {
|
|
393
393
|
const l1ToL2MessagesPadded = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, 'Too many L1 to L2 messages');
|
|
394
394
|
const lastL1ToL2MessageTreeSnapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, db);
|
|
395
|
-
const
|
|
395
|
+
const lastL1ToL2MessageSubtreeRootSiblingPath = assertLength(await getSubtreeSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, L1_TO_L2_MSG_SUBTREE_HEIGHT, db), L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH);
|
|
396
396
|
// Update the local trees to include the new l1 to l2 messages
|
|
397
397
|
await db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l1ToL2MessagesPadded);
|
|
398
398
|
const newL1ToL2MessageTreeSnapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, db);
|
|
399
|
-
const
|
|
399
|
+
const newL1ToL2MessageSubtreeRootSiblingPath = assertLength(await getSubtreeSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, L1_TO_L2_MSG_SUBTREE_HEIGHT, db), L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH);
|
|
400
400
|
return {
|
|
401
401
|
lastL1ToL2MessageTreeSnapshot,
|
|
402
|
-
|
|
402
|
+
lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
403
403
|
newL1ToL2MessageTreeSnapshot,
|
|
404
|
-
|
|
404
|
+
newL1ToL2MessageSubtreeRootSiblingPath
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
407
|
// Updates the merkle trees for a transaction. The first enqueued job for a transaction
|
|
@@ -455,7 +455,7 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
455
455
|
}
|
|
456
456
|
}), (result)=>{
|
|
457
457
|
logger.debug(`Completed proof for ${rollupType} for tx ${processedTx.hash.toString()}`);
|
|
458
|
-
validatePartialState(result.inputs.
|
|
458
|
+
validatePartialState(result.inputs.endTreeSnapshots, txProvingState.treeSnapshots);
|
|
459
459
|
const leafLocation = provingState.setBaseRollupProof(txIndex, result);
|
|
460
460
|
if (provingState.totalNumTxs === 1) {
|
|
461
461
|
this.checkAndEnqueueBlockRootRollup(provingState);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/tx-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EAEpC,yCAAyC,EAC1C,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAC9G,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,sBAAsB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X } from '@aztec/constants';
|
|
|
2
2
|
import { getVkData } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
3
3
|
import { getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
4
|
import { ProofData } from '@aztec/stdlib/proofs';
|
|
5
|
-
import {
|
|
5
|
+
import { PrivateBaseRollupHints, PrivateTxBaseRollupPrivateInputs, PublicBaseRollupHints, PublicTxBaseRollupPrivateInputs } from '@aztec/stdlib/rollup';
|
|
6
6
|
import { VkData } from '@aztec/stdlib/vks';
|
|
7
7
|
import { getCivcProofFromTx, getPublicTubePrivateInputsFromTx, toProofData } from './block-building-helpers.js';
|
|
8
8
|
/**
|
|
@@ -72,10 +72,12 @@ import { getCivcProofFromTx, getPublicTubePrivateInputsFromTx, toProofData } fro
|
|
|
72
72
|
throw new Error('Mismatched base rollup hints, expected public base rollup hints');
|
|
73
73
|
}
|
|
74
74
|
const publicTubeProofData = toProofData(this.publicTube);
|
|
75
|
-
const avmProofData = new
|
|
75
|
+
const avmProofData = new ProofData(this.processedTx.avmProvingRequest.inputs.publicInputs, this.avm.proof, this.#getVkData(this.avm.verificationKey, AVM_VK_INDEX));
|
|
76
76
|
return new PublicTxBaseRollupPrivateInputs(publicTubeProofData, avmProofData, this.baseRollupHints);
|
|
77
77
|
}
|
|
78
78
|
#getVkData(verificationKey, vkIndex) {
|
|
79
|
+
// TODO(#17162): Add avm vk hash to the tree and call `getVkData('AVM')` instead.
|
|
80
|
+
// Below will return a path to an empty leaf.
|
|
79
81
|
const vkPath = getVKSiblingPath(vkIndex);
|
|
80
82
|
return new VkData(verificationKey, vkIndex, vkPath);
|
|
81
83
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20250926",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -67,19 +67,19 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
71
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
72
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
73
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
74
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
75
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
76
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
77
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
78
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
79
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
80
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
81
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
82
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
70
|
+
"@aztec/bb-prover": "3.0.0-nightly.20250926",
|
|
71
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250926",
|
|
72
|
+
"@aztec/constants": "3.0.0-nightly.20250926",
|
|
73
|
+
"@aztec/ethereum": "3.0.0-nightly.20250926",
|
|
74
|
+
"@aztec/foundation": "3.0.0-nightly.20250926",
|
|
75
|
+
"@aztec/kv-store": "3.0.0-nightly.20250926",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20250926",
|
|
77
|
+
"@aztec/noir-types": "3.0.0-nightly.20250926",
|
|
78
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250926",
|
|
79
|
+
"@aztec/simulator": "3.0.0-nightly.20250926",
|
|
80
|
+
"@aztec/stdlib": "3.0.0-nightly.20250926",
|
|
81
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20250926",
|
|
82
|
+
"@aztec/world-state": "3.0.0-nightly.20250926",
|
|
83
83
|
"@google-cloud/storage": "^7.15.0",
|
|
84
84
|
"@iarna/toml": "^2.2.5",
|
|
85
85
|
"commander": "^12.1.0",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"zod": "^3.23.8"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
92
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20250926",
|
|
93
93
|
"@jest/globals": "^30.0.0",
|
|
94
94
|
"@types/jest": "^30.0.0",
|
|
95
95
|
"@types/node": "^22.15.17",
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
MAX_NOTE_HASHES_PER_TX,
|
|
7
7
|
MAX_NULLIFIERS_PER_TX,
|
|
8
8
|
NOTE_HASH_SUBTREE_HEIGHT,
|
|
9
|
-
|
|
9
|
+
NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
10
10
|
NULLIFIER_SUBTREE_HEIGHT,
|
|
11
|
-
|
|
11
|
+
NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
12
12
|
NULLIFIER_TREE_HEIGHT,
|
|
13
13
|
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
14
14
|
PUBLIC_DATA_TREE_HEIGHT,
|
|
@@ -22,7 +22,6 @@ import { MembershipWitness, MerkleTreeCalculator, computeUnbalancedMerkleTreeRoo
|
|
|
22
22
|
import { getVkData } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
23
23
|
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
24
24
|
import { computeFeePayerBalanceLeafSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
25
|
-
import { PublicDataHint } from '@aztec/stdlib/avm';
|
|
26
25
|
import { Body, L2BlockHeader, getBlockBlobFields } from '@aztec/stdlib/block';
|
|
27
26
|
import type { MerkleTreeWriteOperations, PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
28
27
|
import { ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
@@ -31,9 +30,9 @@ import {
|
|
|
31
30
|
BlockConstantData,
|
|
32
31
|
BlockRollupPublicInputs,
|
|
33
32
|
PrivateBaseRollupHints,
|
|
34
|
-
PrivateBaseStateDiffHints,
|
|
35
33
|
PublicBaseRollupHints,
|
|
36
34
|
PublicTubePrivateInputs,
|
|
35
|
+
TreeSnapshotDiffHints,
|
|
37
36
|
} from '@aztec/stdlib/rollup';
|
|
38
37
|
import {
|
|
39
38
|
AppendOnlyTreeSnapshot,
|
|
@@ -85,15 +84,11 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
85
84
|
await getTreeSnapshot(MerkleTreeId.NULLIFIER_TREE, db),
|
|
86
85
|
await getTreeSnapshot(MerkleTreeId.PUBLIC_DATA_TREE, db),
|
|
87
86
|
);
|
|
88
|
-
// Get the subtree sibling paths for the circuit
|
|
89
|
-
const noteHashSubtreeSiblingPathArray = await getSubtreeSiblingPath(
|
|
90
|
-
MerkleTreeId.NOTE_HASH_TREE,
|
|
91
|
-
NOTE_HASH_SUBTREE_HEIGHT,
|
|
92
|
-
db,
|
|
93
|
-
);
|
|
94
87
|
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
// Get the note hash subtree root sibling path for insertion.
|
|
89
|
+
const noteHashSubtreeRootSiblingPath = assertLength(
|
|
90
|
+
await getSubtreeSiblingPath(MerkleTreeId.NOTE_HASH_TREE, NOTE_HASH_SUBTREE_HEIGHT, db),
|
|
91
|
+
NOTE_HASH_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
97
92
|
);
|
|
98
93
|
|
|
99
94
|
// Update the note hash trees with the new items being inserted to get the new roots
|
|
@@ -101,10 +96,6 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
101
96
|
const noteHashes = padArrayEnd(tx.txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX);
|
|
102
97
|
await db.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, noteHashes);
|
|
103
98
|
|
|
104
|
-
// Create data hint for reading fee payer initial balance in Fee Juice
|
|
105
|
-
const leafSlot = await computeFeePayerBalanceLeafSlot(tx.data.feePayer);
|
|
106
|
-
const feePayerFeeJuiceBalanceReadHint = await getPublicDataHint(db, leafSlot.toBigInt());
|
|
107
|
-
|
|
108
99
|
// The read witnesses for a given TX should be generated before the writes of the same TX are applied.
|
|
109
100
|
// All reads that refer to writes in the same tx are transient and can be simplified out.
|
|
110
101
|
const txPublicDataUpdateRequestInfo = await processPublicDataUpdateRequests(tx, db);
|
|
@@ -112,8 +103,8 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
112
103
|
// Update the nullifier tree, capturing the low nullifier info for each individual operation
|
|
113
104
|
const {
|
|
114
105
|
lowLeavesWitnessData: nullifierWitnessLeaves,
|
|
115
|
-
newSubtreeSiblingPath:
|
|
116
|
-
sortedNewLeaves:
|
|
106
|
+
newSubtreeSiblingPath: nullifiersSubtreeRootSiblingPath,
|
|
107
|
+
sortedNewLeaves: sortedNullifiers,
|
|
117
108
|
sortedNewLeavesIndexes,
|
|
118
109
|
} = await db.batchInsert(
|
|
119
110
|
MerkleTreeId.NULLIFIER_TREE,
|
|
@@ -125,17 +116,10 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
125
116
|
throw new Error(`Could not craft nullifier batch insertion proofs`);
|
|
126
117
|
}
|
|
127
118
|
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const nullifierSubtreeSiblingPathArray = nullifiersSubtreeSiblingPath.toFields();
|
|
135
|
-
|
|
136
|
-
const nullifierSubtreeSiblingPath = makeTuple(NULLIFIER_SUBTREE_SIBLING_PATH_LENGTH, i =>
|
|
137
|
-
i < nullifierSubtreeSiblingPathArray.length ? nullifierSubtreeSiblingPathArray[i] : Fr.ZERO,
|
|
138
|
-
);
|
|
119
|
+
const blockHash = await tx.data.constants.anchorBlockHeader.hash();
|
|
120
|
+
const anchorBlockArchiveSiblingPath = (
|
|
121
|
+
await getMembershipWitnessFor(blockHash, MerkleTreeId.ARCHIVE, ARCHIVE_HEIGHT, db)
|
|
122
|
+
).siblingPath;
|
|
139
123
|
|
|
140
124
|
const contractClassLogsFields = makeTuple(
|
|
141
125
|
MAX_CONTRACT_CLASS_LOGS_PER_TX,
|
|
@@ -143,18 +127,10 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
143
127
|
);
|
|
144
128
|
|
|
145
129
|
if (tx.avmProvingRequest) {
|
|
146
|
-
const blockHash = await tx.data.constants.anchorBlockHeader.hash();
|
|
147
|
-
const archiveRootMembershipWitness = await getMembershipWitnessFor(
|
|
148
|
-
blockHash,
|
|
149
|
-
MerkleTreeId.ARCHIVE,
|
|
150
|
-
ARCHIVE_HEIGHT,
|
|
151
|
-
db,
|
|
152
|
-
);
|
|
153
|
-
|
|
154
130
|
return PublicBaseRollupHints.from({
|
|
155
131
|
startSpongeBlob,
|
|
156
132
|
lastArchive,
|
|
157
|
-
|
|
133
|
+
anchorBlockArchiveSiblingPath,
|
|
158
134
|
contractClassLogsFields,
|
|
159
135
|
proverId,
|
|
160
136
|
});
|
|
@@ -167,43 +143,47 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
167
143
|
throw new Error(`More than one public data write in a private only tx`);
|
|
168
144
|
}
|
|
169
145
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
146
|
+
// Get hints for reading fee payer's balance in the public data tree.
|
|
147
|
+
const feePayerBalanceMembershipWitness = txPublicDataUpdateRequestInfo.lowPublicDataWritesMembershipWitnesses[0];
|
|
148
|
+
const feePayerBalanceLeafPreimage = txPublicDataUpdateRequestInfo.lowPublicDataWritesPreimages[0];
|
|
149
|
+
const leafSlot = await computeFeePayerBalanceLeafSlot(tx.data.feePayer);
|
|
150
|
+
if (!feePayerBalanceMembershipWitness || !leafSlot.equals(feePayerBalanceLeafPreimage?.leaf.slot)) {
|
|
151
|
+
throw new Error(`Cannot find the public data tree leaf for the fee payer's balance`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Extract witness objects from returned data
|
|
155
|
+
const nullifierPredecessorMembershipWitnessesWithoutPadding: MembershipWitness<typeof NULLIFIER_TREE_HEIGHT>[] =
|
|
156
|
+
nullifierWitnessLeaves.map(l =>
|
|
157
|
+
MembershipWitness.fromBufferArray(
|
|
158
|
+
l.index,
|
|
159
|
+
assertLength(l.siblingPath.toBufferArray(), NULLIFIER_TREE_HEIGHT),
|
|
160
|
+
),
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
const treeSnapshotDiffHints = TreeSnapshotDiffHints.from({
|
|
164
|
+
noteHashSubtreeRootSiblingPath,
|
|
165
|
+
nullifierPredecessorPreimages: padArrayEnd(
|
|
166
|
+
nullifierWitnessLeaves.map(l => l.leafPreimage as NullifierLeafPreimage),
|
|
167
|
+
NullifierLeafPreimage.empty(),
|
|
168
|
+
MAX_NULLIFIERS_PER_TX,
|
|
184
169
|
),
|
|
185
170
|
nullifierPredecessorMembershipWitnesses: makeTuple(MAX_NULLIFIERS_PER_TX, i =>
|
|
186
171
|
i < nullifierPredecessorMembershipWitnessesWithoutPadding.length
|
|
187
172
|
? nullifierPredecessorMembershipWitnessesWithoutPadding[i]
|
|
188
173
|
: makeEmptyMembershipWitness(NULLIFIER_TREE_HEIGHT),
|
|
189
174
|
),
|
|
190
|
-
sortedNullifiers:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
175
|
+
sortedNullifiers: assertLength(
|
|
176
|
+
sortedNullifiers.map(n => Fr.fromBuffer(n)),
|
|
177
|
+
MAX_NULLIFIERS_PER_TX,
|
|
178
|
+
),
|
|
179
|
+
sortedNullifierIndexes: assertLength(sortedNewLeavesIndexes, MAX_NULLIFIERS_PER_TX),
|
|
180
|
+
nullifierSubtreeRootSiblingPath: assertLength(
|
|
181
|
+
nullifiersSubtreeRootSiblingPath.toFields(),
|
|
182
|
+
NULLIFIER_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
183
|
+
),
|
|
184
|
+
feePayerBalanceMembershipWitness,
|
|
197
185
|
});
|
|
198
186
|
|
|
199
|
-
const blockHash = await tx.data.constants.anchorBlockHeader.hash();
|
|
200
|
-
const archiveRootMembershipWitness = await getMembershipWitnessFor(
|
|
201
|
-
blockHash,
|
|
202
|
-
MerkleTreeId.ARCHIVE,
|
|
203
|
-
ARCHIVE_HEIGHT,
|
|
204
|
-
db,
|
|
205
|
-
);
|
|
206
|
-
|
|
207
187
|
const constants = BlockConstantData.from({
|
|
208
188
|
lastArchive,
|
|
209
189
|
l1ToL2TreeSnapshot: newL1ToL2MessageTreeSnapshot,
|
|
@@ -216,9 +196,9 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
216
196
|
return PrivateBaseRollupHints.from({
|
|
217
197
|
start,
|
|
218
198
|
startSpongeBlob,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
199
|
+
treeSnapshotDiffHints,
|
|
200
|
+
feePayerBalanceLeafPreimage,
|
|
201
|
+
anchorBlockArchiveSiblingPath,
|
|
222
202
|
contractClassLogsFields,
|
|
223
203
|
constants,
|
|
224
204
|
});
|
|
@@ -226,26 +206,6 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
226
206
|
},
|
|
227
207
|
);
|
|
228
208
|
|
|
229
|
-
export async function getPublicDataHint(db: MerkleTreeWriteOperations, leafSlot: bigint) {
|
|
230
|
-
const { index } = (await db.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot)) ?? {};
|
|
231
|
-
if (index === undefined) {
|
|
232
|
-
throw new Error(`Cannot find the previous value index for public data ${leafSlot}.`);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const siblingPath = await db.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, index);
|
|
236
|
-
const membershipWitness = new MembershipWitness(PUBLIC_DATA_TREE_HEIGHT, index, siblingPath.toTuple());
|
|
237
|
-
|
|
238
|
-
const leafPreimage = (await db.getLeafPreimage(MerkleTreeId.PUBLIC_DATA_TREE, index)) as PublicDataTreeLeafPreimage;
|
|
239
|
-
if (!leafPreimage) {
|
|
240
|
-
throw new Error(`Cannot find the leaf preimage for public data tree at index ${index}.`);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const exists = leafPreimage.leaf.slot.toBigInt() === leafSlot;
|
|
244
|
-
const value = exists ? leafPreimage.leaf.value : Fr.ZERO;
|
|
245
|
-
|
|
246
|
-
return new PublicDataHint(new Fr(leafSlot), value, membershipWitness, leafPreimage);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
209
|
export function getCivcProofFromTx(tx: Tx | ProcessedTx) {
|
|
250
210
|
const proofFields = tx.clientIvcProof.proof;
|
|
251
211
|
const numPublicInputs = proofFields.length - CIVC_PROOF_LENGTH;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SpongeBlob } from '@aztec/blob-lib';
|
|
2
2
|
import {
|
|
3
3
|
type ARCHIVE_HEIGHT,
|
|
4
|
-
type
|
|
4
|
+
type L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
5
5
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
6
6
|
type NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
7
7
|
NUM_BASE_PARITY_PER_ROOT_PARITY,
|
|
@@ -69,7 +69,10 @@ export class BlockProvingState {
|
|
|
69
69
|
public readonly lastArchiveTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
70
70
|
private readonly lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
71
71
|
private readonly lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
72
|
-
private readonly
|
|
72
|
+
private readonly lastL1ToL2MessageSubtreeRootSiblingPath: Tuple<
|
|
73
|
+
Fr,
|
|
74
|
+
typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH
|
|
75
|
+
>,
|
|
73
76
|
public readonly newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
74
77
|
private readonly headerOfLastBlockInPreviousCheckpoint: BlockHeader,
|
|
75
78
|
private readonly startSpongeBlob: SpongeBlob,
|
|
@@ -295,7 +298,7 @@ export class BlockProvingState {
|
|
|
295
298
|
this.constants,
|
|
296
299
|
this.startSpongeBlob,
|
|
297
300
|
this.timestamp,
|
|
298
|
-
this.
|
|
301
|
+
this.lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
299
302
|
this.lastArchiveSiblingPath,
|
|
300
303
|
),
|
|
301
304
|
};
|
|
@@ -306,7 +309,7 @@ export class BlockProvingState {
|
|
|
306
309
|
l1ToL2Roots,
|
|
307
310
|
leftRollup,
|
|
308
311
|
this.lastL1ToL2MessageTreeSnapshot,
|
|
309
|
-
this.
|
|
312
|
+
this.lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
310
313
|
this.lastArchiveSiblingPath,
|
|
311
314
|
),
|
|
312
315
|
};
|
|
@@ -317,7 +320,7 @@ export class BlockProvingState {
|
|
|
317
320
|
l1ToL2Roots,
|
|
318
321
|
[leftRollup, rightRollup],
|
|
319
322
|
this.lastL1ToL2MessageTreeSnapshot,
|
|
320
|
-
this.
|
|
323
|
+
this.lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
321
324
|
this.lastArchiveSiblingPath,
|
|
322
325
|
),
|
|
323
326
|
};
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type ARCHIVE_HEIGHT,
|
|
9
9
|
BLOBS_PER_BLOCK,
|
|
10
10
|
FIELDS_PER_BLOB,
|
|
11
|
-
type
|
|
11
|
+
type L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
12
12
|
type NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
13
13
|
NUM_MSGS_PER_BASE_PARITY,
|
|
14
14
|
} from '@aztec/constants';
|
|
@@ -60,10 +60,16 @@ export class CheckpointProvingState {
|
|
|
60
60
|
private readonly l1ToL2Messages: Fr[],
|
|
61
61
|
// The snapshot and sibling path before the new l1 to l2 message subtree is inserted.
|
|
62
62
|
private readonly lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
63
|
-
private readonly
|
|
63
|
+
private readonly lastL1ToL2MessageSubtreeRootSiblingPath: Tuple<
|
|
64
|
+
Fr,
|
|
65
|
+
typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH
|
|
66
|
+
>,
|
|
64
67
|
// The snapshot and sibling path after the new l1 to l2 message subtree is inserted.
|
|
65
68
|
private readonly newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
66
|
-
private readonly
|
|
69
|
+
private readonly newL1ToL2MessageSubtreeRootSiblingPath: Tuple<
|
|
70
|
+
Fr,
|
|
71
|
+
typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH
|
|
72
|
+
>,
|
|
67
73
|
public parentEpoch: EpochProvingState,
|
|
68
74
|
private onBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void,
|
|
69
75
|
) {
|
|
@@ -92,8 +98,8 @@ export class CheckpointProvingState {
|
|
|
92
98
|
// happen in the first block.
|
|
93
99
|
const lastL1ToL2MessageTreeSnapshot =
|
|
94
100
|
index === 0 ? this.lastL1ToL2MessageTreeSnapshot : this.newL1ToL2MessageTreeSnapshot;
|
|
95
|
-
const
|
|
96
|
-
index === 0 ? this.
|
|
101
|
+
const lastL1ToL2MessageSubtreeRootSiblingPath =
|
|
102
|
+
index === 0 ? this.lastL1ToL2MessageSubtreeRootSiblingPath : this.newL1ToL2MessageSubtreeRootSiblingPath;
|
|
97
103
|
|
|
98
104
|
const startSpongeBlob =
|
|
99
105
|
index === 0 ? SpongeBlob.init(this.totalNumBlobFields) : this.blocks[index - 1]?.getEndSpongeBlob();
|
|
@@ -112,7 +118,7 @@ export class CheckpointProvingState {
|
|
|
112
118
|
lastArchiveTreeSnapshot,
|
|
113
119
|
lastArchiveSiblingPath,
|
|
114
120
|
lastL1ToL2MessageTreeSnapshot,
|
|
115
|
-
|
|
121
|
+
lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
116
122
|
this.newL1ToL2MessageTreeSnapshot,
|
|
117
123
|
this.headerOfLastBlockInPreviousCheckpoint,
|
|
118
124
|
startSpongeBlob,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BatchedBlob, BatchedBlobAccumulator, type FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
2
|
import type {
|
|
3
3
|
ARCHIVE_HEIGHT,
|
|
4
|
-
|
|
4
|
+
L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
5
5
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
6
6
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
7
7
|
} from '@aztec/constants';
|
|
@@ -91,9 +91,9 @@ export class EpochProvingState {
|
|
|
91
91
|
lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
92
92
|
l1ToL2Messages: Fr[],
|
|
93
93
|
lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
94
|
-
|
|
94
|
+
lastL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>,
|
|
95
95
|
newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
96
|
-
|
|
96
|
+
newL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>,
|
|
97
97
|
): CheckpointProvingState {
|
|
98
98
|
if (checkpointIndex >= this.totalNumCheckpoints) {
|
|
99
99
|
throw new Error(
|
|
@@ -111,9 +111,9 @@ export class EpochProvingState {
|
|
|
111
111
|
lastArchiveSiblingPath,
|
|
112
112
|
l1ToL2Messages,
|
|
113
113
|
lastL1ToL2MessageTreeSnapshot,
|
|
114
|
-
|
|
114
|
+
lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
115
115
|
newL1ToL2MessageTreeSnapshot,
|
|
116
|
-
|
|
116
|
+
newL1ToL2MessageSubtreeRootSiblingPath,
|
|
117
117
|
this,
|
|
118
118
|
this.onCheckpointBlobAccumulatorSet,
|
|
119
119
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BatchedBlob, BlobAccumulatorPublicInputs, FinalBlobBatchingChallenges, SpongeBlob } from '@aztec/blob-lib';
|
|
2
2
|
import {
|
|
3
3
|
L1_TO_L2_MSG_SUBTREE_HEIGHT,
|
|
4
|
-
|
|
4
|
+
L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
5
5
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
6
6
|
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
7
7
|
NUM_BASE_PARITY_PER_ROOT_PARITY,
|
|
@@ -171,9 +171,9 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
171
171
|
// Insert all the l1 to l2 messages into the db. And get the states before and after the insertion.
|
|
172
172
|
const {
|
|
173
173
|
lastL1ToL2MessageTreeSnapshot,
|
|
174
|
-
|
|
174
|
+
lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
175
175
|
newL1ToL2MessageTreeSnapshot,
|
|
176
|
-
|
|
176
|
+
newL1ToL2MessageSubtreeRootSiblingPath,
|
|
177
177
|
} = await this.updateL1ToL2MessageTree(l1ToL2Messages, db);
|
|
178
178
|
|
|
179
179
|
this.provingState.startNewCheckpoint(
|
|
@@ -185,9 +185,9 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
185
185
|
lastArchiveSiblingPath,
|
|
186
186
|
l1ToL2Messages,
|
|
187
187
|
lastL1ToL2MessageTreeSnapshot,
|
|
188
|
-
|
|
188
|
+
lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
189
189
|
newL1ToL2MessageTreeSnapshot,
|
|
190
|
-
|
|
190
|
+
newL1ToL2MessageSubtreeRootSiblingPath,
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -612,25 +612,25 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
612
612
|
);
|
|
613
613
|
|
|
614
614
|
const lastL1ToL2MessageTreeSnapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, db);
|
|
615
|
-
const
|
|
615
|
+
const lastL1ToL2MessageSubtreeRootSiblingPath = assertLength(
|
|
616
616
|
await getSubtreeSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, L1_TO_L2_MSG_SUBTREE_HEIGHT, db),
|
|
617
|
-
|
|
617
|
+
L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
618
618
|
);
|
|
619
619
|
|
|
620
620
|
// Update the local trees to include the new l1 to l2 messages
|
|
621
621
|
await db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l1ToL2MessagesPadded);
|
|
622
622
|
|
|
623
623
|
const newL1ToL2MessageTreeSnapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, db);
|
|
624
|
-
const
|
|
624
|
+
const newL1ToL2MessageSubtreeRootSiblingPath = assertLength(
|
|
625
625
|
await getSubtreeSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, L1_TO_L2_MSG_SUBTREE_HEIGHT, db),
|
|
626
|
-
|
|
626
|
+
L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
627
627
|
);
|
|
628
628
|
|
|
629
629
|
return {
|
|
630
630
|
lastL1ToL2MessageTreeSnapshot,
|
|
631
|
-
|
|
631
|
+
lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
632
632
|
newL1ToL2MessageTreeSnapshot,
|
|
633
|
-
|
|
633
|
+
newL1ToL2MessageSubtreeRootSiblingPath,
|
|
634
634
|
};
|
|
635
635
|
}
|
|
636
636
|
|
|
@@ -712,7 +712,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
712
712
|
),
|
|
713
713
|
result => {
|
|
714
714
|
logger.debug(`Completed proof for ${rollupType} for tx ${processedTx.hash.toString()}`);
|
|
715
|
-
validatePartialState(result.inputs.
|
|
715
|
+
validatePartialState(result.inputs.endTreeSnapshots, txProvingState.treeSnapshots);
|
|
716
716
|
const leafLocation = provingState.setBaseRollupProof(txIndex, result);
|
|
717
717
|
if (provingState.totalNumTxs === 1) {
|
|
718
718
|
this.checkAndEnqueueBlockRootRollup(provingState);
|
|
@@ -10,7 +10,6 @@ import type { ProofAndVerificationKey, PublicInputsAndRecursiveProof } from '@az
|
|
|
10
10
|
import type { PrivateToPublicKernelCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
11
11
|
import { ProofData } from '@aztec/stdlib/proofs';
|
|
12
12
|
import {
|
|
13
|
-
AvmProofData,
|
|
14
13
|
type BaseRollupHints,
|
|
15
14
|
PrivateBaseRollupHints,
|
|
16
15
|
PrivateTxBaseRollupPrivateInputs,
|
|
@@ -115,7 +114,7 @@ export class TxProvingState {
|
|
|
115
114
|
|
|
116
115
|
const publicTubeProofData = toProofData(this.publicTube);
|
|
117
116
|
|
|
118
|
-
const avmProofData = new
|
|
117
|
+
const avmProofData = new ProofData(
|
|
119
118
|
this.processedTx.avmProvingRequest.inputs.publicInputs,
|
|
120
119
|
this.avm.proof,
|
|
121
120
|
this.#getVkData(this.avm!.verificationKey, AVM_VK_INDEX),
|
|
@@ -125,6 +124,8 @@ export class TxProvingState {
|
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
#getVkData(verificationKey: VerificationKeyData, vkIndex: number) {
|
|
127
|
+
// TODO(#17162): Add avm vk hash to the tree and call `getVkData('AVM')` instead.
|
|
128
|
+
// Below will return a path to an empty leaf.
|
|
128
129
|
const vkPath = getVKSiblingPath(vkIndex);
|
|
129
130
|
return new VkData(verificationKey, vkIndex, vkPath);
|
|
130
131
|
}
|