@aztec/sequencer-client 0.0.1-commit.b655e406 → 0.0.1-commit.b9865e97

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 (153) hide show
  1. package/README.md +281 -21
  2. package/dest/client/index.d.ts +1 -1
  3. package/dest/client/sequencer-client.d.ts +26 -16
  4. package/dest/client/sequencer-client.d.ts.map +1 -1
  5. package/dest/client/sequencer-client.js +78 -37
  6. package/dest/config.d.ts +37 -8
  7. package/dest/config.d.ts.map +1 -1
  8. package/dest/config.js +139 -48
  9. package/dest/global_variable_builder/fee_predictor.d.ts +37 -0
  10. package/dest/global_variable_builder/fee_predictor.d.ts.map +1 -0
  11. package/dest/global_variable_builder/fee_predictor.js +128 -0
  12. package/dest/global_variable_builder/fee_provider.d.ts +21 -0
  13. package/dest/global_variable_builder/fee_provider.d.ts.map +1 -0
  14. package/dest/global_variable_builder/fee_provider.js +58 -0
  15. package/dest/global_variable_builder/global_builder.d.ts +24 -20
  16. package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
  17. package/dest/global_variable_builder/global_builder.js +44 -65
  18. package/dest/global_variable_builder/index.d.ts +4 -2
  19. package/dest/global_variable_builder/index.d.ts.map +1 -1
  20. package/dest/global_variable_builder/index.js +2 -0
  21. package/dest/index.d.ts +2 -3
  22. package/dest/index.d.ts.map +1 -1
  23. package/dest/index.js +1 -2
  24. package/dest/publisher/config.d.ts +55 -20
  25. package/dest/publisher/config.d.ts.map +1 -1
  26. package/dest/publisher/config.js +124 -34
  27. package/dest/publisher/index.d.ts +2 -1
  28. package/dest/publisher/index.d.ts.map +1 -1
  29. package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
  30. package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
  31. package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
  32. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +58 -0
  33. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
  34. package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
  35. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
  36. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
  37. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
  38. package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
  39. package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
  40. package/dest/publisher/l1_tx_failed_store/index.js +2 -0
  41. package/dest/publisher/sequencer-bundle-simulator.d.ts +96 -0
  42. package/dest/publisher/sequencer-bundle-simulator.d.ts.map +1 -0
  43. package/dest/publisher/sequencer-bundle-simulator.js +198 -0
  44. package/dest/publisher/sequencer-publisher-factory.d.ts +15 -8
  45. package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
  46. package/dest/publisher/sequencer-publisher-factory.js +28 -4
  47. package/dest/publisher/sequencer-publisher-metrics.d.ts +3 -3
  48. package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
  49. package/dest/publisher/sequencer-publisher-metrics.js +23 -86
  50. package/dest/publisher/sequencer-publisher.d.ts +137 -97
  51. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  52. package/dest/publisher/sequencer-publisher.js +1004 -416
  53. package/dest/sequencer/automine/automine_factory.d.ts +54 -0
  54. package/dest/sequencer/automine/automine_factory.d.ts.map +1 -0
  55. package/dest/sequencer/automine/automine_factory.js +84 -0
  56. package/dest/sequencer/automine/automine_sequencer.d.ts +151 -0
  57. package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -0
  58. package/dest/sequencer/automine/automine_sequencer.js +509 -0
  59. package/dest/sequencer/chain_state_overrides.d.ts +61 -0
  60. package/dest/sequencer/chain_state_overrides.d.ts.map +1 -0
  61. package/dest/sequencer/chain_state_overrides.js +98 -0
  62. package/dest/sequencer/checkpoint_proposal_job.d.ts +150 -0
  63. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
  64. package/dest/sequencer/checkpoint_proposal_job.js +1793 -0
  65. package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts +34 -0
  66. package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts.map +1 -0
  67. package/dest/sequencer/checkpoint_proposal_job_metrics.js +72 -0
  68. package/dest/sequencer/checkpoint_voter.d.ts +34 -0
  69. package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
  70. package/dest/sequencer/checkpoint_voter.js +106 -0
  71. package/dest/sequencer/config.d.ts +3 -2
  72. package/dest/sequencer/config.d.ts.map +1 -1
  73. package/dest/sequencer/errors.d.ts +1 -1
  74. package/dest/sequencer/errors.d.ts.map +1 -1
  75. package/dest/sequencer/events.d.ts +92 -0
  76. package/dest/sequencer/events.d.ts.map +1 -0
  77. package/dest/sequencer/events.js +1 -0
  78. package/dest/sequencer/index.d.ts +6 -2
  79. package/dest/sequencer/index.d.ts.map +1 -1
  80. package/dest/sequencer/index.js +5 -1
  81. package/dest/sequencer/metrics.d.ts +48 -4
  82. package/dest/sequencer/metrics.d.ts.map +1 -1
  83. package/dest/sequencer/metrics.js +257 -50
  84. package/dest/sequencer/sequencer.d.ts +175 -144
  85. package/dest/sequencer/sequencer.d.ts.map +1 -1
  86. package/dest/sequencer/sequencer.js +1022 -567
  87. package/dest/sequencer/timetable.d.ts +64 -16
  88. package/dest/sequencer/timetable.d.ts.map +1 -1
  89. package/dest/sequencer/timetable.js +154 -64
  90. package/dest/sequencer/types.d.ts +3 -0
  91. package/dest/sequencer/types.d.ts.map +1 -0
  92. package/dest/sequencer/types.js +1 -0
  93. package/dest/sequencer/utils.d.ts +14 -8
  94. package/dest/sequencer/utils.d.ts.map +1 -1
  95. package/dest/sequencer/utils.js +7 -4
  96. package/dest/test/index.d.ts +6 -7
  97. package/dest/test/index.d.ts.map +1 -1
  98. package/dest/test/mock_checkpoint_builder.d.ts +95 -0
  99. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
  100. package/dest/test/mock_checkpoint_builder.js +231 -0
  101. package/dest/test/utils.d.ts +53 -0
  102. package/dest/test/utils.d.ts.map +1 -0
  103. package/dest/test/utils.js +105 -0
  104. package/package.json +32 -30
  105. package/src/client/sequencer-client.ts +105 -60
  106. package/src/config.ts +163 -57
  107. package/src/global_variable_builder/README.md +44 -0
  108. package/src/global_variable_builder/fee_predictor.ts +172 -0
  109. package/src/global_variable_builder/fee_provider.ts +75 -0
  110. package/src/global_variable_builder/global_builder.ts +63 -92
  111. package/src/global_variable_builder/index.ts +3 -1
  112. package/src/index.ts +5 -2
  113. package/src/publisher/config.ts +174 -51
  114. package/src/publisher/index.ts +3 -0
  115. package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
  116. package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +57 -0
  117. package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
  118. package/src/publisher/l1_tx_failed_store/index.ts +3 -0
  119. package/src/publisher/sequencer-bundle-simulator.ts +254 -0
  120. package/src/publisher/sequencer-publisher-factory.ts +45 -14
  121. package/src/publisher/sequencer-publisher-metrics.ts +19 -71
  122. package/src/publisher/sequencer-publisher.ts +798 -538
  123. package/src/sequencer/README.md +243 -0
  124. package/src/sequencer/automine/README.md +46 -0
  125. package/src/sequencer/automine/automine_factory.ts +145 -0
  126. package/src/sequencer/automine/automine_sequencer.ts +595 -0
  127. package/src/sequencer/chain_state_overrides.ts +162 -0
  128. package/src/sequencer/checkpoint_proposal_job.ts +1633 -0
  129. package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
  130. package/src/sequencer/checkpoint_voter.ts +119 -0
  131. package/src/sequencer/config.ts +2 -1
  132. package/src/sequencer/events.ts +76 -0
  133. package/src/sequencer/index.ts +5 -1
  134. package/src/sequencer/metrics.ts +330 -62
  135. package/src/sequencer/sequencer.ts +831 -748
  136. package/src/sequencer/timetable.ts +181 -81
  137. package/src/sequencer/types.ts +6 -0
  138. package/src/sequencer/utils.ts +18 -9
  139. package/src/test/index.ts +5 -6
  140. package/src/test/mock_checkpoint_builder.ts +323 -0
  141. package/src/test/utils.ts +185 -0
  142. package/dest/sequencer/block_builder.d.ts +0 -27
  143. package/dest/sequencer/block_builder.d.ts.map +0 -1
  144. package/dest/sequencer/block_builder.js +0 -130
  145. package/dest/tx_validator/nullifier_cache.d.ts +0 -14
  146. package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
  147. package/dest/tx_validator/nullifier_cache.js +0 -24
  148. package/dest/tx_validator/tx_validator_factory.d.ts +0 -17
  149. package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
  150. package/dest/tx_validator/tx_validator_factory.js +0 -53
  151. package/src/sequencer/block_builder.ts +0 -218
  152. package/src/tx_validator/nullifier_cache.ts +0 -30
  153. package/src/tx_validator/tx_validator_factory.ts +0 -132
