@aztec/sequencer-client 0.0.1-commit.fce3e4f → 0.0.1-commit.ffe5b04ea

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 (115) hide show
  1. package/dest/client/sequencer-client.d.ts +32 -16
  2. package/dest/client/sequencer-client.d.ts.map +1 -1
  3. package/dest/client/sequencer-client.js +118 -28
  4. package/dest/config.d.ts +33 -8
  5. package/dest/config.d.ts.map +1 -1
  6. package/dest/config.js +99 -44
  7. package/dest/global_variable_builder/global_builder.d.ts +20 -13
  8. package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
  9. package/dest/global_variable_builder/global_builder.js +51 -41
  10. package/dest/index.d.ts +2 -3
  11. package/dest/index.d.ts.map +1 -1
  12. package/dest/index.js +1 -2
  13. package/dest/publisher/config.d.ts +41 -20
  14. package/dest/publisher/config.d.ts.map +1 -1
  15. package/dest/publisher/config.js +109 -39
  16. package/dest/publisher/index.d.ts +2 -1
  17. package/dest/publisher/index.d.ts.map +1 -1
  18. package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
  19. package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
  20. package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
  21. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
  22. package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
  23. package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
  24. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
  25. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
  26. package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
  27. package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
  28. package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
  29. package/dest/publisher/l1_tx_failed_store/index.js +2 -0
  30. package/dest/publisher/sequencer-publisher-factory.d.ts +15 -6
  31. package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
  32. package/dest/publisher/sequencer-publisher-factory.js +28 -3
  33. package/dest/publisher/sequencer-publisher-metrics.d.ts +3 -3
  34. package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
  35. package/dest/publisher/sequencer-publisher-metrics.js +23 -86
  36. package/dest/publisher/sequencer-publisher.d.ts +73 -47
  37. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  38. package/dest/publisher/sequencer-publisher.js +888 -146
  39. package/dest/sequencer/checkpoint_proposal_job.d.ts +100 -0
  40. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
  41. package/dest/sequencer/checkpoint_proposal_job.js +1244 -0
  42. package/dest/sequencer/checkpoint_voter.d.ts +35 -0
  43. package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
  44. package/dest/sequencer/checkpoint_voter.js +109 -0
  45. package/dest/sequencer/config.d.ts +3 -2
  46. package/dest/sequencer/config.d.ts.map +1 -1
  47. package/dest/sequencer/events.d.ts +46 -0
  48. package/dest/sequencer/events.d.ts.map +1 -0
  49. package/dest/sequencer/events.js +1 -0
  50. package/dest/sequencer/index.d.ts +4 -2
  51. package/dest/sequencer/index.d.ts.map +1 -1
  52. package/dest/sequencer/index.js +3 -1
  53. package/dest/sequencer/metrics.d.ts +38 -6
  54. package/dest/sequencer/metrics.d.ts.map +1 -1
  55. package/dest/sequencer/metrics.js +216 -72
  56. package/dest/sequencer/sequencer.d.ts +122 -133
  57. package/dest/sequencer/sequencer.d.ts.map +1 -1
  58. package/dest/sequencer/sequencer.js +717 -625
  59. package/dest/sequencer/timetable.d.ts +54 -16
  60. package/dest/sequencer/timetable.d.ts.map +1 -1
  61. package/dest/sequencer/timetable.js +147 -62
  62. package/dest/sequencer/types.d.ts +6 -0
  63. package/dest/sequencer/types.d.ts.map +1 -0
  64. package/dest/sequencer/types.js +1 -0
  65. package/dest/sequencer/utils.d.ts +14 -8
  66. package/dest/sequencer/utils.d.ts.map +1 -1
  67. package/dest/sequencer/utils.js +7 -4
  68. package/dest/test/index.d.ts +6 -7
  69. package/dest/test/index.d.ts.map +1 -1
  70. package/dest/test/mock_checkpoint_builder.d.ts +95 -0
  71. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
  72. package/dest/test/mock_checkpoint_builder.js +231 -0
  73. package/dest/test/utils.d.ts +53 -0
  74. package/dest/test/utils.d.ts.map +1 -0
  75. package/dest/test/utils.js +104 -0
  76. package/package.json +32 -30
  77. package/src/client/sequencer-client.ts +158 -52
  78. package/src/config.ts +114 -54
  79. package/src/global_variable_builder/global_builder.ts +65 -61
  80. package/src/index.ts +1 -7
  81. package/src/publisher/config.ts +131 -50
  82. package/src/publisher/index.ts +3 -0
  83. package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
  84. package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
  85. package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
  86. package/src/publisher/l1_tx_failed_store/index.ts +3 -0
  87. package/src/publisher/sequencer-publisher-factory.ts +43 -10
  88. package/src/publisher/sequencer-publisher-metrics.ts +19 -71
  89. package/src/publisher/sequencer-publisher.ts +587 -191
  90. package/src/sequencer/README.md +531 -0
  91. package/src/sequencer/checkpoint_proposal_job.ts +960 -0
  92. package/src/sequencer/checkpoint_voter.ts +130 -0
  93. package/src/sequencer/config.ts +2 -1
  94. package/src/sequencer/events.ts +27 -0
  95. package/src/sequencer/index.ts +3 -1
  96. package/src/sequencer/metrics.ts +268 -82
  97. package/src/sequencer/sequencer.ts +464 -831
  98. package/src/sequencer/timetable.ts +178 -83
  99. package/src/sequencer/types.ts +9 -0
  100. package/src/sequencer/utils.ts +18 -9
  101. package/src/test/index.ts +5 -6
  102. package/src/test/mock_checkpoint_builder.ts +323 -0
  103. package/src/test/utils.ts +167 -0
  104. package/dest/sequencer/block_builder.d.ts +0 -27
  105. package/dest/sequencer/block_builder.d.ts.map +0 -1
  106. package/dest/sequencer/block_builder.js +0 -134
  107. package/dest/tx_validator/nullifier_cache.d.ts +0 -14
  108. package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
  109. package/dest/tx_validator/nullifier_cache.js +0 -24
  110. package/dest/tx_validator/tx_validator_factory.d.ts +0 -17
  111. package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
  112. package/dest/tx_validator/tx_validator_factory.js +0 -53
  113. package/src/sequencer/block_builder.ts +0 -222
  114. package/src/tx_validator/nullifier_cache.ts +0 -30
  115. package/src/tx_validator/tx_validator_factory.ts +0 -132
