@aztec/prover-client 0.87.2-nightly.20250523 → 0.87.2-nightly.20250525
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/block_builder/light.d.ts +12 -4
- package/dest/block_builder/light.d.ts.map +1 -1
- package/dest/block_builder/light.js +27 -17
- package/dest/mocks/test_context.js +2 -2
- package/dest/orchestrator/block-building-helpers.d.ts +1 -1
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +1 -1
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +5 -3
- package/dest/orchestrator/epoch-proving-state.d.ts +1 -1
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +4 -3
- package/dest/orchestrator/orchestrator.js +2 -2
- package/dest/orchestrator/tx-proving-state.js +3 -3
- package/package.json +15 -15
- package/src/block_builder/light.ts +28 -15
- package/src/mocks/test_context.ts +2 -2
- package/src/orchestrator/block-building-helpers.ts +1 -1
- package/src/orchestrator/block-proving-state.ts +4 -8
- package/src/orchestrator/epoch-proving-state.ts +9 -13
- package/src/orchestrator/orchestrator.ts +2 -2
- package/src/orchestrator/tx-proving-state.ts +3 -3
|
@@ -5,11 +5,19 @@ import { type GlobalVariables, type ProcessedTx } from '@aztec/stdlib/tx';
|
|
|
5
5
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
6
6
|
/**
|
|
7
7
|
* Builds a block and its header from a set of processed tx without running any circuits.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: the onus is ON THE CALLER to update the db that is passed in with the notes hashes, nullifiers, etc
|
|
10
|
+
* PRIOR to calling `buildBlock`.
|
|
11
|
+
*
|
|
12
|
+
* Why? Because if you are, e.g. building a block in practice from TxObjects, you are using the
|
|
13
|
+
* PublicProcessor which will do this for you as it processes transactions.
|
|
14
|
+
*
|
|
15
|
+
* If you haven't already inserted the side effects, e.g. because you are in a testing context, you can use the helper
|
|
16
|
+
* function `buildBlockWithCleanDB`, which calls `insertSideEffectsAndBuildBaseRollupHints` for you.
|
|
8
17
|
*/
|
|
9
18
|
export declare class LightweightBlockBuilder implements BlockBuilder {
|
|
10
19
|
private db;
|
|
11
20
|
private telemetry;
|
|
12
|
-
private spongeBlobState?;
|
|
13
21
|
private globalVariables?;
|
|
14
22
|
private l1ToL2Messages?;
|
|
15
23
|
private txs;
|
|
@@ -26,8 +34,8 @@ export declare class LightweightBlockBuilderFactory {
|
|
|
26
34
|
create(db: MerkleTreeWriteOperations): BlockBuilder;
|
|
27
35
|
}
|
|
28
36
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param db - A db fork to use for block building.
|
|
37
|
+
* Inserts the processed transactions into the DB, then creates a block.
|
|
38
|
+
* @param db - A db fork to use for block building which WILL BE MODIFIED.
|
|
31
39
|
*/
|
|
32
|
-
export declare function
|
|
40
|
+
export declare function buildBlockWithCleanDB(txs: ProcessedTx[], globalVariables: GlobalVariables, l1ToL2Messages: Fr[], db: MerkleTreeWriteOperations, telemetry?: TelemetryClient): Promise<L2Block>;
|
|
33
41
|
//# sourceMappingURL=light.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../src/block_builder/light.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE/F,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAmB,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAQnF
|
|
1
|
+
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../src/block_builder/light.ts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dlib/block';
|
|
|
7
7
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
8
8
|
import { toNumBlobFields } from '@aztec/stdlib/tx';
|
|
9
9
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
10
|
-
import {
|
|
10
|
+
import { buildHeaderAndBodyFromTxs, getTreeSnapshot, insertSideEffectsAndBuildBaseRollupHints } from '../orchestrator/block-building-helpers.js';
|
|
11
11
|
/**
|
|
12
12
|
* Builds a block and its header from a set of processed tx without running any circuits.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: the onus is ON THE CALLER to update the db that is passed in with the notes hashes, nullifiers, etc
|
|
15
|
+
* PRIOR to calling `buildBlock`.
|
|
16
|
+
*
|
|
17
|
+
* Why? Because if you are, e.g. building a block in practice from TxObjects, you are using the
|
|
18
|
+
* PublicProcessor which will do this for you as it processes transactions.
|
|
19
|
+
*
|
|
20
|
+
* If you haven't already inserted the side effects, e.g. because you are in a testing context, you can use the helper
|
|
21
|
+
* function `buildBlockWithCleanDB`, which calls `insertSideEffectsAndBuildBaseRollupHints` for you.
|
|
13
22
|
*/ export class LightweightBlockBuilder {
|
|
14
23
|
db;
|
|
15
24
|
telemetry;
|
|
16
|
-
spongeBlobState;
|
|
17
25
|
globalVariables;
|
|
18
26
|
l1ToL2Messages;
|
|
19
27
|
txs;
|
|
@@ -21,7 +29,6 @@ import { buildBaseRollupHints, buildHeaderAndBodyFromTxs, getTreeSnapshot } from
|
|
|
21
29
|
constructor(db, telemetry = getTelemetryClient()){
|
|
22
30
|
this.db = db;
|
|
23
31
|
this.telemetry = telemetry;
|
|
24
|
-
this.txs = [];
|
|
25
32
|
this.logger = createLogger('prover-client:block_builder');
|
|
26
33
|
}
|
|
27
34
|
async startNewBlock(globalVariables, l1ToL2Messages) {
|
|
@@ -31,26 +38,25 @@ import { buildBaseRollupHints, buildHeaderAndBodyFromTxs, getTreeSnapshot } from
|
|
|
31
38
|
});
|
|
32
39
|
this.globalVariables = globalVariables;
|
|
33
40
|
this.l1ToL2Messages = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
34
|
-
this.txs =
|
|
35
|
-
this.spongeBlobState = undefined;
|
|
41
|
+
this.txs = undefined;
|
|
36
42
|
// Update L1 to L2 tree
|
|
37
43
|
await this.db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, this.l1ToL2Messages);
|
|
38
44
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.txs.push(
|
|
46
|
-
await buildBaseRollupHints(tx, this.globalVariables, this.db, this.spongeBlobState);
|
|
45
|
+
addTxs(txs) {
|
|
46
|
+
// Most times, `addTxs` is only called once per block.
|
|
47
|
+
// So avoid copies.
|
|
48
|
+
if (this.txs === undefined) {
|
|
49
|
+
this.txs = txs;
|
|
50
|
+
} else {
|
|
51
|
+
this.txs.push(...txs);
|
|
47
52
|
}
|
|
53
|
+
return Promise.resolve();
|
|
48
54
|
}
|
|
49
55
|
setBlockCompleted() {
|
|
50
56
|
return this.buildBlock();
|
|
51
57
|
}
|
|
52
58
|
async buildBlock() {
|
|
53
|
-
const { header, body } = await buildHeaderAndBodyFromTxs(this.txs, this.globalVariables, this.l1ToL2Messages, this.db);
|
|
59
|
+
const { header, body } = await buildHeaderAndBodyFromTxs(this.txs ?? [], this.globalVariables, this.l1ToL2Messages, this.db);
|
|
54
60
|
await this.db.updateArchive(header);
|
|
55
61
|
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
56
62
|
const block = new L2Block(newArchive, header, body);
|
|
@@ -72,9 +78,13 @@ export class LightweightBlockBuilderFactory {
|
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
80
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @param db - A db fork to use for block building.
|
|
77
|
-
*/ export async function
|
|
81
|
+
* Inserts the processed transactions into the DB, then creates a block.
|
|
82
|
+
* @param db - A db fork to use for block building which WILL BE MODIFIED.
|
|
83
|
+
*/ export async function buildBlockWithCleanDB(txs, globalVariables, l1ToL2Messages, db, telemetry = getTelemetryClient()) {
|
|
84
|
+
const spongeBlobState = SpongeBlob.init(toNumBlobFields(txs));
|
|
85
|
+
for (const tx of txs){
|
|
86
|
+
await insertSideEffectsAndBuildBaseRollupHints(tx, globalVariables, db, spongeBlobState);
|
|
87
|
+
}
|
|
78
88
|
const builder = new LightweightBlockBuilder(db, telemetry);
|
|
79
89
|
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
80
90
|
await builder.addTxs(txs);
|
|
@@ -16,7 +16,7 @@ import { promises as fs } from 'fs';
|
|
|
16
16
|
// TODO(#12613) This means of sharing test code is not ideal.
|
|
17
17
|
// eslint-disable-next-line import/no-relative-packages
|
|
18
18
|
import { TestCircuitProver } from '../../../bb-prover/src/test/test_circuit_prover.js';
|
|
19
|
-
import {
|
|
19
|
+
import { buildBlockWithCleanDB } from '../block_builder/light.js';
|
|
20
20
|
import { ProvingOrchestrator } from '../orchestrator/index.js';
|
|
21
21
|
import { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
|
|
22
22
|
import { TestBroker } from '../test/mock_prover.js';
|
|
@@ -151,7 +151,7 @@ export class TestContext {
|
|
|
151
151
|
...makeProcessedTxOpts(i)
|
|
152
152
|
}));
|
|
153
153
|
await this.setTreeRoots(txs);
|
|
154
|
-
const block = await
|
|
154
|
+
const block = await buildBlockWithCleanDB(txs, globalVariables, msgs, db);
|
|
155
155
|
this.headers.set(blockNum, block.header);
|
|
156
156
|
await this.worldState.handleL2BlockAndMessages(block, msgs);
|
|
157
157
|
return {
|
|
@@ -18,7 +18,7 @@ type BaseTreeNames = 'NoteHashTree' | 'ContractTree' | 'NullifierTree' | 'Public
|
|
|
18
18
|
* Type representing the names of the trees.
|
|
19
19
|
*/
|
|
20
20
|
export type TreeNames = BaseTreeNames | 'L1ToL2MessageTree' | 'Archive';
|
|
21
|
-
export declare const
|
|
21
|
+
export declare const insertSideEffectsAndBuildBaseRollupHints: (tx: ProcessedTx, globalVariables: GlobalVariables, db: MerkleTreeWriteOperations, startSpongeBlob: SpongeBlob) => Promise<PublicBaseRollupHints | PrivateBaseRollupHints>;
|
|
22
22
|
export declare function getPublicDataHint(db: MerkleTreeWriteOperations, leafSlot: bigint): Promise<PublicDataHint>;
|
|
23
23
|
export declare const buildBlobHints: (txEffects: TxEffect[]) => Promise<{
|
|
24
24
|
blobFields: Fr[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-building-helpers.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-building-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAiBxD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,KAAK,EAAmD,MAAM,6BAA6B,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAqD,MAAM,yBAAyB,CAAC;AAI/G,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,iCAAiC,EACtC,kBAAkB,EAClB,sBAAsB,EAEtB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,sBAAsB,EACtB,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EAEX,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,WAAW,EAChB,cAAc,EACd,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAA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E,EACT,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,CAAC,EACT,EAAE,EAAE,wBAAwB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,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"}
|
|
@@ -17,7 +17,7 @@ import { AppendOnlyTreeSnapshot, MerkleTreeId, NullifierLeafPreimage, PublicData
|
|
|
17
17
|
import { BlockHeader, ContentCommitment, PartialStateReference, StateReference, TxEffect } from '@aztec/stdlib/tx';
|
|
18
18
|
import { Attributes, runInSpan } from '@aztec/telemetry-client';
|
|
19
19
|
// Builds the hints for base rollup. Updating the contract, nullifier, and data trees in the process.
|
|
20
|
-
export const
|
|
20
|
+
export const insertSideEffectsAndBuildBaseRollupHints = runInSpan('BlockBuilderHelpers', 'buildBaseRollupHints', async (span, tx, globalVariables, db, startSpongeBlob)=>{
|
|
21
21
|
span.setAttribute(Attributes.TX_HASH, tx.hash.toString());
|
|
22
22
|
// Get trees info before any changes hit
|
|
23
23
|
const constants = await getConstantRollupData(globalVariables, db);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,wCAAwC,EAC7C,KAAK,yCAAyC,
|
|
1
|
+
{"version":3,"file":"block-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,wCAAwC,EAC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,CAAC;IASlG,kBAAkB,CAAC,aAAa,EAAE,6BAA6B,CAAC,kBAAkB,CAAC;IAInF,uBAAuB,CAC5B,aAAa,EAAE,6BAA6B,CAC1C,iCAAiC,EACjC,OAAO,yCAAyC,CACjD;IAMH,IAAW,MAAM,qBAEhB;IAED,yFAAyF;IACzF,IAAW,WAAW,IAAI,MAAM,CAE/B;IAEM,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB;IAI5C,oBAAoB,CAAC,aAAa,EAAE,gBAAgB;IAS9C,+BAA+B,CAAC,QAAQ,EAAE,EAAE;;;;;;;;;;IAmD5C,yBAAyB,CAAC,QAAQ,EAAE,EAAE;IAgC5C,mBAAmB;IAYnB,iBAAiB,CAAC,OAAO,EAAE,MAAM;IAI3B,6BAA6B;IAyBnC,qBAAqB,CAAC,QAAQ,EAAE,gBAAgB;IAKhD,yBAAyB;IAMzB,oBAAoB;IAIpB,UAAU;IAKV,WAAW;IAIX,MAAM,CAAC,MAAM,EAAE,MAAM;CAwD7B"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { SpongeBlob } from '@aztec/blob-lib';
|
|
2
|
-
import { BLOBS_PER_BLOCK, FIELDS_PER_BLOB, NUM_BASE_PARITY_PER_ROOT_PARITY
|
|
2
|
+
import { BLOBS_PER_BLOCK, FIELDS_PER_BLOB, NUM_BASE_PARITY_PER_ROOT_PARITY } from '@aztec/constants';
|
|
3
3
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import {
|
|
5
|
+
import { UnbalancedTreeStore } from '@aztec/foundation/trees';
|
|
6
6
|
import { getVKIndex, getVKSiblingPath, getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
7
7
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
8
8
|
import { RootParityInput, RootParityInputs } from '@aztec/stdlib/parity';
|
|
9
9
|
import { BlockRootRollupBlobData, BlockRootRollupData, BlockRootRollupInputs, ConstantRollupData, EmptyBlockRootRollupInputs, MergeRollupInputs, PreviousRollupData, SingleTxBlockRootRollupInputs } from '@aztec/stdlib/rollup';
|
|
10
10
|
import { StateReference } from '@aztec/stdlib/tx';
|
|
11
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
11
12
|
import { buildBlobHints, buildHeaderFromCircuitOutputs } from './block-building-helpers.js';
|
|
12
13
|
/**
|
|
13
14
|
* The current state of the proving schedule for a given block. Managed by ProvingState.
|
|
@@ -265,7 +266,8 @@ import { buildBlobHints, buildHeaderFromCircuitOutputs } from './block-building-
|
|
|
265
266
|
}
|
|
266
267
|
#getPreviousRollupData({ inputs, proof, verificationKey }) {
|
|
267
268
|
const leafIndex = getVKIndex(verificationKey.keyAsFields);
|
|
268
|
-
|
|
269
|
+
const vkData = new VkData(verificationKey, leafIndex, getVKSiblingPath(leafIndex));
|
|
270
|
+
return new PreviousRollupData(inputs, proof, vkData);
|
|
269
271
|
}
|
|
270
272
|
#getRootParityData({ inputs, proof, verificationKey }) {
|
|
271
273
|
return new RootParityInput(proof, verificationKey.keyAsFields, getVKSiblingPath(getVKIndex(verificationKey)), inputs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ARCHIVE_HEIGHT, L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
4
4
|
import { type TreeNodeLocation } from '@aztec/foundation/trees';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epoch-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/epoch-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"epoch-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/epoch-pro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StC,iCAAiC,CAAC,WAAW,EAAE,MAAM;IAIrD,mBAAmB,IAAI;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,YAAY,EAAE,sBAAsB,CAAA;KAAE;IAW7E,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB;IAK/C,oBAAoB;IAMpB,MAAM;IAMN,MAAM,CAAC,MAAM,EAAE,MAAM;IAUrB,OAAO,CAAC,MAAM,EAAE,aAAa;CA4BrC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MembershipWitness, UnbalancedTreeStore } from '@aztec/foundation/trees';
|
|
1
|
+
import { UnbalancedTreeStore } from '@aztec/foundation/trees';
|
|
3
2
|
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
3
|
import { BlockMergeRollupInputs, PreviousRollupBlockData, RootRollupInputs } from '@aztec/stdlib/rollup';
|
|
4
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
5
5
|
import { BlockProvingState } from './block-proving-state.js';
|
|
6
6
|
var PROVING_STATE_LIFECYCLE = /*#__PURE__*/ function(PROVING_STATE_LIFECYCLE) {
|
|
7
7
|
PROVING_STATE_LIFECYCLE[PROVING_STATE_LIFECYCLE["PROVING_STATE_CREATED"] = 0] = "PROVING_STATE_CREATED";
|
|
@@ -158,6 +158,7 @@ var PROVING_STATE_LIFECYCLE = /*#__PURE__*/ function(PROVING_STATE_LIFECYCLE) {
|
|
|
158
158
|
}
|
|
159
159
|
#getPreviousRollupData({ inputs, proof, verificationKey }) {
|
|
160
160
|
const leafIndex = getVKIndex(verificationKey.keyAsFields);
|
|
161
|
-
|
|
161
|
+
const vkData = new VkData(verificationKey, leafIndex, getVKSiblingPath(leafIndex));
|
|
162
|
+
return new PreviousRollupBlockData(inputs, proof, vkData);
|
|
162
163
|
}
|
|
163
164
|
}
|
|
@@ -22,7 +22,7 @@ import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
|
22
22
|
import { toNumBlobFields } from '@aztec/stdlib/tx';
|
|
23
23
|
import { Attributes, getTelemetryClient, trackSpan, wrapCallbackInSpan } from '@aztec/telemetry-client';
|
|
24
24
|
import { inspect } from 'util';
|
|
25
|
-
import {
|
|
25
|
+
import { buildHeaderAndBodyFromTxs, getLastSiblingPath, getRootTreeSiblingPath, getSubtreeSiblingPath, getTreeSnapshot, insertSideEffectsAndBuildBaseRollupHints, validatePartialState, validateTx } from './block-building-helpers.js';
|
|
26
26
|
import { EpochProvingState } from './epoch-proving-state.js';
|
|
27
27
|
import { ProvingOrchestratorMetrics } from './orchestrator_metrics.js';
|
|
28
28
|
import { TxProvingState } from './tx-proving-state.js';
|
|
@@ -333,7 +333,7 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
333
333
|
const db = this.dbs.get(provingState.blockNumber);
|
|
334
334
|
// We build the base rollup inputs using a mock proof and verification key.
|
|
335
335
|
// These will be overwritten later once we have proven the tube circuit and any public kernels
|
|
336
|
-
const [ms, hints] = await elapsed(
|
|
336
|
+
const [ms, hints] = await elapsed(insertSideEffectsAndBuildBaseRollupHints(tx, provingState.globalVariables, db, provingState.spongeBlobState));
|
|
337
337
|
this.metrics.recordBaseRollupInputs(ms);
|
|
338
338
|
const promises = [
|
|
339
339
|
MerkleTreeId.NOTE_HASH_TREE,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AVM_VK_INDEX, TUBE_VK_INDEX } from '@aztec/constants';
|
|
2
2
|
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
3
|
import { AvmProofData, PrivateBaseRollupHints, PrivateBaseRollupInputs, PrivateTubeData, PublicBaseRollupHints, PublicBaseRollupInputs, PublicTubeData, TubeInputs } from '@aztec/stdlib/rollup';
|
|
4
|
-
import {
|
|
4
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
5
5
|
/**
|
|
6
6
|
* Helper class to manage the proving cycle of a transaction
|
|
7
7
|
* This includes the public VMs and the public kernels
|
|
@@ -84,11 +84,11 @@ import { VkWitnessData } from '@aztec/stdlib/vks';
|
|
|
84
84
|
// TODO(#7410) The VK for the tube won't be in the tree for now, so we manually set it to the tube vk index
|
|
85
85
|
}
|
|
86
86
|
const vkPath = getVKSiblingPath(vkIndex);
|
|
87
|
-
return new
|
|
87
|
+
return new VkData(this.tube.verificationKey, vkIndex, vkPath);
|
|
88
88
|
}
|
|
89
89
|
#getAvmVkData() {
|
|
90
90
|
const vkIndex = AVM_VK_INDEX;
|
|
91
91
|
const vkPath = getVKSiblingPath(vkIndex);
|
|
92
|
-
return new
|
|
92
|
+
return new VkData(this.avm.verificationKey, vkIndex, vkPath);
|
|
93
93
|
}
|
|
94
94
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "0.87.2-nightly.
|
|
3
|
+
"version": "0.87.2-nightly.20250525",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -64,19 +64,19 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/bb-prover": "0.87.2-nightly.
|
|
68
|
-
"@aztec/blob-lib": "0.87.2-nightly.
|
|
69
|
-
"@aztec/constants": "0.87.2-nightly.
|
|
70
|
-
"@aztec/ethereum": "0.87.2-nightly.
|
|
71
|
-
"@aztec/foundation": "0.87.2-nightly.
|
|
72
|
-
"@aztec/kv-store": "0.87.2-nightly.
|
|
73
|
-
"@aztec/noir-protocol-circuits-types": "0.87.2-nightly.
|
|
74
|
-
"@aztec/noir-types": "0.87.2-nightly.
|
|
75
|
-
"@aztec/protocol-contracts": "0.87.2-nightly.
|
|
76
|
-
"@aztec/simulator": "0.87.2-nightly.
|
|
77
|
-
"@aztec/stdlib": "0.87.2-nightly.
|
|
78
|
-
"@aztec/telemetry-client": "0.87.2-nightly.
|
|
79
|
-
"@aztec/world-state": "0.87.2-nightly.
|
|
67
|
+
"@aztec/bb-prover": "0.87.2-nightly.20250525",
|
|
68
|
+
"@aztec/blob-lib": "0.87.2-nightly.20250525",
|
|
69
|
+
"@aztec/constants": "0.87.2-nightly.20250525",
|
|
70
|
+
"@aztec/ethereum": "0.87.2-nightly.20250525",
|
|
71
|
+
"@aztec/foundation": "0.87.2-nightly.20250525",
|
|
72
|
+
"@aztec/kv-store": "0.87.2-nightly.20250525",
|
|
73
|
+
"@aztec/noir-protocol-circuits-types": "0.87.2-nightly.20250525",
|
|
74
|
+
"@aztec/noir-types": "0.87.2-nightly.20250525",
|
|
75
|
+
"@aztec/protocol-contracts": "0.87.2-nightly.20250525",
|
|
76
|
+
"@aztec/simulator": "0.87.2-nightly.20250525",
|
|
77
|
+
"@aztec/stdlib": "0.87.2-nightly.20250525",
|
|
78
|
+
"@aztec/telemetry-client": "0.87.2-nightly.20250525",
|
|
79
|
+
"@aztec/world-state": "0.87.2-nightly.20250525",
|
|
80
80
|
"@google-cloud/storage": "^7.15.0",
|
|
81
81
|
"@iarna/toml": "^2.2.5",
|
|
82
82
|
"commander": "^12.1.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"zod": "^3.23.8"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@aztec/noir-contracts.js": "0.87.2-nightly.
|
|
89
|
+
"@aztec/noir-contracts.js": "0.87.2-nightly.20250525",
|
|
90
90
|
"@jest/globals": "^29.5.0",
|
|
91
91
|
"@types/jest": "^29.5.0",
|
|
92
92
|
"@types/node": "^22.15.17",
|
|
@@ -10,20 +10,28 @@ import { type GlobalVariables, type ProcessedTx, toNumBlobFields } from '@aztec/
|
|
|
10
10
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
|
-
buildBaseRollupHints,
|
|
14
13
|
buildHeaderAndBodyFromTxs,
|
|
15
14
|
getTreeSnapshot,
|
|
15
|
+
insertSideEffectsAndBuildBaseRollupHints,
|
|
16
16
|
} from '../orchestrator/block-building-helpers.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Builds a block and its header from a set of processed tx without running any circuits.
|
|
20
|
+
*
|
|
21
|
+
* NOTE: the onus is ON THE CALLER to update the db that is passed in with the notes hashes, nullifiers, etc
|
|
22
|
+
* PRIOR to calling `buildBlock`.
|
|
23
|
+
*
|
|
24
|
+
* Why? Because if you are, e.g. building a block in practice from TxObjects, you are using the
|
|
25
|
+
* PublicProcessor which will do this for you as it processes transactions.
|
|
26
|
+
*
|
|
27
|
+
* If you haven't already inserted the side effects, e.g. because you are in a testing context, you can use the helper
|
|
28
|
+
* function `buildBlockWithCleanDB`, which calls `insertSideEffectsAndBuildBaseRollupHints` for you.
|
|
20
29
|
*/
|
|
21
30
|
export class LightweightBlockBuilder implements BlockBuilder {
|
|
22
|
-
private spongeBlobState?: SpongeBlob;
|
|
23
31
|
private globalVariables?: GlobalVariables;
|
|
24
32
|
private l1ToL2Messages?: Fr[];
|
|
25
33
|
|
|
26
|
-
private txs: ProcessedTx[]
|
|
34
|
+
private txs: ProcessedTx[] | undefined;
|
|
27
35
|
|
|
28
36
|
private readonly logger = createLogger('prover-client:block_builder');
|
|
29
37
|
|
|
@@ -36,20 +44,21 @@ export class LightweightBlockBuilder implements BlockBuilder {
|
|
|
36
44
|
this.logger.debug('Starting new block', { globalVariables: globalVariables.toInspect(), l1ToL2Messages });
|
|
37
45
|
this.globalVariables = globalVariables;
|
|
38
46
|
this.l1ToL2Messages = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
39
|
-
this.txs =
|
|
40
|
-
this.spongeBlobState = undefined;
|
|
47
|
+
this.txs = undefined;
|
|
41
48
|
|
|
42
49
|
// Update L1 to L2 tree
|
|
43
50
|
await this.db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, this.l1ToL2Messages!);
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.txs
|
|
51
|
-
|
|
53
|
+
addTxs(txs: ProcessedTx[]): Promise<void> {
|
|
54
|
+
// Most times, `addTxs` is only called once per block.
|
|
55
|
+
// So avoid copies.
|
|
56
|
+
if (this.txs === undefined) {
|
|
57
|
+
this.txs = txs;
|
|
58
|
+
} else {
|
|
59
|
+
this.txs.push(...txs);
|
|
52
60
|
}
|
|
61
|
+
return Promise.resolve();
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
setBlockCompleted(): Promise<L2Block> {
|
|
@@ -58,7 +67,7 @@ export class LightweightBlockBuilder implements BlockBuilder {
|
|
|
58
67
|
|
|
59
68
|
private async buildBlock(): Promise<L2Block> {
|
|
60
69
|
const { header, body } = await buildHeaderAndBodyFromTxs(
|
|
61
|
-
this.txs,
|
|
70
|
+
this.txs ?? [],
|
|
62
71
|
this.globalVariables!,
|
|
63
72
|
this.l1ToL2Messages!,
|
|
64
73
|
this.db,
|
|
@@ -87,16 +96,20 @@ export class LightweightBlockBuilderFactory {
|
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
/**
|
|
90
|
-
*
|
|
91
|
-
* @param db - A db fork to use for block building.
|
|
99
|
+
* Inserts the processed transactions into the DB, then creates a block.
|
|
100
|
+
* @param db - A db fork to use for block building which WILL BE MODIFIED.
|
|
92
101
|
*/
|
|
93
|
-
export async function
|
|
102
|
+
export async function buildBlockWithCleanDB(
|
|
94
103
|
txs: ProcessedTx[],
|
|
95
104
|
globalVariables: GlobalVariables,
|
|
96
105
|
l1ToL2Messages: Fr[],
|
|
97
106
|
db: MerkleTreeWriteOperations,
|
|
98
107
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
99
108
|
) {
|
|
109
|
+
const spongeBlobState = SpongeBlob.init(toNumBlobFields(txs));
|
|
110
|
+
for (const tx of txs) {
|
|
111
|
+
await insertSideEffectsAndBuildBaseRollupHints(tx, globalVariables, db, spongeBlobState);
|
|
112
|
+
}
|
|
100
113
|
const builder = new LightweightBlockBuilder(db, telemetry);
|
|
101
114
|
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
102
115
|
await builder.addTxs(txs);
|
|
@@ -23,7 +23,7 @@ import { promises as fs } from 'fs';
|
|
|
23
23
|
// TODO(#12613) This means of sharing test code is not ideal.
|
|
24
24
|
// eslint-disable-next-line import/no-relative-packages
|
|
25
25
|
import { TestCircuitProver } from '../../../bb-prover/src/test/test_circuit_prover.js';
|
|
26
|
-
import {
|
|
26
|
+
import { buildBlockWithCleanDB } from '../block_builder/light.js';
|
|
27
27
|
import { ProvingOrchestrator } from '../orchestrator/index.js';
|
|
28
28
|
import { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
|
|
29
29
|
import { TestBroker } from '../test/mock_prover.js';
|
|
@@ -193,7 +193,7 @@ export class TestContext {
|
|
|
193
193
|
);
|
|
194
194
|
await this.setTreeRoots(txs);
|
|
195
195
|
|
|
196
|
-
const block = await
|
|
196
|
+
const block = await buildBlockWithCleanDB(txs, globalVariables, msgs, db);
|
|
197
197
|
this.headers.set(blockNum, block.header);
|
|
198
198
|
await this.worldState.handleL2BlockAndMessages(block, msgs);
|
|
199
199
|
return { block, txs, msgs };
|
|
@@ -64,7 +64,7 @@ type BaseTreeNames = 'NoteHashTree' | 'ContractTree' | 'NullifierTree' | 'Public
|
|
|
64
64
|
export type TreeNames = BaseTreeNames | 'L1ToL2MessageTree' | 'Archive';
|
|
65
65
|
|
|
66
66
|
// Builds the hints for base rollup. Updating the contract, nullifier, and data trees in the process.
|
|
67
|
-
export const
|
|
67
|
+
export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
68
68
|
'BlockBuilderHelpers',
|
|
69
69
|
'buildBaseRollupHints',
|
|
70
70
|
async (
|
|
@@ -7,12 +7,11 @@ import {
|
|
|
7
7
|
type NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
8
8
|
NUM_BASE_PARITY_PER_ROOT_PARITY,
|
|
9
9
|
type RECURSIVE_PROOF_LENGTH,
|
|
10
|
-
VK_TREE_HEIGHT,
|
|
11
10
|
} from '@aztec/constants';
|
|
12
11
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
13
12
|
import { Fr } from '@aztec/foundation/fields';
|
|
14
13
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
15
|
-
import {
|
|
14
|
+
import { type TreeNodeLocation, UnbalancedTreeStore } from '@aztec/foundation/trees';
|
|
16
15
|
import { getVKIndex, getVKSiblingPath, getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
17
16
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
18
17
|
import type { L2Block } from '@aztec/stdlib/block';
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
import type { CircuitName } from '@aztec/stdlib/stats';
|
|
34
33
|
import type { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
35
34
|
import { type BlockHeader, type GlobalVariables, StateReference } from '@aztec/stdlib/tx';
|
|
35
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
36
36
|
|
|
37
37
|
import { buildBlobHints, buildHeaderFromCircuitOutputs } from './block-building-helpers.js';
|
|
38
38
|
import type { EpochProvingState } from './epoch-proving-state.js';
|
|
@@ -361,12 +361,8 @@ export class BlockProvingState {
|
|
|
361
361
|
verificationKey,
|
|
362
362
|
}: PublicInputsAndRecursiveProof<BaseOrMergeRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>) {
|
|
363
363
|
const leafIndex = getVKIndex(verificationKey.keyAsFields);
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
proof,
|
|
367
|
-
verificationKey.keyAsFields,
|
|
368
|
-
new MembershipWitness(VK_TREE_HEIGHT, BigInt(leafIndex), getVKSiblingPath(leafIndex)),
|
|
369
|
-
);
|
|
364
|
+
const vkData = new VkData(verificationKey, leafIndex, getVKSiblingPath(leafIndex));
|
|
365
|
+
return new PreviousRollupData(inputs, proof, vkData);
|
|
370
366
|
}
|
|
371
367
|
|
|
372
368
|
#getRootParityData({ inputs, proof, verificationKey }: PublicInputsAndRecursiveProof<ParityPublicInputs>) {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
VK_TREE_HEIGHT,
|
|
1
|
+
import type {
|
|
2
|
+
ARCHIVE_HEIGHT,
|
|
3
|
+
L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH,
|
|
4
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
|
+
TUBE_PROOF_LENGTH,
|
|
7
6
|
} from '@aztec/constants';
|
|
8
7
|
import type { Fr } from '@aztec/foundation/fields';
|
|
9
8
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
10
|
-
import {
|
|
9
|
+
import { type TreeNodeLocation, UnbalancedTreeStore } from '@aztec/foundation/trees';
|
|
11
10
|
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
12
11
|
import type { ProofAndVerificationKey, PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
13
12
|
import type { Proof } from '@aztec/stdlib/proofs';
|
|
@@ -20,6 +19,7 @@ import {
|
|
|
20
19
|
} from '@aztec/stdlib/rollup';
|
|
21
20
|
import type { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
22
21
|
import type { BlockHeader, GlobalVariables } from '@aztec/stdlib/tx';
|
|
22
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
23
23
|
|
|
24
24
|
import { BlockProvingState } from './block-proving-state.js';
|
|
25
25
|
|
|
@@ -244,11 +244,7 @@ export class EpochProvingState {
|
|
|
244
244
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
245
245
|
>) {
|
|
246
246
|
const leafIndex = getVKIndex(verificationKey.keyAsFields);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
proof,
|
|
250
|
-
verificationKey.keyAsFields,
|
|
251
|
-
new MembershipWitness(VK_TREE_HEIGHT, BigInt(leafIndex), getVKSiblingPath(leafIndex)),
|
|
252
|
-
);
|
|
247
|
+
const vkData = new VkData(verificationKey, leafIndex, getVKSiblingPath(leafIndex));
|
|
248
|
+
return new PreviousRollupBlockData(inputs, proof, vkData);
|
|
253
249
|
}
|
|
254
250
|
}
|
|
@@ -47,12 +47,12 @@ import {
|
|
|
47
47
|
import { inspect } from 'util';
|
|
48
48
|
|
|
49
49
|
import {
|
|
50
|
-
buildBaseRollupHints,
|
|
51
50
|
buildHeaderAndBodyFromTxs,
|
|
52
51
|
getLastSiblingPath,
|
|
53
52
|
getRootTreeSiblingPath,
|
|
54
53
|
getSubtreeSiblingPath,
|
|
55
54
|
getTreeSnapshot,
|
|
55
|
+
insertSideEffectsAndBuildBaseRollupHints,
|
|
56
56
|
validatePartialState,
|
|
57
57
|
validateTx,
|
|
58
58
|
} from './block-building-helpers.js';
|
|
@@ -489,7 +489,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
489
489
|
// We build the base rollup inputs using a mock proof and verification key.
|
|
490
490
|
// These will be overwritten later once we have proven the tube circuit and any public kernels
|
|
491
491
|
const [ms, hints] = await elapsed(
|
|
492
|
-
|
|
492
|
+
insertSideEffectsAndBuildBaseRollupHints(tx, provingState.globalVariables, db, provingState.spongeBlobState),
|
|
493
493
|
);
|
|
494
494
|
|
|
495
495
|
this.metrics.recordBaseRollupInputs(ms);
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import type { CircuitName } from '@aztec/stdlib/stats';
|
|
22
22
|
import type { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
23
23
|
import type { ProcessedTx } from '@aztec/stdlib/tx';
|
|
24
|
-
import {
|
|
24
|
+
import { VkData } from '@aztec/stdlib/vks';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Helper class to manage the proving cycle of a transaction
|
|
@@ -133,12 +133,12 @@ export class TxProvingState {
|
|
|
133
133
|
}
|
|
134
134
|
const vkPath = getVKSiblingPath(vkIndex);
|
|
135
135
|
|
|
136
|
-
return new
|
|
136
|
+
return new VkData(this.tube!.verificationKey, vkIndex, vkPath);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
#getAvmVkData() {
|
|
140
140
|
const vkIndex = AVM_VK_INDEX;
|
|
141
141
|
const vkPath = getVKSiblingPath(vkIndex);
|
|
142
|
-
return new
|
|
142
|
+
return new VkData(this.avm!.verificationKey, vkIndex, vkPath);
|
|
143
143
|
}
|
|
144
144
|
}
|