@aztec/sequencer-client 0.80.0 → 0.82.0

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.
@@ -67,5 +67,6 @@ export declare class SequencerClient {
67
67
  get coinbase(): EthAddress;
68
68
  get feeRecipient(): AztecAddress;
69
69
  get forwarderAddress(): EthAddress;
70
+ get validatorAddress(): EthAddress | undefined;
70
71
  }
71
72
  //# sourceMappingURL=sequencer-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sequencer-client.d.ts","sourceRoot":"","sources":["../../src/client/sequencer-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,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mBAAmB,EAAE,mBAAmB,CAAC;QACzC,SAAS,EAAE,eAAe,CAAC;QAC3B,SAAS,CAAC,EAAE,kBAAkB,CAAC;QAC/B,cAAc,CAAC,EAAE,uBAAuB,CAAC;QACzC,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,SAAS,CAAC,EAAE,kBAAkB,CAAC;KAChC;IAiHH;;;OAGG;IACI,qBAAqB,CAAC,MAAM,EAAE,eAAe;IAIpD;;OAEG;IACU,IAAI;IAIjB,uGAAuG;IAChG,KAAK;IAIZ;;OAEG;IACI,OAAO;IAId,IAAI,QAAQ,IAAI,UAAU,CAEzB;IAED,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED,IAAI,gBAAgB,IAAI,UAAU,CAEjC;IAED,IAAI,gBAAgB,IAAI,UAAU,GAAG,SAAS,CAE7C;CACF"}
@@ -114,4 +114,7 @@ import { Sequencer } from '../sequencer/index.js';
114
114
  get forwarderAddress() {
115
115
  return this.sequencer.getForwarderAddress();
116
116
  }
117
+ get validatorAddress() {
118
+ return this.sequencer.getValidatorAddress();
119
+ }
117
120
  }
@@ -1 +1 @@
1
- {"version":3,"file":"global_builder.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/global_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,qBAAqB,IAAI,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD;;G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AgBpF;;;OAGG;IACU,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAanD;;;;;;;OAOG;IACU,oBAAoB,CAC/B,WAAW,EAAE,EAAE,EACf,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC;CA8B5B"}
@@ -1,10 +1,9 @@
1
- import { createEthereumChain } from '@aztec/ethereum';
1
+ import { RollupContract, createEthereumChain } from '@aztec/ethereum';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
- import { RollupAbi } from '@aztec/l1-artifacts';
5
4
  import { GasFees } from '@aztec/stdlib/gas';
6
5
  import { GlobalVariables } from '@aztec/stdlib/tx';
7
- import { createPublicClient, fallback, getAddress, getContract, http } from 'viem';
6
+ import { createPublicClient, fallback, http } from 'viem';
8
7
  /**
9
8
  * Simple global variables builder.
10
9
  */ export class GlobalVariableBuilder {
@@ -21,11 +20,7 @@ import { createPublicClient, fallback, getAddress, getContract, http } from 'vie
21
20
  transport: fallback(chain.rpcUrls.map((url)=>http(url))),
22
21
  pollingInterval: config.viemPollingIntervalMS
23
22
  });
24
- this.rollupContract = getContract({
25
- address: getAddress(l1Contracts.rollupAddress.toString()),
26
- abi: RollupAbi,
27
- client: this.publicClient
28
- });
23
+ this.rollupContract = new RollupContract(this.publicClient, l1Contracts.rollupAddress);
29
24
  }
