@aztec/sequencer-client 0.0.0-test.1 → 0.0.1-commit.001888fc

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 (151) hide show
  1. package/dest/client/index.d.ts +1 -1
  2. package/dest/client/sequencer-client.d.ts +50 -33
  3. package/dest/client/sequencer-client.d.ts.map +1 -1
  4. package/dest/client/sequencer-client.js +164 -57
  5. package/dest/config.d.ts +35 -17
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +150 -81
  8. package/dest/global_variable_builder/global_builder.d.ts +24 -15
  9. package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
  10. package/dest/global_variable_builder/global_builder.js +63 -44
  11. package/dest/global_variable_builder/index.d.ts +1 -1
  12. package/dest/index.d.ts +2 -4
  13. package/dest/index.d.ts.map +1 -1
  14. package/dest/index.js +1 -3
  15. package/dest/publisher/config.d.ts +48 -27
  16. package/dest/publisher/config.d.ts.map +1 -1
  17. package/dest/publisher/config.js +109 -32
  18. package/dest/publisher/index.d.ts +4 -1
  19. package/dest/publisher/index.d.ts.map +1 -1
  20. package/dest/publisher/index.js +3 -0
  21. package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
  22. package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
  23. package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
  24. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
  25. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
  26. package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
  27. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
  28. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
  29. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
  30. package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
  31. package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
  32. package/dest/publisher/l1_tx_failed_store/index.js +2 -0
  33. package/dest/publisher/sequencer-publisher-factory.d.ts +52 -0
  34. package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -0
  35. package/dest/publisher/sequencer-publisher-factory.js +76 -0
  36. package/dest/publisher/sequencer-publisher-metrics.d.ts +5 -4
  37. package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
  38. package/dest/publisher/sequencer-publisher-metrics.js +34 -62
  39. package/dest/publisher/sequencer-publisher.d.ts +158 -93
  40. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  41. package/dest/publisher/sequencer-publisher.js +1452 -255
  42. package/dest/sequencer/checkpoint_proposal_job.d.ts +100 -0
  43. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
  44. package/dest/sequencer/checkpoint_proposal_job.js +1240 -0
  45. package/dest/sequencer/checkpoint_voter.d.ts +35 -0
  46. package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
  47. package/dest/sequencer/checkpoint_voter.js +109 -0
  48. package/dest/sequencer/config.d.ts +7 -1
  49. package/dest/sequencer/config.d.ts.map +1 -1
  50. package/dest/sequencer/errors.d.ts +11 -0
  51. package/dest/sequencer/errors.d.ts.map +1 -0
  52. package/dest/sequencer/errors.js +15 -0
  53. package/dest/sequencer/events.d.ts +46 -0
  54. package/dest/sequencer/events.d.ts.map +1 -0
  55. package/dest/sequencer/events.js +1 -0
  56. package/dest/sequencer/index.d.ts +4 -2
  57. package/dest/sequencer/index.d.ts.map +1 -1
  58. package/dest/sequencer/index.js +3 -1
  59. package/dest/sequencer/metrics.d.ts +60 -12
  60. package/dest/sequencer/metrics.d.ts.map +1 -1
  61. package/dest/sequencer/metrics.js +283 -67
  62. package/dest/sequencer/sequencer.d.ts +157 -135
  63. package/dest/sequencer/sequencer.d.ts.map +1 -1
  64. package/dest/sequencer/sequencer.js +966 -523
  65. package/dest/sequencer/timetable.d.ts +75 -25
  66. package/dest/sequencer/timetable.d.ts.map +1 -1
  67. package/dest/sequencer/timetable.js +174 -62
  68. package/dest/sequencer/types.d.ts +3 -0
  69. package/dest/sequencer/types.d.ts.map +1 -0
  70. package/dest/sequencer/types.js +1 -0
  71. package/dest/sequencer/utils.d.ts +20 -38
  72. package/dest/sequencer/utils.d.ts.map +1 -1
  73. package/dest/sequencer/utils.js +12 -47
  74. package/dest/test/index.d.ts +9 -3
  75. package/dest/test/index.d.ts.map +1 -1
  76. package/dest/test/index.js +0 -4
  77. package/dest/test/mock_checkpoint_builder.d.ts +99 -0
  78. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
  79. package/dest/test/mock_checkpoint_builder.js +231 -0
  80. package/dest/test/utils.d.ts +53 -0
  81. package/dest/test/utils.d.ts.map +1 -0
  82. package/dest/test/utils.js +104 -0
  83. package/package.json +46 -45
  84. package/src/client/sequencer-client.ts +220 -104
  85. package/src/config.ts +172 -96
  86. package/src/global_variable_builder/global_builder.ts +85 -55
  87. package/src/index.ts +1 -3
  88. package/src/publisher/config.ts +150 -59
  89. package/src/publisher/index.ts +7 -0
  90. package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
  91. package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
  92. package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
  93. package/src/publisher/l1_tx_failed_store/index.ts +3 -0
  94. package/src/publisher/sequencer-publisher-factory.ts +124 -0
  95. package/src/publisher/sequencer-publisher-metrics.ts +33 -63
  96. package/src/publisher/sequencer-publisher.ts +1266 -311
  97. package/src/sequencer/README.md +531 -0
  98. package/src/sequencer/checkpoint_proposal_job.ts +967 -0
  99. package/src/sequencer/checkpoint_voter.ts +130 -0
  100. package/src/sequencer/config.ts +8 -0
  101. package/src/sequencer/errors.ts +21 -0
  102. package/src/sequencer/events.ts +27 -0
  103. package/src/sequencer/index.ts +3 -1
  104. package/src/sequencer/metrics.ts +362 -73
  105. package/src/sequencer/sequencer.ts +712 -586
  106. package/src/sequencer/timetable.ts +224 -64
  107. package/src/sequencer/types.ts +6 -0
  108. package/src/sequencer/utils.ts +28 -60
  109. package/src/test/index.ts +11 -5
  110. package/src/test/mock_checkpoint_builder.ts +323 -0
  111. package/src/test/utils.ts +167 -0
  112. package/dest/sequencer/allowed.d.ts +0 -3
  113. package/dest/sequencer/allowed.d.ts.map +0 -1
  114. package/dest/sequencer/allowed.js +0 -27
  115. package/dest/slasher/factory.d.ts +0 -7
  116. package/dest/slasher/factory.d.ts.map +0 -1
  117. package/dest/slasher/factory.js +0 -8
  118. package/dest/slasher/index.d.ts +0 -3
  119. package/dest/slasher/index.d.ts.map +0 -1
  120. package/dest/slasher/index.js +0 -2
  121. package/dest/slasher/slasher_client.d.ts +0 -75
  122. package/dest/slasher/slasher_client.d.ts.map +0 -1
  123. package/dest/slasher/slasher_client.js +0 -132
  124. package/dest/tx_validator/archive_cache.d.ts +0 -14
  125. package/dest/tx_validator/archive_cache.d.ts.map +0 -1
  126. package/dest/tx_validator/archive_cache.js +0 -22
  127. package/dest/tx_validator/gas_validator.d.ts +0 -14
  128. package/dest/tx_validator/gas_validator.d.ts.map +0 -1
  129. package/dest/tx_validator/gas_validator.js +0 -78
  130. package/dest/tx_validator/nullifier_cache.d.ts +0 -16
  131. package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
  132. package/dest/tx_validator/nullifier_cache.js +0 -24
  133. package/dest/tx_validator/phases_validator.d.ts +0 -12
  134. package/dest/tx_validator/phases_validator.d.ts.map +0 -1
  135. package/dest/tx_validator/phases_validator.js +0 -80
  136. package/dest/tx_validator/test_utils.d.ts +0 -23
  137. package/dest/tx_validator/test_utils.d.ts.map +0 -1
  138. package/dest/tx_validator/test_utils.js +0 -26
  139. package/dest/tx_validator/tx_validator_factory.d.ts +0 -18
  140. package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
  141. package/dest/tx_validator/tx_validator_factory.js +0 -50
  142. package/src/sequencer/allowed.ts +0 -36
  143. package/src/slasher/factory.ts +0 -15
  144. package/src/slasher/index.ts +0 -2
  145. package/src/slasher/slasher_client.ts +0 -193
  146. package/src/tx_validator/archive_cache.ts +0 -28
  147. package/src/tx_validator/gas_validator.ts +0 -101
  148. package/src/tx_validator/nullifier_cache.ts +0 -30
  149. package/src/tx_validator/phases_validator.ts +0 -98
  150. package/src/tx_validator/test_utils.ts +0 -48
  151. package/src/tx_validator/tx_validator_factory.ts +0 -120
