@aztec/sequencer-client 0.0.1-commit.18ccd8f0 → 0.0.1-commit.1bb068fb5

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.
Files changed (33) hide show
  1. package/dest/config.d.ts +1 -2
  2. package/dest/config.d.ts.map +1 -1
  3. package/dest/config.js +4 -8
  4. package/dest/publisher/sequencer-publisher.d.ts +8 -2
  5. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  6. package/dest/publisher/sequencer-publisher.js +53 -23
  7. package/dest/sequencer/checkpoint_proposal_job.d.ts +29 -6
  8. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
  9. package/dest/sequencer/checkpoint_proposal_job.js +71 -47
  10. package/dest/sequencer/metrics.d.ts +4 -1
  11. package/dest/sequencer/metrics.d.ts.map +1 -1
  12. package/dest/sequencer/metrics.js +25 -0
  13. package/dest/sequencer/sequencer.d.ts +3 -1
  14. package/dest/sequencer/sequencer.d.ts.map +1 -1
  15. package/dest/sequencer/sequencer.js +6 -1
  16. package/dest/sequencer/timetable.d.ts +1 -4
  17. package/dest/sequencer/timetable.d.ts.map +1 -1
  18. package/dest/sequencer/timetable.js +1 -4
  19. package/dest/test/mock_checkpoint_builder.d.ts +7 -5
  20. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
  21. package/dest/test/mock_checkpoint_builder.js +6 -6
  22. package/dest/test/utils.d.ts +3 -3
  23. package/dest/test/utils.d.ts.map +1 -1
  24. package/dest/test/utils.js +5 -4
  25. package/package.json +28 -28
  26. package/src/config.ts +9 -11
  27. package/src/publisher/sequencer-publisher.ts +60 -22
  28. package/src/sequencer/checkpoint_proposal_job.ts +95 -63
  29. package/src/sequencer/metrics.ts +24 -0
  30. package/src/sequencer/sequencer.ts +8 -1
  31. package/src/sequencer/timetable.ts +6 -5
  32. package/src/test/mock_checkpoint_builder.ts +14 -5
  33. package/src/test/utils.ts +5 -2