@@ -1,11 +1,13 @@
1
+ import { MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
1
2
  import { EpochCache } from '@aztec/epoch-cache';
2
- import { GovernanceProposerContract, PublisherManager, RollupContract, getPublicClient, isAnvilTestChain } from '@aztec/ethereum';
3
- import { EthAddress } from '@aztec/foundation/eth-address';
3
+ import { isAnvilTestChain } from '@aztec/ethereum/chain';
4
+ import { getPublicClient } from '@aztec/ethereum/client';
5
+ import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
6
+ import { PublisherManager } from '@aztec/ethereum/publisher-manager';
4
7
  import { createLogger } from '@aztec/foundation/log';
5
- import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
6
8
  import { L1Metrics } from '@aztec/telemetry-client';
7
9
  import { NodeKeystoreAdapter } from '@aztec/validator-client';
8
- import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
10
+ import { getPublisherConfigFromSequencerConfig } from '../config.js';
9
11
  import { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
10
12
  import { Sequencer } from '../sequencer/index.js';
11
13
  /**
@@ -13,15 +15,17 @@ import { Sequencer } from '../sequencer/index.js';
13
15
  */ export class SequencerClient {
14
16
  publisherManager;
15
17
  sequencer;
16
- blockBuilder;
18
+ checkpointsBuilder;
17
19
  validatorClient;
18
20
  l1Metrics;
19
- constructor(publisherManager, sequencer, blockBuilder, validatorClient, l1Metrics){
21
+ delayer_;
22
+ constructor(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer_){
20
23
  this.publisherManager = publisherManager;
21
24
  this.sequencer = sequencer;
22
- this.blockBuilder = blockBuilder;
25
+ this.checkpointsBuilder = checkpointsBuilder;
23
26
  this.validatorClient = validatorClient;
24
27
  this.l1Metrics = l1Metrics;
28
+ this.delayer_ = delayer_;
25
29
  }
26
30
  /**
27
31
  * Initializes a new instance.
@@ -35,20 +39,24 @@ import { Sequencer } from '../sequencer/index.js';
35
39
  * @param prover - An instance of a block prover
36
40
  * @returns A new running instance.
37
41
  */ static async new(config, deps) {
38
- const { validatorClient, p2pClient, worldStateSynchronizer, slasherClient, blockBuilder, l2BlockSource, l1ToL2MessageSource, telemetry: telemetryClient } = deps;
42
+ const { validatorClient, p2pClient, worldStateSynchronizer, slasherClient, checkpointsBuilder, l2BlockSource, l1ToL2MessageSource, telemetry: telemetryClient } = deps;
39
43
  const { l1RpcUrls: rpcUrls, l1ChainId: chainId } = config;
40
44
  const log = createLogger('sequencer');
41
45
  const publicClient = getPublicClient(config);
42
46
  const l1TxUtils = deps.l1TxUtils;
43
47
  const l1Metrics = new L1Metrics(telemetryClient.getMeter('L1PublisherMetrics'), publicClient, l1TxUtils.map((x)=>x.getSenderAddress()));
44
- const publisherManager = new PublisherManager(l1TxUtils, config);
45
- const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
46
- const [l1GenesisTime, slotDuration] = await Promise.all([
48
+ const publisherManager = new PublisherManager(l1TxUtils, getPublisherConfigFromSequencerConfig(config), {
49
+ bindings: log.getBindings(),
50
+ funder: deps.funderL1TxUtils
51
+ });
52
+ const rollupContract = new RollupContract(publicClient, config.rollupAddress.toString());
53
+ const [l1GenesisTime, slotDuration, rollupManaLimit] = await Promise.all([
47
54
  rollupContract.getL1GenesisTime(),
48
- rollupContract.getSlotDuration()
55
+ rollupContract.getSlotDuration(),
56
+ rollupContract.getManaLimit().then(Number)
49
57
  ]);
50
- const governanceProposerContract = new GovernanceProposerContract(publicClient, config.l1Contracts.governanceProposerAddress.toString());
51
- const epochCache = deps.epochCache ?? await EpochCache.create(config.l1Contracts.rollupAddress, {
58
+ const governanceProposerContract = new GovernanceProposerContract(publicClient, config.governanceProposerAddress.toString());
59
+ const epochCache = deps.epochCache ?? await EpochCache.create(config.rollupAddress, {
52
60
  l1RpcUrls: rpcUrls,
53
61
  l1ChainId: chainId,
54
62
  viemPollingIntervalMS: config.viemPollingIntervalMS,
@@ -56,72 +64,80 @@ import { Sequencer } from '../sequencer/index.js';
56
64
  }, {
57
65
  dateProvider: deps.dateProvider
58
66
  });
59
- const slashFactoryContract = new SlashFactoryContract(publicClient, config.l1Contracts.slashFactoryAddress?.toString() ?? EthAddress.ZERO.toString());
60
67
  const publisherFactory = deps.publisherFactory ?? new SequencerPublisherFactory(config, {
61
68
  telemetry: telemetryClient,
62
- blobSinkClient: deps.blobSinkClient,
69
+ blobClient: deps.blobClient,
63
70
  epochCache,
64
71
  governanceProposerContract,
65
- slashFactoryContract,
66
72
  rollupContract,
67
73
  dateProvider: deps.dateProvider,
68
74
  publisherManager,
69
75
  nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
70
76
  logger: log
71
77
  });
72
- const globalsBuilder = new GlobalVariableBuilder(config);
73
78
  const ethereumSlotDuration = config.ethereumSlotDuration;
74
- const rollupManaLimit = Number(await rollupContract.getManaLimit());
75
- let sequencerManaLimit = config.maxL2BlockGas ?? rollupManaLimit;
76
- if (sequencerManaLimit > rollupManaLimit) {
77
- log.warn(`Provided maxL2BlockGas of ${sequencerManaLimit} is greater than the maximum allowed by the L1 (${rollupManaLimit}), setting limit to ${rollupManaLimit}`);
78
- sequencerManaLimit = rollupManaLimit;
79
- }
79
+ const globalsBuilder = deps.globalVariableBuilder;
80
80
  // When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
81
- // Otherwise, assume we must have broadcasted the tx before the slot started (we use a default
82
- // maxL1TxInclusionTimeIntoSlot of zero) to get the tx into that L1 slot.
81
+ // Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
83
82
  // In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
84
- // make it with a propagation time into slot equal to 4s. However, we prefer being conservative.
83
+ // reduce the publishing time allowance. However, we prefer being conservative.
85
84
  // See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
86
- const maxL1TxInclusionTimeIntoSlot = config.maxL1TxInclusionTimeIntoSlot ?? isAnvilTestChain(config.l1ChainId) ? ethereumSlotDuration - 1 : 0;
85
+ const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
86
+ const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
87
+ const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = capPerBlockLimits(config, rollupManaLimit, log);
87
88
  const l1Constants = {
88
89
  l1GenesisTime,
89
90
  slotDuration: Number(slotDuration),
90
- ethereumSlotDuration
91
+ ethereumSlotDuration,
92
+ rollupManaLimit,
93
+ epochDuration: config.aztecEpochDuration
91
94
  };
92
- const sequencer = new Sequencer(publisherFactory, validatorClient, globalsBuilder, p2pClient, worldStateSynchronizer, slasherClient, l2BlockSource, l1ToL2MessageSource, blockBuilder, l1Constants, deps.dateProvider, epochCache, rollupContract, {
95
+ const sequencer = new Sequencer(publisherFactory, validatorClient, globalsBuilder, p2pClient, worldStateSynchronizer, slasherClient, l2BlockSource, l1ToL2MessageSource, checkpointsBuilder, l1Constants, deps.dateProvider, epochCache, rollupContract, {
93
96
  ...config,
94
- maxL1TxInclusionTimeIntoSlot,
95
- maxL2BlockGas: sequencerManaLimit
97
+ l1PublishingTime,
98
+ maxL2BlockGas,
99
+ maxDABlockGas,
100
+ maxTxsPerBlock
96
101
  }, telemetryClient, log);
97
- await sequencer.init();
98
- return new SequencerClient(publisherManager, sequencer, blockBuilder, validatorClient, l1Metrics);
102
+ sequencer.init();
103
+ // Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
104
+ const delayer = l1TxUtils[0]?.delayer;
105
+ return new SequencerClient(publisherManager, sequencer, checkpointsBuilder, validatorClient, l1Metrics, delayer);
99
106
  }
100
107
  /**
101
108
  * Updates sequencer and validator client config.
102
109
  * @param config - New parameters.
103
110
  */ updateConfig(config) {
104
111
  this.sequencer.updateConfig(config);
105
- this.blockBuilder.updateConfig(config);
112
+ this.checkpointsBuilder.updateConfig(config);
106
113
  this.validatorClient?.updateConfig(config);
107
114
  }
108
115
  /** Starts the sequencer. */ async start() {
109
116
  await this.validatorClient?.start();
110
117
  this.sequencer.start();
111
118
  this.l1Metrics?.start();
112
- await this.publisherManager.loadState();
119
+ await this.publisherManager.start();
113
120
  }
114
121
  /**
115
122
  * Stops the sequencer from processing new txs.
116
123
  */ async stop() {
117
124
  await this.sequencer.stop();
118
125
  await this.validatorClient?.stop();
119
- this.publisherManager.interrupt();
126
+ await this.publisherManager.stop();
120
127
  this.l1Metrics?.stop();
121
128
  }
129
+ /** Triggers an immediate run of the sequencer, bypassing the polling interval. */ trigger() {
130
+ return this.sequencer.trigger();
131
+ }
122
132
  getSequencer() {
123
133
  return this.sequencer;
124
134
  }
135
+ /** Updates the publisher factory's node keystore adapter after a keystore reload. */ updatePublisherNodeKeyStore(adapter) {
136
+ this.sequencer.updatePublisherNodeKeyStore(adapter);
137
+ }
138
+ /** Returns the shared tx delayer for sequencer L1 txs, if enabled. Test-only. */ getDelayer() {
139
+ return this.delayer_;
140
+ }
125
141
  get validatorAddresses() {
126
142
  return this.sequencer.getValidatorAddresses();
127
143
  }
@@ -129,3 +145,28 @@ import { Sequencer } from '../sequencer/index.js';
129
145
  return this.sequencer.maxL2BlockGas;
130
146
  }
131
147
  }
148
+ /**
149
+ * Caps operator-provided per-block limits at checkpoint-level limits.
150
+ * Returns undefined for any limit the operator didn't set — the checkpoint builder handles redistribution.
151
+ */ function capPerBlockLimits(config, rollupManaLimit, log) {
152
+ let maxL2BlockGas = config.maxL2BlockGas;
153
+ if (maxL2BlockGas !== undefined && maxL2BlockGas > rollupManaLimit) {
154
+ log.warn(`Provided MAX_L2_BLOCK_GAS ${maxL2BlockGas} exceeds rollup mana limit ${rollupManaLimit} (capping)`);
155
+ maxL2BlockGas = rollupManaLimit;
156
+ }
157
+ let maxDABlockGas = config.maxDABlockGas;
158
+ if (maxDABlockGas !== undefined && maxDABlockGas > MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT) {
159
+ log.warn(`Provided MAX_DA_BLOCK_GAS ${maxDABlockGas} exceeds DA checkpoint limit ${MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT} (capping)`);
160
+ maxDABlockGas = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT;
161
+ }
162
+ let maxTxsPerBlock = config.maxTxsPerBlock;
163
+ if (maxTxsPerBlock !== undefined && config.maxTxsPerCheckpoint !== undefined && maxTxsPerBlock > config.maxTxsPerCheckpoint) {
164
+ log.warn(`Provided MAX_TX_PER_BLOCK ${maxTxsPerBlock} exceeds MAX_TX_PER_CHECKPOINT ${config.maxTxsPerCheckpoint} (capping)`);
165
+ maxTxsPerBlock = config.maxTxsPerCheckpoint;
166
+ }
167
+ return {
168
+ maxL2BlockGas,
169
+ maxDABlockGas,
170
+ maxTxsPerBlock
171
+ };
172
+ }
package/dest/config.d.ts CHANGED
@@ -1,21 +1,50 @@
1
- import { type L1ContractsConfig, type L1ReaderConfig } from '@aztec/ethereum';
1
+ import { type L1ContractsConfig } from '@aztec/ethereum/config';
2
+ import { type L1ReaderConfig } from '@aztec/ethereum/l1-reader';
2
3
  import { type ConfigMappingsType } from '@aztec/foundation/config';
3
- import { type KeyStoreConfig } from '@aztec/node-keystore';
4
- import { type P2PConfig } from '@aztec/p2p';
4
+ import { type KeyStoreConfig } from '@aztec/node-keystore/config';
5
+ import { type P2PConfig } from '@aztec/p2p/config';
5
6
  import { type ChainConfig, type SequencerConfig } from '@aztec/stdlib/config';
6
- import { type ValidatorClientConfig } from '@aztec/validator-client';
7
- import { type PublisherConfig, type TxSenderConfig } from './publisher/config.js';
7
+ import { type ValidatorClientConfig } from '@aztec/validator-client/config';
8
+ import { type SequencerPublisherConfig, type SequencerTxSenderConfig } from './publisher/config.js';
8
9
  export * from './publisher/config.js';
9
10
  export type { SequencerConfig };
10
- export declare const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
11
+ /**
12
+ * Default values for SequencerConfig.
13
+ * Centralized location for all sequencer configuration defaults.
14
+ */
15
+ export declare const DefaultSequencerConfig: {
16
+ sequencerPollingIntervalMS: number;
17
+ minTxsPerBlock: number;
18
+ buildCheckpointIfEmpty: false;
19
+ publishTxsWithProposals: false;
20
+ perBlockAllocationMultiplier: number;
21
+ redistributeCheckpointBudget: true;
22
+ enforceTimeTable: true;
23
+ attestationPropagationTime: number;
24
+ secondsBeforeInvalidatingBlockAsCommitteeMember: number;
25
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: number;
26
+ skipCollectingAttestations: false;
27
+ skipInvalidateBlockAsProposer: false;
28
+ skipWaitForValidParentCheckpointOnL1: false;
29
+ broadcastInvalidBlockProposal: false;
30
+ broadcastInvalidCheckpointProposalOnly: false;
31
+ injectFakeAttestation: false;
32
+ injectHighSValueAttestation: false;
33
+ injectUnrecoverableSignatureAttestation: false;
34
+ fishermanMode: false;
35
+ shuffleAttestationOrdering: false;
36
+ skipPushProposedBlocksToArchiver: false;
37
+ skipPublishingCheckpointsPercent: number;
38
+ maxBlocksPerCheckpoint: number;
39
+ };
11
40
  /**
12
41
  * Configuration settings for the SequencerClient.
13
42
  */
14
- export type SequencerClientConfig = PublisherConfig & KeyStoreConfig & ValidatorClientConfig & TxSenderConfig & SequencerConfig & L1ReaderConfig & ChainConfig & Pick<P2PConfig, 'txPublicSetupAllowList'> & Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
43
+ export type SequencerClientConfig = SequencerPublisherConfig & KeyStoreConfig & ValidatorClientConfig & SequencerTxSenderConfig & SequencerConfig & L1ReaderConfig & ChainConfig & Pick<P2PConfig, 'txPublicSetupAllowListExtend'> & Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
15
44
  export declare const sequencerConfigMappings: ConfigMappingsType<SequencerConfig>;
16
45
  export declare const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig>;
17
46
  /**
18
47
  * Creates an instance of SequencerClientConfig out of environment variables using sensible defaults for integration testing if not set.
19
48
  */
20
49
  export declare function getConfigEnvVars(): SequencerClientConfig;
21
- //# sourceMappingURL=config.d.ts.map
50
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLGlCQUFpQixFQUE2QixNQUFNLHdCQUF3QixDQUFDO0FBQzNGLE9BQU8sRUFBRSxLQUFLLGNBQWMsRUFBMEIsTUFBTSwyQkFBMkIsQ0FBQztBQUN4RixPQUFPLEVBQ0wsS0FBSyxrQkFBa0IsRUFNeEIsTUFBTSwwQkFBMEIsQ0FBQztBQUVsQyxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQTBCLE1BQU0sNkJBQTZCLENBQUM7QUFDMUYsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUFxQixNQUFNLG1CQUFtQixDQUFDO0FBRXRFLE9BQU8sRUFDTCxLQUFLLFdBQVcsRUFFaEIsS0FBSy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,CAAC;AAEtE,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,KAAK,qBAAqB,EAAiC,MAAM,gCAAgC,CAAC;AAE3G,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAG7B,MAAM,uBAAuB,CAAC;AAE/B,cAAc,uBAAuB,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;CAwBA,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,GAC1D,cAAc,GACd,qBAAqB,GACrB,uBAAuB,GACvB,eAAe,GACf,cAAc,GACd,WAAW,GACX,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,GAC/C,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC,CAAC;AAE/F,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CAwLvE,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CASnF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
package/dest/config.js CHANGED
@@ -1,48 +1,90 @@
1
- import { l1ContractsConfigMappings, l1ReaderConfigMappings } from '@aztec/ethereum';
2
- import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, pickConfigMappings } from '@aztec/foundation/config';
1
+ import { l1ContractsConfigMappings } from '@aztec/ethereum/config';
2
+ import { l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
3
+ import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, optionalNumberConfigHelper, pickConfigMappings } from '@aztec/foundation/config';
3
4
  import { EthAddress } from '@aztec/foundation/eth-address';
4
- import { keyStoreConfigMappings } from '@aztec/node-keystore';
5
- import { p2pConfigMappings } from '@aztec/p2p';
5
+ import { keyStoreConfigMappings } from '@aztec/node-keystore/config';
6
+ import { p2pConfigMappings } from '@aztec/p2p/config';
6
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import { chainConfigMappings } from '@aztec/stdlib/config';
8
- import { validatorClientConfigMappings } from '@aztec/validator-client';
9
- import { getPublisherConfigMappings, getTxSenderConfigMappings } from './publisher/config.js';
8
+ import { DEFAULT_MAX_BLOCKS_PER_CHECKPOINT, chainConfigMappings, sharedSequencerConfigMappings } from '@aztec/stdlib/config';
9
+ import { DEFAULT_P2P_PROPAGATION_TIME } from '@aztec/stdlib/timetable';
10
+ import { validatorClientConfigMappings } from '@aztec/validator-client/config';
11
+ import { sequencerPublisherConfigMappings, sequencerTxSenderConfigMappings } from './publisher/config.js';
10
12
  export * from './publisher/config.js';
11
- export const DEFAULT_ATTESTATION_PROPAGATION_TIME = 2;
13
+ /**
14
+ * Default values for SequencerConfig.
15
+ * Centralized location for all sequencer configuration defaults.
16
+ */ export const DefaultSequencerConfig = {
17
+ sequencerPollingIntervalMS: 500,
18
+ minTxsPerBlock: 1,
19
+ buildCheckpointIfEmpty: false,
20
+ publishTxsWithProposals: false,
21
+ perBlockAllocationMultiplier: 1.2,
22
+ redistributeCheckpointBudget: true,
23
+ enforceTimeTable: true,
24
+ attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
25
+ secondsBeforeInvalidatingBlockAsCommitteeMember: 144,
26
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432,
27
+ skipCollectingAttestations: false,
28
+ skipInvalidateBlockAsProposer: false,
29
+ skipWaitForValidParentCheckpointOnL1: false,
30
+ broadcastInvalidBlockProposal: false,
31
+ broadcastInvalidCheckpointProposalOnly: false,
32
+ injectFakeAttestation: false,
33
+ injectHighSValueAttestation: false,
34
+ injectUnrecoverableSignatureAttestation: false,
35
+ fishermanMode: false,
36
+ shuffleAttestationOrdering: false,
37
+ skipPushProposedBlocksToArchiver: false,
38
+ skipPublishingCheckpointsPercent: 0,
39
+ maxBlocksPerCheckpoint: DEFAULT_MAX_BLOCKS_PER_CHECKPOINT
40
+ };
12
41
  export const sequencerConfigMappings = {
13
- transactionPollingIntervalMS: {
14
- env: 'SEQ_TX_POLLING_INTERVAL_MS',
15
- description: 'The number of ms to wait between polling for pending txs.',
16
- ...numberConfigHelper(500)
42
+ sequencerPollingIntervalMS: {
43
+ env: 'SEQ_POLLING_INTERVAL_MS',
44
+ description: 'The number of ms to wait between polling for checking to build on the next slot.',
45
+ ...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS)
17
46
  },
18
- maxTxsPerBlock: {
19
- env: 'SEQ_MAX_TX_PER_BLOCK',
20
- description: 'The maximum number of txs to include in a block.',
21
- ...numberConfigHelper(32)
47
+ maxTxsPerCheckpoint: {
48
+ env: 'SEQ_MAX_TX_PER_CHECKPOINT',
49
+ description: 'The maximum number of txs across all blocks in a checkpoint.',
50
+ ...optionalNumberConfigHelper()
22
51
  },
23
52
  minTxsPerBlock: {
24
53
  env: 'SEQ_MIN_TX_PER_BLOCK',
25
54
  description: 'The minimum number of txs to include in a block.',
26
- ...numberConfigHelper(1)
55
+ ...numberConfigHelper(DefaultSequencerConfig.minTxsPerBlock)
56
+ },
57
+ minValidTxsPerBlock: {
58
+ description: 'The minimum number of valid txs (after execution) to include in a block. If not set, falls back to minTxsPerBlock.'
27
59
  },
28
60
  publishTxsWithProposals: {
29
61
  env: 'SEQ_PUBLISH_TXS_WITH_PROPOSALS',
30
62
  description: 'Whether to publish txs with proposals.',
31
- ...booleanConfigHelper(false)
63
+ ...booleanConfigHelper(DefaultSequencerConfig.publishTxsWithProposals)
32
64
  },
33
65
  maxL2BlockGas: {
34
66
  env: 'SEQ_MAX_L2_BLOCK_GAS',
35
67
  description: 'The maximum L2 block gas.',
36
- ...numberConfigHelper(10e9)
68
+ ...optionalNumberConfigHelper()
37
69
  },
38
70
  maxDABlockGas: {
39
71
  env: 'SEQ_MAX_DA_BLOCK_GAS',
40
72
  description: 'The maximum DA block gas.',
41
- ...numberConfigHelper(10e9)
73
+ ...optionalNumberConfigHelper()
74
+ },
75
+ perBlockAllocationMultiplier: {
76
+ env: 'SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER',
77
+ description: 'Per-block gas budget multiplier for both L2 and DA gas. Budget per block is (checkpointLimit / maxBlocks) * multiplier.' + ' Values greater than one allow early blocks to use more than their even share, relying on checkpoint-level capping for later blocks.',
78
+ ...numberConfigHelper(DefaultSequencerConfig.perBlockAllocationMultiplier)
79
+ },
80
+ redistributeCheckpointBudget: {
81
+ env: 'SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET',
82
+ description: 'Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget.',
83
+ ...booleanConfigHelper(DefaultSequencerConfig.redistributeCheckpointBudget)
42
84
  },
43
85
  coinbase: {
44
86
  env: 'COINBASE',
45
- parseEnv: (val)=>val ? EthAddress.fromString(val) : undefined,
87
+ parseEnv: (val)=>EthAddress.fromString(val),
46
88
  description: 'Recipient of block reward.'
47
89
  },
48
90
  feeRecipient: {
@@ -58,74 +100,123 @@ export const sequencerConfigMappings = {
58
100
  env: 'ACVM_BINARY_PATH',
59
101
  description: 'The path to the ACVM binary'
60
102
  },
61
- maxBlockSizeInBytes: {
62
- env: 'SEQ_MAX_BLOCK_SIZE_IN_BYTES',
63
- description: 'Max block size',
64
- ...numberConfigHelper(1024 * 1024)
65
- },
66
103
  enforceTimeTable: {
67
104
  env: 'SEQ_ENFORCE_TIME_TABLE',
68
105
  description: 'Whether to enforce the time table when building blocks',
69
- ...booleanConfigHelper(),
70
- defaultValue: true
106
+ ...booleanConfigHelper(DefaultSequencerConfig.enforceTimeTable)
71
107
  },
72
108
  governanceProposerPayload: {
73
109
  env: 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS',
74
110
  description: 'The address of the payload for the governanceProposer',
75
- parseEnv: (val)=>EthAddress.fromString(val),
76
- defaultValue: EthAddress.ZERO
77
- },
78
- maxL1TxInclusionTimeIntoSlot: {
79
- env: 'SEQ_MAX_L1_TX_INCLUSION_TIME_INTO_SLOT',
80
- description: 'How many seconds into an L1 slot we can still send a tx and get it mined.',
81
- parseEnv: (val)=>val ? parseInt(val, 10) : undefined
111
+ parseEnv: (val)=>EthAddress.fromString(val)
82
112
  },
83
- attestationPropagationTime: {
84
- env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
85
- description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way)',
86
- ...numberConfigHelper(DEFAULT_ATTESTATION_PROPAGATION_TIME)
113
+ l1PublishingTime: {
114
+ env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
115
+ description: 'How much time (in seconds) we allow in the slot for publishing the L1 tx (defaults to 1 L1 slot).',
116
+ ...optionalNumberConfigHelper()
87
117
  },
88
118
  fakeProcessingDelayPerTxMs: {
89
119
  description: 'Used for testing to introduce a fake delay after processing each tx'
90
120
  },
121
+ fakeThrowAfterProcessingTxCount: {
122
+ description: 'Used for testing to throw an error after processing N txs'
123
+ },
91
124
  secondsBeforeInvalidatingBlockAsCommitteeMember: {
92
125
  env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER',
93
126
  description: 'How many seconds to wait before trying to invalidate a block from the pending chain as a committee member (zero to never invalidate).' + ' The next proposer is expected to invalidate, so the committee acts as a fallback.',
94
- ...numberConfigHelper(144)
127
+ ...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsCommitteeMember)
95
128
  },
96
129
  secondsBeforeInvalidatingBlockAsNonCommitteeMember: {
97
130
  env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER',
98
131
  description: 'How many seconds to wait before trying to invalidate a block from the pending chain as a non-committee member (zero to never invalidate).' + ' The next proposer is expected to invalidate, then the committee, so other sequencers act as a fallback.',
99
- ...numberConfigHelper(432)
132
+ ...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsNonCommitteeMember)
100
133
  },
101
134
  skipCollectingAttestations: {
102
135
  description: 'Whether to skip collecting attestations from validators and only use self-attestations (for testing only)',
103
- ...booleanConfigHelper(false)
136
+ ...booleanConfigHelper(DefaultSequencerConfig.skipCollectingAttestations)
104
137
  },
105
138
  skipInvalidateBlockAsProposer: {
106
139
  description: 'Do not invalidate the previous block if invalid when we are the proposer (for testing only)',
107
- ...booleanConfigHelper(false)
140
+ ...booleanConfigHelper(DefaultSequencerConfig.skipInvalidateBlockAsProposer)
141
+ },
142
+ skipWaitForValidParentCheckpointOnL1: {
143
+ description: 'Bypass the parent checkpoint validity check before submitting a pipelined checkpoint, ' + 'allowing the proposer to publish even when the parent landed on L1 with invalid attestations (for testing only)',
144
+ ...booleanConfigHelper(DefaultSequencerConfig.skipWaitForValidParentCheckpointOnL1)
108
145
  },
109
146
  broadcastInvalidBlockProposal: {
110
147
  description: 'Broadcast invalid block proposals with corrupted state (for testing only)',
111
- ...booleanConfigHelper(false)
148
+ ...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidBlockProposal)
149
+ },
150
+ invalidBlockProposalIndexWithinCheckpoint: {
151
+ description: 'Broadcast an invalid block proposal only at this indexWithinCheckpoint (for testing only)',
152
+ ...optionalNumberConfigHelper()
153
+ },
154
+ broadcastInvalidCheckpointProposalOnly: {
155
+ description: 'Broadcast invalid checkpoint proposals while keeping the underlying block proposals valid (for testing only). When unset, the checkpoint follows broadcastInvalidBlockProposal.',
156
+ ...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidCheckpointProposalOnly)
112
157
  },
113
158
  injectFakeAttestation: {
114
159
  description: 'Inject a fake attestation (for testing only)',
160
+ ...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation)
161
+ },
162
+ injectHighSValueAttestation: {
163
+ description: 'Inject a malleable attestation with a high-s value (for testing only)',
164
+ ...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation)
165
+ },
166
+ injectUnrecoverableSignatureAttestation: {
167
+ description: 'Inject an attestation with an unrecoverable signature (for testing only)',
168
+ ...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation)
169
+ },
170
+ fishermanMode: {
171
+ env: 'FISHERMAN_MODE',
172
+ description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
173
+ ...booleanConfigHelper(DefaultSequencerConfig.fishermanMode)
174
+ },
175
+ shuffleAttestationOrdering: {
176
+ description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
177
+ ...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering)
178
+ },
179
+ ...sharedSequencerConfigMappings,
180
+ buildCheckpointIfEmpty: {
181
+ env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
182
+ description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
183
+ ...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty)
184
+ },
185
+ skipPushProposedBlocksToArchiver: {
186
+ description: 'Skip pushing proposed blocks to archiver (default: true)',
187
+ ...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver)
188
+ },
189
+ minBlocksForCheckpoint: {
190
+ description: 'Minimum number of blocks required for a checkpoint proposal (test only)'
191
+ },
192
+ skipPublishingCheckpointsPercent: {
193
+ env: 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT',
194
+ description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
195
+ ...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent)
196
+ },
197
+ skipBroadcastProposals: {
198
+ description: 'Skip broadcasting checkpoint and block proposals via gossipsub when proposer (for testing only)',
199
+ ...booleanConfigHelper(false)
200
+ },
201
+ skipBroadcastCheckpointProposal: {
202
+ description: 'Skip broadcasting only the CheckpointProposal via gossipsub when proposer; the held last block is broadcast ' + 'standalone instead so peers still receive it as a proposed-but-uncheckpointed tip (for testing only)',
115
203
  ...booleanConfigHelper(false)
116
204
  },
