@aztec/prover-client 0.0.0-test.0 → 0.0.1-fake-c83136db25
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-factory/index.d.ts +2 -0
- package/dest/block-factory/index.d.ts.map +1 -0
- package/dest/block-factory/light.d.ts +38 -0
- package/dest/block-factory/light.d.ts.map +1 -0
- package/dest/block-factory/light.js +94 -0
- package/dest/config.d.ts +6 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +11 -1
- package/dest/mocks/fixtures.d.ts +7 -4
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +32 -4
- package/dest/mocks/test_context.d.ts +43 -15
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +110 -48
- package/dest/orchestrator/block-building-helpers.d.ts +37 -28
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +156 -150
- package/dest/orchestrator/block-proving-state.d.ts +62 -46
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +223 -179
- package/dest/orchestrator/checkpoint-proving-state.d.ts +63 -0
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -0
- package/dest/orchestrator/checkpoint-proving-state.js +211 -0
- package/dest/orchestrator/epoch-proving-state.d.ts +37 -24
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +143 -73
- package/dest/orchestrator/orchestrator.d.ts +34 -31
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +392 -234
- package/dest/orchestrator/orchestrator_metrics.d.ts +2 -0
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +9 -0
- package/dest/orchestrator/tx-proving-state.d.ts +12 -10
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +30 -38
- package/dest/prover-client/prover-client.d.ts +3 -3
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +5 -4
- package/dest/prover-client/server-epoch-prover.d.ts +13 -10
- package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.js +11 -11
- package/dest/proving_broker/broker_prover_facade.d.ts +22 -15
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +64 -39
- package/dest/proving_broker/config.d.ts +9 -4
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +15 -4
- package/dest/proving_broker/factory.d.ts +1 -1
- package/dest/proving_broker/factory.d.ts.map +1 -1
- package/dest/proving_broker/factory.js +5 -1
- package/dest/proving_broker/fixtures.js +1 -1
- package/dest/proving_broker/proof_store/factory.js +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.js +1 -0
- package/dest/proving_broker/proof_store/index.d.ts +1 -0
- package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.js +1 -0
- package/dest/proving_broker/proving_agent.d.ts +3 -3
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +83 -47
- package/dest/proving_broker/proving_broker.d.ts +11 -2
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +34 -22
- package/dest/proving_broker/proving_broker_database/memory.js +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +9 -8
- package/dest/proving_broker/proving_job_controller.d.ts +7 -8
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +89 -61
- package/dest/proving_broker/rpc.d.ts +3 -5
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +1 -4
- package/dest/test/mock_proof_store.d.ts +9 -0
- package/dest/test/mock_proof_store.d.ts.map +1 -0
- package/dest/test/mock_proof_store.js +10 -0
- package/dest/test/mock_prover.d.ts +23 -16
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +38 -20
- package/package.json +29 -29
- package/src/block-factory/index.ts +1 -0
- package/src/block-factory/light.ts +140 -0
- package/src/config.ts +24 -8
- package/src/mocks/fixtures.ts +43 -15
- package/src/mocks/test_context.ts +201 -75
- package/src/orchestrator/block-building-helpers.ts +247 -243
- package/src/orchestrator/block-proving-state.ts +247 -231
- package/src/orchestrator/checkpoint-proving-state.ts +299 -0
- package/src/orchestrator/epoch-proving-state.ts +187 -111
- package/src/orchestrator/orchestrator.ts +590 -289
- package/src/orchestrator/orchestrator_metrics.ts +20 -1
- package/src/orchestrator/tx-proving-state.ts +60 -61
- package/src/prover-client/prover-client.ts +16 -14
- package/src/prover-client/server-epoch-prover.ts +40 -21
- package/src/proving_broker/broker_prover_facade.ts +200 -113
- package/src/proving_broker/config.ts +17 -6
- package/src/proving_broker/factory.ts +2 -1
- package/src/proving_broker/fixtures.ts +1 -1
- package/src/proving_broker/proof_store/factory.ts +1 -1
- package/src/proving_broker/proof_store/gcs_proof_store.ts +5 -1
- package/src/proving_broker/proof_store/index.ts +1 -0
- package/src/proving_broker/proof_store/inline_proof_store.ts +1 -1
- package/src/proving_broker/proving_agent.ts +89 -47
- package/src/proving_broker/proving_broker.ts +51 -32
- package/src/proving_broker/proving_broker_database/memory.ts +1 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +9 -8
- package/src/proving_broker/proving_job_controller.ts +92 -81
- package/src/proving_broker/rpc.ts +1 -6
- package/src/test/mock_proof_store.ts +14 -0
- package/src/test/mock_prover.ts +164 -60
- package/dest/bin/get-proof-inputs.d.ts +0 -2
- package/dest/bin/get-proof-inputs.d.ts.map +0 -1
- package/dest/bin/get-proof-inputs.js +0 -51
- package/dest/block_builder/index.d.ts +0 -6
- package/dest/block_builder/index.d.ts.map +0 -1
- package/dest/block_builder/light.d.ts +0 -33
- package/dest/block_builder/light.d.ts.map +0 -1
- package/dest/block_builder/light.js +0 -82
- package/src/bin/get-proof-inputs.ts +0 -59
- package/src/block_builder/index.ts +0 -6
- package/src/block_builder/light.ts +0 -101
- /package/dest/{block_builder → block-factory}/index.js +0 -0
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */ import { AVM_INPUTS_FILENAME } from '@aztec/bb-prover';
|
|
2
|
-
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import { ProvingJobInputs } from '@aztec/stdlib/interfaces/server';
|
|
5
|
-
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
6
|
-
import { mkdirSync, writeFileSync } from 'fs';
|
|
7
|
-
import { createProofStoreForUri } from '../proving_broker/index.js';
|
|
8
|
-
const logger = createLogger('prover-client:get-proof-inputs');
|
|
9
|
-
function printUsage() {
|
|
10
|
-
console.error('Usage: get-proof-inputs <proof-uri> [out-dir=.]');
|
|
11
|
-
}
|
|
12
|
-
async function main() {
|
|
13
|
-
if (process.argv[2] === '--help') {
|
|
14
|
-
printUsage();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const uri = process.argv[2];
|
|
18
|
-
const outDir = process.argv[3] || '.';
|
|
19
|
-
if (!uri) {
|
|
20
|
-
printUsage();
|
|
21
|
-
throw new Error('Missing proof URI');
|
|
22
|
-
}
|
|
23
|
-
mkdirSync(outDir, {
|
|
24
|
-
recursive: true
|
|
25
|
-
});
|
|
26
|
-
const proofStore = createProofStoreForUri(uri);
|
|
27
|
-
logger.info(`Processing uri ${uri}`);
|
|
28
|
-
const input = await proofStore.getProofInput(uri);
|
|
29
|
-
logger.info(`Found inputs for ${ProvingRequestType[input.type]}`);
|
|
30
|
-
writeProofInputs(input, outDir);
|
|
31
|
-
console.log((await jsonParseWithSchema(jsonStringify(input), ProvingJobInputs)).inputs);
|
|
32
|
-
}
|
|
33
|
-
// This mimics the behavior of bb-prover/src/bb/execute.ts
|
|
34
|
-
function writeProofInputs(input, outDir) {
|
|
35
|
-
switch(input.type){
|
|
36
|
-
case ProvingRequestType.PUBLIC_VM:
|
|
37
|
-
{
|
|
38
|
-
writeFileSync(`${outDir}/${AVM_INPUTS_FILENAME}`, input.inputs.serializeWithMessagePack());
|
|
39
|
-
logger.info(`Wrote AVM inputs to ${AVM_INPUTS_FILENAME}`);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
default:
|
|
43
|
-
{
|
|
44
|
-
throw new Error(`Unimplemented proving request type: ${ProvingRequestType[input.type]}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
main().catch((err)=>{
|
|
49
|
-
console.error(err);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/block_builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE9F,cAAc,YAAY,CAAC;AAC3B,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,EAAE,wBAAwB,GAAG,YAAY,CAAC;CACpD"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { L2Block } from '@aztec/stdlib/block';
|
|
3
|
-
import type { BlockBuilder, MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
4
|
-
import { type GlobalVariables, type 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
|
-
export declare class LightweightBlockBuilder implements BlockBuilder {
|
|
10
|
-
private db;
|
|
11
|
-
private telemetry;
|
|
12
|
-
private spongeBlobState?;
|
|
13
|
-
private globalVariables?;
|
|
14
|
-
private l1ToL2Messages?;
|
|
15
|
-
private txs;
|
|
16
|
-
private readonly logger;
|
|
17
|
-
constructor(db: MerkleTreeWriteOperations, telemetry?: TelemetryClient);
|
|
18
|
-
startNewBlock(globalVariables: GlobalVariables, l1ToL2Messages: Fr[]): Promise<void>;
|
|
19
|
-
addTxs(txs: ProcessedTx[]): Promise<void>;
|
|
20
|
-
setBlockCompleted(): Promise<L2Block>;
|
|
21
|
-
private buildBlock;
|
|
22
|
-
}
|
|
23
|
-
export declare class LightweightBlockBuilderFactory {
|
|
24
|
-
private telemetry;
|
|
25
|
-
constructor(telemetry?: TelemetryClient);
|
|
26
|
-
create(db: MerkleTreeWriteOperations): BlockBuilder;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Creates a block builder under the hood with the given txs and messages and creates a block.
|
|
30
|
-
* @param db - A db fork to use for block building.
|
|
31
|
-
*/
|
|
32
|
-
export declare function buildBlock(txs: ProcessedTx[], globalVariables: GlobalVariables, l1ToL2Messages: Fr[], db: MerkleTreeWriteOperations, telemetry?: TelemetryClient): Promise<L2Block>;
|
|
33
|
-
//# sourceMappingURL=light.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;;GAEG;AACH,qBAAa,uBAAwB,YAAW,YAAY;IAS9C,OAAO,CAAC,EAAE;IAA6B,OAAO,CAAC,SAAS;IARpE,OAAO,CAAC,eAAe,CAAC,CAAa;IACrC,OAAO,CAAC,eAAe,CAAC,CAAkB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAO;IAE9B,OAAO,CAAC,GAAG,CAAqB;IAEhC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+C;gBAElD,EAAE,EAAE,yBAAyB,EAAU,SAAS,GAAE,eAAsC;IAEtG,aAAa,CAAC,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpF,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/C,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;YAIvB,UAAU;CAoBzB;AAED,qBAAa,8BAA8B;IAC7B,OAAO,CAAC,SAAS;gBAAT,SAAS,GAAE,eAAsC;IAErE,MAAM,CAAC,EAAE,EAAE,yBAAyB,GAAG,YAAY;CAGpD;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,WAAW,EAAE,EAClB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,EAAE,EAAE,EACpB,EAAE,EAAE,yBAAyB,EAC7B,SAAS,GAAE,eAAsC,oBAMlD"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { SpongeBlob } 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/fields';
|
|
5
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
-
import { L2Block } from '@aztec/stdlib/block';
|
|
7
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
8
|
-
import { toNumBlobFields } from '@aztec/stdlib/tx';
|
|
9
|
-
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
10
|
-
import { buildBaseRollupHints, buildHeaderAndBodyFromTxs, getTreeSnapshot } 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
|
-
*/ export class LightweightBlockBuilder {
|
|
14
|
-
db;
|
|
15
|
-
telemetry;
|
|
16
|
-
spongeBlobState;
|
|
17
|
-
globalVariables;
|
|
18
|
-
l1ToL2Messages;
|
|
19
|
-
txs;
|
|
20
|
-
logger;
|
|
21
|
-
constructor(db, telemetry = getTelemetryClient()){
|
|
22
|
-
this.db = db;
|
|
23
|
-
this.telemetry = telemetry;
|
|
24
|
-
this.txs = [];
|
|
25
|
-
this.logger = createLogger('prover-client:block_builder');
|
|
26
|
-
}
|
|
27
|
-
async startNewBlock(globalVariables, l1ToL2Messages) {
|
|
28
|
-
this.logger.debug('Starting new block', {
|
|
29
|
-
globalVariables: globalVariables.toInspect(),
|
|
30
|
-
l1ToL2Messages
|
|
31
|
-
});
|
|
32
|
-
this.globalVariables = globalVariables;
|
|
33
|
-
this.l1ToL2Messages = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
34
|
-
this.txs = [];
|
|
35
|
-
this.spongeBlobState = undefined;
|
|
36
|
-
// Update L1 to L2 tree
|
|
37
|
-
await this.db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, this.l1ToL2Messages);
|
|
38
|
-
}
|
|
39
|
-
async addTxs(txs) {
|
|
40
|
-
this.spongeBlobState = SpongeBlob.init(toNumBlobFields(txs));
|
|
41
|
-
for (const tx of txs){
|
|
42
|
-
this.logger.debug('Adding new tx to block', {
|
|
43
|
-
txHash: tx.hash.toString()
|
|
44
|
-
});
|
|
45
|
-
this.txs.push(tx);
|
|
46
|
-
await buildBaseRollupHints(tx, this.globalVariables, this.db, this.spongeBlobState);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
setBlockCompleted() {
|
|
50
|
-
return this.buildBlock();
|
|
51
|
-
}
|
|
52
|
-
async buildBlock() {
|
|
53
|
-
const { header, body } = await buildHeaderAndBodyFromTxs(this.txs, this.globalVariables, this.l1ToL2Messages, this.db);
|
|
54
|
-
await this.db.updateArchive(header);
|
|
55
|
-
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
56
|
-
const block = new L2Block(newArchive, header, body);
|
|
57
|
-
this.logger.debug(`Built block ${block.number}`, {
|
|
58
|
-
globalVariables: this.globalVariables?.toInspect(),
|
|
59
|
-
archiveRoot: newArchive.root.toString(),
|
|
60
|
-
blockHash: block.hash.toString()
|
|
61
|
-
});
|
|
62
|
-
return block;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export class LightweightBlockBuilderFactory {
|
|
66
|
-
telemetry;
|
|
67
|
-
constructor(telemetry = getTelemetryClient()){
|
|
68
|
-
this.telemetry = telemetry;
|
|
69
|
-
}
|
|
70
|
-
create(db) {
|
|
71
|
-
return new LightweightBlockBuilder(db, this.telemetry);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Creates a block builder under the hood with the given txs and messages and creates a block.
|
|
76
|
-
* @param db - A db fork to use for block building.
|
|
77
|
-
*/ export async function buildBlock(txs, globalVariables, l1ToL2Messages, db, telemetry = getTelemetryClient()) {
|
|
78
|
-
const builder = new LightweightBlockBuilder(db, telemetry);
|
|
79
|
-
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
80
|
-
await builder.addTxs(txs);
|
|
81
|
-
return await builder.setBlockCompleted();
|
|
82
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import { AVM_INPUTS_FILENAME } from '@aztec/bb-prover';
|
|
3
|
-
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
-
import { type ProofUri, ProvingJobInputs } from '@aztec/stdlib/interfaces/server';
|
|
6
|
-
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
7
|
-
|
|
8
|
-
import { mkdirSync, writeFileSync } from 'fs';
|
|
9
|
-
|
|
10
|
-
import { createProofStoreForUri } from '../proving_broker/index.js';
|
|
11
|
-
|
|
12
|
-
const logger = createLogger('prover-client:get-proof-inputs');
|
|
13
|
-
|
|
14
|
-
function printUsage() {
|
|
15
|
-
console.error('Usage: get-proof-inputs <proof-uri> [out-dir=.]');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async function main() {
|
|
19
|
-
if (process.argv[2] === '--help') {
|
|
20
|
-
printUsage();
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const uri = process.argv[2];
|
|
25
|
-
const outDir = process.argv[3] || '.';
|
|
26
|
-
if (!uri) {
|
|
27
|
-
printUsage();
|
|
28
|
-
throw new Error('Missing proof URI');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
mkdirSync(outDir, { recursive: true });
|
|
32
|
-
|
|
33
|
-
const proofStore = createProofStoreForUri(uri);
|
|
34
|
-
logger.info(`Processing uri ${uri}`);
|
|
35
|
-
const input = await proofStore.getProofInput(uri as ProofUri);
|
|
36
|
-
logger.info(`Found inputs for ${ProvingRequestType[input.type]}`);
|
|
37
|
-
writeProofInputs(input, outDir);
|
|
38
|
-
|
|
39
|
-
console.log((await jsonParseWithSchema(jsonStringify(input), ProvingJobInputs)).inputs);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// This mimics the behavior of bb-prover/src/bb/execute.ts
|
|
43
|
-
function writeProofInputs(input: ProvingJobInputs, outDir: string) {
|
|
44
|
-
switch (input.type) {
|
|
45
|
-
case ProvingRequestType.PUBLIC_VM: {
|
|
46
|
-
writeFileSync(`${outDir}/${AVM_INPUTS_FILENAME}`, input.inputs.serializeWithMessagePack());
|
|
47
|
-
logger.info(`Wrote AVM inputs to ${AVM_INPUTS_FILENAME}`);
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
default: {
|
|
51
|
-
throw new Error(`Unimplemented proving request type: ${ProvingRequestType[input.type]}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
main().catch(err => {
|
|
57
|
-
console.error(err);
|
|
58
|
-
process.exit(1);
|
|
59
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { SpongeBlob } 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/fields';
|
|
5
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
-
import { L2Block } from '@aztec/stdlib/block';
|
|
7
|
-
import type { BlockBuilder, MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
8
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
9
|
-
import { type GlobalVariables, type ProcessedTx, toNumBlobFields } from '@aztec/stdlib/tx';
|
|
10
|
-
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
buildBaseRollupHints,
|
|
14
|
-
buildHeaderAndBodyFromTxs,
|
|
15
|
-
getTreeSnapshot,
|
|
16
|
-
} from '../orchestrator/block-building-helpers.js';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Builds a block and its header from a set of processed tx without running any circuits.
|
|
20
|
-
*/
|
|
21
|
-
export class LightweightBlockBuilder implements BlockBuilder {
|
|
22
|
-
private spongeBlobState?: SpongeBlob;
|
|
23
|
-
private globalVariables?: GlobalVariables;
|
|
24
|
-
private l1ToL2Messages?: Fr[];
|
|
25
|
-
|
|
26
|
-
private txs: ProcessedTx[] = [];
|
|
27
|
-
|
|
28
|
-
private readonly logger = createLogger('prover-client:block_builder');
|
|
29
|
-
|
|
30
|
-
constructor(private db: MerkleTreeWriteOperations, private telemetry: TelemetryClient = getTelemetryClient()) {}
|
|
31
|
-
|
|
32
|
-
async startNewBlock(globalVariables: GlobalVariables, l1ToL2Messages: Fr[]): Promise<void> {
|
|
33
|
-
this.logger.debug('Starting new block', { globalVariables: globalVariables.toInspect(), l1ToL2Messages });
|
|
34
|
-
this.globalVariables = globalVariables;
|
|
35
|
-
this.l1ToL2Messages = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
36
|
-
this.txs = [];
|
|
37
|
-
this.spongeBlobState = undefined;
|
|
38
|
-
|
|
39
|
-
// Update L1 to L2 tree
|
|
40
|
-
await this.db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, this.l1ToL2Messages!);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async addTxs(txs: ProcessedTx[]): Promise<void> {
|
|
44
|
-
this.spongeBlobState = SpongeBlob.init(toNumBlobFields(txs));
|
|
45
|
-
for (const tx of txs) {
|
|
46
|
-
this.logger.debug('Adding new tx to block', { txHash: tx.hash.toString() });
|
|
47
|
-
this.txs.push(tx);
|
|
48
|
-
await buildBaseRollupHints(tx, this.globalVariables!, this.db, this.spongeBlobState!);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
setBlockCompleted(): Promise<L2Block> {
|
|
53
|
-
return this.buildBlock();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private async buildBlock(): Promise<L2Block> {
|
|
57
|
-
const { header, body } = await buildHeaderAndBodyFromTxs(
|
|
58
|
-
this.txs,
|
|
59
|
-
this.globalVariables!,
|
|
60
|
-
this.l1ToL2Messages!,
|
|
61
|
-
this.db,
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
await this.db.updateArchive(header);
|
|
65
|
-
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
66
|
-
|
|
67
|
-
const block = new L2Block(newArchive, header, body);
|
|
68
|
-
this.logger.debug(`Built block ${block.number}`, {
|
|
69
|
-
globalVariables: this.globalVariables?.toInspect(),
|
|
70
|
-
archiveRoot: newArchive.root.toString(),
|
|
71
|
-
blockHash: block.hash.toString(),
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
return block;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export class LightweightBlockBuilderFactory {
|
|
79
|
-
constructor(private telemetry: TelemetryClient = getTelemetryClient()) {}
|
|
80
|
-
|
|
81
|
-
create(db: MerkleTreeWriteOperations): BlockBuilder {
|
|
82
|
-
return new LightweightBlockBuilder(db, this.telemetry);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Creates a block builder under the hood with the given txs and messages and creates a block.
|
|
88
|
-
* @param db - A db fork to use for block building.
|
|
89
|
-
*/
|
|
90
|
-
export async function buildBlock(
|
|
91
|
-
txs: ProcessedTx[],
|
|
92
|
-
globalVariables: GlobalVariables,
|
|
93
|
-
l1ToL2Messages: Fr[],
|
|
94
|
-
db: MerkleTreeWriteOperations,
|
|
95
|
-
telemetry: TelemetryClient = getTelemetryClient(),
|
|
96
|
-
) {
|
|
97
|
-
const builder = new LightweightBlockBuilder(db, telemetry);
|
|
98
|
-
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
99
|
-
await builder.addTxs(txs);
|
|
100
|
-
return await builder.setBlockCompleted();
|
|
101
|
-
}
|
|
File without changes
|