package/dest/config.js CHANGED
@@ -1,44 +1,77 @@
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 { 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 { 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: 2,
22
+ enforceTimeTable: true,
23
+ attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
24
+ secondsBeforeInvalidatingBlockAsCommitteeMember: 144,
25
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432,
26
+ skipCollectingAttestations: false,
27
+ skipInvalidateBlockAsProposer: false,
28
+ broadcastInvalidBlockProposal: false,
29
+ injectFakeAttestation: false,
30
+ injectHighSValueAttestation: false,
31
+ injectUnrecoverableSignatureAttestation: false,
32
+ fishermanMode: false,
33
+ shuffleAttestationOrdering: false,
34
+ skipPushProposedBlocksToArchiver: false,
35
+ skipPublishingCheckpointsPercent: 0
36
+ };
12
37
  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)
17
- },
18
- maxTxsPerBlock: {
19
- env: 'SEQ_MAX_TX_PER_BLOCK',
20
- description: 'The maximum number of txs to include in a block.',
21
- ...numberConfigHelper(32)
38
+ sequencerPollingIntervalMS: {
39
+ env: 'SEQ_POLLING_INTERVAL_MS',
40
+ description: 'The number of ms to wait between polling for checking to build on the next slot.',
41
+ ...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS)
42
+ },
43
+ maxTxsPerCheckpoint: {
44
+ env: 'SEQ_MAX_TX_PER_CHECKPOINT',
45
+ description: 'The maximum number of txs across all blocks in a checkpoint.',
46
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
22
47
  },