30
25
  /**
31
26
  * Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
@@ -34,18 +29,11 @@ import { createPublicClient, fallback, getAddress, getContract, http } from 'vie
34
29
  // Since this might be called in the middle of a slot where a block might have been published,
35
30
  // we need to fetch the last block written, and estimate the earliest timestamp for the next block.
36
31
  // The timestamp of that last block will act as a lower bound for the next block.
37
- const lastBlock = await this.rollupContract.read.getBlock([
38
- await this.rollupContract.read.getPendingBlockNumber()
39
- ]);
40
- const earliestTimestamp = await this.rollupContract.read.getTimestampForSlot([
41
- lastBlock.slotNumber + 1n
42
- ]);
32
+ const lastBlock = await this.rollupContract.getBlock(await this.rollupContract.getBlockNumber());
33
+ const earliestTimestamp = await this.rollupContract.getTimestampForSlot(lastBlock.slotNumber + 1n);
43
34
  const nextEthTimestamp = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
44
35
  const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
45
- return new GasFees(Fr.ZERO, new Fr(await this.rollupContract.read.getManaBaseFeeAt([
46
- timestamp,
47
- true
48
- ])));
36
+ return new GasFees(Fr.ZERO, new Fr(await this.rollupContract.getManaBaseFeeAt(timestamp, true)));
49
37
  }
50
38
  /**
51
39
  * Simple builder of global variables that use the minimum time possible.
@@ -55,24 +43,17 @@ import { createPublicClient, fallback, getAddress, getContract, http } from 'vie
55
43
  * @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
56
44
  * @returns The global variables for the given block number.
57
45
  */ async buildGlobalVariables(blockNumber, coinbase, feeRecipient, slotNumber) {
58
- const version = new Fr(await this.rollupContract.read.getVersion());
46
+ const version = new Fr(await this.rollupContract.getVersion());
59
47
  const chainId = new Fr(this.publicClient.chain.id);
60
48
  if (slotNumber === undefined) {
61
49
  const ts = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
62
- slotNumber = await this.rollupContract.read.getSlotAt([
63
- ts
64
- ]);
50
+ slotNumber = await this.rollupContract.getSlotAt(ts);
65
51
  }
66
- const timestamp = await this.rollupContract.read.getTimestampForSlot([
67
- slotNumber
68
- ]);
52
+ const timestamp = await this.rollupContract.getTimestampForSlot(slotNumber);
69
53
  const slotFr = new Fr(slotNumber);
70
54
  const timestampFr = new Fr(timestamp);
71
55
  // We can skip much of the logic in getCurrentBaseFees since it we already check that we are not within a slot elsewhere.
72
- const gasFees = new GasFees(Fr.ZERO, new Fr(await this.rollupContract.read.getManaBaseFeeAt([
73
- timestamp,
74
- true
75
- ])));
56
+ const gasFees = new GasFees(Fr.ZERO, new Fr(await this.rollupContract.getManaBaseFeeAt(timestamp, true)));
76
57
  const globalVariables = new GlobalVariables(chainId, version, blockNumber, slotFr, timestampFr, coinbase, feeRecipient, gasFees);
77
58
  return globalVariables;
78
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,sBAAsB,EAA0B,MAAM,YAAY,CAAC;AAEtG,qBAAa,gBAAgB;IAC3B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,kBAAkB,CAAY;IACtC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,6BAA6B,CAAY;IACjD,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,sBAAsB,CAAY;IAE1C,OAAO,CAAC,yBAAyB,CAAQ;gBAE7B,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,sBAAsB,EAAE,IAAI,SAAc;IAyDzF,gCAAgC,IAAI,MAAM,IAAI;IAS9C,+BAA+B,CAAC,IAAI,EAAE,MAAM;IAI5C,gCAAgC,CAAC,MAAM,EAAE,MAAM;IAI/C,oBAAoB;IAOpB,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAQ3D,iBAAiB;IAOjB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAInD,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc;IAMvE,OAAO,CAAC,eAAe;CAIxB"}
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,sBAAsB,EAA0B,MAAM,YAAY,CAAC;AAEtG,qBAAa,gBAAgB;IAC3B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,kBAAkB,CAAY;IACtC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,6BAA6B,CAAY;IACjD,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,sBAAsB,CAAY;IAE1C,OAAO,CAAC,yBAAyB,CAAQ;gBAE7B,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,sBAAsB,EAAE,IAAI,SAAc;IAmEzF,gCAAgC,IAAI,MAAM,IAAI;IAS9C,+BAA+B,CAAC,IAAI,EAAE,MAAM;IAI5C,gCAAgC,CAAC,MAAM,EAAE,MAAM;IAI/C,oBAAoB;IAOpB,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAQ3D,iBAAiB;IAOjB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAInD,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc;IAMvE,OAAO,CAAC,eAAe;CAIxB"}
@@ -52,7 +52,17 @@ export class SequencerMetrics {
52
52
  unit: 'us',
53
53
  valueType: ValueType.INT
54
54
  });
55
+ // Init gauges and counters
55
56
  this.setCurrentBlock(0, 0);
57
+ this.blockCounter.add(0, {
58
+ [Attributes.STATUS]: 'cancelled'
59
+ });
60
+ this.blockCounter.add(0, {
61
+ [Attributes.STATUS]: 'failed'
62
+ });
63
+ this.blockCounter.add(0, {
64
+ [Attributes.STATUS]: 'built'
65
+ });
56
66
  }