package/dest/config.js CHANGED
@@ -1,37 +1,86 @@
1
- import { l1ContractsConfigMappings, l1ReaderConfigMappings } from '@aztec/ethereum';
1
+ import { l1ContractsConfigMappings } from '@aztec/ethereum/config';
2
+ import { l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
2
3
  import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, pickConfigMappings } from '@aztec/foundation/config';
3
4
  import { EthAddress } from '@aztec/foundation/eth-address';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import { FunctionSelector } from '@aztec/stdlib/abi';
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 { getPublisherConfigMappings, getTxSenderConfigMappings } from './publisher/config.js';
8
+ import { 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';
9
12
  export * from './publisher/config.js';
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
+ broadcastInvalidBlockProposal: false,
30
+ injectFakeAttestation: false,
31
+ injectHighSValueAttestation: false,
32
+ injectUnrecoverableSignatureAttestation: false,
33
+ fishermanMode: false,
34
+ shuffleAttestationOrdering: false,
35
+ skipPushProposedBlocksToArchiver: false,
36
+ skipPublishingCheckpointsPercent: 0
37
+ };
10
38
  export const sequencerConfigMappings = {
11
- transactionPollingIntervalMS: {
12
- env: 'SEQ_TX_POLLING_INTERVAL_MS',
13
- description: 'The number of ms to wait between polling for pending txs.',
14
- ...numberConfigHelper(500)
39
+ sequencerPollingIntervalMS: {
40
+ env: 'SEQ_POLLING_INTERVAL_MS',
41
+ description: 'The number of ms to wait between polling for checking to build on the next slot.',
42
+ ...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS)
15
43
  },
16
- maxTxsPerBlock: {
17
- env: 'SEQ_MAX_TX_PER_BLOCK',
18
- description: 'The maximum number of txs to include in a block.',
19
- ...numberConfigHelper(32)
44
+ maxTxsPerCheckpoint: {
45
+ env: 'SEQ_MAX_TX_PER_CHECKPOINT',
46
+ description: 'The maximum number of txs across all blocks in a checkpoint.',
47
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
20
48
  },
21
49
  minTxsPerBlock: {
22
50
  env: 'SEQ_MIN_TX_PER_BLOCK',
23
51
  description: 'The minimum number of txs to include in a block.',
24
- ...numberConfigHelper(1)
52
+ ...numberConfigHelper(DefaultSequencerConfig.minTxsPerBlock)
53
+ },
54
+ minValidTxsPerBlock: {
55
+ description: 'The minimum number of valid txs (after execution) to include in a block. If not set, falls back to minTxsPerBlock.'
56
+ },
57
+ publishTxsWithProposals: {
58
+ env: 'SEQ_PUBLISH_TXS_WITH_PROPOSALS',
59
+ description: 'Whether to publish txs with proposals.',
60
+ ...booleanConfigHelper(DefaultSequencerConfig.publishTxsWithProposals)
25
61
  },
26
62
  maxL2BlockGas: {
27
63
  env: 'SEQ_MAX_L2_BLOCK_GAS',
28
64
  description: 'The maximum L2 block gas.',
29
- ...numberConfigHelper(10e9)
65
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
30
66
  },
31
67
  maxDABlockGas: {
32
68
  env: 'SEQ_MAX_DA_BLOCK_GAS',
33
69
  description: 'The maximum DA block gas.',
34
- ...numberConfigHelper(10e9)
70
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
71
+ },
72
+ perBlockAllocationMultiplier: {
73
+ env: 'SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER',
74
+ 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.',
75
+ ...numberConfigHelper(DefaultSequencerConfig.perBlockAllocationMultiplier)
76
+ },
77
+ redistributeCheckpointBudget: {
78
+ env: 'SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET',
79
+ description: 'Redistribute remaining checkpoint budget evenly across remaining blocks instead of allowing a single block to consume the entire remaining budget.',
80
+ ...booleanConfigHelper(DefaultSequencerConfig.redistributeCheckpointBudget)
81
+ },
82
+ maxBlocksPerCheckpoint: {
83
+ description: 'Computed max number of blocks per checkpoint from timetable.'
35
84
  },
36
85
  coinbase: {
37
86
  env: 'COINBASE',
@@ -51,40 +100,104 @@ export const sequencerConfigMappings = {
51
100
  env: 'ACVM_BINARY_PATH',
52
101
  description: 'The path to the ACVM binary'
53
102
  },
54
- allowedInSetup: {
55
- env: 'SEQ_ALLOWED_SETUP_FN',
56
- parseEnv: (val)=>parseSequencerAllowList(val),
57
- description: 'The list of functions calls allowed to run in setup',
58
- printDefault: ()=>'AuthRegistry, FeeJuice.increase_public_balance, Token.increase_public_balance, FPC.prepare_fee'
59
- },
60
- maxBlockSizeInBytes: {
61
- env: 'SEQ_MAX_BLOCK_SIZE_IN_BYTES',
62
- description: 'Max block size',
63
- ...numberConfigHelper(1024 * 1024)
64
- },
65
103
  enforceTimeTable: {
66
104
  env: 'SEQ_ENFORCE_TIME_TABLE',
67
105
  description: 'Whether to enforce the time table when building blocks',
68
- ...booleanConfigHelper(),
69
- defaultValue: false
106
+ ...booleanConfigHelper(DefaultSequencerConfig.enforceTimeTable)
70
107
  },
71
108
  governanceProposerPayload: {
72
109
  env: 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS',
73
110
  description: 'The address of the payload for the governanceProposer',
74
- parseEnv: (val)=>EthAddress.fromString(val),
75
- defaultValue: EthAddress.ZERO
111
+ parseEnv: (val)=>EthAddress.fromString(val)
76
112
  },
77
- maxL1TxInclusionTimeIntoSlot: {
78
- env: 'SEQ_MAX_L1_TX_INCLUSION_TIME_INTO_SLOT',
79
- description: 'How many seconds into an L1 slot we can still send a tx and get it mined.',
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).',
80
116
  parseEnv: (val)=>val ? parseInt(val, 10) : undefined
81
- }
117
+ },
118
+ attestationPropagationTime: {
119
+ env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
120
+ description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way)',
121
+ ...numberConfigHelper(DefaultSequencerConfig.attestationPropagationTime)
122
+ },
123
+ fakeProcessingDelayPerTxMs: {
124
+ description: 'Used for testing to introduce a fake delay after processing each tx'
125
+ },
126
+ fakeThrowAfterProcessingTxCount: {
127
+ description: 'Used for testing to throw an error after processing N txs'
128
+ },
129
+ secondsBeforeInvalidatingBlockAsCommitteeMember: {
130
+ env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER',
131
+ 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.',
132
+ ...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsCommitteeMember)
133
+ },
134
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: {
135
+ env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER',
136
+ 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.',
137
+ ...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsNonCommitteeMember)
138
+ },
139
+ skipCollectingAttestations: {
140
+ description: 'Whether to skip collecting attestations from validators and only use self-attestations (for testing only)',
141
+ ...booleanConfigHelper(DefaultSequencerConfig.skipCollectingAttestations)
142
+ },
143
+ skipInvalidateBlockAsProposer: {
144
+ description: 'Do not invalidate the previous block if invalid when we are the proposer (for testing only)',
145
+ ...booleanConfigHelper(DefaultSequencerConfig.skipInvalidateBlockAsProposer)
146
+ },
147
+ broadcastInvalidBlockProposal: {
148
+ description: 'Broadcast invalid block proposals with corrupted state (for testing only)',
149
+ ...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidBlockProposal)
150
+ },
151
+ injectFakeAttestation: {
152
+ description: 'Inject a fake attestation (for testing only)',
153
+ ...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation)
154
+ },
155
+ injectHighSValueAttestation: {
156
+ description: 'Inject a malleable attestation with a high-s value (for testing only)',
157
+ ...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation)
158
+ },
159
+ injectUnrecoverableSignatureAttestation: {
160
+ description: 'Inject an attestation with an unrecoverable signature (for testing only)',
161
+ ...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation)
162
+ },
163
+ fishermanMode: {
164
+ env: 'FISHERMAN_MODE',
165
+ description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
166
+ ...booleanConfigHelper(DefaultSequencerConfig.fishermanMode)
167
+ },
168
+ shuffleAttestationOrdering: {
169
+ description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
170
+ ...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering)
171
+ },
172
+ ...sharedSequencerConfigMappings,
173
+ buildCheckpointIfEmpty: {
174
+ env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
175
+ description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
176
+ ...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty)
177
+ },
178
+ skipPushProposedBlocksToArchiver: {
179
+ description: 'Skip pushing proposed blocks to archiver (default: true)',
180
+ ...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver)
181
+ },
182
+ minBlocksForCheckpoint: {
183
+ description: 'Minimum number of blocks required for a checkpoint proposal (test only)'
184
+ },
185
+ skipPublishingCheckpointsPercent: {
186
+ env: 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT',
187
+ description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
188
+ ...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent)
189
+ },
190
+ ...pickConfigMappings(p2pConfigMappings, [
191
+ 'txPublicSetupAllowListExtend'
192
+ ])
82
193
  };