@@ -35,13 +35,13 @@ export declare function createBlockProposal(block: L2Block, signature: Signature
35
35
  /**
36
36
  * Creates a checkpoint proposal from a block and signature
37
37
  */
38
- export declare function createCheckpointProposal(block: L2Block, checkpointSignature: Signature, blockSignature?: Signature): CheckpointProposal;
38
+ export declare function createCheckpointProposal(block: L2Block, checkpointSignature: Signature, blockSignature?: Signature, feeAssetPriceModifier?: bigint): CheckpointProposal;
39
39
  /**
40
40
  * Creates a checkpoint attestation from a block and signature.
41
41
  * Note: We manually set the sender since we use random signatures in tests.
42
42
  * In production, the sender is recovered from the signature.
43
43
  */
44
- export declare function createCheckpointAttestation(block: L2Block, signature: Signature, sender: EthAddress): CheckpointAttestation;
44
+ export declare function createCheckpointAttestation(block: L2Block, signature: Signature, sender: EthAddress, feeAssetPriceModifier?: bigint): CheckpointAttestation;
45
45
  /**
46
46
  * Creates transactions and a block, and mocks P2P to return them.
47
47
  * Helper for tests that need to set up a block with transactions.
@@ -50,4 +50,4 @@ export declare function setupTxsAndBlock(p2p: MockProxy<P2P>, globalVariables: G
50
50
  txs: Tx[];
51
51
  block: L2Block;
52
52
  }>;
53
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUM1RSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV0Qyx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+36,7 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
36
36
  */ export function mockPendingTxs(p2p, txs) {
37
37
  p2p.getPendingTxCount.mockResolvedValue(txs.length);
38
38
  p2p.iteratePendingTxs.mockImplementation(()=>mockTxIterator(Promise.resolve(txs)));
39
+ p2p.iterateEligiblePendingTxs.mockImplementation(()=>mockTxIterator(Promise.resolve(txs)));
39
40
  }
40
41
  /**
41
42
  * Creates an async iterator for transactions
@@ -67,10 +68,10 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
67
68
  }
68
69
  /**
69
70
  * Creates a checkpoint proposal from a block and signature
70
- */ export function createCheckpointProposal(block, checkpointSignature, blockSignature) {
71
+ */ export function createCheckpointProposal(block, checkpointSignature, blockSignature, feeAssetPriceModifier = 0n) {
71
72
  const txHashes = block.body.txEffects.map((tx)=>tx.txHash);
72
73
  const checkpointHeader = createCheckpointHeaderFromBlock(block);
73
- return new CheckpointProposal(checkpointHeader, block.archive.root, checkpointSignature, {
74
+ return new CheckpointProposal(checkpointHeader, block.archive.root, feeAssetPriceModifier, checkpointSignature, {
74
75
  blockHeader: block.header,
75
76
  indexWithinCheckpoint: block.indexWithinCheckpoint,
76
77
  txHashes,
@@ -81,9 +82,9 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
81
82
  * Creates a checkpoint attestation from a block and signature.
82
83
  * Note: We manually set the sender since we use random signatures in tests.
83
84
  * In production, the sender is recovered from the signature.
84
- */ export function createCheckpointAttestation(block, signature, sender) {
85
+ */ export function createCheckpointAttestation(block, signature, sender, feeAssetPriceModifier = 0n) {
85
86
  const checkpointHeader = createCheckpointHeaderFromBlock(block);
86
- const payload = new ConsensusPayload(checkpointHeader, block.archive.root);
87
+ const payload = new ConsensusPayload(checkpointHeader, block.archive.root, feeAssetPriceModifier);
87
88
  const attestation = new CheckpointAttestation(payload, signature, signature);
88
89
  // Set sender directly for testing (bypasses signature recovery)
89
90
  attestation.sender = sender;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/sequencer-client",
3
- "version": "0.0.1-commit.18ccd8f0",
3
+ "version": "0.0.1-commit.1bb068fb5",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -26,38 +26,38 @@
26
26
  "test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
27
27
  },
28
28
  "dependencies": {
29
- "@aztec/aztec.js": "0.0.1-commit.18ccd8f0",
30
- "@aztec/bb-prover": "0.0.1-commit.18ccd8f0",
31
- "@aztec/blob-client": "0.0.1-commit.18ccd8f0",
32
- "@aztec/blob-lib": "0.0.1-commit.18ccd8f0",
33
- "@aztec/constants": "0.0.1-commit.18ccd8f0",
34
- "@aztec/epoch-cache": "0.0.1-commit.18ccd8f0",
35
- "@aztec/ethereum": "0.0.1-commit.18ccd8f0",
36
- "@aztec/foundation": "0.0.1-commit.18ccd8f0",
37
- "@aztec/l1-artifacts": "0.0.1-commit.18ccd8f0",
38
- "@aztec/merkle-tree": "0.0.1-commit.18ccd8f0",
39
- "@aztec/node-keystore": "0.0.1-commit.18ccd8f0",
40
- "@aztec/noir-acvm_js": "0.0.1-commit.18ccd8f0",
41
- "@aztec/noir-contracts.js": "0.0.1-commit.18ccd8f0",
42
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.18ccd8f0",
43
- "@aztec/noir-types": "0.0.1-commit.18ccd8f0",
44
- "@aztec/p2p": "0.0.1-commit.18ccd8f0",
45
- "@aztec/protocol-contracts": "0.0.1-commit.18ccd8f0",
46
- "@aztec/prover-client": "0.0.1-commit.18ccd8f0",
47
- "@aztec/simulator": "0.0.1-commit.18ccd8f0",
48
- "@aztec/slasher": "0.0.1-commit.18ccd8f0",
49
- "@aztec/stdlib": "0.0.1-commit.18ccd8f0",
50
- "@aztec/telemetry-client": "0.0.1-commit.18ccd8f0",
51
- "@aztec/validator-client": "0.0.1-commit.18ccd8f0",
52
- "@aztec/validator-ha-signer": "0.0.1-commit.18ccd8f0",
53
- "@aztec/world-state": "0.0.1-commit.18ccd8f0",
29
+ "@aztec/aztec.js": "0.0.1-commit.1bb068fb5",
30
+ "@aztec/bb-prover": "0.0.1-commit.1bb068fb5",
31
+ "@aztec/blob-client": "0.0.1-commit.1bb068fb5",
32
+ "@aztec/blob-lib": "0.0.1-commit.1bb068fb5",
33
+ "@aztec/constants": "0.0.1-commit.1bb068fb5",
34
+ "@aztec/epoch-cache": "0.0.1-commit.1bb068fb5",
35
+ "@aztec/ethereum": "0.0.1-commit.1bb068fb5",
36
+ "@aztec/foundation": "0.0.1-commit.1bb068fb5",
37
+ "@aztec/l1-artifacts": "0.0.1-commit.1bb068fb5",
38
+ "@aztec/merkle-tree": "0.0.1-commit.1bb068fb5",
39
+ "@aztec/node-keystore": "0.0.1-commit.1bb068fb5",
40
+ "@aztec/noir-acvm_js": "0.0.1-commit.1bb068fb5",
41
+ "@aztec/noir-contracts.js": "0.0.1-commit.1bb068fb5",
42
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.1bb068fb5",
43
+ "@aztec/noir-types": "0.0.1-commit.1bb068fb5",
44
+ "@aztec/p2p": "0.0.1-commit.1bb068fb5",
45
+ "@aztec/protocol-contracts": "0.0.1-commit.1bb068fb5",
46
+ "@aztec/prover-client": "0.0.1-commit.1bb068fb5",
47
+ "@aztec/simulator": "0.0.1-commit.1bb068fb5",
48
+ "@aztec/slasher": "0.0.1-commit.1bb068fb5",
49
+ "@aztec/stdlib": "0.0.1-commit.1bb068fb5",
50
+ "@aztec/telemetry-client": "0.0.1-commit.1bb068fb5",
51
+ "@aztec/validator-client": "0.0.1-commit.1bb068fb5",
52
+ "@aztec/validator-ha-signer": "0.0.1-commit.1bb068fb5",
53
+ "@aztec/world-state": "0.0.1-commit.1bb068fb5",
54
54
  "lodash.chunk": "^4.2.0",
55
55
  "tslib": "^2.4.0",
56
56
  "viem": "npm:@aztec/viem@2.38.2"
57
57
  },
58
58
  "devDependencies": {
59
- "@aztec/archiver": "0.0.1-commit.18ccd8f0",
60
- "@aztec/kv-store": "0.0.1-commit.18ccd8f0",
59
+ "@aztec/archiver": "0.0.1-commit.1bb068fb5",
60
+ "@aztec/kv-store": "0.0.1-commit.1bb068fb5",
61
61
  "@electric-sql/pglite": "^0.3.14",
62
62
  "@jest/globals": "^30.0.0",
63
63
  "@types/jest": "^30.0.0",
package/src/config.ts CHANGED
@@ -11,8 +11,14 @@ import { EthAddress } from '@aztec/foundation/eth-address';
11
11
  import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore/config';
12
12
  import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
13
13
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
14
- import { type ChainConfig, type SequencerConfig, chainConfigMappings } from '@aztec/stdlib/config';
14
+ import {
15
+ type ChainConfig,
16
+ type SequencerConfig,
17
+ chainConfigMappings,
18
+ sharedSequencerConfigMappings,
19
+ } from '@aztec/stdlib/config';
15
20
  import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
21
+ import { DEFAULT_P2P_PROPAGATION_TIME } from '@aztec/stdlib/timetable';
16
22
  import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
17
23
 
18
24
  import {
@@ -25,8 +31,6 @@ import {
25
31
  export * from './publisher/config.js';
26
32
  export type { SequencerConfig };
27
33
 
28
- export const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
29
-
30
34
  /**
31
35
  * Default values for SequencerConfig.
32
36
  * Centralized location for all sequencer configuration defaults.
@@ -41,7 +45,7 @@ export const DefaultSequencerConfig: ResolvedSequencerConfig = {
41
45
  maxDABlockGas: 10e9,
42
46
  maxBlockSizeInBytes: 1024 * 1024,
43
47
  enforceTimeTable: true,
44
- attestationPropagationTime: DEFAULT_ATTESTATION_PROPAGATION_TIME,
48
+ attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
45
49
  secondsBeforeInvalidatingBlockAsCommitteeMember: 144, // 12 L1 blocks
46
50
  secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432, // 36 L1 blocks
47
51
  skipCollectingAttestations: false,
@@ -191,13 +195,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
191
195
  description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
192
196
  ...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering),
193
197
  },
194
- blockDurationMs: {
195
- env: 'SEQ_BLOCK_DURATION_MS',
196
- description:
197
- 'Duration per block in milliseconds when building multiple blocks per slot. ' +
198
- 'If undefined (default), builds a single block per slot using the full slot duration.',
199
- parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
200
- },
198
+ ...sharedSequencerConfigMappings,
201
199
  buildCheckpointIfEmpty: {
202
200
  env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
203
201
  description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
@@ -4,6 +4,7 @@ import type { EpochCache } from '@aztec/epoch-cache';
4
4
  import type { L1ContractsConfig } from '@aztec/ethereum/config';
5
5
  import {
6
6
  type EmpireSlashingProposerContract,
7
+ FeeAssetPriceOracle,
7
8
  type GovernanceProposerContract,
8
9
  type IEmpireBase,
9
10
  MULTI_CALL_3_ADDRESS,
@@ -18,11 +19,12 @@ import {
18
19
  type L1BlobInputs,
19
20
  type L1TxConfig,
20
21
  type L1TxRequest,
22
+ MAX_L1_TX_LIMIT,
21
23
  type TransactionStats,
22
24
  WEI_CONST,
23
25
  } from '@aztec/ethereum/l1-tx-utils';
24
26
  import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
25
- import { FormattedViemError, formatViemError, tryExtractEvent } from '@aztec/ethereum/utils';
27
+ import { FormattedViemError, formatViemError, mergeAbis, tryExtractEvent } from '@aztec/ethereum/utils';
26
28
  import { sumBigint } from '@aztec/foundation/bigint';
27
29
  import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
28
30
  import { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
@@ -59,6 +61,8 @@ type L1ProcessArgs = {
59
61
  attestationsAndSigners: CommitteeAttestationsAndSigners;
60
62
  /** Attestations and signers signature */
61
63
  attestationsAndSignersSignature: Signature;
64
+ /** The fee asset price modifier in basis points (from oracle) */
65
+ feeAssetPriceModifier: bigint;
62
66
  };
63
67
 
64
68
  export const Actions = [
@@ -122,10 +126,9 @@ export class SequencerPublisher {
122
126
 
123
127
  /** L1 fee analyzer for fisherman mode */
124
128
  private l1FeeAnalyzer?: L1FeeAnalyzer;
125
- // @note - with blobs, the below estimate seems too large.
126
- // Total used for full block from int_l1_pub e2e test: 1m (of which 86k is 1x blob)
127
- // Total used for emptier block from above test: 429k (of which 84k is 1x blob)
128
- public static PROPOSE_GAS_GUESS: bigint = 12_000_000n;
129
+
130
+ /** Fee asset price oracle for computing price modifiers from Uniswap V4 */
131
+ private feeAssetPriceOracle: FeeAssetPriceOracle;
129
132
 
130
133
  // A CALL to a cold address is 2700 gas
131
134
  public static MULTICALL_OVERHEAD_GAS_GUESS = 5000n;
@@ -192,12 +195,27 @@ export class SequencerPublisher {
192
195
  createLogger('sequencer:publisher:fee-analyzer'),
193
196
  );
194
197
  }
198
+
199
+ // Initialize fee asset price oracle
200
+ this.feeAssetPriceOracle = new FeeAssetPriceOracle(
201
+ this.l1TxUtils.client,
202
+ this.rollupContract,
203
+ createLogger('sequencer:publisher:price-oracle'),
204
+ );
195
205
  }
196
206
 
197
207
  public getRollupContract(): RollupContract {
198
208
  return this.rollupContract;
199
209
  }
200
210
 
211
+ /**
212
+ * Gets the fee asset price modifier from the oracle.
213
+ * Returns 0n if the oracle query fails.
214
+ */
215
+ public getFeeAssetPriceModifier(): Promise<bigint> {
216
+ return this.feeAssetPriceOracle.computePriceModifier();
217
+ }
218
+
201
219
  public getSenderAddress() {
202
220
  return this.l1TxUtils.getSenderAddress();
203
221
  }
@@ -273,7 +291,7 @@ export class SequencerPublisher {
273
291
  // Start the analysis
274
292
  const analysisId = await this.l1FeeAnalyzer.startAnalysis(
275
293
  l2SlotNumber,
276
- gasLimit > 0n ? gasLimit : SequencerPublisher.PROPOSE_GAS_GUESS,
294
+ gasLimit > 0n ? gasLimit : MAX_L1_TX_LIMIT,
277
295
  l1Requests,
278
296
  blobConfig,
279
297
  onComplete,
@@ -346,7 +364,16 @@ export class SequencerPublisher {
346
364
 
347
365
  // Merge gasConfigs. Yields the sum of gasLimits, and the earliest txTimeoutAt, or undefined if no gasConfig sets them.
348
366
  const gasLimits = gasConfigs.map(g => g?.gasLimit).filter((g): g is bigint => g !== undefined);
349
- const gasLimit = gasLimits.length > 0 ? sumBigint(gasLimits) : undefined; // sum
367
+ let gasLimit = gasLimits.length > 0 ? sumBigint(gasLimits) : undefined; // sum
368
+ // Cap at L1 block gas limit so the node accepts the tx ("gas limit too high" otherwise).
369
+ const maxGas = MAX_L1_TX_LIMIT;
370
+ if (gasLimit !== undefined && gasLimit > maxGas) {
371
+ this.log.debug('Capping bundled tx gas limit to L1 max', {
372
+ requested: gasLimit,
373
+ capped: maxGas,
374
+ });
375
+ gasLimit = maxGas;
376
+ }
350
377
  const txTimeoutAts = gasConfigs.map(g => g?.txTimeoutAt).filter((g): g is Date => g !== undefined);
351
378
  const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map(g => g.getTime()))) : undefined; // earliest
352
379
  const txConfig: RequestWithExpiry['gasConfig'] = { gasLimit, txTimeoutAt };
@@ -517,7 +544,12 @@ export class SequencerPublisher {
517
544
  this.log.debug(`Simulating invalidate checkpoint ${checkpointNumber}`, { ...logData, request });
518
545
 
519
546
  try {
520
- const { gasUsed } = await this.l1TxUtils.simulate(request, undefined, undefined, ErrorsAbi);
547
+ const { gasUsed } = await this.l1TxUtils.simulate(
548
+ request,
549
+ undefined,
550
+ undefined,
551
+ mergeAbis([request.abi ?? [], ErrorsAbi]),
552
+ );
521
553
  this.log.verbose(`Simulation for invalidate checkpoint ${checkpointNumber} succeeded`, {
522
554
  ...logData,
523
555
  request,
@@ -536,7 +568,7 @@ export class SequencerPublisher {
536
568
 
537
569
  // If the error is due to the checkpoint not being in the pending chain, and it was indeed removed by someone else,
538
570
  // we can safely ignore it and return undefined so we go ahead with checkpoint building.
539
- if (viemError.message?.includes('Rollup__BlockNotInPendingChain')) {
571
+ if (viemError.message?.includes('Rollup__CheckpointNotInPendingChain')) {
540
572
  this.log.verbose(
541
573
  `Simulation for invalidate checkpoint ${checkpointNumber} failed due to checkpoint not being in pending chain`,
542
574
  { ...logData, request, error: viemError.message },
@@ -632,7 +664,7 @@ export class SequencerPublisher {
632
664
  header: checkpoint.header.toViem(),
633
665
  archive: toHex(checkpoint.archive.root.toBuffer()),
634
666
  oracleInput: {
635
- feeAssetPriceModifier: 0n,
667
+ feeAssetPriceModifier: checkpoint.feeAssetPriceModifier,
636
668
  },
637
669
  },
638
670
  attestationsAndSigners.getPackedAttestations(),
@@ -700,7 +732,7 @@ export class SequencerPublisher {
700
732
  });
701
733
 
702
734
  try {
703
- await this.l1TxUtils.simulate(request, { time: timestamp }, [], ErrorsAbi);
735
+ await this.l1TxUtils.simulate(request, { time: timestamp }, [], mergeAbis([request.abi ?? [], ErrorsAbi]));
704
736
  this.log.debug(`Simulation for ${action} at slot ${slotNumber} succeeded`, { request });
705
737
  } catch (err) {
706
738
  this.log.error(`Failed simulation for ${action} at slot ${slotNumber} (enqueuing the action anyway)`, err);
@@ -910,12 +942,13 @@ export class SequencerPublisher {
910
942
  const blobFields = checkpoint.toBlobFields();
911
943
  const blobs = getBlobsPerL1Block(blobFields);
912
944
 
913
- const proposeTxArgs = {
945
+ const proposeTxArgs: L1ProcessArgs = {
914
946
  header: checkpointHeader,
915
947
  archive: checkpoint.archive.root.toBuffer(),
916
948
  blobs,
917
949
  attestationsAndSigners,
918
950
  attestationsAndSignersSignature,
951
+ feeAssetPriceModifier: checkpoint.feeAssetPriceModifier,
919
952
  };
920
953
 
921
954
  let ts: bigint;
@@ -999,12 +1032,14 @@ export class SequencerPublisher {
999
1032
  this.log.debug(`Simulating ${action} for slot ${slotNumber}`, logData);
1000
1033
 
1001
1034
  let gasUsed: bigint;
1035
+ const simulateAbi = mergeAbis([request.abi ?? [], ErrorsAbi]);
1002
1036
  try {
1003
- ({ gasUsed } = await this.l1TxUtils.simulate(request, { time: timestamp }, [], ErrorsAbi)); // TODO(palla/slash): Check the timestamp logic
1037
+ ({ gasUsed } = await this.l1TxUtils.simulate(request, { time: timestamp }, [], simulateAbi)); // TODO(palla/slash): Check the timestamp logic
1004
1038
  this.log.verbose(`Simulation for ${action} succeeded`, { ...logData, request, gasUsed });
1005
1039
  } catch (err) {
1006
- const viemError = formatViemError(err);
1040
+ const viemError = formatViemError(err, simulateAbi);
1007
1041
  this.log.error(`Simulation for ${action} at ${slotNumber} failed`, viemError, logData);
1042
+
1008
1043
  return false;
1009
1044
  }
1010
1045
 
@@ -1012,10 +1047,14 @@ export class SequencerPublisher {
1012
1047
  const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil((Number(gasUsed) * 64) / 63)));
1013
1048
  logData.gasLimit = gasLimit;
1014
1049
 
1050
+ // Store the ABI used for simulation on the request so Multicall3.forward can decode errors
1051
+ // when the tx is sent and a revert is diagnosed via simulation.
1052
+ const requestWithAbi = { ...request, abi: simulateAbi };
1053
+
1015
1054
  this.log.debug(`Enqueuing ${action}`, logData);
1016
1055
  this.addRequest({
1017
1056
  action,
1018
- request,
1057
+ request: requestWithAbi,
1019
1058
  gasConfig: { gasLimit },
1020
1059
  lastValidL2Slot: slotNumber,
1021
1060
  checkSuccess: (_req, result) => {
@@ -1097,8 +1136,7 @@ export class SequencerPublisher {
1097
1136
  header: encodedData.header.toViem(),
1098
1137
  archive: toHex(encodedData.archive),
1099
1138
  oracleInput: {
1100
- // We are currently not modifying these. See #9963
1101
- feeAssetPriceModifier: 0n,
1139
+ feeAssetPriceModifier: encodedData.feeAssetPriceModifier,
1102
1140
  },
1103
1141
  },
1104
1142
  encodedData.attestationsAndSigners.getPackedAttestations(),
@@ -1124,7 +1162,7 @@ export class SequencerPublisher {
1124
1162
  readonly header: ViemHeader;
1125
1163
  readonly archive: `0x${string}`;
1126
1164
  readonly oracleInput: {
1127
- readonly feeAssetPriceModifier: 0n;
1165
+ readonly feeAssetPriceModifier: bigint;
1128
1166
  };
1129
1167
  },
1130
1168
  ViemCommitteeAttestations,
@@ -1171,20 +1209,20 @@ export class SequencerPublisher {
1171
1209
  {
1172
1210
  to: this.rollupContract.address,
1173
1211
  data: rollupData,
1174
- gas: SequencerPublisher.PROPOSE_GAS_GUESS,
1212
+ gas: MAX_L1_TX_LIMIT,
1175
1213
  ...(this.proposerAddressForSimulation && { from: this.proposerAddressForSimulation.toString() }),
1176
1214
  },
1177
1215
  {
1178
1216
  // @note we add 1n to the timestamp because geth implementation doesn't like simulation timestamp to be equal to the current block timestamp
1179
1217
  time: timestamp + 1n,
1180
1218
  // @note reth should have a 30m gas limit per block but throws errors that this tx is beyond limit so we increase here
1181
- gasLimit: SequencerPublisher.PROPOSE_GAS_GUESS * 2n,
1219
+ gasLimit: MAX_L1_TX_LIMIT * 2n,
1182
1220
  },
1183
1221
  stateOverrides,
1184
1222
  RollupAbi,
1185
1223
  {
1186
1224
  // @note fallback gas estimate to use if the node doesn't support simulation API
1187
- fallbackGasEstimate: SequencerPublisher.PROPOSE_GAS_GUESS,
1225
+ fallbackGasEstimate: MAX_L1_TX_LIMIT,
1188
1226
  },
1189
1227
  )
1190
1228
  .catch(err => {
@@ -1194,7 +1232,7 @@ export class SequencerPublisher {
1194
1232
  this.log.debug(`Ignoring expected ValidatorSelection__MissingProposerSignature error in fisherman mode`);
1195
1233
  // Return a minimal simulation result with the fallback gas estimate
1196
1234
  return {
1197
- gasUsed: SequencerPublisher.PROPOSE_GAS_GUESS,
1235
+ gasUsed: MAX_L1_TX_LIMIT,
1198
1236
  logs: [],
1199
1237
  };
1200
1238
  }