57
67
  startCollectingAttestationsTimer() {
58
68
  const startTime = Date.now();
@@ -63,6 +63,7 @@ export declare class Sequencer {
63
63
  private maxBlockSizeInBytes;
64
64
  private maxBlockGas;
65
65
  private metrics;
66
+ private l1Metrics;
66
67
  private isFlushing;
67
68
  /** The maximum number of seconds that the sequencer can be into a slot to transition to a particular state. */
68
69
  protected timetable: SequencerTimetable;
@@ -70,6 +71,7 @@ export declare class Sequencer {
70
71
  constructor(publisher: SequencerPublisher, validatorClient: ValidatorClient | undefined, // During migration the validator client can be inactive
71
72
  globalsBuilder: GlobalVariableBuilder, p2pClient: P2P, worldState: WorldStateSynchronizer, slasherClient: SlasherClient, blockBuilderFactory: BlockBuilderFactory, l2BlockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, publicProcessorFactory: PublicProcessorFactory, contractDataSource: ContractDataSource, l1Constants: SequencerRollupConstants, dateProvider: DateProvider, config?: SequencerConfig, telemetry?: TelemetryClient, log?: import("@aztec/aztec.js").Logger);
72
73
  get tracer(): Tracer;
74
+ getValidatorAddress(): EthAddress | undefined;
73
75
  /**
74
76
  * Updates sequencer config.
75
77
  * @param config - New parameters.
@@ -1 +1 @@
1
- {"version":3,"file":"sequencer.d.ts","sourceRoot":"","sources":["../../src/sequencer/sequencer.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,EAAW,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CA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O,CAAC,qBAAqB;IAI7B,OAAO,CAAC,kBAAkB;IAK1B,IAAI,iBAAiB,WAEpB;IAED,IAAI,QAAQ,IAAI,UAAU,CAEzB;IAED,IAAI,YAAY,IAAI,YAAY,CAE/B;CACF"}
@@ -17,7 +17,7 @@ import { SequencerConfigSchema } from '@aztec/stdlib/interfaces/server';
17
17
  import { pickFromSchema } from '@aztec/stdlib/schemas';
18
18
  import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
19
19
  import { BlockHeader, ContentCommitment, StateReference, Tx } from '@aztec/stdlib/tx';
20
- import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
20
+ import { Attributes, L1Metrics, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
21
21
  import { VoteType } from '../publisher/sequencer-publisher.js';
22
22
  import { createValidatorsForBlockBuilding } from '../tx_validator/tx_validator_factory.js';
23
23
  import { getDefaultAllowedSetupFunctions } from './allowed.js';
@@ -62,6 +62,7 @@ export { SequencerState };
62
62
  maxBlockSizeInBytes;
63
63
  maxBlockGas;
64
64
  metrics;
65
+ l1Metrics;
65
66
  isFlushing;
66
67
  /** The maximum number of seconds that the sequencer can be into a slot to transition to a particular state. */ timetable;
67
68
  enforceTimeTable;
@@ -94,6 +95,9 @@ export { SequencerState };
94
95
  this.isFlushing = false;
95
96
  this.enforceTimeTable = false;
96
97
  this.metrics = new SequencerMetrics(telemetry, ()=>this.state, 'Sequencer');
98
+ this.l1Metrics = new L1Metrics(telemetry.getMeter('SequencerL1Metrics'), publisher.l1TxUtils.publicClient, [
99
+ publisher.getSenderAddress()
100
+ ]);
97
101
  // Register the block builder with the validator client for re-execution
98
102
  this.validatorClient?.registerBlockBuilder(this.buildBlock.bind(this));
99
103
  // Register the slasher on the publisher to fetch slashing payloads
@@ -102,6 +106,9 @@ export { SequencerState };
102
106
  get tracer() {
103
107
  return this.metrics.tracer;
104
108
  }
109
+ getValidatorAddress() {
110
+ return this.validatorClient?.getValidatorAddress();
111
+ }
105
112
  /**
106
113
  * Updates sequencer config.
107
114
  * @param config - New parameters.
@@ -162,6 +169,7 @@ export { SequencerState };
162
169
  this.runningPromise = new RunningPromise(this.work.bind(this), this.log, this.pollingIntervalMs);
163
170
  this.setState(SequencerState.IDLE, 0n, true);
164
171
  this.runningPromise.start();
172
+ this.l1Metrics.start();
165
173
  this.log.info(`Sequencer started with address ${this.publisher.getSenderAddress().toString()}`);
166
174
  }
167
175
  /**
@@ -173,6 +181,7 @@ export { SequencerState };
173
181
  this.slasherClient.stop();
174
182
  this.publisher.interrupt();
175
183
  this.setState(SequencerState.STOPPED, 0n, true);
184
+ this.l1Metrics.stop();
176
185
  this.log.info('Stopped sequencer');
177
186
  }
178
187
  /**
@@ -342,13 +351,13 @@ export { SequencerState };
342
351
  await this.worldState.syncImmediate(blockNumber - 1);
343
352
  this.log.debug(`Synced to previous block ${blockNumber - 1}`);
344
353
  // NB: separating the dbs because both should update the state
345
- const publicProcessorFork = await this.worldState.fork();
346
- const orchestratorFork = await this.worldState.fork();
347
- const previousBlockHeader = (await this.l2BlockSource.getBlock(blockNumber - 1))?.header ?? orchestratorFork.getInitialHeader();
354
+ const publicProcessorDBFork = await this.worldState.fork();
355
+ const orchestratorDBFork = await this.worldState.fork();
356
+ const previousBlockHeader = (await this.l2BlockSource.getBlock(blockNumber - 1))?.header ?? orchestratorDBFork.getInitialHeader();
348
357
  try {
349
- const processor = this.publicProcessorFactory.create(publicProcessorFork, newGlobalVariables, true);
358
+ const processor = this.publicProcessorFactory.create(publicProcessorDBFork, newGlobalVariables, true);
350
359
  const blockBuildingTimer = new Timer();
351
- const blockBuilder = this.blockBuilderFactory.create(orchestratorFork);
360
+ const blockBuilder = this.blockBuilderFactory.create(orchestratorDBFork);
352
361
  await blockBuilder.startNewBlock(newGlobalVariables, l1ToL2Messages, previousBlockHeader);
353
362
  // Deadline for processing depends on whether we're proposing a block
354
363
  const secondsIntoSlot = this.getSecondsIntoSlot(slot);
@@ -361,7 +370,7 @@ export { SequencerState };
361
370
  now: new Date(this.dateProvider.now()),
362
371
  deadline
363
372
  });
364
- const validators = createValidatorsForBlockBuilding(publicProcessorFork, this.contractDataSource, newGlobalVariables, this.allowedInSetup);
373
+ const validators = createValidatorsForBlockBuilding(publicProcessorDBFork, this.contractDataSource, newGlobalVariables, this.allowedInSetup);
365
374
  // TODO(#11000): Public processor should just handle processing, one tx at a time. It should be responsibility
366
375
  // of the sequencer to update world state and iterate over txs. We should refactor this along with unifying the
367
376
  // publicProcessorFork and orchestratorFork, to avoid doing tree insertions twice when building the block.
@@ -418,8 +427,8 @@ export { SequencerState };
418
427
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
419
428
  setTimeout(async ()=>{
420
429
  try {
421
- await publicProcessorFork.close();
422
- await orchestratorFork.close();
430
+ await publicProcessorDBFork.close();
431
+ await orchestratorDBFork.close();
423
432
  } catch (err) {
424
433
  // This can happen if the sequencer is stopped before we hit this timeout.
425
434
  this.log.warn(`Error closing forks for block processing`, err);
@@ -4,8 +4,9 @@ import { type PublicExecutionRequest, Tx, type TxValidationResult, type TxValida
4
4
  export declare class PhasesTxValidator implements TxValidator<Tx> {
5
5
  #private;
6
6
  private setupAllowList;
7
- private contractDataSource;
8
- constructor(contracts: ContractDataSource, setupAllowList: AllowedElement[]);
7
+ private blockNumber;
8
+ private contractsDB;
9
+ constructor(contracts: ContractDataSource, setupAllowList: AllowedElement[], blockNumber: number);
9
10
  validateTx(tx: Tx): Promise<TxValidationResult>;
10
11
  isOnAllowList(publicCall: PublicExecutionRequest, allowList: AllowedElement[]): Promise<boolean>;
11
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"phases_validator.d.ts","sourceRoot":"","sources":["../../src/tx_validator/phases_validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACL,KAAK,sBAAsB,EAC3B,EAAE,EAEF,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,iBAAkB,YAAW,WAAW,CAAC,EAAE,CAAC;;IAIZ,OAAO,CAAC,cAAc;IAFjE,OAAO,CAAC,kBAAkB,CAA8B;gBAE5C,SAAS,EAAE,kBAAkB,EAAU,cAAc,EAAE,cAAc,EAAE;IAI7E,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgC/C,aAAa,CAAC,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CA6CvG"}
1
+ {"version":3,"file":"phases_validator.d.ts","sourceRoot":"","sources":["../../src/tx_validator/phases_validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EACL,KAAK,sBAAsB,EAC3B,EAAE,EAEF,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,iBAAkB,YAAW,WAAW,CAAC,EAAE,CAAC;;IAIZ,OAAO,CAAC,cAAc;IAAoB,OAAO,CAAC,WAAW;IAFxG,OAAO,CAAC,WAAW,CAAoB;gBAE3B,SAAS,EAAE,kBAAkB,EAAU,cAAc,EAAE,cAAc,EAAE,EAAU,WAAW,EAAE,MAAM;IAI1G,UAAU,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkC/C,aAAa,CAAC,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CA6CvG"}
@@ -1,23 +1,25 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
- import { ContractsDataSourcePublicDB, getExecutionRequestsByPhase } from '@aztec/simulator/server';
2
+ import { PublicContractsDB, getExecutionRequestsByPhase } from '@aztec/simulator/server';
3
3
  import { Tx, TxExecutionPhase } from '@aztec/stdlib/tx';
4
4
  export class PhasesTxValidator {
5
5
  setupAllowList;
6
+ blockNumber;
6
7
  #log;
7
- contractDataSource;
8
- constructor(contracts, setupAllowList){
8
+ contractsDB;
9
+ constructor(contracts, setupAllowList, blockNumber){
9
10
  this.setupAllowList = setupAllowList;
11
+ this.blockNumber = blockNumber;
10
12
  this.#log = createLogger('sequencer:tx_validator:tx_phases');
11
- this.contractDataSource = new ContractsDataSourcePublicDB(contracts);
13
+ this.contractsDB = new PublicContractsDB(contracts);
12
14
  }
13
15
  async validateTx(tx) {
14
16
  try {
15
17
  // TODO(@spalladino): We add this just to handle public authwit-check calls during setup
16
18
  // which are needed for public FPC flows, but fail if the account contract hasnt been deployed yet,
17
19
  // which is what we're trying to do as part of the current txs.
18
- await this.contractDataSource.addNewContracts(tx);
20
+ await this.contractsDB.addNewContracts(tx);
19
21
  if (!tx.data.forPublic) {
20
- this.#log.debug(`Tx ${Tx.getHash(tx)} does not contain enqueued public functions. Skipping phases validation.`);
22
+ this.#log.debug(`Tx ${await Tx.getHash(tx)} does not contain enqueued public functions. Skipping phases validation.`);
21
23
  return {
22
24
  result: 'valid'
23
25
  };
@@ -25,7 +27,7 @@ export class PhasesTxValidator {
25
27
  const setupFns = getExecutionRequestsByPhase(tx, TxExecutionPhase.SETUP);
26
28
  for (const setupFn of setupFns){
27
29
  if (!await this.isOnAllowList(setupFn, this.setupAllowList)) {
28
- this.#log.warn(`Rejecting tx ${Tx.getHash(tx)} because it calls setup function not on allow list: ${setupFn.callContext.contractAddress}:${setupFn.callContext.functionSelector}`, {
30
+ this.#log.warn(`Rejecting tx ${await Tx.getHash(tx)} because it calls setup function not on allow list: ${setupFn.callContext.contractAddress}:${setupFn.callContext.functionSelector}`, {
29
31
  allowList: this.setupAllowList
30
32
  });
31
33
  return {
@@ -40,7 +42,7 @@ export class PhasesTxValidator {
40
42
  result: 'valid'
41
43
  };
42
44
  } finally{
43
- this.contractDataSource.clearContractsForTx();
45
+ this.contractsDB.clearContractsForTx();
44
46
  }
45
47
  }
46
48
  async isOnAllowList(publicCall, allowList) {
@@ -60,7 +62,7 @@ export class PhasesTxValidator {
60
62
  return true;
61
63
  }
62
64
  }
63
- const contractClass = await this.contractDataSource.getContractInstance(contractAddress);
65
+ const contractClass = await this.contractsDB.getContractInstance(contractAddress, this.blockNumber);
64
66
  if (!contractClass) {
65
67
  throw new Error(`Contract not found: ${contractAddress}`);
66
68
  }
@@ -11,7 +11,7 @@ export function createValidatorForAcceptingTxs(db, contractDataSource, verifier,
11
11
  new DataTxValidator(),
12
12
  new MetadataTxValidator(new Fr(l1ChainId), new Fr(blockNumber)),
13
13
  new DoubleSpendTxValidator(new NullifierCache(db)),
14
- new PhasesTxValidator(contractDataSource, setupAllowList),
14
+ new PhasesTxValidator(contractDataSource, setupAllowList, blockNumber),
15
15
  new BlockHeaderTxValidator(new ArchiveCache(db))
16
16
  ];
17
17
  if (!skipFeeEnforcement) {
@@ -43,7 +43,7 @@ class DatabasePublicStateSource {
43
43
  }
44
44
  function preprocessValidator(nullifierCache, archiveCache, publicStateSource, contractDataSource, globalVariables, setupAllowList) {
45
45
  // We don't include the TxProofValidator nor the DataTxValidator here because they are already checked by the time we get to block building.
46
- return new AggregateTxValidator(new MetadataTxValidator(globalVariables.chainId, globalVariables.blockNumber), new DoubleSpendTxValidator(nullifierCache), new PhasesTxValidator(contractDataSource, setupAllowList), new GasTxValidator(publicStateSource, ProtocolContractAddress.FeeJuice, globalVariables.gasFees), new BlockHeaderTxValidator(archiveCache));
46
+ return new AggregateTxValidator(new MetadataTxValidator(globalVariables.chainId, globalVariables.blockNumber), new DoubleSpendTxValidator(nullifierCache), new PhasesTxValidator(contractDataSource, setupAllowList, globalVariables.blockNumber.toNumber()), new GasTxValidator(publicStateSource, ProtocolContractAddress.FeeJuice, globalVariables.gasFees), new BlockHeaderTxValidator(archiveCache));
47
47
  }
48
48
  function postprocessValidator(nullifierCache) {
49
49
  return new DoubleSpendTxValidator(nullifierCache);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/sequencer-client",
3
- "version": "0.80.0",
3
+ "version": "0.82.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -28,36 +28,36 @@
28
28
  "test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
29
29
  },
30
30
  "dependencies": {
31
- "@aztec/aztec.js": "0.80.0",
32
- "@aztec/bb-prover": "0.80.0",
33
- "@aztec/blob-lib": "0.80.0",
34
- "@aztec/blob-sink": "0.80.0",
35
- "@aztec/constants": "0.80.0",
36
- "@aztec/epoch-cache": "0.80.0",
37
- "@aztec/ethereum": "0.80.0",
38
- "@aztec/foundation": "0.80.0",
39
- "@aztec/l1-artifacts": "0.80.0",
40
- "@aztec/merkle-tree": "0.80.0",
41
- "@aztec/noir-acvm_js": "0.80.0",
42
- "@aztec/noir-contracts.js": "0.80.0",
43
- "@aztec/noir-protocol-circuits-types": "0.80.0",
44
- "@aztec/noir-types": "0.80.0",
45
- "@aztec/p2p": "0.80.0",
46
- "@aztec/protocol-contracts": "0.80.0",
47
- "@aztec/prover-client": "0.80.0",
48
- "@aztec/simulator": "0.80.0",
49
- "@aztec/stdlib": "0.80.0",
50
- "@aztec/telemetry-client": "0.80.0",
51
- "@aztec/validator-client": "0.80.0",
52
- "@aztec/world-state": "0.80.0",
31
+ "@aztec/aztec.js": "0.82.0",
32
+ "@aztec/bb-prover": "0.82.0",
33
+ "@aztec/blob-lib": "0.82.0",
34
+ "@aztec/blob-sink": "0.82.0",
35
+ "@aztec/constants": "0.82.0",
36
+ "@aztec/epoch-cache": "0.82.0",
37
+ "@aztec/ethereum": "0.82.0",
38
+ "@aztec/foundation": "0.82.0",
39
+ "@aztec/l1-artifacts": "0.82.0",
40
+ "@aztec/merkle-tree": "0.82.0",
41
+ "@aztec/noir-acvm_js": "0.82.0",
42
+ "@aztec/noir-contracts.js": "0.82.0",
43
+ "@aztec/noir-protocol-circuits-types": "0.82.0",
44
+ "@aztec/noir-types": "0.82.0",
45
+ "@aztec/p2p": "0.82.0",
46
+ "@aztec/protocol-contracts": "0.82.0",
47
+ "@aztec/prover-client": "0.82.0",
48
+ "@aztec/simulator": "0.82.0",
49
+ "@aztec/stdlib": "0.82.0",
50
+ "@aztec/telemetry-client": "0.82.0",
51
+ "@aztec/validator-client": "0.82.0",
52
+ "@aztec/world-state": "0.82.0",
53
53
  "lodash.chunk": "^4.2.0",
54
54
  "lodash.pick": "^4.4.0",
55
55
  "tslib": "^2.4.0",
56
56
  "viem": "2.23.7"
57
57
  },
58
58
  "devDependencies": {
59
- "@aztec/archiver": "0.80.0",
60
- "@aztec/kv-store": "0.80.0",
59
+ "@aztec/archiver": "0.82.0",
60
+ "@aztec/kv-store": "0.82.0",
61
61
  "@jest/globals": "^29.5.0",
62
62
  "@types/jest": "^29.5.0",
63
63
  "@types/levelup": "^5.1.2",
@@ -216,4 +216,8 @@ export class SequencerClient {
216
216
  get forwarderAddress(): EthAddress {
217
217
  return this.sequencer.getForwarderAddress();
218
218
  }
219
+
220
+ get validatorAddress(): EthAddress | undefined {
221
+ return this.sequencer.getValidatorAddress();
222
+ }
219
223
  }
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  type L1ContractsConfig,
3
3
  type L1ReaderConfig,
4
+ RollupContract,
4
5
  type ViemPublicClient,
5
6
  createEthereumChain,
6
7
  } from '@aztec/ethereum';
7
8
  import type { EthAddress } from '@aztec/foundation/eth-address';
8
9
  import { Fr } from '@aztec/foundation/fields';
9
10
  import { createLogger } from '@aztec/foundation/log';
10
- import { RollupAbi } from '@aztec/l1-artifacts';
11
11
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
12
12
  import { GasFees } from '@aztec/stdlib/gas';
13
13
  import type { GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@aztec/stdlib/tx';
14
14
  import { GlobalVariables } from '@aztec/stdlib/tx';
15
15
 
16
- import { type GetContractReturnType, createPublicClient, fallback, getAddress, getContract, http } from 'viem';
16
+ import { createPublicClient, fallback, http } from 'viem';
17
17
 
18
18
  /**
19
19
  * Simple global variables builder.
@@ -21,7 +21,7 @@ import { type GetContractReturnType, createPublicClient, fallback, getAddress, g
21
21
  export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
22
22
  private log = createLogger('sequencer:global_variable_builder');
23
23
 
24
- private rollupContract: GetContractReturnType<typeof RollupAbi, ViemPublicClient>;
24
+ private rollupContract: RollupContract;
25
25
  private publicClient: ViemPublicClient;
26
26
  private ethereumSlotDuration: number;
27
27
 
@@ -38,11 +38,7 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
38
38
  pollingInterval: config.viemPollingIntervalMS,
39
39
  });
40
40
 
41
- this.rollupContract = getContract({
42
- address: getAddress(l1Contracts.rollupAddress.toString()),
43
- abi: RollupAbi,
44
- client: this.publicClient,
45
- });
41
+ this.rollupContract = new RollupContract(this.publicClient, l1Contracts.rollupAddress);
46
42
  }
47
43
 
48
44
  /**
@@ -54,12 +50,12 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
54
50
  // we need to fetch the last block written, and estimate the earliest timestamp for the next block.
55
51
  // The timestamp of that last block will act as a lower bound for the next block.
56
52
 
57
- const lastBlock = await this.rollupContract.read.getBlock([await this.rollupContract.read.getPendingBlockNumber()]);
58
- const earliestTimestamp = await this.rollupContract.read.getTimestampForSlot([lastBlock.slotNumber + 1n]);
53
+ const lastBlock = await this.rollupContract.getBlock(await this.rollupContract.getBlockNumber());
54
+ const earliestTimestamp = await this.rollupContract.getTimestampForSlot(lastBlock.slotNumber + 1n);
59
55
  const nextEthTimestamp = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
60
56
  const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
61
57
 
62
- return new GasFees(Fr.ZERO, new Fr(await this.rollupContract.read.getManaBaseFeeAt([timestamp, true])));
58
+ return new GasFees(Fr.ZERO, new Fr(await this.rollupContract.getManaBaseFeeAt(timestamp, true)));
63
59
  }
64
60
 
65
61
  /**
@@ -76,21 +72,21 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
76
72
  feeRecipient: AztecAddress,
77
73
  slotNumber?: bigint,
78
74
  ): Promise<GlobalVariables> {
79
- const version = new Fr(await this.rollupContract.read.getVersion());
75
+ const version = new Fr(await this.rollupContract.getVersion());
80
76
  const chainId = new Fr(this.publicClient.chain.id);
81
77
 
82
78
  if (slotNumber === undefined) {
83
79
  const ts = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
84
- slotNumber = await this.rollupContract.read.getSlotAt([ts]);
80
+ slotNumber = await this.rollupContract.getSlotAt(ts);
85
81
  }
86
82
 
87
- const timestamp = await this.rollupContract.read.getTimestampForSlot([slotNumber]);
83
+ const timestamp = await this.rollupContract.getTimestampForSlot(slotNumber);
88
84
 
89
85
  const slotFr = new Fr(slotNumber);
90
86
  const timestampFr = new Fr(timestamp);
91
87
 
92
88
  // We can skip much of the logic in getCurrentBaseFees since it we already check that we are not within a slot elsewhere.
93
- const gasFees = new GasFees(Fr.ZERO, new Fr(await this.rollupContract.read.getManaBaseFeeAt([timestamp, true])));
89
+ const gasFees = new GasFees(Fr.ZERO, new Fr(await this.rollupContract.getManaBaseFeeAt(timestamp, true)));
94
90
 
95
91
  const globalVariables = new GlobalVariables(
96
92
  chainId,
@@ -78,7 +78,17 @@ export class SequencerMetrics {
78
78
  valueType: ValueType.INT,
79
79
  });
80
80
 
81
+ // Init gauges and counters
81
82
  this.setCurrentBlock(0, 0);
83
+ this.blockCounter.add(0, {
84
+ [Attributes.STATUS]: 'cancelled',
85
+ });
86
+ this.blockCounter.add(0, {
87
+ [Attributes.STATUS]: 'failed',
88
+ });
89
+ this.blockCounter.add(0, {
90
+ [Attributes.STATUS]: 'built',
91
+ });
82
92
  }
83
93
 
84
94
  startCollectingAttestationsTimer(): () => void {
@@ -33,7 +33,14 @@ import {
33
33
  Tx,
34
34
  type TxHash,
35
35
  } from '@aztec/stdlib/tx';
36
- import { Attributes, type TelemetryClient, type Tracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
36
+ import {
37
+ Attributes,
38
+ L1Metrics,
39
+ type TelemetryClient,
40
+ type Tracer,
41
+ getTelemetryClient,
42
+ trackSpan,
43
+ } from '@aztec/telemetry-client';
37
44
  import type { ValidatorClient } from '@aztec/validator-client';
38
45
 
39
46
  import type { GlobalVariableBuilder } from '../global_variable_builder/global_builder.js';
@@ -73,6 +80,7 @@ export class Sequencer {
73
80
  private maxBlockSizeInBytes: number = 1024 * 1024;
74
81
  private maxBlockGas: Gas = new Gas(100e9, 100e9);
75
82
  private metrics: SequencerMetrics;
83
+ private l1Metrics: L1Metrics;
76
84
  private isFlushing: boolean = false;
77
85
 
78
86
  /** The maximum number of seconds that the sequencer can be into a slot to transition to a particular state. */
@@ -99,6 +107,9 @@ export class Sequencer {
99
107
  protected log = createLogger('sequencer'),
100
108
  ) {
101
109
  this.metrics = new SequencerMetrics(telemetry, () => this.state, 'Sequencer');
110
+ this.l1Metrics = new L1Metrics(telemetry.getMeter('SequencerL1Metrics'), publisher.l1TxUtils.publicClient, [
111
+ publisher.getSenderAddress(),
112
+ ]);
102
113
 
103
114
  // Register the block builder with the validator client for re-execution
104
115
  this.validatorClient?.registerBlockBuilder(this.buildBlock.bind(this));
@@ -111,6 +122,10 @@ export class Sequencer {
111
122
  return this.metrics.tracer;
112
123
  }
113
124
 
125
+ public getValidatorAddress() {
126
+ return this.validatorClient?.getValidatorAddress();
127
+ }
128
+
114
129
  /**
115
130
  * Updates sequencer config.
116
131
  * @param config - New parameters.
@@ -183,6 +198,7 @@ export class Sequencer {
183
198
  this.runningPromise = new RunningPromise(this.work.bind(this), this.log, this.pollingIntervalMs);
184
199
  this.setState(SequencerState.IDLE, 0n, true /** force */);
185
200
  this.runningPromise.start();
201
+ this.l1Metrics.start();
186
202
  this.log.info(`Sequencer started with address ${this.publisher.getSenderAddress().toString()}`);
187
203
  }
188
204
 
@@ -196,6 +212,7 @@ export class Sequencer {
196
212
  this.slasherClient.stop();
197
213
  this.publisher.interrupt();
198
214
  this.setState(SequencerState.STOPPED, 0n, true /** force */);
215
+ this.l1Metrics.stop();
199
216
  this.log.info('Stopped sequencer');
200
217
  }
201
218
 
@@ -418,16 +435,16 @@ export class Sequencer {
418
435
  this.log.debug(`Synced to previous block ${blockNumber - 1}`);
419
436
 
420
437
  // NB: separating the dbs because both should update the state
421
- const publicProcessorFork = await this.worldState.fork();
422
- const orchestratorFork = await this.worldState.fork();
438
+ const publicProcessorDBFork = await this.worldState.fork();
439
+ const orchestratorDBFork = await this.worldState.fork();
423
440
 
424
441
  const previousBlockHeader =
425
- (await this.l2BlockSource.getBlock(blockNumber - 1))?.header ?? orchestratorFork.getInitialHeader();
442
+ (await this.l2BlockSource.getBlock(blockNumber - 1))?.header ?? orchestratorDBFork.getInitialHeader();
426
443
 
427
444
  try {
428
- const processor = this.publicProcessorFactory.create(publicProcessorFork, newGlobalVariables, true);
445
+ const processor = this.publicProcessorFactory.create(publicProcessorDBFork, newGlobalVariables, true);
429
446
  const blockBuildingTimer = new Timer();
430
- const blockBuilder = this.blockBuilderFactory.create(orchestratorFork);
447
+ const blockBuilder = this.blockBuilderFactory.create(orchestratorDBFork);
431
448
  await blockBuilder.startNewBlock(newGlobalVariables, l1ToL2Messages, previousBlockHeader);
432
449
 
433
450
  // Deadline for processing depends on whether we're proposing a block
@@ -449,7 +466,7 @@ export class Sequencer {
449
466
  });
450
467
 
451
468
  const validators = createValidatorsForBlockBuilding(
452
- publicProcessorFork,
469
+ publicProcessorDBFork,
453
470
  this.contractDataSource,
454
471
  newGlobalVariables,
455
472
  this.allowedInSetup,
@@ -516,8 +533,8 @@ export class Sequencer {
516
533
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
517
534
  setTimeout(async () => {
518
535
  try {
519
- await publicProcessorFork.close();
520
- await orchestratorFork.close();
536
+ await publicProcessorDBFork.close();
537
+ await orchestratorDBFork.close();
521
538
  } catch (err) {
522
539
  // This can happen if the sequencer is stopped before we hit this timeout.
523
540
  this.log.warn(`Error closing forks for block processing`, err);
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
- import { ContractsDataSourcePublicDB, getExecutionRequestsByPhase } from '@aztec/simulator/server';
2
+ import { PublicContractsDB, getExecutionRequestsByPhase } from '@aztec/simulator/server';
3
3
  import type { ContractDataSource } from '@aztec/stdlib/contract';
4
4
  import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
5
5
  import {
@@ -12,10 +12,10 @@ import {
12
12
 
13
13
  export class PhasesTxValidator implements TxValidator<Tx> {
14
14
  #log = createLogger('sequencer:tx_validator:tx_phases');
15
- private contractDataSource: ContractsDataSourcePublicDB;
15
+ private contractsDB: PublicContractsDB;
16
16
 
17
- constructor(contracts: ContractDataSource, private setupAllowList: AllowedElement[]) {
18
- this.contractDataSource = new ContractsDataSourcePublicDB(contracts);
17
+ constructor(contracts: ContractDataSource, private setupAllowList: AllowedElement[], private blockNumber: number) {
18
+ this.contractsDB = new PublicContractsDB(contracts);
19
19
  }
20
20
 
21
21
  async validateTx(tx: Tx): Promise<TxValidationResult> {
@@ -23,10 +23,12 @@ export class PhasesTxValidator implements TxValidator<Tx> {
23
23
  // TODO(@spalladino): We add this just to handle public authwit-check calls during setup
24
24
  // which are needed for public FPC flows, but fail if the account contract hasnt been deployed yet,
25
25
  // which is what we're trying to do as part of the current txs.
26
- await this.contractDataSource.addNewContracts(tx);
26
+ await this.contractsDB.addNewContracts(tx);
27
27
 
28
28
  if (!tx.data.forPublic) {
29
- this.#log.debug(`Tx ${Tx.getHash(tx)} does not contain enqueued public functions. Skipping phases validation.`);
29
+ this.#log.debug(
30
+ `Tx ${await Tx.getHash(tx)} does not contain enqueued public functions. Skipping phases validation.`,
31
+ );
30
32
  return { result: 'valid' };
31
33
  }
32
34
 
@@ -34,7 +36,7 @@ export class PhasesTxValidator implements TxValidator<Tx> {
34
36
  for (const setupFn of setupFns) {
35
37
  if (!(await this.isOnAllowList(setupFn, this.setupAllowList))) {
36
38
  this.#log.warn(
37
- `Rejecting tx ${Tx.getHash(tx)} because it calls setup function not on allow list: ${
39
+ `Rejecting tx ${await Tx.getHash(tx)} because it calls setup function not on allow list: ${
38
40
  setupFn.callContext.contractAddress
39
41
  }:${setupFn.callContext.functionSelector}`,
40
42
  { allowList: this.setupAllowList },
@@ -46,7 +48,7 @@ export class PhasesTxValidator implements TxValidator<Tx> {
46
48
 
47
49
  return { result: 'valid' };
48
50
  } finally {
49
- this.contractDataSource.clearContractsForTx();
51
+ this.contractsDB.clearContractsForTx();
50
52
  }
51
53
  }
52
54
 
@@ -71,7 +73,7 @@ export class PhasesTxValidator implements TxValidator<Tx> {
71
73
  }
72
74
  }
73
75
 
74
- const contractClass = await this.contractDataSource.getContractInstance(contractAddress);
76
+ const contractClass = await this.contractsDB.getContractInstance(contractAddress, this.blockNumber);
75
77
 
76
78
  if (!contractClass) {
77
79
  throw new Error(`Contract not found: ${contractAddress}`);
@@ -46,7 +46,7 @@ export function createValidatorForAcceptingTxs(
46
46
  new DataTxValidator(),
47
47
  new MetadataTxValidator(new Fr(l1ChainId), new Fr(blockNumber)),
48
48
  new DoubleSpendTxValidator(new NullifierCache(db)),
49
- new PhasesTxValidator(contractDataSource, setupAllowList),
49
+ new PhasesTxValidator(contractDataSource, setupAllowList, blockNumber),
50
50
  new BlockHeaderTxValidator(new ArchiveCache(db)),
51
51
  ];
52
52
 
@@ -109,7 +109,7 @@ function preprocessValidator(
109
109
  return new AggregateTxValidator(
110
110
  new MetadataTxValidator(globalVariables.chainId, globalVariables.blockNumber),
111
111
  new DoubleSpendTxValidator(nullifierCache),
112
- new PhasesTxValidator(contractDataSource, setupAllowList),
112
+ new PhasesTxValidator(contractDataSource, setupAllowList, globalVariables.blockNumber.toNumber()),
113
113
  new GasTxValidator(publicStateSource, ProtocolContractAddress.FeeJuice, globalVariables.gasFees),
114
114
  new BlockHeaderTxValidator(archiveCache),
115
115
  );