23
48
  minTxsPerBlock: {
24
49
  env: 'SEQ_MIN_TX_PER_BLOCK',
25
50
  description: 'The minimum number of txs to include in a block.',
26
- ...numberConfigHelper(1)
51
+ ...numberConfigHelper(DefaultSequencerConfig.minTxsPerBlock)
52
+ },
53
+ minValidTxsPerBlock: {
54
+ description: 'The minimum number of valid txs (after execution) to include in a block. If not set, falls back to minTxsPerBlock.'
27
55
  },
28
56
  publishTxsWithProposals: {
29
57
  env: 'SEQ_PUBLISH_TXS_WITH_PROPOSALS',
30
58
  description: 'Whether to publish txs with proposals.',
31
- ...booleanConfigHelper(false)
59
+ ...booleanConfigHelper(DefaultSequencerConfig.publishTxsWithProposals)
32
60
  },
33
61
  maxL2BlockGas: {
34
62
  env: 'SEQ_MAX_L2_BLOCK_GAS',
35
63
  description: 'The maximum L2 block gas.',
36
- ...numberConfigHelper(10e9)
64
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
37
65
  },
38
66
  maxDABlockGas: {
39
67
  env: 'SEQ_MAX_DA_BLOCK_GAS',
40
68
  description: 'The maximum DA block gas.',
41
- ...numberConfigHelper(10e9)
69
+ parseEnv: (val)=>val ? parseInt(val, 10) : undefined
70
+ },
71
+ perBlockAllocationMultiplier: {
72
+ env: 'SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER',
73
+ 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.',
74
+ ...numberConfigHelper(DefaultSequencerConfig.perBlockAllocationMultiplier)
42
75
  },
43
76
  coinbase: {
44
77
  env: 'COINBASE',
@@ -58,73 +91,95 @@ export const sequencerConfigMappings = {
58
91
  env: 'ACVM_BINARY_PATH',
59
92
  description: 'The path to the ACVM binary'
60
93
  },
61
- maxBlockSizeInBytes: {
62
- env: 'SEQ_MAX_BLOCK_SIZE_IN_BYTES',
63
- description: 'Max block size',
64
- ...numberConfigHelper(1024 * 1024)
65
- },
66
94
  enforceTimeTable: {
67
95
  env: 'SEQ_ENFORCE_TIME_TABLE',
68
96
  description: 'Whether to enforce the time table when building blocks',
69
- ...booleanConfigHelper(),
70
- defaultValue: true
97
+ ...booleanConfigHelper(DefaultSequencerConfig.enforceTimeTable)
71
98
  },
72
99
  governanceProposerPayload: {
73
100
  env: 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS',
74
101
  description: 'The address of the payload for the governanceProposer',
75
- parseEnv: (val)=>EthAddress.fromString(val),
76
- defaultValue: EthAddress.ZERO
102
+ parseEnv: (val)=>EthAddress.fromString(val)
77
103
  },
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.',
104
+ l1PublishingTime: {
105
+ env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
106
+ description: 'How much time (in seconds) we allow in the slot for publishing the L1 tx (defaults to 1 L1 slot).',
81
107
  parseEnv: (val)=>val ? parseInt(val, 10) : undefined
82
108
  },
83
109
  attestationPropagationTime: {
84
110
  env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
85
111
  description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way)',
86
- ...numberConfigHelper(DEFAULT_ATTESTATION_PROPAGATION_TIME)
112
+ ...numberConfigHelper(DefaultSequencerConfig.attestationPropagationTime)
87
113
  },
88
114
  fakeProcessingDelayPerTxMs: {
89
115
  description: 'Used for testing to introduce a fake delay after processing each tx'
90
116
  },
117
+ fakeThrowAfterProcessingTxCount: {
118
+ description: 'Used for testing to throw an error after processing N txs'
119
+ },
91
120
  secondsBeforeInvalidatingBlockAsCommitteeMember: {
92
121
  env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_COMMITTEE_MEMBER',
93
122
  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)