83
194
  export const sequencerClientConfigMappings = {
195
+ ...validatorClientConfigMappings,
84
196
  ...sequencerConfigMappings,
197
+ ...keyStoreConfigMappings,
85
198
  ...l1ReaderConfigMappings,
86
- ...getTxSenderConfigMappings('SEQ'),
87
- ...getPublisherConfigMappings('SEQ'),
199
+ ...sequencerTxSenderConfigMappings,
200
+ ...sequencerPublisherConfigMappings,
88
201
  ...chainConfigMappings,
89
202
  ...pickConfigMappings(l1ContractsConfigMappings, [
90
203
  'ethereumSlotDuration',
@@ -97,47 +210,3 @@ export const sequencerClientConfigMappings = {
97
210
  */ export function getConfigEnvVars() {
98
211
  return getConfigFromMappings(sequencerClientConfigMappings);
99
212
  }
100
- /**
101
- * Parses a string to a list of allowed elements.
102
- * Each encoded is expected to be of one of the following formats
103
- * `I:${address}`
104
- * `I:${address}:${selector}`
105
- * `C:${classId}`
106
- * `C:${classId}:${selector}`
107
- *
108
- * @param value The string to parse
109
- * @returns A list of allowed elements
110
- */ export function parseSequencerAllowList(value) {
111
- const entries = [];
112
- if (!value) {
113
- return entries;
114
- }
115
- for (const val of value.split(',')){
116
- const [typeString, identifierString, selectorString] = val.split(':');
117
- const selector = selectorString !== undefined ? FunctionSelector.fromString(selectorString) : undefined;
118
- if (typeString === 'I') {
119
- if (selector) {
120
- entries.push({
121
- address: AztecAddress.fromString(identifierString),
122
- selector
123
- });
124
- } else {
125
- entries.push({
126
- address: AztecAddress.fromString(identifierString)
127
- });
128
- }
129
- } else if (typeString === 'C') {
130
- if (selector) {
131
- entries.push({
132
- classId: Fr.fromHexString(identifierString),
133
- selector
134
- });
135
- } else {
136
- entries.push({
137
- classId: Fr.fromHexString(identifierString)
138
- });
139
- }
140
- }
141
- }
142
- return entries;
143
- }
@@ -1,32 +1,41 @@
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';
3
+ import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
2
4
  import type { EthAddress } from '@aztec/foundation/eth-address';
3
- import { Fr } from '@aztec/foundation/fields';
4
5
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
+ import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
5
7
  import { GasFees } from '@aztec/stdlib/gas';
6
- import type { GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@aztec/stdlib/tx';
8
+ import type { CheckpointGlobalVariables, GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@aztec/stdlib/tx';
7
9
  import { GlobalVariables } from '@aztec/stdlib/tx';
8
10
  /**
9
11
  * Simple global variables builder.
10
12
  */
11
13
  export declare class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
12
14
  private log;
13
- private rollupContract;
14
- private publicClient;
15
- private ethereumSlotDuration;
16
- constructor(config: L1ReaderConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>);
15
+ private currentMinFees;
16
+ private currentL1BlockNumber;
17
+ private readonly rollupContract;
18
+ private readonly publicClient;
19
+ private readonly ethereumSlotDuration;
20
+ private readonly aztecSlotDuration;
21
+ private readonly l1GenesisTime;
22
+ private chainId;
23
+ private version;
24
+ constructor(config: L1ReaderConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'> & Pick<L1RollupConstants, 'slotDuration' | 'l1GenesisTime'> & {
25
+ rollupVersion: bigint;
26
+ });
27
+ private computeCurrentMinFees;
28
+ getCurrentMinFees(): Promise<GasFees>;
17
29
  /**
18
- * Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
19
- * @returns Base fees for the expected next block
20
- */
21
- getCurrentBaseFees(): Promise<GasFees>;
22
- /**
23
- * Simple builder of global variables that use the minimum time possible.
30
+ * Simple builder of global variables.
24
31
  * @param blockNumber - The block number to build global variables for.
25
32
  * @param coinbase - The address to receive block reward.
26
33
  * @param feeRecipient - The address to receive fees.
27
34
  * @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
28
35
  * @returns The global variables for the given block number.
29
36
  */
30
- buildGlobalVariables(blockNumber: Fr, coinbase: EthAddress, feeRecipient: AztecAddress, slotNumber?: bigint): Promise<GlobalVariables>;
37
+ buildGlobalVariables(blockNumber: BlockNumber, coinbase: EthAddress, feeRecipient: AztecAddress, maybeSlot?: SlotNumber): Promise<GlobalVariables>;
38
+ /** Builds global variables that are constant throughout a checkpoint. */
39
+ buildCheckpointGlobalVariables(coinbase: EthAddress, feeRecipient: AztecAddress, slotNumber: S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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;;GAEG;AACH,qBAAa,qBAAsB,YAAW,8BAA8B;IAC1E,OAAO,CAAC,GAAG,CAAqD;IAEhE,OAAO,CAAC,cAAc,CAA4D;IAClF,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,oBAAoB,CAAS;gBAEzB,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IAoBpF;;;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
+ {"version":3,"file":"global_builder.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/global_builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAA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Q,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,yBAAyB,CAAC,CAapC;CACF"}
@@ -1,79 +1,98 @@
1
- import { createEthereumChain } from '@aztec/ethereum';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { createEthereumChain } from '@aztec/ethereum/chain';
2
+ import { makeL1HttpTransport } from '@aztec/ethereum/client';
3
+ import { RollupContract } from '@aztec/ethereum/contracts';
4
+ import { SlotNumber } from '@aztec/foundation/branded-types';
5
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
6
  import { createLogger } from '@aztec/foundation/log';
4
- import { RollupAbi } from '@aztec/l1-artifacts';
7
+ import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
5
8
  import { GasFees } from '@aztec/stdlib/gas';
6
9
  import { GlobalVariables } from '@aztec/stdlib/tx';
7
- import { createPublicClient, fallback, getAddress, getContract, http } from 'viem';
10
+ import { createPublicClient } from 'viem';
8
11
  /**
9
12
  * Simple global variables builder.
10
13
  */ export class GlobalVariableBuilder {
11
14
  log = createLogger('sequencer:global_variable_builder');
15
+ currentMinFees = Promise.resolve(new GasFees(0, 0));
16
+ currentL1BlockNumber = undefined;
12
17
  rollupContract;
13
18
  publicClient;
14
19
  ethereumSlotDuration;
20
+ aztecSlotDuration;
21
+ l1GenesisTime;
22
+ chainId;
23
+ version;
15
24
  constructor(config){
16
25
  const { l1RpcUrls, l1ChainId: chainId, l1Contracts } = config;
17
26
  const chain = createEthereumChain(l1RpcUrls, chainId);
27
+ this.version = new Fr(config.rollupVersion);
28
+ this.chainId = new Fr(chainId);
18
29
  this.ethereumSlotDuration = config.ethereumSlotDuration;
30
+ this.aztecSlotDuration = config.slotDuration;
31
+ this.l1GenesisTime = config.l1GenesisTime;
19
32
  this.publicClient = createPublicClient({
20
33
  chain: chain.chainInfo,
21
- transport: fallback(chain.rpcUrls.map((url)=>http(url))),
34
+ transport: makeL1HttpTransport(chain.rpcUrls, {
35
+ timeout: config.l1HttpTimeoutMS
36
+ }),
22
37
  pollingInterval: config.viemPollingIntervalMS
23
38
  });
24
- this.rollupContract = getContract({
25
- address: getAddress(l1Contracts.rollupAddress.toString()),
26
- abi: RollupAbi,
27
- client: this.publicClient
28
- });
39
+ this.rollupContract = new RollupContract(this.publicClient, l1Contracts.rollupAddress);
29
40
  }
30
41
  /**
31
- * Computes the "current" base fees, e.g., the price that you currently should pay to get include in the next block
32
- * @returns Base fees for the expected next block
33
- */ async getCurrentBaseFees() {
42
+ * Computes the "current" min fees, e.g., the price that you currently should pay to get include in the next block
43
+ * @returns Min fees for the next block
44
+ */ async computeCurrentMinFees() {
34
45
  // Since this might be called in the middle of a slot where a block might have been published,
35
46
  // we need to fetch the last block written, and estimate the earliest timestamp for the next block.
36
47
  // 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
- ]);
48
+ const lastCheckpoint = await this.rollupContract.getPendingCheckpoint();
49
+ const earliestTimestamp = await this.rollupContract.getTimestampForSlot(SlotNumber.fromBigInt(BigInt(lastCheckpoint.slotNumber) + 1n));
43
50
  const nextEthTimestamp = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
44
51
  const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
45
- return new GasFees(Fr.ZERO, new Fr(await this.rollupContract.read.getManaBaseFeeAt([
46
- timestamp,
47
- true
48
- ])));
52
+ return new GasFees(0, await this.rollupContract.getManaMinFeeAt(timestamp, true));
53
+ }
54
+ async getCurrentMinFees() {
55
+ // Get the current block number
56
+ const blockNumber = await this.publicClient.getBlockNumber();
57
+ // If the L1 block number has changed then chain a new promise to get the current min fees
58
+ if (this.currentL1BlockNumber === undefined || blockNumber > this.currentL1BlockNumber) {
59
+ this.currentL1BlockNumber = blockNumber;
60
+ this.currentMinFees = this.currentMinFees.then(()=>this.computeCurrentMinFees());
61
+ }
62
+ return this.currentMinFees;
49
63
  }
50
64
  /**
51
- * Simple builder of global variables that use the minimum time possible.
65
+ * Simple builder of global variables.
52
66
  * @param blockNumber - The block number to build global variables for.
53
67
  * @param coinbase - The address to receive block reward.
54
68
  * @param feeRecipient - The address to receive fees.
55
69
  * @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
56
70
  * @returns The global variables for the given block number.
57
- */ async buildGlobalVariables(blockNumber, coinbase, feeRecipient, slotNumber) {
58
- const version = new Fr(await this.rollupContract.read.getVersion());
59
- const chainId = new Fr(this.publicClient.chain.id);
60
- if (slotNumber === undefined) {
61
- const ts = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
62
- slotNumber = await this.rollupContract.read.getSlotAt([
63
- ts
64
- ]);
65
- }
66
- const timestamp = await this.rollupContract.read.getTimestampForSlot([
67
- slotNumber
68
- ]);
69
- const slotFr = new Fr(slotNumber);
70
- const timestampFr = new Fr(timestamp);
71
- // 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([
71
+ */ async buildGlobalVariables(blockNumber, coinbase, feeRecipient, maybeSlot) {
72
+ const slot = maybeSlot ?? await this.rollupContract.getSlotAt(BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration)));
73
+ const checkpointGlobalVariables = await this.buildCheckpointGlobalVariables(coinbase, feeRecipient, slot);
74
+ return GlobalVariables.from({
75
+ blockNumber,
76
+ ...checkpointGlobalVariables
77
+ });
78
+ }
79
+ /** Builds global variables that are constant throughout a checkpoint. */ async buildCheckpointGlobalVariables(coinbase, feeRecipient, slotNumber) {
80
+ const { chainId, version } = this;
81
+ const timestamp = getTimestampForSlot(slotNumber, {
82
+ slotDuration: this.aztecSlotDuration,
83
+ l1GenesisTime: this.l1GenesisTime
84
+ });
85
+ // We can skip much of the logic in getCurrentMinFees since it we already check that we are not within a slot elsewhere.
86
+ // TODO(palla/mbps): Can we use a cached value here?
87
+ const gasFees = new GasFees(0, await this.rollupContract.getManaMinFeeAt(timestamp, true));
88
+ return {
89
+ chainId,
90
+ version,
91
+ slotNumber,
73
92
  timestamp,
74
- true
75
- ])));
76
- const globalVariables = new GlobalVariables(chainId, version, blockNumber, slotFr, timestampFr, coinbase, feeRecipient, gasFees);
77
- return globalVariables;
93
+ coinbase,
94
+ feeRecipient,
95
+ gasFees
96
+ };
78
97
  }
79
98
  }
