@aztec/prover-client 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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 +1 -1
- package/dest/block-factory/light.d.ts +5 -3
- package/dest/block-factory/light.d.ts.map +1 -1
- package/dest/block-factory/light.js +32 -11
- package/dest/config.d.ts +2 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +2 -2
- package/dest/index.d.ts +1 -1
- package/dest/light/index.d.ts +2 -0
- package/dest/light/index.d.ts.map +1 -0
- package/dest/light/index.js +1 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts +36 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
- package/dest/light/lightweight_checkpoint_builder.js +147 -0
- package/dest/mocks/fixtures.d.ts +5 -5
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +33 -15
- package/dest/mocks/test_context.d.ts +38 -33
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +133 -82
- package/dest/orchestrator/block-building-helpers.d.ts +35 -35
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +151 -187
- package/dest/orchestrator/block-proving-state.d.ts +68 -55
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +273 -185
- 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 +210 -0
- package/dest/orchestrator/epoch-proving-state.d.ts +38 -31
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +128 -84
- package/dest/orchestrator/index.d.ts +1 -1
- package/dest/orchestrator/orchestrator.d.ts +35 -34
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +777 -292
- package/dest/orchestrator/orchestrator_metrics.d.ts +1 -3
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +0 -9
- 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 +23 -29
- package/dest/prover-client/factory.d.ts +3 -3
- package/dest/prover-client/factory.d.ts.map +1 -1
- package/dest/prover-client/index.d.ts +1 -1
- 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 +1 -1
- package/dest/prover-client/server-epoch-prover.d.ts +13 -11
- package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.js +9 -9
- package/dest/proving_broker/broker_prover_facade.d.ts +23 -18
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +42 -33
- package/dest/proving_broker/config.d.ts +18 -14
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +12 -6
- package/dest/proving_broker/factory.d.ts +1 -1
- package/dest/proving_broker/factory.js +1 -1
- package/dest/proving_broker/fixtures.d.ts +3 -2
- package/dest/proving_broker/fixtures.d.ts.map +1 -1
- package/dest/proving_broker/fixtures.js +3 -2
- package/dest/proving_broker/index.d.ts +1 -1
- package/dest/proving_broker/proof_store/factory.d.ts +2 -2
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.d.ts +2 -1
- 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/proof_store/inline_proof_store.d.ts +1 -1
- package/dest/proving_broker/proof_store/inline_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/proof_store.d.ts +1 -1
- package/dest/proving_broker/proving_agent.d.ts +3 -8
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +1 -16
- package/dest/proving_broker/proving_broker.d.ts +2 -2
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +35 -29
- package/dest/proving_broker/proving_broker_database/memory.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database/memory.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.d.ts +5 -3
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +397 -8
- package/dest/proving_broker/proving_broker_database.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.d.ts +3 -2
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +40 -21
- package/dest/proving_broker/rpc.d.ts +4 -4
- package/dest/test/mock_proof_store.d.ts +3 -3
- package/dest/test/mock_proof_store.d.ts.map +1 -1
- package/dest/test/mock_prover.d.ts +23 -19
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +36 -21
- package/package.json +21 -19
- package/src/block-factory/light.ts +40 -17
- package/src/config.ts +2 -2
- package/src/light/index.ts +1 -0
- package/src/light/lightweight_checkpoint_builder.ts +198 -0
- package/src/mocks/fixtures.ts +41 -36
- package/src/mocks/test_context.ts +196 -114
- package/src/orchestrator/block-building-helpers.ts +233 -313
- package/src/orchestrator/block-proving-state.ts +315 -247
- package/src/orchestrator/checkpoint-proving-state.ts +303 -0
- package/src/orchestrator/epoch-proving-state.ts +176 -129
- package/src/orchestrator/orchestrator.ts +558 -348
- package/src/orchestrator/orchestrator_metrics.ts +1 -20
- package/src/orchestrator/tx-proving-state.ts +47 -55
- package/src/prover-client/factory.ts +6 -2
- package/src/prover-client/prover-client.ts +4 -11
- package/src/prover-client/server-epoch-prover.ts +30 -21
- package/src/proving_broker/broker_prover_facade.ts +175 -112
- package/src/proving_broker/config.ts +14 -7
- package/src/proving_broker/factory.ts +1 -1
- package/src/proving_broker/fixtures.ts +8 -3
- package/src/proving_broker/proof_store/index.ts +1 -0
- package/src/proving_broker/proving_agent.ts +1 -17
- package/src/proving_broker/proving_broker.ts +42 -27
- package/src/proving_broker/proving_broker_database/memory.ts +2 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +25 -10
- package/src/proving_broker/proving_broker_database.ts +2 -1
- package/src/proving_broker/proving_job_controller.ts +42 -22
- package/src/test/mock_prover.ts +143 -66
- 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/proving_broker/proving_agent_instrumentation.d.ts +0 -8
- package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +0 -1
- package/dest/proving_broker/proving_agent_instrumentation.js +0 -16
- package/src/bin/get-proof-inputs.ts +0 -59
- package/src/proving_broker/proving_agent_instrumentation.ts +0 -21
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { SpongeBlob, computeBlobsHashFromBlobs, encodeCheckpointEndMarker, getBlobsPerL1Block } from '@aztec/blob-lib';
|
|
2
|
+
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
3
|
+
import type { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
5
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
7
|
+
import { L2BlockNew } from '@aztec/stdlib/block';
|
|
8
|
+
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
9
|
+
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
10
|
+
import { computeCheckpointOutHash, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
|
|
11
|
+
import { CheckpointHeader, computeBlockHeadersHash } from '@aztec/stdlib/rollup';
|
|
12
|
+
import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
13
|
+
import {
|
|
14
|
+
type CheckpointGlobalVariables,
|
|
15
|
+
ContentCommitment,
|
|
16
|
+
type GlobalVariables,
|
|
17
|
+
type ProcessedTx,
|
|
18
|
+
StateReference,
|
|
19
|
+
} from '@aztec/stdlib/tx';
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
buildHeaderAndBodyFromTxs,
|
|
23
|
+
getTreeSnapshot,
|
|
24
|
+
insertSideEffects,
|
|
25
|
+
} from '../orchestrator/block-building-helpers.js';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Builds a checkpoint and its header and the blocks in it from a set of processed tx without running any circuits.
|
|
29
|
+
*
|
|
30
|
+
* It updates the l1-to-l2 message tree when starting a new checkpoint, and then updates the archive tree when each block is added.
|
|
31
|
+
* Finally completes the checkpoint by computing its header.
|
|
32
|
+
*/
|
|
33
|
+
export class LightweightCheckpointBuilder {
|
|
34
|
+
private readonly logger = createLogger('lightweight-checkpoint-builder');
|
|
35
|
+
|
|
36
|
+
private lastArchives: AppendOnlyTreeSnapshot[] = [];
|
|
37
|
+
private spongeBlob: SpongeBlob;
|
|
38
|
+
private blocks: L2BlockNew[] = [];
|
|
39
|
+
private blobFields: Fr[] = [];
|
|
40
|
+
|
|
41
|
+
constructor(
|
|
42
|
+
public readonly checkpointNumber: CheckpointNumber,
|
|
43
|
+
public readonly constants: CheckpointGlobalVariables,
|
|
44
|
+
public readonly l1ToL2Messages: Fr[],
|
|
45
|
+
public readonly db: MerkleTreeWriteOperations,
|
|
46
|
+
) {
|
|
47
|
+
this.spongeBlob = SpongeBlob.init();
|
|
48
|
+
this.logger.debug('Starting new checkpoint', { constants, l1ToL2Messages });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static async startNewCheckpoint(
|
|
52
|
+
checkpointNumber: CheckpointNumber,
|
|
53
|
+
constants: CheckpointGlobalVariables,
|
|
54
|
+
l1ToL2Messages: Fr[],
|
|
55
|
+
db: MerkleTreeWriteOperations,
|
|
56
|
+
): Promise<LightweightCheckpointBuilder> {
|
|
57
|
+
// Insert l1-to-l2 messages into the tree.
|
|
58
|
+
await db.appendLeaves(
|
|
59
|
+
MerkleTreeId.L1_TO_L2_MESSAGE_TREE,
|
|
60
|
+
padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return new LightweightCheckpointBuilder(checkpointNumber, constants, l1ToL2Messages, db);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Adds a new block to the checkpoint. The tx effects must have already been inserted into the db if
|
|
68
|
+
* this is called after tx processing, if that's not the case, then set `insertTxsEffects` to true.
|
|
69
|
+
*/
|
|
70
|
+
public async addBlock(
|
|
71
|
+
globalVariables: GlobalVariables,
|
|
72
|
+
txs: ProcessedTx[],
|
|
73
|
+
opts: { insertTxsEffects?: boolean; expectedEndState?: StateReference } = {},
|
|
74
|
+
): Promise<L2BlockNew> {
|
|
75
|
+
const isFirstBlock = this.blocks.length === 0;
|
|
76
|
+
|
|
77
|
+
// Empty blocks are only allowed as the first block in a checkpoint
|
|
78
|
+
if (!isFirstBlock && txs.length === 0) {
|
|
79
|
+
throw new Error('Cannot add empty block that is not the first block in the checkpoint.');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (isFirstBlock) {
|
|
83
|
+
this.lastArchives.push(await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const lastArchive = this.lastArchives.at(-1)!;
|
|
87
|
+
|
|
88
|
+
if (opts.insertTxsEffects) {
|
|
89
|
+
this.logger.debug(
|
|
90
|
+
`Inserting side effects for ${txs.length} txs for block ${globalVariables.blockNumber} into db`,
|
|
91
|
+
{ txs: txs.map(tx => tx.hash.toString()) },
|
|
92
|
+
);
|
|
93
|
+
for (const tx of txs) {
|
|
94
|
+
await insertSideEffects(tx, this.db);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const endState = await this.db.getStateReference();
|
|
99
|
+
if (opts.expectedEndState && !endState.equals(opts.expectedEndState)) {
|
|
100
|
+
this.logger.error('End state after processing txs does not match expected end state', {
|
|
101
|
+
globalVariables: globalVariables.toInspect(),
|
|
102
|
+
expectedEndState: opts.expectedEndState.toInspect(),
|
|
103
|
+
actualEndState: endState.toInspect(),
|
|
104
|
+
});
|
|
105
|
+
throw new Error(`End state does not match expected end state when building block ${globalVariables.blockNumber}`);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const { header, body, blockBlobFields } = await buildHeaderAndBodyFromTxs(
|
|
109
|
+
txs,
|
|
110
|
+
lastArchive,
|
|
111
|
+
endState,
|
|
112
|
+
globalVariables,
|
|
113
|
+
this.spongeBlob,
|
|
114
|
+
isFirstBlock,
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
header.state.validate();
|
|
118
|
+
|
|
119
|
+
await this.db.updateArchive(header);
|
|
120
|
+
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
121
|
+
this.lastArchives.push(newArchive);
|
|
122
|
+
|
|
123
|
+
const indexWithinCheckpoint = this.blocks.length;
|
|
124
|
+
const block = new L2BlockNew(newArchive, header, body, this.checkpointNumber, indexWithinCheckpoint);
|
|
125
|
+
this.blocks.push(block);
|
|
126
|
+
|
|
127
|
+
await this.spongeBlob.absorb(blockBlobFields);
|
|
128
|
+
this.blobFields.push(...blockBlobFields);
|
|
129
|
+
|
|
130
|
+
this.logger.debug(`Built block ${header.getBlockNumber()}`, {
|
|
131
|
+
globalVariables: globalVariables.toInspect(),
|
|
132
|
+
archiveRoot: newArchive.root.toString(),
|
|
133
|
+
stateReference: header.state.toInspect(),
|
|
134
|
+
blockHash: (await block.hash()).toString(),
|
|
135
|
+
txs: block.body.txEffects.map(tx => tx.txHash.toString()),
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return block;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async completeCheckpoint(): Promise<Checkpoint> {
|
|
142
|
+
if (!this.blocks.length) {
|
|
143
|
+
throw new Error('Cannot complete a checkpoint with no blocks');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const numBlobFields = this.blobFields.length + 1; // +1 for the checkpoint end marker.
|
|
147
|
+
const checkpointEndMarker = encodeCheckpointEndMarker({ numBlobFields });
|
|
148
|
+
this.blobFields.push(checkpointEndMarker);
|
|
149
|
+
|
|
150
|
+
const blocks = this.blocks;
|
|
151
|
+
const blockHeadersHash = await computeBlockHeadersHash(blocks.map(block => block.header));
|
|
152
|
+
|
|
153
|
+
const newArchive = this.lastArchives[this.lastArchives.length - 1];
|
|
154
|
+
|
|
155
|
+
const blobs = getBlobsPerL1Block(this.blobFields);
|
|
156
|
+
const blobsHash = computeBlobsHashFromBlobs(blobs);
|
|
157
|
+
|
|
158
|
+
const inHash = computeInHashFromL1ToL2Messages(this.l1ToL2Messages);
|
|
159
|
+
|
|
160
|
+
const outHash = computeCheckpointOutHash(blocks.map(block => block.body.txEffects.map(tx => tx.l2ToL1Msgs)));
|
|
161
|
+
|
|
162
|
+
const { slotNumber, coinbase, feeRecipient, gasFees } = this.constants;
|
|
163
|
+
|
|
164
|
+
// TODO(palla/mbps): Should we source this from the constants instead?
|
|
165
|
+
// timestamp of a checkpoint is the timestamp of the last block in the checkpoint.
|
|
166
|
+
const timestamp = blocks[blocks.length - 1].timestamp;
|
|
167
|
+
|
|
168
|
+
const totalManaUsed = blocks.reduce((acc, block) => acc.add(block.header.totalManaUsed), Fr.ZERO);
|
|
169
|
+
|
|
170
|
+
const header = CheckpointHeader.from({
|
|
171
|
+
lastArchiveRoot: this.lastArchives[0].root,
|
|
172
|
+
contentCommitment: new ContentCommitment(blobsHash, inHash, outHash),
|
|
173
|
+
blockHeadersHash,
|
|
174
|
+
slotNumber,
|
|
175
|
+
timestamp,
|
|
176
|
+
coinbase,
|
|
177
|
+
feeRecipient,
|
|
178
|
+
gasFees,
|
|
179
|
+
totalManaUsed,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
return new Checkpoint(newArchive, header, blocks, this.checkpointNumber);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
clone() {
|
|
186
|
+
const clone = new LightweightCheckpointBuilder(
|
|
187
|
+
this.checkpointNumber,
|
|
188
|
+
this.constants,
|
|
189
|
+
[...this.l1ToL2Messages],
|
|
190
|
+
this.db,
|
|
191
|
+
);
|
|
192
|
+
clone.lastArchives = [...this.lastArchives];
|
|
193
|
+
clone.spongeBlob = this.spongeBlob.clone();
|
|
194
|
+
clone.blocks = [...this.blocks];
|
|
195
|
+
clone.blobFields = [...this.blobFields];
|
|
196
|
+
return clone;
|
|
197
|
+
}
|
|
198
|
+
}
|
package/src/mocks/fixtures.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
6
5
|
import type { Logger } from '@aztec/foundation/log';
|
|
6
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
7
7
|
import { fileURLToPath } from '@aztec/foundation/url';
|
|
8
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
9
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
8
10
|
import { type CircuitSimulator, NativeACVMSimulator, WASMSimulatorWithBlobs } from '@aztec/simulator/server';
|
|
9
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
12
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
11
|
-
import
|
|
12
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
13
|
-
import type { ProcessedTx } from '@aztec/stdlib/tx';
|
|
13
|
+
import { CheckpointConstantData } from '@aztec/stdlib/rollup';
|
|
14
14
|
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
15
15
|
|
|
16
16
|
import { promises as fs } from 'fs';
|
|
@@ -32,7 +32,7 @@ export const getEnvironmentConfig = async (logger: Logger) => {
|
|
|
32
32
|
try {
|
|
33
33
|
const expectedBBPath = BB_BINARY_PATH
|
|
34
34
|
? BB_BINARY_PATH
|
|
35
|
-
: `${path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../barretenberg/', BB_RELEASE_DIR)}/bb`;
|
|
35
|
+
: `${path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../barretenberg/', BB_RELEASE_DIR)}/bb-avm`;
|
|
36
36
|
await fs.access(expectedBBPath, fs.constants.R_OK);
|
|
37
37
|
const tempWorkingDirectory = `${TEMP_DIR}/${randomBytes(4).toString('hex')}`;
|
|
38
38
|
const bbWorkingDirectory = BB_WORKING_DIRECTORY ? BB_WORKING_DIRECTORY : `${tempWorkingDirectory}/bb`;
|
|
@@ -84,34 +84,39 @@ export async function getSimulator(
|
|
|
84
84
|
return new WASMSimulatorWithBlobs();
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
87
|
+
export const makeGlobals = (
|
|
88
|
+
blockNumber: number,
|
|
89
|
+
slotNumber = blockNumber,
|
|
90
|
+
overrides: Partial<FieldsOf<GlobalVariables> & FieldsOf<CheckpointConstantData>> = {},
|
|
91
|
+
) => {
|
|
92
|
+
const checkpointConstants = makeCheckpointConstants(slotNumber, overrides);
|
|
93
|
+
return GlobalVariables.from({
|
|
94
|
+
chainId: checkpointConstants.chainId,
|
|
95
|
+
version: checkpointConstants.version,
|
|
96
|
+
blockNumber: BlockNumber(blockNumber) /** block number */,
|
|
97
|
+
slotNumber: SlotNumber(slotNumber) /** slot number */,
|
|
98
|
+
timestamp: BigInt(blockNumber * 123) /** block number * 123 as pseudo-timestamp for testing */,
|
|
99
|
+
coinbase: checkpointConstants.coinbase,
|
|
100
|
+
feeRecipient: checkpointConstants.feeRecipient,
|
|
101
|
+
gasFees: checkpointConstants.gasFees,
|
|
102
|
+
...overrides,
|
|
103
|
+
});
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
export const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
export const makeCheckpointConstants = (
|
|
107
|
+
slotNumber: number,
|
|
108
|
+
overrides: Partial<FieldsOf<CheckpointConstantData>> = {},
|
|
109
|
+
) => {
|
|
110
|
+
return CheckpointConstantData.from({
|
|
111
|
+
chainId: Fr.ZERO,
|
|
112
|
+
version: Fr.ZERO,
|
|
113
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
114
|
+
protocolContractsHash,
|
|
115
|
+
proverId: Fr.ZERO,
|
|
116
|
+
slotNumber: SlotNumber(slotNumber),
|
|
117
|
+
coinbase: EthAddress.ZERO,
|
|
118
|
+
feeRecipient: AztecAddress.ZERO,
|
|
119
|
+
gasFees: GasFees.empty(),
|
|
120
|
+
...overrides,
|
|
121
|
+
});
|
|
117
122
|
};
|