123
+ ...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsCommitteeMember)
95
124
  },
96
125
  secondsBeforeInvalidatingBlockAsNonCommitteeMember: {
97
126
  env: 'SEQ_SECONDS_BEFORE_INVALIDATING_BLOCK_AS_NON_COMMITTEE_MEMBER',
98
127
  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)
128
+ ...numberConfigHelper(DefaultSequencerConfig.secondsBeforeInvalidatingBlockAsNonCommitteeMember)
100
129
  },
101
130
  skipCollectingAttestations: {
102
131
  description: 'Whether to skip collecting attestations from validators and only use self-attestations (for testing only)',
103
- ...booleanConfigHelper(false)
132
+ ...booleanConfigHelper(DefaultSequencerConfig.skipCollectingAttestations)
104
133
  },
105
134
  skipInvalidateBlockAsProposer: {
106
135
  description: 'Do not invalidate the previous block if invalid when we are the proposer (for testing only)',
107
- ...booleanConfigHelper(false)
136
+ ...booleanConfigHelper(DefaultSequencerConfig.skipInvalidateBlockAsProposer)
108
137
  },
109
138
  broadcastInvalidBlockProposal: {
110
139
  description: 'Broadcast invalid block proposals with corrupted state (for testing only)',
111
- ...booleanConfigHelper(false)
140
+ ...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidBlockProposal)
112
141
  },
113
142
  injectFakeAttestation: {
114
143
  description: 'Inject a fake attestation (for testing only)',
115
- ...booleanConfigHelper(false)
144
+ ...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation)
145
+ },
146
+ injectHighSValueAttestation: {
147
+ description: 'Inject a malleable attestation with a high-s value (for testing only)',
148
+ ...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation)
149
+ },
150
+ injectUnrecoverableSignatureAttestation: {
151
+ description: 'Inject an attestation with an unrecoverable signature (for testing only)',
152
+ ...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation)
116
153
  },
117
154
  fishermanMode: {
118
155
  env: 'FISHERMAN_MODE',
119
156
  description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
120
- ...booleanConfigHelper(false)
157
+ ...booleanConfigHelper(DefaultSequencerConfig.fishermanMode)
121
158
  },
122
159
  shuffleAttestationOrdering: {
123
160
  description: 'Shuffle attestation ordering to create invalid ordering (for testing only)',
124
- ...booleanConfigHelper(false)
161
+ ...booleanConfigHelper(DefaultSequencerConfig.shuffleAttestationOrdering)
162
+ },
163
+ ...sharedSequencerConfigMappings,
164
+ buildCheckpointIfEmpty: {
165
+ env: 'SEQ_BUILD_CHECKPOINT_IF_EMPTY',
166
+ description: 'Have sequencer build and publish an empty checkpoint if there are no txs',
167
+ ...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty)
168
+ },
169
+ skipPushProposedBlocksToArchiver: {
170
+ description: 'Skip pushing proposed blocks to archiver (default: true)',
171
+ ...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver)
172
+ },
173
+ minBlocksForCheckpoint: {
174
+ description: 'Minimum number of blocks required for a checkpoint proposal (test only)'
175
+ },
176
+ skipPublishingCheckpointsPercent: {
177
+ env: 'SEQ_SKIP_CHECKPOINT_PUBLISH_PERCENT',
178
+ description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
179
+ ...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent)
125
180
  },
126
181
  ...pickConfigMappings(p2pConfigMappings, [
127
- 'txPublicSetupAllowList'
182
+ 'txPublicSetupAllowListExtend'
128
183
  ])
129
184
  };
