@aztec/sequencer-client 0.0.0-test.0 → 0.0.1-commit.03f7ef2

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 (141) hide show
  1. package/dest/client/index.d.ts +1 -1
  2. package/dest/client/sequencer-client.d.ts +30 -29
  3. package/dest/client/sequencer-client.d.ts.map +1 -1
  4. package/dest/client/sequencer-client.js +82 -60
  5. package/dest/config.d.ts +15 -16
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +113 -70
  8. package/dest/global_variable_builder/global_builder.d.ts +25 -14
  9. package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
  10. package/dest/global_variable_builder/global_builder.js +60 -42
  11. package/dest/global_variable_builder/index.d.ts +1 -1
  12. package/dest/index.d.ts +2 -3
  13. package/dest/index.d.ts.map +1 -1
  14. package/dest/index.js +1 -2
  15. package/dest/publisher/config.d.ts +15 -12
  16. package/dest/publisher/config.d.ts.map +1 -1
  17. package/dest/publisher/config.js +32 -19
  18. package/dest/publisher/index.d.ts +3 -1
  19. package/dest/publisher/index.d.ts.map +1 -1
  20. package/dest/publisher/index.js +3 -0
  21. package/dest/publisher/sequencer-publisher-factory.d.ts +44 -0
  22. package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -0
  23. package/dest/publisher/sequencer-publisher-factory.js +51 -0
  24. package/dest/publisher/sequencer-publisher-metrics.d.ts +5 -4
  25. package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
  26. package/dest/publisher/sequencer-publisher-metrics.js +37 -2
  27. package/dest/publisher/sequencer-publisher.d.ts +132 -86
  28. package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
  29. package/dest/publisher/sequencer-publisher.js +755 -248
  30. package/dest/sequencer/block_builder.d.ts +26 -0
  31. package/dest/sequencer/block_builder.d.ts.map +1 -0
  32. package/dest/sequencer/block_builder.js +129 -0
  33. package/dest/sequencer/checkpoint_builder.d.ts +63 -0
  34. package/dest/sequencer/checkpoint_builder.d.ts.map +1 -0
  35. package/dest/sequencer/checkpoint_builder.js +131 -0
  36. package/dest/sequencer/checkpoint_proposal_job.d.ts +74 -0
  37. package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
  38. package/dest/sequencer/checkpoint_proposal_job.js +640 -0
  39. package/dest/sequencer/checkpoint_voter.d.ts +34 -0
  40. package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
  41. package/dest/sequencer/checkpoint_voter.js +85 -0
  42. package/dest/sequencer/config.d.ts +7 -1
  43. package/dest/sequencer/config.d.ts.map +1 -1
  44. package/dest/sequencer/errors.d.ts +11 -0
  45. package/dest/sequencer/errors.d.ts.map +1 -0
  46. package/dest/sequencer/errors.js +15 -0
  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 +6 -2
  51. package/dest/sequencer/index.d.ts.map +1 -1
  52. package/dest/sequencer/index.js +5 -1
  53. package/dest/sequencer/metrics.d.ts +48 -12
  54. package/dest/sequencer/metrics.d.ts.map +1 -1
  55. package/dest/sequencer/metrics.js +274 -48
  56. package/dest/sequencer/sequencer.d.ts +132 -135
  57. package/dest/sequencer/sequencer.d.ts.map +1 -1
  58. package/dest/sequencer/sequencer.js +519 -521
  59. package/dest/sequencer/timetable.d.ts +76 -24
  60. package/dest/sequencer/timetable.d.ts.map +1 -1
  61. package/dest/sequencer/timetable.js +177 -61
  62. package/dest/sequencer/types.d.ts +3 -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 +20 -38
  66. package/dest/sequencer/utils.d.ts.map +1 -1
  67. package/dest/sequencer/utils.js +12 -47
  68. package/dest/test/index.d.ts +10 -1
  69. package/dest/test/index.d.ts.map +1 -1
  70. package/dest/test/index.js +0 -4
  71. package/dest/test/mock_checkpoint_builder.d.ts +83 -0
  72. package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
  73. package/dest/test/mock_checkpoint_builder.js +179 -0
  74. package/dest/test/utils.d.ts +49 -0
  75. package/dest/test/utils.d.ts.map +1 -0
  76. package/dest/test/utils.js +94 -0
  77. package/dest/tx_validator/nullifier_cache.d.ts +1 -3
  78. package/dest/tx_validator/nullifier_cache.d.ts.map +1 -1
  79. package/dest/tx_validator/tx_validator_factory.d.ts +11 -11
  80. package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
  81. package/dest/tx_validator/tx_validator_factory.js +28 -25
  82. package/package.json +45 -45
  83. package/src/client/sequencer-client.ts +105 -105
  84. package/src/config.ts +126 -81
  85. package/src/global_variable_builder/global_builder.ts +82 -53
  86. package/src/index.ts +8 -2
  87. package/src/publisher/config.ts +45 -32
  88. package/src/publisher/index.ts +4 -0
  89. package/src/publisher/sequencer-publisher-factory.ts +92 -0
  90. package/src/publisher/sequencer-publisher-metrics.ts +26 -4
  91. package/src/publisher/sequencer-publisher.ts +955 -293
  92. package/src/sequencer/README.md +531 -0
  93. package/src/sequencer/block_builder.ts +217 -0
  94. package/src/sequencer/checkpoint_builder.ts +217 -0
  95. package/src/sequencer/checkpoint_proposal_job.ts +703 -0
  96. package/src/sequencer/checkpoint_voter.ts +105 -0
  97. package/src/sequencer/config.ts +8 -0
  98. package/src/sequencer/errors.ts +21 -0
  99. package/src/sequencer/events.ts +27 -0
  100. package/src/sequencer/index.ts +5 -1
  101. package/src/sequencer/metrics.ts +355 -50
  102. package/src/sequencer/sequencer.ts +631 -594
  103. package/src/sequencer/timetable.ts +221 -62
  104. package/src/sequencer/types.ts +6 -0
  105. package/src/sequencer/utils.ts +28 -60
  106. package/src/test/index.ts +13 -4
  107. package/src/test/mock_checkpoint_builder.ts +247 -0
  108. package/src/test/utils.ts +137 -0
  109. package/src/tx_validator/tx_validator_factory.ts +46 -33
  110. package/dest/sequencer/allowed.d.ts +0 -3
  111. package/dest/sequencer/allowed.d.ts.map +0 -1
  112. package/dest/sequencer/allowed.js +0 -27
  113. package/dest/slasher/factory.d.ts +0 -7
  114. package/dest/slasher/factory.d.ts.map +0 -1
  115. package/dest/slasher/factory.js +0 -8
  116. package/dest/slasher/index.d.ts +0 -3
  117. package/dest/slasher/index.d.ts.map +0 -1
  118. package/dest/slasher/index.js +0 -2
  119. package/dest/slasher/slasher_client.d.ts +0 -75
  120. package/dest/slasher/slasher_client.d.ts.map +0 -1
  121. package/dest/slasher/slasher_client.js +0 -132
  122. package/dest/tx_validator/archive_cache.d.ts +0 -14
  123. package/dest/tx_validator/archive_cache.d.ts.map +0 -1
  124. package/dest/tx_validator/archive_cache.js +0 -22
  125. package/dest/tx_validator/gas_validator.d.ts +0 -14
  126. package/dest/tx_validator/gas_validator.d.ts.map +0 -1
  127. package/dest/tx_validator/gas_validator.js +0 -78
  128. package/dest/tx_validator/phases_validator.d.ts +0 -12
  129. package/dest/tx_validator/phases_validator.d.ts.map +0 -1
  130. package/dest/tx_validator/phases_validator.js +0 -80
  131. package/dest/tx_validator/test_utils.d.ts +0 -23
  132. package/dest/tx_validator/test_utils.d.ts.map +0 -1
  133. package/dest/tx_validator/test_utils.js +0 -26
  134. package/src/sequencer/allowed.ts +0 -36
  135. package/src/slasher/factory.ts +0 -15
  136. package/src/slasher/index.ts +0 -2
  137. package/src/slasher/slasher_client.ts +0 -193
  138. package/src/tx_validator/archive_cache.ts +0 -28
  139. package/src/tx_validator/gas_validator.ts +0 -101
  140. package/src/tx_validator/phases_validator.ts +0 -98
  141. package/src/tx_validator/test_utils.ts +0 -48