@@ -1,2 +1,2 @@
1
1
  export { GlobalVariableBuilder } from './global_builder.js';
2
- //# sourceMappingURL=index.d.ts.map
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9nbG9iYWxfdmFyaWFibGVfYnVpbGRlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQyJ9
package/dest/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  export * from './client/index.js';
2
2
  export * from './config.js';
3
3
  export * from './publisher/index.js';
4
- export * from './tx_validator/tx_validator_factory.js';
5
- export * from './slasher/index.js';
6
- export { Sequencer, SequencerState, getDefaultAllowedSetupFunctions } from './sequencer/index.js';
4
+ export { Sequencer, SequencerState, type SequencerEvents } from './sequencer/index.js';
7
5
  export * from './global_variable_builder/index.js';
8
- //# sourceMappingURL=index.d.ts.map
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsT0FBTyxFQUFFLFNBQVMsRUFBRSxjQUFjLEVBQUUsS0FBSyxlQUFlLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUl2RixjQUFjLG9DQUFvQyxDQUFDIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wCAAwC,CAAC;AACvD,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAIlG,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvF,cAAc,oCAAoC,CAAC"}
package/dest/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  export * from './client/index.js';
2
2
  export * from './config.js';
3
3
  export * from './publisher/index.js';
4
- export * from './tx_validator/tx_validator_factory.js';
5
- export * from './slasher/index.js';
6
- export { Sequencer, SequencerState, getDefaultAllowedSetupFunctions } from './sequencer/index.js';
4
+ export { Sequencer, SequencerState } from './sequencer/index.js';
7
5
  // Used by the node to simulate public parts of transactions. Should these be moved to a shared library?