205
+ pauseProposingForSlots: {
206
+ description: 'List of slots for which the sequencer will not produce a proposal (for testing only). Attestation paths are unaffected.'
207
+ },
117
208
  ...pickConfigMappings(p2pConfigMappings, [
118
- 'txPublicSetupAllowList'
209
+ 'txPublicSetupAllowListExtend'
119
210
  ])
120
211
  };
121
212
  export const sequencerClientConfigMappings = {
213
+ ...chainConfigMappings,
122
214
  ...validatorClientConfigMappings,
123
215
  ...sequencerConfigMappings,
124
216
  ...keyStoreConfigMappings,
125
217
  ...l1ReaderConfigMappings,
126
- ...getTxSenderConfigMappings('SEQ'),
127
- ...getPublisherConfigMappings('SEQ'),
128
- ...chainConfigMappings,
218
+ ...sequencerTxSenderConfigMappings,
219
+ ...sequencerPublisherConfigMappings,
129
220
  ...pickConfigMappings(l1ContractsConfigMappings, [
130
221
  'ethereumSlotDuration',
131
222
  'aztecSlotDuration',
@@ -0,0 +1,37 @@
1
+ import { type RollupContract } from '@aztec/ethereum/contracts';
2
+ import type { DateProvider } from '@aztec/foundation/timer';
3
+ import { GasFees, ManaUsageEstimate } from '@aztec/stdlib/gas';
4
+ /**
5
+ * Predicts min fees for LAG upcoming slots based on the L1 oracle state.
6
+ * A new oracle update can activate at startSlot + LAG, so only the first LAG entries
7
+ * are guaranteed stable. Caches L1 queries per L1 block and recomputes predictions
8
+ * for each mana usage estimate.
9
+ */
10
+ export declare class FeePredictor {
11
+ private readonly rollupContract;
12
+ private readonly publicClient;
13
+ private readonly dateProvider;
14
+ private cachedState;
15
+ private cachedL1BlockNumber;
16
+ private readonly slotDuration;
17
+ private readonly l1GenesisTime;
18
+ private readonly ethereumSlotDuration;
19
+ constructor(rollupContract: RollupContract, publicClient: {
20
+ getBlockNumber: (opts?: {
21
+ cacheTime?: number;
22
+ }) => Promise<bigint>;
23
+ }, dateProvider: DateProvider, config: {
24
+ slotDuration: number;
25
+ l1GenesisTime: bigint;
26
+ ethereumSlotDuration: number;
27
+ });
28
+ /** Returns predicted min fees for each slot in the prediction window. */
29
+ getPredictedMinFees(manaUsage: ManaUsageEstimate): Promise<GasFees[]>;
30
+ private getState;
31
+ private fetchState;
32
+ /** Computes per-slot fee predictions given cached state and a mana usage assumption. */
33
+ private computePredictions;
34
+ private getAssumedManaUsed;
35
+ private computeGasFees;
36
+ }
37
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmVlX3ByZWRpY3Rvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2dsb2JhbF92YXJpYWJsZV9idWlsZGVyL2ZlZV9wcmVkaWN0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFvRCxLQUFLLGNBQWMsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBR2xILE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRTVELE9BQU8sRUFFTCxPQUFPLEVBRVAsaUJBQWlCLEVBR2xCLE1BQU0sbUJBQW1CLENBQUM7QUFlM0I7Ozs7O0dBS0c7QUFDSCxxQkFBYSxZQUFZO0lBU3JCLE9BQU8sQ0FBQyxRQUFRLENBQUMsY0FBYztJQUMvQixPQUFPLENBQUMsUUFBUSxDQUFDLFlBQVk7SUFDN0IsT0FBTyxDQUFDLFFBQVEsQ0FBQyxZQUFZO0lBVi9CLE9BQU8sQ0FBQyxXQUFXLENBQXNDO0lBQ3pELE9BQU8sQ0FBQyxtQkFBbUIsQ0FBcUI7SUFFaEQsT0FBTyxDQUFDLFFBQVEsQ0FBQyxZQUFZLENBQVM7SUFDdEMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxhQUFhLENBQVM7SUFDdkMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxvQkFBb0IsQ0FBUztJQUU5QyxZQUNtQixjQUFjLEVBQUUsY0FBYyxFQUM5QixZQUFZLEVBQUU7UUFBRS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