@@ -0,0 +1,640 @@
1
+ function _ts_add_disposable_resource(env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() {
16
+ try {
17
+ inner.call(this);
18
+ } catch (e) {
19
+ return Promise.reject(e);
20
+ }
21
+ };
22
+ env.stack.push({
23
+ value: value,
24
+ dispose: dispose,
25
+ async: async
26
+ });
27
+ } else if (async) {
28
+ env.stack.push({
29
+ async: true
30
+ });
31
+ }
32
+ return value;
33
+ }
34
+ function _ts_dispose_resources(env) {
35
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
36
+ var e = new Error(message);
37
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
38
+ };
39
+ return (_ts_dispose_resources = function _ts_dispose_resources(env) {
40
+ function fail(e) {
41
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
42
+ env.hasError = true;
43
+ }
44
+ var r, s = 0;
45
+ function next() {
46
+ while(r = env.stack.pop()){
47
+ try {
48
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
49
+ if (r.dispose) {
50
+ var result = r.dispose.call(r.value);
51
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
52
+ fail(e);
53
+ return next();
54
+ });
55
+ } else s |= 1;
56
+ } catch (e) {
57
+ fail(e);
58
+ }
59
+ }
60
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
61
+ if (env.hasError) throw env.error;
62
+ }
63
+ return next();
64
+ })(env);
65
+ }
66
+ import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB } from '@aztec/constants';
67
+ import { BlockNumber } from '@aztec/foundation/branded-types';
68
+ import { randomInt } from '@aztec/foundation/crypto/random';
69
+ import { Signature } from '@aztec/foundation/eth-signature';
70
+ import { filter } from '@aztec/foundation/iterator';
71
+ import { sleep, sleepUntil } from '@aztec/foundation/sleep';
72
+ import { Timer } from '@aztec/foundation/timer';
73
+ import { unfreeze } from '@aztec/foundation/types';
74
+ import { CommitteeAttestationsAndSigners, MaliciousCommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
75
+ import { getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
76
+ import { Gas } from '@aztec/stdlib/gas';
77
+ import { orderAttestations } from '@aztec/stdlib/p2p';
78
+ import { AttestationTimeoutError } from '@aztec/stdlib/validators';
79
+ import { CheckpointVoter } from './checkpoint_voter.js';
80
+ import { SequencerInterruptedError } from './errors.js';
81
+ import { SequencerState } from './utils.js';
82
+ /** How much time to sleep while waiting for min transactions to accumulate for a block */ const TXS_POLLING_MS = 500;
83
+ /**
84
+ * Handles the execution of a checkpoint proposal after the initial preparation phase.
85
+ * This includes building blocks, collecting attestations, and publishing the checkpoint to L1,
86
+ * as well as enqueueing votes for slashing and governance proposals. This class is created from
87
+ * the Sequencer once the check for being the proposer for the slot has succeeded.
88
+ */ export class CheckpointProposalJob {
89
+ slot;
90
+ checkpointNumber;
91
+ syncedToBlockNumber;
92
+ proposer;
93
+ publisher;
94
+ attestorAddress;
95
+ invalidateBlock;
96
+ validatorClient;
97
+ globalsBuilder;
98
+ p2pClient;
99
+ worldState;
100
+ l1ToL2MessageSource;
101
+ checkpointsBuilder;
102
+ l1Constants;
103
+ config;
104
+ timetable;
105
+ slasherClient;
106
+ epochCache;
107
+ dateProvider;
108
+ metrics;
109
+ eventEmitter;
110
+ setStateFn;
111
+ log;
112
+ constructor(slot, checkpointNumber, syncedToBlockNumber, // TODO(palla/mbps): Can we remove the proposer in favor of attestorAddress? Need to check fisherman-node flows.
113
+ proposer, publisher, attestorAddress, invalidateBlock, validatorClient, globalsBuilder, p2pClient, worldState, l1ToL2MessageSource, checkpointsBuilder, l1Constants, config, timetable, slasherClient, epochCache, dateProvider, metrics, eventEmitter, setStateFn, log){
114
+ this.slot = slot;
115
+ this.checkpointNumber = checkpointNumber;
116
+ this.syncedToBlockNumber = syncedToBlockNumber;
117
+ this.proposer = proposer;
118
+ this.publisher = publisher;
119
+ this.attestorAddress = attestorAddress;
120
+ this.invalidateBlock = invalidateBlock;
121
+ this.validatorClient = validatorClient;
122
+ this.globalsBuilder = globalsBuilder;
123
+ this.p2pClient = p2pClient;
124
+ this.worldState = worldState;
125
+ this.l1ToL2MessageSource = l1ToL2MessageSource;
126
+ this.checkpointsBuilder = checkpointsBuilder;
127
+ this.l1Constants = l1Constants;
128
+ this.config = config;
129
+ this.timetable = timetable;
130
+ this.slasherClient = slasherClient;
131
+ this.epochCache = epochCache;
132
+ this.dateProvider = dateProvider;
133
+ this.metrics = metrics;
134
+ this.eventEmitter = eventEmitter;
135
+ this.setStateFn = setStateFn;
136
+ this.log = log;
137
+ }
138
+ /**
139
+ * Executes the checkpoint proposal job.
140
+ * Returns the published checkpoint if successful, undefined otherwise.
141
+ */ async execute() {
142
+ // Enqueue governance and slashing votes (returns promises that will be awaited later)
143
+ // In fisherman mode, we simulate slashing but don't actually publish to L1
144
+ // These are constant for the whole slot, so we only enqueue them once
145
+ const votesPromises = new CheckpointVoter(this.slot, this.publisher, this.attestorAddress, this.validatorClient, this.slasherClient, this.l1Constants, this.config, this.metrics, this.log).enqueueVotes();
146
+ // Build and propose the checkpoint. This will enqueue the request on the publisher if a checkpoint is built.
147
+ const checkpoint = await this.proposeCheckpoint();
148
+ // Wait until the voting promises have resolved, so all requests are enqueued (not sent)
149
+ await Promise.all(votesPromises);
150
+ // Do not post anything to L1 if we are fishermen, but do perform L1 fee analysis
151
+ if (this.config.fishermanMode) {
152
+ await this.handleCheckpointEndAsFisherman(checkpoint);
153
+ return;
154
+ }
155
+ // Then send everything to L1
156
+ const l1Response = await this.publisher.sendRequests();
157
+ const proposedAction = l1Response?.successfulActions.find((a)=>a === 'propose');
158
+ if (proposedAction) {
159
+ this.eventEmitter.emit('checkpoint-published', {
160
+ checkpoint: this.checkpointNumber,
161
+ slot: this.slot
162
+ });
163
+ const coinbase = checkpoint?.header.coinbase;
164
+ await this.metrics.incFilledSlot(this.publisher.getSenderAddress().toString(), coinbase);
165
+ return checkpoint;
166
+ } else if (checkpoint) {
167
+ this.eventEmitter.emit('checkpoint-publish-failed', {
168
+ ...l1Response,
169
+ slot: this.slot
170
+ });
171
+ return undefined;
172
+ }
173
+ }
174
+ async proposeCheckpoint() {
175
+ try {
176
+ const env = {
177
+ stack: [],
178
+ error: void 0,
179
+ hasError: false
180
+ };
181
+ try {
182
+ // Get operator configured coinbase and fee recipient for this attestor
183
+ const coinbase = this.validatorClient.getCoinbaseForAttestor(this.attestorAddress);
184
+ const feeRecipient = this.validatorClient.getFeeRecipientForAttestor(this.attestorAddress);
185
+ // Start the checkpoint
186
+ this.setStateFn(SequencerState.INITIALIZING_CHECKPOINT, this.slot);
187
+ this.metrics.incOpenSlot(this.slot, this.proposer?.toString() ?? 'unknown');
188
+ // Enqueues block invalidation (constant for the whole slot)
189
+ if (this.invalidateBlock && !this.config.skipInvalidateBlockAsProposer) {
190
+ this.publisher.enqueueInvalidateBlock(this.invalidateBlock);
191
+ }
192
+ // Create checkpoint builder for the slot
193
+ const checkpointGlobalVariables = await this.globalsBuilder.buildCheckpointGlobalVariables(coinbase, feeRecipient, this.slot);
194
+ // Collect L1 to L2 messages for the checkpoint
195
+ const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(this.checkpointNumber);
196
+ const fork = _ts_add_disposable_resource(env, await this.worldState.fork(this.syncedToBlockNumber, {
197
+ closeDelayMs: 12_000
198
+ }), false);
199
+ // Create checkpoint builder for the entire slot
200
+ const checkpointBuilder = await this.checkpointsBuilder.startCheckpoint(this.checkpointNumber, checkpointGlobalVariables, l1ToL2Messages, fork);
201
+ // Options for the validator client when creating block and checkpoint proposals
202
+ const blockProposalOptions = {
203
+ publishFullTxs: !!this.config.publishTxsWithProposals,
204
+ broadcastInvalidBlockProposal: this.config.broadcastInvalidBlockProposal
205
+ };
206
+ // Main loop: build blocks for the checkpoint
207
+ const { blocksInCheckpoint, pendingBroadcast } = await this.buildBlocksForCheckpoint(checkpointBuilder, checkpointGlobalVariables.timestamp, blockProposalOptions);
208
+ if (blocksInCheckpoint.length === 0) {
209
+ this.log.warn(`No blocks were built for slot ${this.slot}`, {
210
+ slot: this.slot
211
+ });
212
+ this.eventEmitter.emit('checkpoint-empty', {
213
+ slot: this.slot
214
+ });
215
+ return undefined;
216
+ }
217
+ // Assemble and broadcast the checkpoint proposal, including the last block that was not
218
+ // broadcasted yet, and wait to collect the committee attestations.
219
+ this.setStateFn(SequencerState.ASSEMBLING_CHECKPOINT, this.slot);
220
+ const checkpoint = await checkpointBuilder.completeCheckpoint();
221
+ // Do not collect attestations nor publish to L1 in fisherman mode
222
+ if (this.config.fishermanMode) {
223
+ this.log.info(`Built checkpoint for slot ${this.slot} with ${blocksInCheckpoint.length} blocks. ` + `Skipping proposal in fisherman mode.`, {
224
+ slot: this.slot,
225
+ checkpoint: checkpoint.header.toInspect(),
226
+ blocksBuilt: blocksInCheckpoint.length
227
+ });
228
+ this.metrics.recordCheckpointSuccess();
229
+ return checkpoint;
230
+ }
231
+ // TODO(palla/mbps): Wire this to the new p2p API once available, including the pendingBroadcast.block
232
+ const proposal = await this.validatorClient.createCheckpointProposal(checkpoint.header, checkpoint.archive.root, pendingBroadcast?.txs ?? [], this.proposer, blockProposalOptions);
233
+ const blockProposedAt = this.dateProvider.now();
234
+ await this.p2pClient.broadcastProposal(proposal);
235
+ this.setStateFn(SequencerState.COLLECTING_ATTESTATIONS, this.slot);
236
+ const attestations = await this.waitForAttestations(proposal);
237
+ const blockAttestedAt = this.dateProvider.now();
238
+ this.metrics.recordBlockAttestationDelay(blockAttestedAt - blockProposedAt);
239
+ // Proposer must sign over the attestations before pushing them to L1
240
+ const signer = this.proposer ?? this.publisher.getSenderAddress();
241
+ const attestationsSignature = await this.validatorClient.signAttestationsAndSigners(attestations, signer);
242
+ // Enqueue publishing the checkpoint to L1
243
+ this.setStateFn(SequencerState.PUBLISHING_CHECKPOINT, this.slot);
244
+ const aztecSlotDuration = this.l1Constants.slotDuration;
245
+ const slotStartBuildTimestamp = this.getSlotStartBuildTimestamp();
246
+ const txTimeoutAt = new Date((slotStartBuildTimestamp + aztecSlotDuration) * 1000);
247
+ await this.publisher.enqueueProposeCheckpoint(checkpoint, attestations, attestationsSignature, {
248
+ txTimeoutAt,
249
+ forcePendingBlockNumber: this.invalidateBlock?.forcePendingBlockNumber
250
+ });
251
+ return checkpoint;
252
+ } catch (e) {
253
+ env.error = e;
254
+ env.hasError = true;
255
+ } finally{
256
+ _ts_dispose_resources(env);
257
+ }
258
+ } catch (err) {
259
+ this.log.error(`Error building checkpoint at slot ${this.slot}`, err);
260
+ return undefined;
261
+ }
262
+ }
263
+ /**
264
+ * Builds blocks for a checkpoint within the current slot.
265
+ */ async buildBlocksForCheckpoint(checkpointBuilder, timestamp, blockProposalOptions) {
266
+ const blocksInCheckpoint = [];
267
+ const txHashesAlreadyIncluded = new Set();
268
+ const initialBlockNumber = BlockNumber(this.syncedToBlockNumber + 1);
269
+ // Last block in the checkpoint will usually be flagged as pending broadcast, so we send it along with the checkpoint proposal
270
+ let pendingBroadcast = undefined;
271
+ while(true){
272
+ const blocksBuilt = blocksInCheckpoint.length;
273
+ const indexWithinCheckpoint = blocksBuilt;
274
+ const blockNumber = BlockNumber(initialBlockNumber + blocksBuilt);
275
+ const secondsIntoSlot = this.getSecondsIntoSlot();
276
+ const timingInfo = this.timetable.canStartNextBlock(secondsIntoSlot);
277
+ if (!timingInfo.canStart) {
278
+ this.log.debug(`Not enough time left in slot to start another block`, {
279
+ slot: this.slot,
280
+ blocksBuilt,
281
+ secondsIntoSlot
282
+ });
283
+ break;
284
+ }
285
+ const buildResult = await this.buildSingleBlock(checkpointBuilder, {
286
+ // Create all blocks with the same timestamp
287
+ blockTimestamp: timestamp,
288
+ // Create an empty block if we haven't already and this is the last one
289
+ forceCreate: timingInfo.isLastBlock && blocksBuilt === 0 && this.config.buildCheckpointIfEmpty,
290
+ // Build deadline is only set if we are enforcing the timetable
291
+ buildDeadline: timingInfo.deadline ? new Date((this.getSlotStartBuildTimestamp() + timingInfo.deadline) * 1000) : undefined,
292
+ blockNumber,
293
+ indexWithinCheckpoint,
294
+ txHashesAlreadyIncluded
295
+ });
296
+ if (!buildResult && timingInfo.isLastBlock) {
297
+ break;
298
+ } else if (!buildResult && timingInfo.deadline !== undefined) {
299
+ // But if there is still time for more blocks, wait until the next subslot and try again
300
+ await this.waitUntilNextSubslot(timingInfo.deadline);
301
+ continue;
302
+ } else if (!buildResult) {
303
+ break;
304
+ } else if ('error' in buildResult) {
305
+ // If there was an error building the block, just exit the loop and give up the rest of the slot
306
+ if (!(buildResult.error instanceof SequencerInterruptedError)) {
307
+ this.log.warn(`Halting block building for slot ${this.slot}`, {
308
+ slot: this.slot,
309
+ blocksBuilt,
310
+ error: buildResult.error
311
+ });
312
+ }
313
+ break;
314
+ }
315
+ const { block, usedTxs } = buildResult;
316
+ blocksInCheckpoint.push(block);
317
+ // Sync the proposed block to the archiver to make it available
318
+ // Note that the checkpoint builder uses its own fork so it should not need to wait for this syncing
319
+ // Eventually we should refactor the checkpoint builder to not need a separate long-lived fork
320
+ await this.syncProposedBlockToArchiver(block);
321
+ // If this is the last block, exit the loop now so we start collecting attestations
322
+ if (timingInfo.isLastBlock) {
323
+ this.log.verbose(`Completed final block ${blockNumber} for slot ${this.slot}`, {
324
+ slot: this.slot,
325
+ blockNumber,
326
+ blocksBuilt
327
+ });
328
+ pendingBroadcast = {
329
+ block,
330
+ txs: usedTxs
331
+ };
332
+ break;
333
+ }
334
+ // For non-last blocks, broadcast the block proposal (unless we're in fisherman mode)
335
+ // If the block is the last one, we'll broadcast it along with the checkpoint at the end of the loop
336
+ if (!this.config.fishermanMode) {
337
+ // TODO(palla/mbps): Wire this to the new p2p API once available
338
+ const proposal = await this.validatorClient.createBlockProposal(block.header.globalVariables.blockNumber, (await checkpointBuilder.getCheckpoint()).header, block.archive.root, usedTxs, this.proposer, blockProposalOptions);
339
+ await this.p2pClient.broadcastProposal(proposal);
340
+ }
341
+ // Wait until the next block's start time
342
+ await this.waitUntilNextSubslot(timingInfo.deadline);
343
+ }
344
+ this.log.verbose(`Block building loop completed for slot ${this.slot}`, {
345
+ slot: this.slot,
346
+ blocksBuilt: blocksInCheckpoint.length
347
+ });
348
+ return {
349
+ blocksInCheckpoint,
350
+ pendingBroadcast
351
+ };
352
+ }
353
+ /** Sleeps until it is time to produce the next block in the slot */ async waitUntilNextSubslot(nextSubslotStart) {
354
+ this.setStateFn(SequencerState.WAITING_UNTIL_NEXT_BLOCK, this.slot);
355
+ this.log.verbose(`Waiting until time for the next block at ${nextSubslotStart}s into slot`, {
356
+ slot: this.slot
357
+ });
358
+ await this.waitUntilTimeInSlot(nextSubslotStart);
359
+ }
360
+ /** Builds a single block. Called from the main block building loop. */ async buildSingleBlock(checkpointBuilder, opts) {
361
+ const { blockTimestamp, forceCreate, blockNumber, indexWithinCheckpoint, buildDeadline, txHashesAlreadyIncluded } = opts;
362
+ this.log.verbose(`Preparing block ${blockNumber} index ${indexWithinCheckpoint} at checkpoint ${this.checkpointNumber} for slot ${this.slot}`, {
363
+ ...checkpointBuilder.getConstantData(),
364
+ ...opts
365
+ });
366
+ try {
367
+ // Wait until we have enough txs to build the block
368
+ const minTxs = this.config.minTxsPerBlock;
369
+ const { availableTxs, canStartBuilding } = await this.waitForMinTxs(opts);
370
+ if (!canStartBuilding) {
371
+ this.log.warn(`Not enough txs to build block ${blockNumber} at index ${indexWithinCheckpoint} in slot ${this.slot} (got ${availableTxs} txs but needs ${minTxs})`, {
372
+ blockNumber,
373
+ slot: this.slot,
374
+ indexWithinCheckpoint
375
+ });
376
+ this.eventEmitter.emit('block-tx-count-check-failed', {
377
+ minTxs,
378
+ availableTxs,
379
+ slot: this.slot
380
+ });
381
+ this.metrics.recordBlockProposalFailed('insufficient_txs');
382
+ return undefined;
383
+ }
384
+ // Create iterator to pending txs. We filter out txs already included in previous blocks in the checkpoint
385
+ // just in case p2p failed to sync the provisional block and didn't get to remove those txs from the mempool yet.
386
+ const pendingTxs = filter(this.p2pClient.iteratePendingTxs(), (tx)=>!txHashesAlreadyIncluded.has(tx.txHash.toString()));
387
+ this.log.debug(`Building block ${blockNumber} at index ${indexWithinCheckpoint} for slot ${this.slot} with ${availableTxs} available txs`, {
388
+ slot: this.slot,
389
+ blockNumber,
390
+ indexWithinCheckpoint
391
+ });
392
+ this.setStateFn(SequencerState.CREATING_BLOCK, this.slot);
393
+ const blockBuilderOptions = {
394
+ maxTransactions: this.config.maxTxsPerBlock,
395
+ maxBlockSize: this.config.maxBlockSizeInBytes,
396
+ maxBlockGas: new Gas(this.config.maxDABlockGas, this.config.maxL2BlockGas),
397
+ maxBlobFields: BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB,
398
+ deadline: buildDeadline
399
+ };
400
+ // Actually build the block by executing txs
401
+ const workTimer = new Timer();
402
+ const { publicGas, block, publicProcessorDuration, numTxs, blockBuildingTimer, usedTxs, failedTxs } = await checkpointBuilder.buildBlock(pendingTxs, blockNumber, blockTimestamp, blockBuilderOptions);
403
+ const blockBuildDuration = workTimer.ms();
404
+ // If any txs failed during execution, drop them from the mempool so we don't pick them up again
405
+ await this.dropFailedTxsFromP2P(failedTxs);
406
+ // Check if we have created a block with enough txs. If there were invalid txs in the pool, or if execution took
407
+ // too long, then we may not get to minTxsPerBlock after executing public functions.
408
+ const minValidTxs = this.config.minValidTxsPerBlock ?? minTxs;
409
+ if (!forceCreate && numTxs < minValidTxs) {
410
+ this.log.warn(`Block ${blockNumber} at index ${indexWithinCheckpoint} on slot ${this.slot} has too few valid txs to be proposed (got ${numTxs} but required ${minValidTxs})`, {
411
+ slot: this.slot,
412
+ blockNumber,
413
+ numTxs,
414
+ indexWithinCheckpoint
415
+ });
416
+ this.eventEmitter.emit('block-tx-count-check-failed', {
417
+ minTxs: minValidTxs,
418
+ availableTxs: numTxs,
419
+ slot: this.slot
420
+ });
421
+ this.metrics.recordBlockProposalFailed('insufficient_valid_txs');
422
+ return undefined;
423
+ }
424
+ // Block creation succeeded, emit stats and metrics
425
+ const blockStats = {
426
+ eventName: 'l2-block-built',
427
+ duration: blockBuildDuration,
428
+ publicProcessDuration: publicProcessorDuration,
429
+ rollupCircuitsDuration: blockBuildingTimer.ms(),
430
+ ...block.getStats()
431
+ };
432
+ const blockHash = await block.hash();
433
+ const txHashes = block.body.txEffects.map((tx)=>tx.txHash);
434
+ const manaPerSec = publicGas.l2Gas / (blockBuildDuration / 1000);
435
+ this.log.info(`Built block ${block.number} at checkpoint ${this.checkpointNumber} for slot ${this.slot} with ${numTxs} txs`, {
436
+ blockHash,
437
+ txHashes,
438
+ manaPerSec,
439
+ ...blockStats
440
+ });
441
+ this.eventEmitter.emit('block-proposed', {
442
+ blockNumber: block.number,
443
+ slot: this.slot
444
+ });
445
+ this.metrics.recordBuiltBlock(blockBuildDuration, publicGas.l2Gas);
446
+ return {
447
+ block,
448
+ usedTxs
449
+ };
450
+ } catch (err) {
451
+ this.eventEmitter.emit('block-build-failed', {
452
+ reason: err.message,
453
+ slot: this.slot
454
+ });
455
+ this.log.error(`Error building block`, err, {
456
+ blockNumber,
457
+ slot: this.slot
458
+ });
459
+ this.metrics.recordBlockProposalFailed(err.name || 'unknown_error');
460
+ this.metrics.recordFailedBlock();
461
+ return {
462
+ error: err
463
+ };
464
+ }
465
+ }
466
+ /** Waits until minTxs are available on the pool for building a block. */ async waitForMinTxs(opts) {
467
+ const minTxs = this.config.minTxsPerBlock;
468
+ const { indexWithinCheckpoint, blockNumber, buildDeadline, forceCreate } = opts;
469
+ // Deadline is undefined if we are not enforcing the timetable, meaning we'll exit immediately when out of time
470
+ const startBuildingDeadline = buildDeadline ? new Date(buildDeadline.getTime() - this.timetable.minExecutionTime * 1000) : undefined;
471
+ let availableTxs = await this.p2pClient.getPendingTxCount();
472
+ while(!forceCreate && availableTxs < minTxs){
473
+ // If we're past deadline, or we have no deadline, give up
474
+ const now = this.dateProvider.nowAsDate();
475
+ if (startBuildingDeadline === undefined || now >= startBuildingDeadline) {
476
+ return {
477
+ canStartBuilding: false,
478
+ availableTxs: availableTxs
479
+ };
480
+ }
481
+ // Wait a bit before checking again
482
+ this.setStateFn(SequencerState.WAITING_FOR_TXS, this.slot);
483
+ this.log.verbose(`Waiting for enough txs to build block ${blockNumber} at index ${indexWithinCheckpoint} in slot ${this.slot} (have ${availableTxs} but need ${minTxs})`, {
484
+ blockNumber,
485
+ slot: this.slot,
486
+ indexWithinCheckpoint
487
+ });
488
+ await sleep(TXS_POLLING_MS);
489
+ availableTxs = await this.p2pClient.getPendingTxCount();
490
+ }
491
+ return {
492
+ canStartBuilding: true,
493
+ availableTxs
494
+ };
495
+ }
496
+ /**
497
+ * Waits for enough attestations to be collected via p2p.
498
+ * This is run after all blocks for the checkpoint have been built.
499
+ */ async waitForAttestations(proposal) {
500
+ if (this.config.fishermanMode) {
501
+ this.log.debug('Skipping attestation collection in fisherman mode');
502
+ return CommitteeAttestationsAndSigners.empty();
503
+ }
504
+ const slotNumber = proposal.slotNumber;
505
+ const { committee, seed, epoch } = await this.epochCache.getCommittee(slotNumber);
506
+ if (!committee) {
507
+ throw new Error('No committee when collecting attestations');
508
+ } else if (committee.length === 0) {
509
+ this.log.verbose(`Attesting committee is empty`);
510
+ return CommitteeAttestationsAndSigners.empty();
511
+ } else {
512
+ this.log.debug(`Attesting committee length is ${committee.length}`, {
513
+ committee
514
+ });
515
+ }
516
+ const numberOfRequiredAttestations = Math.floor(committee.length * 2 / 3) + 1;
517
+ if (this.config.skipCollectingAttestations) {
518
+ this.log.warn('Skipping attestation collection as per config (attesting with own keys only)');
519
+ const attestations = await this.validatorClient?.collectOwnAttestations(proposal);
520
+ return new CommitteeAttestationsAndSigners(orderAttestations(attestations ?? [], committee));
521
+ }
522
+ const attestationTimeAllowed = this.config.enforceTimeTable ? this.timetable.getMaxAllowedTime(SequencerState.PUBLISHING_CHECKPOINT) : this.l1Constants.slotDuration;
523
+ const attestationDeadline = new Date(this.dateProvider.now() + attestationTimeAllowed * 1000);
524
+ this.metrics.recordRequiredAttestations(numberOfRequiredAttestations, attestationTimeAllowed);
525
+ const collectAttestationsTimer = new Timer();
526
+ let collectedAttestationsCount = 0;
527
+ try {
528
+ const attestations = await this.validatorClient.collectAttestations(proposal, numberOfRequiredAttestations, attestationDeadline);
529
+ collectedAttestationsCount = attestations.length;
530
+ // Rollup contract requires that the signatures are provided in the order of the committee
531
+ const sorted = orderAttestations(attestations, committee);
532
+ // Manipulate the attestations if we've been configured to do so
533
+ if (this.config.injectFakeAttestation || this.config.shuffleAttestationOrdering) {
534
+ const checkpoint = proposal.payload.header;
535
+ return this.manipulateAttestations(checkpoint, epoch, seed, committee, sorted);
536
+ }
537
+ return new CommitteeAttestationsAndSigners(sorted);
538
+ } catch (err) {
539
+ if (err && err instanceof AttestationTimeoutError) {
540
+ collectedAttestationsCount = err.collectedCount;
541
+ }
542
+ throw err;
543
+ } finally{
544
+ this.metrics.recordCollectedAttestations(collectedAttestationsCount, collectAttestationsTimer.ms());
545
+ }
546
+ }
547
+ /** Breaks the attestations before publishing based on attack configs */ manipulateAttestations(checkpoint, epoch, seed, committee, attestations) {
548
+ // Compute the proposer index in the committee, since we dont want to tweak it.
549
+ // Otherwise, the L1 rollup contract will reject the block outright.
550
+ const { slotNumber } = checkpoint;
551
+ const proposerIndex = Number(this.epochCache.computeProposerIndex(slotNumber, epoch, seed, BigInt(committee.length)));
552
+ if (this.config.injectFakeAttestation) {
553
+ // Find non-empty attestations that are not from the proposer
554
+ const nonProposerIndices = [];
555
+ for(let i = 0; i < attestations.length; i++){
556
+ if (!attestations[i].signature.isEmpty() && i !== proposerIndex) {
557
+ nonProposerIndices.push(i);
558
+ }
559
+ }
560
+ if (nonProposerIndices.length > 0) {
561
+ const targetIndex = nonProposerIndices[randomInt(nonProposerIndices.length)];
562
+ this.log.warn(`Injecting fake attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
563
+ unfreeze(attestations[targetIndex]).signature = Signature.random();
564
+ }
565
+ return new CommitteeAttestationsAndSigners(attestations);
566
+ }
567
+ if (this.config.shuffleAttestationOrdering) {
568
+ this.log.warn(`Shuffling attestation ordering in checkpoint for slot ${slotNumber} (proposer #${proposerIndex})`);
569
+ const shuffled = [
570
+ ...attestations
571
+ ];
572
+ const [i, j] = [
573
+ (proposerIndex + 1) % shuffled.length,
574
+ (proposerIndex + 2) % shuffled.length
575
+ ];
576
+ const valueI = shuffled[i];
577
+ const valueJ = shuffled[j];
578
+ shuffled[i] = valueJ;
579
+ shuffled[j] = valueI;
580
+ const signers = new CommitteeAttestationsAndSigners(attestations).getSigners();
581
+ return new MaliciousCommitteeAttestationsAndSigners(shuffled, signers);
582
+ }
583
+ return new CommitteeAttestationsAndSigners(attestations);
584
+ }
585
+ async dropFailedTxsFromP2P(failedTxs) {
586
+ if (failedTxs.length === 0) {
587
+ return;
588
+ }
589
+ const failedTxData = failedTxs.map((fail)=>fail.tx);
590
+ const failedTxHashes = failedTxData.map((tx)=>tx.getTxHash());
591
+ this.log.verbose(`Dropping failed txs ${failedTxHashes.join(', ')}`);
592
+ await this.p2pClient.deleteTxs(failedTxHashes);
593
+ }
594
+ /**
595
+ * Placeholder for pushing block to archiver and waiting for sync.
596
+ * To be implemented when archiver and world-state support proposed blocks.
597
+ */ async syncProposedBlockToArchiver(block) {
598
+ this.log.debug(`Syncing proposed block ${block.number}`, {
599
+ blockNumber: block.number,
600
+ slot: block.header.globalVariables.slotNumber
601
+ });
602
+ // TODO(palla/mbps): Implement actual sync to archiver and world-state
603
+ await Promise.resolve();
604
+ }
605
+ /** Runs fee analysis and logs checkpoint outcome as fisherman */ async handleCheckpointEndAsFisherman(checkpoint) {
606
+ // Perform L1 fee analysis before clearing requests
607
+ // The callback is invoked asynchronously after the next block is mined
608
+ const feeAnalysis = await this.publisher.analyzeL1Fees(this.slot, (analysis)=>this.metrics.recordFishermanFeeAnalysis(analysis));
609
+ if (checkpoint) {
610
+ this.log.info(`Validation checkpoint building SUCCEEDED for slot ${this.slot}`, {
611
+ ...checkpoint.toCheckpointInfo(),
612
+ ...checkpoint.getStats(),
613
+ feeAnalysisId: feeAnalysis?.id
614
+ });
615
+ this.metrics.recordBlockProposalSuccess();
616
+ } else {
617
+ this.log.warn(`Validation block building FAILED for slot ${this.slot}`, {
618
+ slot: this.slot,
619
+ feeAnalysisId: feeAnalysis?.id
620
+ });
621
+ this.metrics.recordBlockProposalFailed('block_build_failed');
622
+ }
623
+ this.publisher.clearPendingRequests();
624
+ }
625
+ /** Waits until a specific time within the current slot */ async waitUntilTimeInSlot(targetSecondsIntoSlot) {
626
+ const slotStartTimestamp = this.getSlotStartBuildTimestamp();
627
+ const targetTimestamp = slotStartTimestamp + targetSecondsIntoSlot;
628
+ await sleepUntil(new Date(targetTimestamp * 1000), this.dateProvider.nowAsDate());
629
+ }
630
+ getSlotStartBuildTimestamp() {
631
+ return getSlotStartBuildTimestamp(this.slot, this.l1Constants);
632
+ }
633
+ getSecondsIntoSlot() {
634
+ const slotStartTimestamp = this.getSlotStartBuildTimestamp();
635
+ return Number((this.dateProvider.now() / 1000 - slotStartTimestamp).toFixed(3));
636
+ }
637
+ getPublisher() {
638
+ return this.publisher;
639
+ }
640
+ }
@@ -0,0 +1,34 @@
1
+ import type { SlotNumber } from '@aztec/foundation/branded-types';
2
+ import type { EthAddress } from '@aztec/foundation/eth-address';
3
+ import type { Logger } from '@aztec/foundation/log';
4
+ import type { SlasherClientInterface } from '@aztec/slasher';
5
+ import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
6
+ import type { ValidatorClient } from '@aztec/validator-client';
7
+ import type { SequencerPublisher } from '../publisher/sequencer-publisher.js';
8
+ import type { SequencerMetrics } from './metrics.js';
9
+ import type { SequencerRollupConstants } from './types.js';
10
+ /**
11
+ * Handles governance and slashing voting for a given slot.
12
+ */
13
+ export declare class CheckpointVoter {
14
+ private readonly slot;
15
+ private readonly publisher;
16
+ private readonly attestorAddress;
17
+ private readonly validatorClient;
18
+ private readonly slasherClient;
19
+ private readonly l1Constants;
20
+ private readonly config;
21
+ private readonly metrics;
22
+ private readonly log;
23
+ private slotTimestamp;
24
+ private signer;
25
+ constructor(slot: SlotNumber, publisher: SequencerPublisher, attestorAddress: EthAddress, validatorClient: ValidatorClient, slasherClient: SlasherClientInterface | undefined, l1Constants: SequencerRollupConstants, config: ResolvedSequencerConfig, metrics: SequencerMetrics, log: Logger);
26
+ /**
27
+ * Enqueues governance and slashing votes with the publisher.
28
+ * Returns a tuple of promises that resolve to whether each vote was successfully enqueued.
29
+ */
30
+ enqueueVotes(): [Promise<boolean | undefined>, Promise<boolean | undefined>];
31
+ private enqueueGovernanceVote;
32
+ private enqueueSlashingVote;
33
+ }
34
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2twb2ludF92b3Rlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NlcXVlbmNlci9jaGVja3BvaW50X3ZvdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2xFLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFN0QsT0FBTyxLQUFLLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUMvRSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUkvRCxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHFDQUFxQyxDQUFDO0FBQzlFLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sY0FBYyxDQUFDO0FBQ3JELE9BQU8sS0FBSyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sWUFBWSxDQUFDO0FBRTNEOztHQUVHO0FBQ0gscUJBQWEsZUFBZTtJQUt4QixPQUFPLENBQUMsUUFBUSxDQUFDLElBQUk7SUFDckIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBQzFCLE9BQU8sQ0FBQyxRQUFRLENBQUMsZUFBZTtJQUNoQyxPQUFPLENBQUMsUUFBUSxDQUFDLGVBQWU7SUFDaEMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxhQUFhO0lBQzlCLE9BQU8sQ0FBQyxRQUFRLENBQUMsV0FBVztJQUM1QixPQUFPLENBQUMsUUFBUSxDQUFDLE1BQU07SUFDdkIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxPQUFPO0lBQ3hCLE9BQU8sQ0FBQyxRQUFRLENBQUMsR0FBRztJQVp0QixPQUFPLENBQUMsYUFBYSxDQUFTO0lBQzlCLE9BQU8sQ0FBQyxNQUFNLENBQXVEO0lBRXJFLFlBQ21CLElBQUksRUFBRSxVQUFVLEVBQ2hCLFNBQVMsRUFBRSxrQkFBa0IsRUFDN0IsZUFBZSxFQUFFLFVBQVUsRUFDM0IsZUFBZSxFQUFFLGVBQWUsRUFDaEMsYUFBYSxFQUFFLHNCQUFzQixHQUFHLFNBQVMsRUFDakQsV0FBVyxFQUFFLHdCQUF3QixFQUNyQyxNQUFNLEVBQUUsdUJBQXVCLEVBQy9CLE9BQU8sRUFBRSxnQkFBZ0IsRUFDekIsR0FBRyxFQUFFLE1BQU0sRUFLN0I7SUFFRDs7O09BR0c7SUFDSCxZQUFZLElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxHQUFHLFNBQVMsQ0FBQyxFQUFFLE9BQU8sQ0FBQyxPQUFPLEdBQUcsU0FBUyxDQUFDLENBQUMsQ0FVM0U7WUFFYSxxQkFBcUI7WUF5QnJCLG1CQUFtQjtDQTBCbEMifQ==