@aztec/prover-client 4.0.0-nightly.20260119 → 4.0.0-nightly.20260120
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/light/lightweight_checkpoint_builder.d.ts +2 -2
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +2 -1
- package/package.json +15 -16
- package/src/light/lightweight_checkpoint_builder.ts +2 -2
- package/dest/block-factory/index.d.ts +0 -2
- package/dest/block-factory/index.d.ts.map +0 -1
- package/dest/block-factory/index.js +0 -1
- package/dest/block-factory/light.d.ts +0 -39
- package/dest/block-factory/light.d.ts.map +0 -1
- package/dest/block-factory/light.js +0 -116
- package/src/block-factory/index.ts +0 -1
- package/src/block-factory/light.ts +0 -146
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { L2BlockNew } from '@aztec/stdlib/block';
|
|
4
4
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
@@ -41,4 +41,4 @@ export declare class LightweightCheckpointBuilder {
|
|
|
41
41
|
completeCheckpoint(): Promise<Checkpoint>;
|
|
42
42
|
clone(): LightweightCheckpointBuilder;
|
|
43
43
|
}
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
44
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlnaHR3ZWlnaHRfY2hlY2twb2ludF9idWlsZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGlnaHQvbGlnaHR3ZWlnaHRfY2hlY2twb2ludF9idWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUF5QixN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QUFTLEVBQUUseUJBQXlCLEVBQ3BDLGNBQWMsRUFBRSxFQUFFLEVBQUUsRUFDcEIsMkJBQTJCLEVBQUUsRUFBRSxFQUFFLEVBQ2pDLEVBQUUsRUFBRSx5QkFBeUIsR0FDNUIsT0FBTyxDQUFDLDRCQUE0QixDQUFDLENBY3ZDO0lBRUQ7Ozs7O09BS0c7SUFDSCxPQUFhLGdCQUFnQixDQUMzQixnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFDbEMsU0FBUyxFQUFFLHlCQUF5QixFQUNwQyxjQUFjLEVBQUUsRUFBRSxFQUFFLEVBQ3BCLDJCQUEyQixFQUFFLEVBQUUsRUFBRSxFQUNqQyxFQUFFLEVBQUUseUJBQXlCLEVBQzdCLGNBQWMsRUFBRSxVQUFVLEVBQUUsR0FDM0IsT0FBTyxDQUFDLDRCQUE0QixDQUFDLENBNkN2QztJQUVEOzs7T0FHRztJQUNVLFFBQVEsQ0FDbkIsZUFBZSxFQUFFLGVBQWUsRUFDaEMsR0FBRyxFQUFFLFdBQVcsRUFBRSxFQUNsQixJQUFJLEdBQUU7UUFBRSxnQkFBZ0IsQ0FBQyxFQUFFLE9BQU8sQ0FBQztRQUFDLGdCQUFnQixDQUFDLEVBQUUsY0FBYyxDQUFBO0tBQU8sR0FDM0UsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQWlFckI7SUFFSyxrQkFBa0IsSUFBSSxPQUFPLENBQUMsVUFBVSxDQUFDLENBOEM5QztJQUVELEtBQUssaUNBYUo7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightweight_checkpoint_builder.d.ts","sourceRoot":"","sources":["../../src/light/lightweight_checkpoint_builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"lightweight_checkpoint_builder.d.ts","sourceRoot":"","sources":["../../src/light/lightweight_checkpoint_builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB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EACjC,EAAE,EAAE,yBAAyB,EAC7B,cAAc,EAAE,UAAU,EAAE,GAC3B,OAAO,CAAC,4BAA4B,CAAC,CA6CvC;IAED;;;OAGG;IACU,QAAQ,CACnB,eAAe,EAAE,eAAe,EAChC,GAAG,EAAE,WAAW,EAAE,EAClB,IAAI,GAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAAC,gBAAgB,CAAC,EAAE,cAAc,CAAA;KAAO,GAC3E,OAAO,CAAC,UAAU,CAAC,CAiErB;IAEK,kBAAkB,IAAI,OAAO,CAAC,UAAU,CAAC,CA8C9C;IAED,KAAK,iCAaJ;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SpongeBlob, computeBlobsHashFromBlobs, encodeCheckpointEndMarker, getBlobsPerL1Block } from '@aztec/blob-lib';
|
|
2
2
|
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
3
|
+
import { IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
3
4
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
4
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -118,7 +119,7 @@ import { buildHeaderAndBodyFromTxs, getTreeSnapshot, insertSideEffects } from '.
|
|
|
118
119
|
await this.db.updateArchive(header);
|
|
119
120
|
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
120
121
|
this.lastArchives.push(newArchive);
|
|
121
|
-
const indexWithinCheckpoint = this.blocks.length;
|
|
122
|
+
const indexWithinCheckpoint = IndexWithinCheckpoint(this.blocks.length);
|
|
122
123
|
const block = new L2BlockNew(newArchive, header, body, this.checkpointNumber, indexWithinCheckpoint);
|
|
123
124
|
this.blocks.push(block);
|
|
124
125
|
await this.spongeBlob.absorb(blockBlobFields);
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "4.0.0-nightly.
|
|
3
|
+
"version": "4.0.0-nightly.20260120",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
7
|
-
"./block-factory": "./dest/block-factory/index.js",
|
|
8
7
|
"./broker": "./dest/proving_broker/index.js",
|
|
9
8
|
"./broker/config": "./dest/proving_broker/config.js",
|
|
10
9
|
"./orchestrator": "./dest/orchestrator/index.js",
|
|
@@ -69,19 +68,19 @@
|
|
|
69
68
|
]
|
|
70
69
|
},
|
|
71
70
|
"dependencies": {
|
|
72
|
-
"@aztec/bb-prover": "4.0.0-nightly.
|
|
73
|
-
"@aztec/blob-lib": "4.0.0-nightly.
|
|
74
|
-
"@aztec/constants": "4.0.0-nightly.
|
|
75
|
-
"@aztec/ethereum": "4.0.0-nightly.
|
|
76
|
-
"@aztec/foundation": "4.0.0-nightly.
|
|
77
|
-
"@aztec/kv-store": "4.0.0-nightly.
|
|
78
|
-
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.
|
|
79
|
-
"@aztec/noir-types": "4.0.0-nightly.
|
|
80
|
-
"@aztec/protocol-contracts": "4.0.0-nightly.
|
|
81
|
-
"@aztec/simulator": "4.0.0-nightly.
|
|
82
|
-
"@aztec/stdlib": "4.0.0-nightly.
|
|
83
|
-
"@aztec/telemetry-client": "4.0.0-nightly.
|
|
84
|
-
"@aztec/world-state": "4.0.0-nightly.
|
|
71
|
+
"@aztec/bb-prover": "4.0.0-nightly.20260120",
|
|
72
|
+
"@aztec/blob-lib": "4.0.0-nightly.20260120",
|
|
73
|
+
"@aztec/constants": "4.0.0-nightly.20260120",
|
|
74
|
+
"@aztec/ethereum": "4.0.0-nightly.20260120",
|
|
75
|
+
"@aztec/foundation": "4.0.0-nightly.20260120",
|
|
76
|
+
"@aztec/kv-store": "4.0.0-nightly.20260120",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20260120",
|
|
78
|
+
"@aztec/noir-types": "4.0.0-nightly.20260120",
|
|
79
|
+
"@aztec/protocol-contracts": "4.0.0-nightly.20260120",
|
|
80
|
+
"@aztec/simulator": "4.0.0-nightly.20260120",
|
|
81
|
+
"@aztec/stdlib": "4.0.0-nightly.20260120",
|
|
82
|
+
"@aztec/telemetry-client": "4.0.0-nightly.20260120",
|
|
83
|
+
"@aztec/world-state": "4.0.0-nightly.20260120",
|
|
85
84
|
"@google-cloud/storage": "^7.15.0",
|
|
86
85
|
"@iarna/toml": "^2.2.5",
|
|
87
86
|
"commander": "^12.1.0",
|
|
@@ -91,7 +90,7 @@
|
|
|
91
90
|
"zod": "^3.23.8"
|
|
92
91
|
},
|
|
93
92
|
"devDependencies": {
|
|
94
|
-
"@aztec/noir-contracts.js": "4.0.0-nightly.
|
|
93
|
+
"@aztec/noir-contracts.js": "4.0.0-nightly.20260120",
|
|
95
94
|
"@jest/globals": "^30.0.0",
|
|
96
95
|
"@types/jest": "^30.0.0",
|
|
97
96
|
"@types/node": "^22.15.17",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpongeBlob, computeBlobsHashFromBlobs, encodeCheckpointEndMarker, getBlobsPerL1Block } from '@aztec/blob-lib';
|
|
2
2
|
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
3
|
-
import type
|
|
3
|
+
import { type CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
4
4
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
5
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -191,7 +191,7 @@ export class LightweightCheckpointBuilder {
|
|
|
191
191
|
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
192
192
|
this.lastArchives.push(newArchive);
|
|
193
193
|
|
|
194
|
-
const indexWithinCheckpoint = this.blocks.length;
|
|
194
|
+
const indexWithinCheckpoint = IndexWithinCheckpoint(this.blocks.length);
|
|
195
195
|
const block = new L2BlockNew(newArchive, header, body, this.checkpointNumber, indexWithinCheckpoint);
|
|
196
196
|
this.blocks.push(block);
|
|
197
197
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/block-factory/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './light.js';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { L2Block } from '@aztec/stdlib/block';
|
|
3
|
-
import type { IBlockFactory, MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
4
|
-
import type { GlobalVariables, ProcessedTx } from '@aztec/stdlib/tx';
|
|
5
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
6
|
-
/**
|
|
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 `insertSideEffects` for you.
|
|
17
|
-
*
|
|
18
|
-
* @deprecated Use LightweightCheckpointBuilder instead. This only works for one block per checkpoint.
|
|
19
|
-
*/
|
|
20
|
-
export declare class LightweightBlockFactory implements IBlockFactory {
|
|
21
|
-
private previousCheckpointOutHashes;
|
|
22
|
-
private db;
|
|
23
|
-
private telemetry;
|
|
24
|
-
private globalVariables?;
|
|
25
|
-
private l1ToL2Messages?;
|
|
26
|
-
private txs;
|
|
27
|
-
private readonly logger;
|
|
28
|
-
constructor(previousCheckpointOutHashes: Fr[], db: MerkleTreeWriteOperations, telemetry?: TelemetryClient);
|
|
29
|
-
startNewBlock(globalVariables: GlobalVariables, l1ToL2Messages: Fr[]): Promise<void>;
|
|
30
|
-
addTxs(txs: ProcessedTx[]): Promise<void>;
|
|
31
|
-
setBlockCompleted(): Promise<L2Block>;
|
|
32
|
-
private buildBlock;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Inserts the processed transactions into the DB, then creates a block.
|
|
36
|
-
* @param db - A db fork to use for block building which WILL BE MODIFIED.
|
|
37
|
-
*/
|
|
38
|
-
export declare function buildBlockWithCleanDB(txs: ProcessedTx[], globalVariables: GlobalVariables, l1ToL2Messages: Fr[], db: MerkleTreeWriteOperations, telemetry?: TelemetryClient): Promise<L2Block>;
|
|
39
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlnaHQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ibG9jay1mYWN0b3J5L2xpZ2h0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUVwRCxPQUFPLEVBQUUsT0FBTyxFQUFpQixNQUFNLHFCQUFxQixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSx5QkFBeUIsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBT2hHLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxXQUFXLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNyRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0seUJBQXlCLENBQUM7QUFRbkY7Ozs7Ozs7Ozs7Ozs7R0FhRztBQUNILHFCQUF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';
|
|
3
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
4
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
-
import { L2Block, L2BlockHeader } from '@aztec/stdlib/block';
|
|
7
|
-
import { accumulateCheckpointOutHashes, computeBlockOutHash, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
|
|
8
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
9
|
-
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
10
|
-
import { buildHeaderAndBodyFromTxs, getTreeSnapshot, insertSideEffects } from '../orchestrator/block-building-helpers.js';
|
|
11
|
-
/**
|
|
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 `insertSideEffects` for you.
|
|
22
|
-
*
|
|
23
|
-
* @deprecated Use LightweightCheckpointBuilder instead. This only works for one block per checkpoint.
|
|
24
|
-
*/ export class LightweightBlockFactory {
|
|
25
|
-
previousCheckpointOutHashes;
|
|
26
|
-
db;
|
|
27
|
-
telemetry;
|
|
28
|
-
globalVariables;
|
|
29
|
-
l1ToL2Messages;
|
|
30
|
-
txs;
|
|
31
|
-
logger;
|
|
32
|
-
constructor(previousCheckpointOutHashes, db, telemetry = getTelemetryClient()){
|
|
33
|
-
this.previousCheckpointOutHashes = previousCheckpointOutHashes;
|
|
34
|
-
this.db = db;
|
|
35
|
-
this.telemetry = telemetry;
|
|
36
|
-
this.logger = createLogger('lightweight-block-factory');
|
|
37
|
-
}
|
|
38
|
-
async startNewBlock(globalVariables, l1ToL2Messages) {
|
|
39
|
-
this.logger.debug('Starting new block', {
|
|
40
|
-
globalVariables: globalVariables.toInspect(),
|
|
41
|
-
l1ToL2Messages
|
|
42
|
-
});
|
|
43
|
-
this.globalVariables = globalVariables;
|
|
44
|
-
this.l1ToL2Messages = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
45
|
-
this.txs = undefined;
|
|
46
|
-
// Update L1 to L2 tree
|
|
47
|
-
await this.db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, this.l1ToL2Messages);
|
|
48
|
-
}
|
|
49
|
-
addTxs(txs) {
|
|
50
|
-
// Most times, `addTxs` is only called once per block.
|
|
51
|
-
// So avoid copies.
|
|
52
|
-
if (this.txs === undefined) {
|
|
53
|
-
this.txs = txs;
|
|
54
|
-
} else {
|
|
55
|
-
this.txs.push(...txs);
|
|
56
|
-
}
|
|
57
|
-
return Promise.resolve();
|
|
58
|
-
}
|
|
59
|
-
setBlockCompleted() {
|
|
60
|
-
return this.buildBlock();
|
|
61
|
-
}
|
|
62
|
-
async buildBlock() {
|
|
63
|
-
const lastArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
64
|
-
const state = await this.db.getStateReference();
|
|
65
|
-
const txs = this.txs ?? [];
|
|
66
|
-
const startSpongeBlob = SpongeBlob.init();
|
|
67
|
-
const { header, body, blockBlobFields } = await buildHeaderAndBodyFromTxs(txs, lastArchive, state, this.globalVariables, startSpongeBlob, true);
|
|
68
|
-
header.state.validate();
|
|
69
|
-
await this.db.updateArchive(header);
|
|
70
|
-
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
71
|
-
const blockOutHash = computeBlockOutHash(txs.map((tx)=>tx.txEffect.l2ToL1Msgs));
|
|
72
|
-
// There's only one block per checkpoint, so the checkpoint out hash equals the block out hash.
|
|
73
|
-
const checkpointOutHash = blockOutHash;
|
|
74
|
-
const epochOutHash = accumulateCheckpointOutHashes([
|
|
75
|
-
...this.previousCheckpointOutHashes,
|
|
76
|
-
checkpointOutHash
|
|
77
|
-
]);
|
|
78
|
-
const inHash = computeInHashFromL1ToL2Messages(this.l1ToL2Messages);
|
|
79
|
-
const numBlobFields = blockBlobFields.length + 1;
|
|
80
|
-
const blobFields = blockBlobFields.concat([
|
|
81
|
-
encodeCheckpointEndMarker({
|
|
82
|
-
numBlobFields
|
|
83
|
-
})
|
|
84
|
-
]);
|
|
85
|
-
const blobsHash = computeBlobsHashFromBlobs(getBlobsPerL1Block(blobFields));
|
|
86
|
-
const blockHeaderHash = await header.hash();
|
|
87
|
-
const l2BlockHeader = L2BlockHeader.from({
|
|
88
|
-
...header,
|
|
89
|
-
blockHeadersHash: blockHeaderHash,
|
|
90
|
-
blobsHash,
|
|
91
|
-
inHash,
|
|
92
|
-
epochOutHash
|
|
93
|
-
});
|
|
94
|
-
const block = new L2Block(newArchive, l2BlockHeader, body);
|
|
95
|
-
this.logger.debug(`Built block ${block.number}`, {
|
|
96
|
-
globalVariables: this.globalVariables?.toInspect(),
|
|
97
|
-
archiveRoot: newArchive.root.toString(),
|
|
98
|
-
stateReference: header.state.toInspect(),
|
|
99
|
-
blockHash: (await block.hash()).toString(),
|
|
100
|
-
txs: block.body.txEffects.map((tx)=>tx.txHash.toString())
|
|
101
|
-
});
|
|
102
|
-
return block;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Inserts the processed transactions into the DB, then creates a block.
|
|
107
|
-
* @param db - A db fork to use for block building which WILL BE MODIFIED.
|
|
108
|
-
*/ export async function buildBlockWithCleanDB(txs, globalVariables, l1ToL2Messages, db, telemetry = getTelemetryClient()) {
|
|
109
|
-
const builder = new LightweightBlockFactory([], db, telemetry);
|
|
110
|
-
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
111
|
-
for (const tx of txs){
|
|
112
|
-
await insertSideEffects(tx, db);
|
|
113
|
-
}
|
|
114
|
-
await builder.addTxs(txs);
|
|
115
|
-
return await builder.setBlockCompleted();
|
|
116
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './light.js';
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { SpongeBlob, computeBlobsHashFromBlobs, encodeCheckpointEndMarker, getBlobsPerL1Block } from '@aztec/blob-lib';
|
|
2
|
-
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
3
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
4
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
-
import { L2Block, L2BlockHeader } from '@aztec/stdlib/block';
|
|
7
|
-
import type { IBlockFactory, MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
8
|
-
import {
|
|
9
|
-
accumulateCheckpointOutHashes,
|
|
10
|
-
computeBlockOutHash,
|
|
11
|
-
computeInHashFromL1ToL2Messages,
|
|
12
|
-
} from '@aztec/stdlib/messaging';
|
|
13
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
14
|
-
import type { GlobalVariables, ProcessedTx } from '@aztec/stdlib/tx';
|
|
15
|
-
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
buildHeaderAndBodyFromTxs,
|
|
19
|
-
getTreeSnapshot,
|
|
20
|
-
insertSideEffects,
|
|
21
|
-
} from '../orchestrator/block-building-helpers.js';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Builds a block and its header from a set of processed tx without running any circuits.
|
|
25
|
-
*
|
|
26
|
-
* NOTE: the onus is ON THE CALLER to update the db that is passed in with the notes hashes, nullifiers, etc
|
|
27
|
-
* PRIOR to calling `buildBlock`.
|
|
28
|
-
*
|
|
29
|
-
* Why? Because if you are, e.g. building a block in practice from TxObjects, you are using the
|
|
30
|
-
* PublicProcessor which will do this for you as it processes transactions.
|
|
31
|
-
*
|
|
32
|
-
* If you haven't already inserted the side effects, e.g. because you are in a testing context, you can use the helper
|
|
33
|
-
* function `buildBlockWithCleanDB`, which calls `insertSideEffects` for you.
|
|
34
|
-
*
|
|
35
|
-
* @deprecated Use LightweightCheckpointBuilder instead. This only works for one block per checkpoint.
|
|
36
|
-
*/
|
|
37
|
-
export class LightweightBlockFactory implements IBlockFactory {
|
|
38
|
-
private globalVariables?: GlobalVariables;
|
|
39
|
-
private l1ToL2Messages?: Fr[];
|
|
40
|
-
private txs: ProcessedTx[] | undefined;
|
|
41
|
-
|
|
42
|
-
private readonly logger = createLogger('lightweight-block-factory');
|
|
43
|
-
|
|
44
|
-
constructor(
|
|
45
|
-
private previousCheckpointOutHashes: Fr[],
|
|
46
|
-
private db: MerkleTreeWriteOperations,
|
|
47
|
-
private telemetry: TelemetryClient = getTelemetryClient(),
|
|
48
|
-
) {}
|
|
49
|
-
|
|
50
|
-
async startNewBlock(globalVariables: GlobalVariables, l1ToL2Messages: Fr[]): Promise<void> {
|
|
51
|
-
this.logger.debug('Starting new block', { globalVariables: globalVariables.toInspect(), l1ToL2Messages });
|
|
52
|
-
this.globalVariables = globalVariables;
|
|
53
|
-
this.l1ToL2Messages = padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
54
|
-
this.txs = undefined;
|
|
55
|
-
// Update L1 to L2 tree
|
|
56
|
-
await this.db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, this.l1ToL2Messages!);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
addTxs(txs: ProcessedTx[]): Promise<void> {
|
|
60
|
-
// Most times, `addTxs` is only called once per block.
|
|
61
|
-
// So avoid copies.
|
|
62
|
-
if (this.txs === undefined) {
|
|
63
|
-
this.txs = txs;
|
|
64
|
-
} else {
|
|
65
|
-
this.txs.push(...txs);
|
|
66
|
-
}
|
|
67
|
-
return Promise.resolve();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
setBlockCompleted(): Promise<L2Block> {
|
|
71
|
-
return this.buildBlock();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
private async buildBlock(): Promise<L2Block> {
|
|
75
|
-
const lastArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
76
|
-
const state = await this.db.getStateReference();
|
|
77
|
-
|
|
78
|
-
const txs = this.txs ?? [];
|
|
79
|
-
const startSpongeBlob = SpongeBlob.init();
|
|
80
|
-
|
|
81
|
-
const { header, body, blockBlobFields } = await buildHeaderAndBodyFromTxs(
|
|
82
|
-
txs,
|
|
83
|
-
lastArchive,
|
|
84
|
-
state,
|
|
85
|
-
this.globalVariables!,
|
|
86
|
-
startSpongeBlob,
|
|
87
|
-
true,
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
header.state.validate();
|
|
91
|
-
|
|
92
|
-
await this.db.updateArchive(header);
|
|
93
|
-
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
94
|
-
|
|
95
|
-
const blockOutHash = computeBlockOutHash(txs.map(tx => tx.txEffect.l2ToL1Msgs));
|
|
96
|
-
// There's only one block per checkpoint, so the checkpoint out hash equals the block out hash.
|
|
97
|
-
const checkpointOutHash = blockOutHash;
|
|
98
|
-
const epochOutHash = accumulateCheckpointOutHashes([...this.previousCheckpointOutHashes, checkpointOutHash]);
|
|
99
|
-
const inHash = computeInHashFromL1ToL2Messages(this.l1ToL2Messages!);
|
|
100
|
-
const numBlobFields = blockBlobFields.length + 1;
|
|
101
|
-
const blobFields = blockBlobFields.concat([encodeCheckpointEndMarker({ numBlobFields })]);
|
|
102
|
-
const blobsHash = computeBlobsHashFromBlobs(getBlobsPerL1Block(blobFields));
|
|
103
|
-
const blockHeaderHash = await header.hash();
|
|
104
|
-
const l2BlockHeader = L2BlockHeader.from({
|
|
105
|
-
...header,
|
|
106
|
-
blockHeadersHash: blockHeaderHash,
|
|
107
|
-
blobsHash,
|
|
108
|
-
inHash,
|
|
109
|
-
epochOutHash,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
const block = new L2Block(newArchive, l2BlockHeader, body);
|
|
113
|
-
|
|
114
|
-
this.logger.debug(`Built block ${block.number}`, {
|
|
115
|
-
globalVariables: this.globalVariables?.toInspect(),
|
|
116
|
-
archiveRoot: newArchive.root.toString(),
|
|
117
|
-
stateReference: header.state.toInspect(),
|
|
118
|
-
blockHash: (await block.hash()).toString(),
|
|
119
|
-
txs: block.body.txEffects.map(tx => tx.txHash.toString()),
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
return block;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Inserts the processed transactions into the DB, then creates a block.
|
|
128
|
-
* @param db - A db fork to use for block building which WILL BE MODIFIED.
|
|
129
|
-
*/
|
|
130
|
-
export async function buildBlockWithCleanDB(
|
|
131
|
-
txs: ProcessedTx[],
|
|
132
|
-
globalVariables: GlobalVariables,
|
|
133
|
-
l1ToL2Messages: Fr[],
|
|
134
|
-
db: MerkleTreeWriteOperations,
|
|
135
|
-
telemetry: TelemetryClient = getTelemetryClient(),
|
|
136
|
-
) {
|
|
137
|
-
const builder = new LightweightBlockFactory([], db, telemetry);
|
|
138
|
-
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
139
|
-
|
|
140
|
-
for (const tx of txs) {
|
|
141
|
-
await insertSideEffects(tx, db);
|
|
142
|
-
}
|
|
143
|
-
await builder.addTxs(txs);
|
|
144
|
-
|
|
145
|
-
return await builder.setBlockCompleted();
|
|
146
|
-
}
|