8
6
  // ISSUE(#9832)
9
7
  export * from './global_variable_builder/index.js';
@@ -1,31 +1,52 @@
1
- import { type BlobSinkConfig } from '@aztec/blob-sink/client';
2
- import { type L1ReaderConfig, type L1TxUtilsConfig } from '@aztec/ethereum';
3
- import { type ConfigMappingsType } from '@aztec/foundation/config';
1
+ import { type BlobClientConfig } from '@aztec/blob-client/client/config';
2
+ import { type L1ReaderConfig } from '@aztec/ethereum/l1-reader';
3
+ import { type L1TxUtilsConfig } from '@aztec/ethereum/l1-tx-utils/config';
4
+ import { type ConfigMappingsType, SecretValue } from '@aztec/foundation/config';
4
5
  import { EthAddress } from '@aztec/foundation/eth-address';
5
- /**
6
- * The configuration of the rollup transaction publisher.
7
- */
6
+ /** Configuration of the transaction publisher. */
8
7
  export type TxSenderConfig = L1ReaderConfig & {
9
- /**
10
- * The private key to be used by the publisher.
11
- */
12
- publisherPrivateKey: `0x${string}`;
13
- /**
14
- * The address of the custom forwarder contract.
15
- */
16
- customForwarderContractAddress: EthAddress;
8
+ /** The private key to be used by the publisher. */
9
+ publisherPrivateKeys?: SecretValue<`0x${string}`>[];
10
+ /** Publisher addresses to be used with a remote signer */
11
+ publisherAddresses?: EthAddress[];
17
12
  };
