Skip to content

Commit 361b937

Browse files
committed
refactor: remove block builder in favor of checkpoint builder
1 parent 50bc3b1 commit 361b937

File tree

17 files changed

+149
-1142
lines changed

17 files changed

+149
-1142
lines changed

yarn-project/aztec-node/src/aztec-node/server.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
} from '@aztec/node-lib/factories';
3232
import { type P2P, type P2PClientDeps, createP2PClient, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
3333
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
34-
import { BlockBuilder, GlobalVariableBuilder, SequencerClient, type SequencerPublisher } from '@aztec/sequencer-client';
34+
import { GlobalVariableBuilder, SequencerClient, type SequencerPublisher } from '@aztec/sequencer-client';
3535
import { PublicProcessorFactory } from '@aztec/simulator/server';
3636
import {
3737
AttestationsBlockWatcher,
@@ -309,18 +309,10 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
309309
// We should really not be modifying the config object
310310
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? (await getDefaultAllowedSetupFunctions());
311311

312-
// Create BlockBuilder for EpochPruneWatcher (slasher functionality)
313-
const blockBuilder = new BlockBuilder(
314-
{ ...config, l1GenesisTime, slotDuration: Number(slotDuration) },
315-
worldStateSynchronizer,
316-
archiver,
317-
dateProvider,
318-
telemetry,
319-
);
320-
321312
// Create FullNodeCheckpointsBuilder for validator and non-validator block proposal handling
322313
const validatorCheckpointsBuilder = new FullNodeCheckpointsBuilder(
323314
{ ...config, l1GenesisTime, slotDuration: Number(slotDuration) },
315+
worldStateSynchronizer,
324316
archiver,
325317
dateProvider,
326318
telemetry,
@@ -387,7 +379,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
387379
archiver,
388380
epochCache,
389381
p2pClient.getTxProvider(),
390-
blockBuilder,
382+
validatorCheckpointsBuilder,
391383
config,
392384
);
393385
watchers.push(epochPruneWatcher);
@@ -452,6 +444,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
452444
// Create and start the sequencer client
453445
const checkpointsBuilder = new CheckpointsBuilder(
454446
{ ...config, l1GenesisTime, slotDuration: Number(slotDuration) },
447+
worldStateSynchronizer,
455448
archiver,
456449
dateProvider,
457450
telemetry,

yarn-project/end-to-end/src/e2e_p2p/reex.test.ts

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { times } from '@aztec/foundation/collection';
66
import { sleep } from '@aztec/foundation/sleep';
77
import { unfreeze } from '@aztec/foundation/types';
88
import type { LibP2PService, P2PClient } from '@aztec/p2p';
9-
import type { BlockBuilder } from '@aztec/sequencer-client';
109
import type { CppPublicTxSimulator, PublicTxResult } from '@aztec/simulator/server';
1110
import { BlockProposal } from '@aztec/stdlib/p2p';
1211
import { ReExFailedTxsError, ReExStateMismatchError, ReExTimeoutError } from '@aztec/stdlib/validators';
@@ -170,30 +169,28 @@ describe('e2e_p2p_reex', () => {
170169
node: AztecNodeService,
171170
stub: (tx: Tx, originalSimulate: (tx: Tx) => Promise<PublicTxResult>) => Promise<PublicTxResult>,
172171
) => {
173-
const blockBuilder: BlockBuilder = (node as any).sequencer.sequencer.blockBuilder;
172+
const blockBuilder: any = (node as any).sequencer.sequencer.blockBuilder;
174173
const originalCreateDeps = blockBuilder.makeBlockBuilderDeps.bind(blockBuilder);
175-
jest
176-
.spyOn(blockBuilder, 'makeBlockBuilderDeps')
177-
.mockImplementation(async (...args: Parameters<BlockBuilder['makeBlockBuilderDeps']>) => {
178-
const deps = await originalCreateDeps(...args);
179-
t.logger.warn('Creating mocked processor factory');
180-
const simulator: CppPublicTxSimulator = (deps.processor as any).publicTxSimulator;
181-
const originalSimulate = simulator.simulate.bind(simulator);
182-
// We only stub the simulate method if it's NOT the first time we see the tx
183-
// so the proposer works fine, but we cause the failure in the validators.
184-
jest.spyOn(simulator, 'simulate').mockImplementation((tx: Tx) => {
185-
const txHash = tx.getTxHash().toString();
186-
if (seenTxs.has(txHash)) {
187-
t.logger.warn('Calling stubbed simulate for tx', { txHash });
188-
return stub(tx, originalSimulate);
189-
} else {
190-
seenTxs.add(txHash);
191-
t.logger.warn('Calling original simulate for tx', { txHash });
192-
return originalSimulate(tx);
193-
}
194-
});
195-
return deps;
174+
jest.spyOn(blockBuilder, 'makeBlockBuilderDeps').mockImplementation(async (...args: any[]) => {
175+
const deps = await originalCreateDeps(...args);
176+
t.logger.warn('Creating mocked processor factory');
177+
const simulator: CppPublicTxSimulator = (deps.processor as any).publicTxSimulator;
178+
const originalSimulate = simulator.simulate.bind(simulator);
179+
// We only stub the simulate method if it's NOT the first time we see the tx
180+
// so the proposer works fine, but we cause the failure in the validators.
181+
jest.spyOn(simulator, 'simulate').mockImplementation((tx: Tx) => {
182+
const txHash = tx.getTxHash().toString();
183+
if (seenTxs.has(txHash)) {
184+
t.logger.warn('Calling stubbed simulate for tx', { txHash });
185+
return stub(tx, originalSimulate);
186+
} else {
187+
seenTxs.add(txHash);
188+
t.logger.warn('Calling original simulate for tx', { txHash });
189+
return originalSimulate(tx);
190+
}
196191
});
192+
return deps;
193+
});
197194
};
198195

199196
// Have the public tx processor take an extra long time to process the tx, so the validator times out

yarn-project/prover-client/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"type": "module",
55
"exports": {
66
".": "./dest/index.js",
7-
"./block-factory": "./dest/block-factory/index.js",
87
"./broker": "./dest/proving_broker/index.js",
98
"./broker/config": "./dest/proving_broker/config.js",
109
"./orchestrator": "./dest/orchestrator/index.js",

yarn-project/prover-client/src/block-factory/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)