130
185
  export const sequencerClientConfigMappings = {
@@ -132,8 +187,8 @@ export const sequencerClientConfigMappings = {
132
187
  ...sequencerConfigMappings,
133
188
  ...keyStoreConfigMappings,
134
189
  ...l1ReaderConfigMappings,
135
- ...getTxSenderConfigMappings('SEQ'),
136
- ...getPublisherConfigMappings('SEQ'),
190
+ ...sequencerTxSenderConfigMappings,
191
+ ...sequencerPublisherConfigMappings,
137
192
  ...chainConfigMappings,
138
193
  ...pickConfigMappings(l1ContractsConfigMappings, [
139
194
  'ethereumSlotDuration',
@@ -1,34 +1,41 @@
1
- import { type L1ContractsConfig, type L1ReaderConfig } from '@aztec/ethereum';
2
- import { SlotNumber } from '@aztec/foundation/branded-types';
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';
3
4
  import type { EthAddress } from '@aztec/foundation/eth-address';
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 currentBaseFees;
15
+ private currentMinFees;
14
16
  private currentL1BlockNumber;
15
17
  private readonly rollupContract;
16
18
  private readonly publicClient;
17
19
  private readonly ethereumSlotDuration;
18
- private chainId?;
19
- private version?;
20
- constructor(config: L1ReaderConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>);
21
- private computeCurrentBaseFees;
22
- getCurrentBaseFees(): Promise<GasFees>;
23
- getGlobalConstantVariables(): Promise<Pick<GlobalVariables, 'chainId' | 'version'>>;
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>;
24
29
  /**
25
- * Simple builder of global variables that use the minimum time possible.
30
+ * Simple builder of global variables.
26
31
  * @param blockNumber - The block number to build global variables for.
27
32
  * @param coinbase - The address to receive block reward.
28
33
  * @param feeRecipient - The address to receive fees.
29
34
  * @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
30
35
  * @returns The global variables for the given block number.
31
36
  */
32
- buildGlobalVariables(blockNumber: number, coinbase: EthAddress, feeRecipient: AztecAddress, slotNumber?: SlotNumber): 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: SlotNumber): Promise<CheckpointGlobalVariables>;
33
40
  }
34
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2xvYmFsX2J1aWxkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9nbG9iYWxfdmFyaWFibGVfYnVpbGRlci9nbG9iYWxfYnVpbGRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsS0FBSyxpQkFBaUIsRUFDdEIsS0FBSyxjQUFjLEVBSXBCLE1BQU0saUJBQWlCLENBQUM7QUFDekIsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBR2hFLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUM1QyxPQUFPLEtB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QyxZQUFZLENBQW1CO0lBQ2hELE9BQU8sQ0FBQyxRQUFRLENBQUMsb0JBQW9CLENBQVM7SUFDOUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxpQkFBaUIsQ0FBUztJQUMzQyxPQUFPLENBQUMsUUFBUSxDQUFDLGFBQWEsQ0FBUztJQUV2QyxPQUFPLENBQUMsT0FBTyxDQUFLO0lBQ3BCLE9BQU8sQ0FBQyxPQUFPLENBQUs7SUFFcEIsWUFDRSxNQUFNLEVBQUUsY0FBYyxHQUNwQixJQUFJLENBQUMsaUJBQWlCLEVBQUUsc0JBQXNCLENBQUMsR0FDL0MsSUFBSSxDQUFDLGlCQUFpQixFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUMsR0FBRztRQUFFLGFBQWEsRUFBRSxNQUFNLENBQUE7S0FBRSxFQW9CeEY7WUFNYSxxQkFBcUI7SUFldEIsaUJBQWlCLElBQUksT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQVVqRDtJQUVEOzs7Ozs7O09BT0c7SUFDVSxvQkFBb0IsQ0FDL0IsV0FBVyxFQUFFLFdBQVcsRUFDeEIsUUFBUSxFQUFFLFVBQVUsRUFDcEIsWUFBWSxFQUFFLFlBQVksRUFDMUIsU0FBUyxDQUFDLEVBQUUsVUFBVSxHQUNyQixPQUFPLENBQUMsZUFBZSxDQUFDLENBUzFCO0lBRUQseUVBQXlFO0lBQzVELDhCQUE4QixDQUN6QyxRQUFRLEVBQUUsVUFBVSxFQUNwQixZQUFZLEVBQUUsWUFBWSxFQUMxQixVQUFVLEVBQUUsVUFBVSxHQUNyQixPQUFPLENBQUMseUJBQXlCLENBQUMsQ0FhcEM7Q0FDRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"global_builder.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/global_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAIpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,E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/B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,SAAS,CAAC,EAAE,UAAU,GACrB,OAAO,CAAC,eAAe,CAAC,CAS1B;IAED,yEAAyE;IAC5D,8BAA8B,CACzC,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,yBAAyB,CAAC,CAapC;CACF"}
@@ -1,7 +1,9 @@
1
- import { RollupContract, createEthereumChain } from '@aztec/ethereum';
1
+ import { createEthereumChain } from '@aztec/ethereum/chain';
2
+ import { RollupContract } from '@aztec/ethereum/contracts';
2
3
  import { SlotNumber } from '@aztec/foundation/branded-types';
3
- import { Fr } from '@aztec/foundation/fields';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
5
  import { createLogger } from '@aztec/foundation/log';
6
+ import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
5
7
  import { GasFees } from '@aztec/stdlib/gas';
6
8
  import { GlobalVariables } from '@aztec/stdlib/tx';
7
9
  import { createPublicClient, fallback, http } from 'viem';
@@ -9,79 +11,87 @@ import { createPublicClient, fallback, http } from 'viem';
9
11
  * Simple global variables builder.
10
12
  */ export class GlobalVariableBuilder {
11
13
  log = createLogger('sequencer:global_variable_builder');
12
- currentBaseFees = Promise.resolve(new GasFees(0, 0));
14
+ currentMinFees = Promise.resolve(new GasFees(0, 0));
13
15
  currentL1BlockNumber = undefined;
14
16
  rollupContract;
15
17
  publicClient;
16
18
  ethereumSlotDuration;
19
+ aztecSlotDuration;
20
+ l1GenesisTime;
17
21
  chainId;
18
22
  version;
19
23
  constructor(config){
20
24
  const { l1RpcUrls, l1ChainId: chainId, l1Contracts } = config;
21
25
  const chain = createEthereumChain(l1RpcUrls, chainId);
26
+ this.version = new Fr(config.rollupVersion);
27
+ this.chainId = new Fr(chainId);
22
28
  this.ethereumSlotDuration = config.ethereumSlotDuration;
29
+ this.aztecSlotDuration = config.slotDuration;
30
+ this.l1GenesisTime = config.l1GenesisTime;
23
31
  this.publicClient = createPublicClient({
24
32
  chain: chain.chainInfo,
25
- transport: fallback(chain.rpcUrls.map((url)=>http(url))),
33
+ transport: fallback(chain.rpcUrls.map((url)=>http(url, {
34
+ batch: false
35
+ }))),
26
36
  pollingInterval: config.viemPollingIntervalMS
27
37
  });
28
38
  this.rollupContract = new RollupContract(this.publicClient, l1Contracts.rollupAddress);
29
39
  }
30
40
  /**
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 next block
33
- */ async computeCurrentBaseFees() {
41
+ * Computes the "current" min fees, e.g., the price that you currently should pay to get include in the next block
42
+ * @returns Min fees for the next block
43
+ */ async computeCurrentMinFees() {
34
44
  // Since this might be called in the middle of a slot where a block might have been published,
35
45
  // we need to fetch the last block written, and estimate the earliest timestamp for the next block.
36
46
  // The timestamp of that last block will act as a lower bound for the next block.
37
- const lastBlock = await this.rollupContract.getCheckpoint(await this.rollupContract.getCheckpointNumber());
38
- const earliestTimestamp = await this.rollupContract.getTimestampForSlot(SlotNumber.fromBigInt(lastBlock.slotNumber + 1n));
47
+ const lastCheckpoint = await this.rollupContract.getPendingCheckpoint();
48
+ const earliestTimestamp = await this.rollupContract.getTimestampForSlot(SlotNumber.fromBigInt(BigInt(lastCheckpoint.slotNumber) + 1n));
39
49
  const nextEthTimestamp = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
40
50
  const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
41
- return new GasFees(0, await this.rollupContract.getManaBaseFeeAt(timestamp, true));
51
+ return new GasFees(0, await this.rollupContract.getManaMinFeeAt(timestamp, true));
42
52
  }
43
- async getCurrentBaseFees() {
53
+ async getCurrentMinFees() {
44
54
  // Get the current block number
45
55
  const blockNumber = await this.publicClient.getBlockNumber();
46
- // If the L1 block number has changed then chain a new promise to get the current base fees
56
+ // If the L1 block number has changed then chain a new promise to get the current min fees
47
57
  if (this.currentL1BlockNumber === undefined || blockNumber > this.currentL1BlockNumber) {
48
58
  this.currentL1BlockNumber = blockNumber;
49
- this.currentBaseFees = this.currentBaseFees.then(()=>this.computeCurrentBaseFees());
59
+ this.currentMinFees = this.currentMinFees.then(()=>this.computeCurrentMinFees());
50
60
  }
51
- return this.currentBaseFees;
52
- }
53
- async getGlobalConstantVariables() {
54
- if (!this.chainId) {
55
- this.chainId = new Fr(this.publicClient.chain.id);
56
- }
57
- if (!this.version) {
58
- this.version = new Fr(await this.rollupContract.getVersion());
59
- }
60
- return {
61
- chainId: this.chainId,
62
- version: this.version
63
- };
61
+ return this.currentMinFees;
64
62
  }
65
63
  /**
66
- * Simple builder of global variables that use the minimum time possible.
64
+ * Simple builder of global variables.
67
65
  * @param blockNumber - The block number to build global variables for.
68
66
  * @param coinbase - The address to receive block reward.
69
67
  * @param feeRecipient - The address to receive fees.
70
68
  * @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
71
69
  * @returns The global variables for the given block number.
72
- */ async buildGlobalVariables(blockNumber, coinbase, feeRecipient, slotNumber) {
73
- const { chainId, version } = await this.getGlobalConstantVariables();
74
- let slot;
75
- if (slotNumber === undefined) {
76
- const ts = BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration));
77
- slot = await this.rollupContract.getSlotAt(ts);
78
- } else {
79
- slot = slotNumber;
80
- }
81
- const timestamp = await this.rollupContract.getTimestampForSlot(slot);
82
- // We can skip much of the logic in getCurrentBaseFees since it we already check that we are not within a slot elsewhere.
83
- const gasFees = new GasFees(0, await this.rollupContract.getManaBaseFeeAt(timestamp, true));
84
- const globalVariables = new GlobalVariables(chainId, version, blockNumber, slot, timestamp, coinbase, feeRecipient, gasFees);
85
- return globalVariables;
70
+ */ async buildGlobalVariables(blockNumber, coinbase, feeRecipient, maybeSlot) {
71
+ const slot = maybeSlot ?? await this.rollupContract.getSlotAt(BigInt((await this.publicClient.getBlock()).timestamp + BigInt(this.ethereumSlotDuration)));
72
+ const checkpointGlobalVariables = await this.buildCheckpointGlobalVariables(coinbase, feeRecipient, slot);
73
+ return GlobalVariables.from({
74
+ blockNumber,
75
+ ...checkpointGlobalVariables
76
+ });
77
+ }
78
+ /** Builds global variables that are constant throughout a checkpoint. */ async buildCheckpointGlobalVariables(coinbase, feeRecipient, slotNumber) {
79
+ const { chainId, version } = this;
80
+ const timestamp = getTimestampForSlot(slotNumber, {
81
+ slotDuration: this.aztecSlotDuration,
82
+ l1GenesisTime: this.l1GenesisTime
83
+ });
84
+ // We can skip much of the logic in getCurrentMinFees since it we already check that we are not within a slot elsewhere.
85
+ // TODO(palla/mbps): Can we use a cached value here?
86
+ const gasFees = new GasFees(0, await this.rollupContract.getManaMinFeeAt(timestamp, true));
87
+ return {
88
+ chainId,
89
+ version,
90
+ slotNumber,
91
+ timestamp,
92
+ coinbase,
93
+ feeRecipient,
94
+ gasFees
95
+ };
86
96
  }
87
97
  }
package/dest/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from './client/index.js';
2
2
  export * from './config.js';
3
3
  export * from './publisher/index.js';
4
- export { FullNodeBlockBuilder as BlockBuilder, Sequencer, SequencerState, type SequencerEvents, } from './sequencer/index.js';
5
- export * from './tx_validator/tx_validator_factory.js';
4
+ export { Sequencer, SequencerState, type SequencerEvents } from './sequencer/index.js';
6
5
  export * from './global_variable_builder/index.js';
7
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsT0FBTyxFQUNMLG9CQUFvQixJQUFJLFlBQVksRUFDcEMsU0FBUyxFQUNULGNBQWMsRUFDZCxLQUFLLGVBQWUsR0FDckIsTUFBTSxzQkFBc0IsQ0FBQztBQUM5QixjQUFjLHdDQUF3QyxDQUFDO0FBSXZELGNBQWMsb0NBQW9DLENBQUMifQ==
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,OAAO,EACL,oBAAoB,IAAI,YAAY,EACpC,SAAS,EACT,cAAc,EACd,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAC9B,cAAc,wCAAwC,CAAC;AAIvD,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,8 +1,7 @@
1
1
  export * from './client/index.js';
2
2
  export * from './config.js';
3
3
  export * from './publisher/index.js';
4
- export { FullNodeBlockBuilder as BlockBuilder, Sequencer, SequencerState } from './sequencer/index.js';
5
- export * from './tx_validator/tx_validator_factory.js';
4
+ export { Sequencer, SequencerState } from './sequencer/index.js';
6
5
  // Used by the node to simulate public parts of transactions. Should these be moved to a shared library?
7
6
  // ISSUE(#9832)
8
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';
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';
3
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
- */
8
+ /** The private key to be used by the publisher. */
12
9
  publisherPrivateKeys?: SecretValue<`0x${string}`>[];
13
- /**
14
- * Publisher addresses to be used with a remote signer
15
- */
10
+ /** Publisher addresses to be used with a remote signer */
16
11
  publisherAddresses?: EthAddress[];
17
12
  };
18
- /**
19
- * Configuration of the L1Publisher.
20
- */
21
- export type PublisherConfig = L1TxUtilsConfig & BlobSinkConfig & {
13
+ export type ProverTxSenderConfig = L1ReaderConfig & {
14
+ proverPublisherPrivateKeys?: SecretValue<`0x${string}`>[];
15
+ proverPublisherAddresses?: EthAddress[];
16
+ };
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 & {
22
25
  /** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
23
26
  publisherAllowInvalidStates?: boolean;
24
27
  /** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1 */
25
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;
26
45
  };
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=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9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DLGNBQWMsRUFBRSxhQUFhLENBQUMsQ0FFckc7QUFFRCxlQUFPLE1BQU0sMEJBQTBCLEVBQUUsQ0FDdkMsS0FBSyxFQUFFLFFBQVEsR0FBRyxLQUFLLEtBQ3BCLGtCQUFrQixDQUFDLGVBQWUsR0FBRyxlQUFlLENBY3ZELENBQUM7QUFFSCx3QkFBZ0IseUJBQXlCLENBQUMsS0FBSyxFQUFFLFFBQVEsR0FBRyxLQUFLLEdBQUcsZUFBZSxDQUVsRiJ9
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHVibGlzaGVyL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBMkIsTUFBTSxrQ0FBa0MsQ0FBQztBQUNsRyxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQTBCLE1BQU0sMkJBQTJCLENBQUM7QUFDeEYsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUEyQixNQUFNLG9DQUFvQyxDQUFDO0FBQ25HLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFFLFdBQVcsRUFBdUIsTUFB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