18
- /**
19
- * Configuration of the L1Publisher.
20
- */
21
- export type PublisherConfig = L1TxUtilsConfig & BlobSinkConfig & {
22
- /**
23
- * The interval to wait between publish retries.
24
- */
25
- l1PublishRetryIntervalMS: number;
13
+ export type ProverTxSenderConfig = L1ReaderConfig & {
14
+ proverPublisherPrivateKeys?: SecretValue<`0x${string}`>[];
15
+ proverPublisherAddresses?: EthAddress[];
26
16
  };
27
- export declare const getTxSenderConfigMappings: (scope: 'PROVER' | 'SEQ') => ConfigMappingsType<Omit<TxSenderConfig, 'l1Contracts'>>;
28
- export declare function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'>;
29
- export declare const getPublisherConfigMappings: (scope: 'PROVER' | 'SEQ') => ConfigMappingsType<PublisherConfig & L1TxUtilsConfig>;
30
- export declare function getPublisherConfigFromEnv(scope: 'PROVER' | 'SEQ'): PublisherConfig;
31
- //# sourceMappingURL=config.d.ts.map
17
+ export type SequencerTxSenderConfig = L1ReaderConfig & {
18
+ sequencerPublisherPrivateKeys?: SecretValue<`0x${string}`>[];
19
+ sequencerPublisherAddresses?: EthAddress[];
20
+ };
21
+ export declare function getTxSenderConfigFromProverConfig(config: ProverTxSenderConfig): TxSenderConfig;
22
+ export declare function getTxSenderConfigFromSequencerConfig(config: SequencerTxSenderConfig): TxSenderConfig;
23
+ /** Configuration of the L1Publisher. */
24
+ export type PublisherConfig = L1TxUtilsConfig & BlobClientConfig & {
25
+ /** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
26
+ publisherAllowInvalidStates?: boolean;
27
+ /** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1 */
28
+ fishermanMode?: boolean;
29
+ /** Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only) */
30
+ publisherForwarderAddress?: EthAddress;
31
+ /** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
32
+ l1TxFailedStore?: string;
33
+ };
34
+ export type ProverPublisherConfig = L1TxUtilsConfig & BlobClientConfig & {
35
+ fishermanMode?: boolean;
36
+ proverPublisherAllowInvalidStates?: boolean;
37
+ proverPublisherForwarderAddress?: EthAddress;
38
+ };
39
+ export type SequencerPublisherConfig = L1TxUtilsConfig & BlobClientConfig & {
40
+ fishermanMode?: boolean;
41
+ sequencerPublisherAllowInvalidStates?: boolean;
42
+ sequencerPublisherForwarderAddress?: EthAddress;
43
+ /** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
44
+ l1TxFailedStore?: string;
45
+ };
46
+ export declare function getPublisherConfigFromProverConfig(config: ProverPublisherConfig): PublisherConfig;
47
+ export declare function getPublisherConfigFromSequencerConfig(config: SequencerPublisherConfig): PublisherConfig;
48
+ export declare const proverTxSenderConfigMappings: ConfigMappingsType<Omit<ProverTxSenderConfig, 'l1Contracts'>>;
49
+ export declare const sequencerTxSenderConfigMappings: ConfigMappingsType<Omit<SequencerTxSenderConfig, 'l1Contracts'>>;
50
+ export declare const sequencerPublisherConfigMappings: ConfigMappingsType<SequencerPublisherConfig & L1TxUtilsConfig>;
51
+ export declare const proverPublisherConfigMappings: ConfigMappingsType<ProverPublisherConfig & L1TxUtilsConfig>;
52
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHVibGlzaGVyL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBMkIsTUFBTSxrQ0FBa0MsQ0FBQztBQUNsRyxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQTBCLE1BQU0sMkJBQTJCLENBQUM7QUFDeEYsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUEyQixNQUFNLG9DQUFvQyxDQUFDO0FBQ25HLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFFLFdBQVcsRUFBdUIsTUFBTSwwQkFBMEIsQ0FBQztBQUNyRyxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFFM0Qsa0RBQWtEO0FBQ2xELE1BQU0sTUFBTSxjQUFjLEdBQUcsY0FBYyxHQUFHO0lBQzVDLG1EQUFtRDtJQUNuRCxvQkFBb0IsQ0FBQyxFQUFFLFdBQVcsQ0FBQyxLQUFLLE1BQU0sRUFBRSxDQUFDLEVBQUUsQ0FBQztJQUVwRCwwREFBMEQ7SUFDMUQsa0JBQWtCLENBQUMsRUFBRSxVQUFVLEVBQUUsQ0FBQztDQUNuQyxDQUFDO0FBRUYsTUFBTSxNQUFNLG9CQUFvQixHQUFHLGNBQWMsR0FBRztJQUNsRCwwQkFBMEIsQ0FBQyxFQUFFLFdBQVcsQ0FBQyxLQUFLLE1BQU0sRUFBRSxDQUFDLEVBQUUsQ0FBQztJQUMxRCx3Qk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