@aztec/sequencer-client 0.48.0 → 0.50.1

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 (44) hide show
  1. package/dest/block_builder/index.d.ts +26 -0
  2. package/dest/block_builder/index.d.ts.map +1 -0
  3. package/dest/block_builder/index.js +40 -0
  4. package/dest/client/sequencer-client.d.ts +6 -2
  5. package/dest/client/sequencer-client.d.ts.map +1 -1
  6. package/dest/client/sequencer-client.js +14 -7
  7. package/dest/config.d.ts.map +1 -1
  8. package/dest/config.js +1 -6
  9. package/dest/global_variable_builder/global_builder.d.ts +6 -54
  10. package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
  11. package/dest/global_variable_builder/global_builder.js +24 -12
  12. package/dest/global_variable_builder/index.d.ts +0 -9
  13. package/dest/global_variable_builder/index.d.ts.map +1 -1
  14. package/dest/global_variable_builder/index.js +2 -12
  15. package/dest/publisher/index.d.ts +0 -8
  16. package/dest/publisher/index.d.ts.map +1 -1
  17. package/dest/publisher/index.js +1 -10
  18. package/dest/publisher/l1-publisher.d.ts +26 -70
  19. package/dest/publisher/l1-publisher.d.ts.map +1 -1
  20. package/dest/publisher/l1-publisher.js +168 -19
  21. package/dest/sequencer/sequencer.d.ts +25 -11
  22. package/dest/sequencer/sequencer.d.ts.map +1 -1
  23. package/dest/sequencer/sequencer.js +90 -36
  24. package/package.json +18 -15
  25. package/src/block_builder/index.ts +51 -0
  26. package/src/client/sequencer-client.ts +15 -7
  27. package/src/config.ts +0 -5
  28. package/src/global_variable_builder/global_builder.ts +38 -62
  29. package/src/global_variable_builder/index.ts +0 -15
  30. package/src/publisher/index.ts +0 -14
  31. package/src/publisher/l1-publisher.ts +217 -95
  32. package/src/sequencer/sequencer.ts +113 -45
  33. package/dest/global_variable_builder/viem-reader.d.ts +0 -17
  34. package/dest/global_variable_builder/viem-reader.d.ts.map +0 -1
  35. package/dest/global_variable_builder/viem-reader.js +0 -40
  36. package/dest/publisher/viem-tx-sender.d.ts +0 -59
  37. package/dest/publisher/viem-tx-sender.d.ts.map +0 -1
  38. package/dest/publisher/viem-tx-sender.js +0 -236
  39. package/dest/receiver.d.ts +0 -10
  40. package/dest/receiver.d.ts.map +0 -1
  41. package/dest/receiver.js +0 -2
  42. package/src/global_variable_builder/viem-reader.ts +0 -64
  43. package/src/publisher/viem-tx-sender.ts +0 -296
  44. package/src/receiver.ts +0 -11
@@ -1,17 +1,14 @@
1
1
  import {
2
+ type BlockAttestation,
2
3
  type L1ToL2MessageSource,
3
4
  type L2Block,
4
5
  type L2BlockSource,
5
6
  type ProcessedTx,
7
+ Signature,
6
8
  Tx,
7
9
  type TxValidator,
8
10
  } from '@aztec/circuit-types';
9
- import {
10
- type AllowedElement,
11
- BlockProofError,
12
- PROVING_STATUS,
13
- type ProverClient,
14
- } from '@aztec/circuit-types/interfaces';
11
+ import { type AllowedElement, BlockProofError, PROVING_STATUS } from '@aztec/circuit-types/interfaces';
15
12
  import { type L2BlockBuiltStats } from '@aztec/circuit-types/stats';
16
13
  import { AztecAddress, EthAddress, type GlobalVariables, type Header, IS_DEV_NET } from '@aztec/circuits.js';
17
14
  import { Fr } from '@aztec/foundation/fields';
@@ -21,10 +18,12 @@ import { Timer, elapsed } from '@aztec/foundation/timer';
21
18
  import { type P2P } from '@aztec/p2p';
22
19
  import { type PublicProcessorFactory } from '@aztec/simulator';
23
20
  import { Attributes, type TelemetryClient, type Tracer, trackSpan } from '@aztec/telemetry-client';
21
+ import { type ValidatorClient } from '@aztec/validator-client';
24
22
  import { type WorldStateStatus, type WorldStateSynchronizer } from '@aztec/world-state';
25
23
 
24
+ import { type BlockBuilderFactory } from '../block_builder/index.js';
26
25
  import { type GlobalVariableBuilder } from '../global_variable_builder/global_builder.js';
27
- import { type Attestation, type L1Publisher } from '../publisher/l1-publisher.js';
26
+ import { type L1Publisher } from '../publisher/l1-publisher.js';
28
27
  import { type TxValidatorFactory } from '../tx_validator/tx_validator_factory.js';
29
28
  import { type SequencerConfig } from './config.js';
30
29
  import { SequencerMetrics } from './metrics.js';
@@ -53,21 +52,22 @@ export class Sequencer {
53
52
  private allowedInSetup: AllowedElement[] = [];
54
53
  private allowedInTeardown: AllowedElement[] = [];
55
54
  private maxBlockSizeInBytes: number = 1024 * 1024;
56
- private skipSubmitProofs: boolean = false;
57
55
  private metrics: SequencerMetrics;
56
+ private isFlushing: boolean = false;
58
57
 
59
58
  constructor(
60
59
  private publisher: L1Publisher,
60
+ private validatorClient: ValidatorClient | undefined, // During migration the validator client can be inactive
61
61
  private globalsBuilder: GlobalVariableBuilder,
62
62
  private p2pClient: P2P,
63
63
  private worldState: WorldStateSynchronizer,
64
- private prover: ProverClient,
64
+ private blockBuilderFactory: BlockBuilderFactory,
65
65
  private l2BlockSource: L2BlockSource,
66
66
  private l1ToL2MessageSource: L1ToL2MessageSource,
67
67
  private publicProcessorFactory: PublicProcessorFactory,
68
68
  private txValidatorFactory: TxValidatorFactory,
69
69
  telemetry: TelemetryClient,
70
- config: SequencerConfig = {},
70
+ private config: SequencerConfig = {},
71
71
  private log = createDebugLogger('aztec:sequencer'),
72
72
  ) {
73
73
  this.updateConfig(config);
@@ -115,10 +115,8 @@ export class Sequencer {
115
115
  if (config.allowedInTeardown) {
116
116
  this.allowedInTeardown = config.allowedInTeardown;
117
117
  }
118
- // TODO(palla/prover) This flag should not be needed: the sequencer should be initialized with a blockprover
119
- // that does not return proofs at all (just simulates circuits), and use that to determine whether to submit
120
- // proofs or not.
121
- this.skipSubmitProofs = !!config.sequencerSkipSubmitProofs;
118
+ // TODO: Just read everything from the config object as needed instead of copying everything into local vars.
119
+ this.config = config;
122
120
  }
123
121
 
124
122
  /**
@@ -197,15 +195,26 @@ export class Sequencer {
197
195
  return;
198
196
  }
199
197
 
198
+ if (this.isFlushing) {
199
+ this.log.verbose(`Flushing all pending txs in new block`);
200
+ }
201
+
200
202
  // Compute time elapsed since the previous block
201
203
  const lastBlockTime = historicalHeader?.globalVariables.timestamp.toNumber() || 0;
202
204
  const currentTime = Math.floor(Date.now() / 1000);
203
205
  const elapsedSinceLastBlock = currentTime - lastBlockTime;
206
+ this.log.debug(
207
+ `Last block mined at ${lastBlockTime} current time is ${currentTime} (elapsed ${elapsedSinceLastBlock})`,
208
+ );
204
209
 
205
210
  // Do not go forward with new block if not enough time has passed since last block
206
- if (this.minSecondsBetweenBlocks > 0 && elapsedSinceLastBlock < this.minSecondsBetweenBlocks) {
211
+ if (
212
+ !this.isFlushing &&
213
+ this.minSecondsBetweenBlocks > 0 &&
214
+ elapsedSinceLastBlock < this.minSecondsBetweenBlocks
215
+ ) {
207
216
  this.log.debug(
208
- `Not creating block because not enough time has passed since last block (last block at ${lastBlockTime} current time ${currentTime})`,
217
+ `Not creating block because not enough time ${this.minSecondsBetweenBlocks} has passed since last block`,
209
218
  );
210
219
  return;
211
220
  }
@@ -216,7 +225,7 @@ export class Sequencer {
216
225
  const pendingTxs = this.p2pClient.getTxs('pending');
217
226
 
218
227
  // If we haven't hit the maxSecondsBetweenBlocks, we need to have at least minTxsPerBLock txs.
219
- if (pendingTxs.length < this.minTxsPerBLock) {
228
+ if (!this.isFlushing && pendingTxs.length < this.minTxsPerBLock) {
220
229
  if (this.skipMinTxsPerBlockCheck(elapsedSinceLastBlock)) {
221
230
  this.log.debug(
222
231
  `Creating block with only ${pendingTxs.length} txs as more than ${this.maxSecondsBetweenBlocks}s have passed since last block`,
@@ -252,7 +261,11 @@ export class Sequencer {
252
261
  const validTxs = this.takeTxsWithinMaxSize(allValidTxs);
253
262
 
254
263
  // Bail if we don't have enough valid txs
255
- if (!this.skipMinTxsPerBlockCheck(elapsedSinceLastBlock) && validTxs.length < this.minTxsPerBLock) {
264
+ if (
265
+ !this.isFlushing &&
266
+ !this.skipMinTxsPerBlockCheck(elapsedSinceLastBlock) &&
267
+ validTxs.length < this.minTxsPerBLock
268
+ ) {
256
269
  this.log.debug(
257
270
  `Not creating block because not enough valid txs loaded from the pool (got ${validTxs.length} min ${this.minTxsPerBLock})`,
258
271
  );
@@ -318,11 +331,11 @@ export class Sequencer {
318
331
  const blockSize = Math.max(2, numRealTxs);
319
332
 
320
333
  const blockBuildingTimer = new Timer();
321
- const prover = this.prover.createBlockProver(this.worldState.getLatest());
322
- const blockTicket = await prover.startNewBlock(blockSize, newGlobalVariables, l1ToL2Messages);
334
+ const blockBuilder = this.blockBuilderFactory.create(this.worldState.getLatest());
335
+ const blockTicket = await blockBuilder.startNewBlock(blockSize, newGlobalVariables, l1ToL2Messages);
323
336
 
324
337
  const [publicProcessorDuration, [processedTxs, failedTxs]] = await elapsed(() =>
325
- processor.process(validTxs, blockSize, prover, this.txValidatorFactory.validatorForProcessedTxs()),
338
+ processor.process(validTxs, blockSize, blockBuilder, this.txValidatorFactory.validatorForProcessedTxs()),
326
339
  );
327
340
  if (failedTxs.length > 0) {
328
341
  const failedTxData = failedTxs.map(fail => fail.tx);
@@ -334,16 +347,21 @@ export class Sequencer {
334
347
  // less txs than the minimum. But that'd cause the entire block to be aborted and retried. Instead, we should
335
348
  // go back to the p2p pool and load more txs until we hit our minTxsPerBLock target. Only if there are no txs
336
349
  // we should bail.
337
- if (processedTxs.length === 0 && !this.skipMinTxsPerBlockCheck(elapsedSinceLastBlock)) {
350
+ if (
351
+ !this.isFlushing &&
352
+ processedTxs.length === 0 &&
353
+ !this.skipMinTxsPerBlockCheck(elapsedSinceLastBlock) &&
354
+ this.minTxsPerBLock > 0
355
+ ) {
338
356
  this.log.verbose('No txs processed correctly to build block. Exiting');
339
- prover.cancelBlock();
357
+ blockBuilder.cancelBlock();
340
358
  return;
341
359
  }
342
360
 
343
361
  await assertBlockHeight();
344
362
 
345
363
  // All real transactions have been added, set the block as full and complete the proving.
346
- await prover.setBlockCompleted();
364
+ await blockBuilder.setBlockCompleted();
347
365
 
348
366
  // Here we are now waiting for the block to be proven.
349
367
  // TODO(@PhilWindle) We should probably periodically check for things like another
@@ -355,8 +373,8 @@ export class Sequencer {
355
373
 
356
374
  await assertBlockHeight();
357
375
 
358
- // Block is proven, now finalise and publish!
359
- const { block, aggregationObject, proof } = await prover.finaliseBlock();
376
+ // Block is ready, now finalise and publish!
377
+ const { block } = await blockBuilder.finaliseBlock();
360
378
 
361
379
  await assertBlockHeight();
362
380
 
@@ -374,6 +392,11 @@ export class Sequencer {
374
392
  } satisfies L2BlockBuiltStats,
375
393
  );
376
394
 
395
+ if (this.isFlushing) {
396
+ this.log.verbose(`Flushing completed`);
397
+ }
398
+ this.isFlushing = false;
399
+
377
400
  try {
378
401
  const attestations = await this.collectAttestations(block);
379
402
  await this.publishL2Block(block, attestations);
@@ -381,29 +404,20 @@ export class Sequencer {
381
404
  this.log.info(
382
405
  `Submitted rollup block ${block.number} with ${
383
406
  processedTxs.length
384
- } transactions duration=${workDuration}ms (Submitter: ${await this.publisher.senderAddress()})`,
407
+ } transactions duration=${workDuration}ms (Submitter: ${await this.publisher.getSenderAddress()})`,
385
408
  );
386
409
  } catch (err) {
387
410
  this.metrics.recordFailedBlock();
388
411
  throw err;
389
412
  }
413
+ }
390
414
 
391
- // Submit the proof if we have configured this sequencer to run with an actual prover.
392
- // This is temporary while we submit one proof per block, but will have to change once we
393
- // move onto proving batches of multiple blocks at a time.
394
- if (aggregationObject && proof && !this.skipSubmitProofs) {
395
- await this.publisher.submitProof(
396
- block.header,
397
- block.archive.root,
398
- prover.getProverId(),
399
- aggregationObject,
400
- proof,
401
- );
402
- this.log.info(`Submitted proof for block ${block.number}`);
403
- }
415
+ /** Forces the sequencer to bypass all time and tx count checks for the next block and build anyway. */
416
+ public flush() {
417
+ this.isFlushing = true;
404
418
  }
405
419
 
406
- protected async collectAttestations(block: L2Block): Promise<Attestation[] | undefined> {
420
+ protected async collectAttestations(block: L2Block): Promise<Signature[] | undefined> {
407
421
  // @todo This should collect attestations properly and fix the ordering of them to make sense
408
422
  // the current implementation is a PLACEHOLDER and should be nuked from orbit.
409
423
  // It is assuming that there will only be ONE (1) validator, so only one attestation
@@ -417,12 +431,30 @@ export class Sequencer {
417
431
  // ; ;
418
432
  // / \
419
433
  // _____________/_ __ \_____________
420
- if (IS_DEV_NET) {
434
+ if (IS_DEV_NET || !this.validatorClient) {
421
435
  return undefined;
422
436
  }
423
437
 
424
- const myAttestation = await this.publisher.attest(block.archive.root.toString());
425
- return [myAttestation];
438
+ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/7962): inefficient to have a round trip in here - this should be cached
439
+ const committee = await this.publisher.getCurrentEpochCommittee();
440
+ const numberOfRequiredAttestations = Math.floor((committee.length * 2) / 3) + 1;
441
+
442
+ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/7974): we do not have transaction[] lists in the block for now
443
+ // Dont do anything with the proposals for now - just collect them
444
+
445
+ const proposal = await this.validatorClient.createBlockProposal(block.header, block.archive.root, []);
446
+
447
+ this.state = SequencerState.PUBLISHING_BLOCK_TO_PEERS;
448
+ this.validatorClient.broadcastBlockProposal(proposal);
449
+
450
+ this.state = SequencerState.WAITING_FOR_ATTESTATIONS;
451
+ const attestations = await this.validatorClient.collectAttestations(
452
+ proposal.header.globalVariables.slotNumber.toBigInt(),
453
+ numberOfRequiredAttestations,
454
+ );
455
+
456
+ // note: the smart contract requires that the signatures are provided in the order of the committee
457
+ return await orderAttestations(attestations, committee);
426
458
  }
427
459
 
428
460
  /**
@@ -432,9 +464,10 @@ export class Sequencer {
432
464
  @trackSpan('Sequencer.publishL2Block', block => ({
433
465
  [Attributes.BLOCK_NUMBER]: block.number,
434
466
  }))
435
- protected async publishL2Block(block: L2Block, attestations?: Attestation[]) {
467
+ protected async publishL2Block(block: L2Block, attestations?: Signature[]) {
436
468
  // Publishes new block to the network and awaits the tx to be mined
437
469
  this.state = SequencerState.PUBLISHING_BLOCK;
470
+
438
471
  const publishedL2Block = await this.publisher.processL2Block(block, attestations);
439
472
  if (publishedL2Block) {
440
473
  this.lastPublishedBlock = block.number;
@@ -521,6 +554,14 @@ export enum SequencerState {
521
554
  * Creating a new L2 block. Includes processing public function calls and running rollup circuits. Will move to PUBLISHING_CONTRACT_DATA.
522
555
  */
523
556
  CREATING_BLOCK,
557
+ /**
558
+ * Publishing blocks to validator peers. Will move to WAITING_FOR_ATTESTATIONS.
559
+ */
560
+ PUBLISHING_BLOCK_TO_PEERS,
561
+ /**
562
+ * The block has been published to peers, and we are waiting for attestations. Will move to PUBLISHING_CONTRACT_DATA.
563
+ */
564
+ WAITING_FOR_ATTESTATIONS,
524
565
  /**
525
566
  * Sending the tx to L1 with encrypted logs and awaiting it to be mined. Will move back to PUBLISHING_BLOCK once finished.
526
567
  */
@@ -534,3 +575,30 @@ export enum SequencerState {
534
575
  */
535
576
  STOPPED,
536
577
  }
578
+
579
+ /** Order Attestations
580
+ *
581
+ * Returns attestation signatures in the order of a series of provided ethereum addresses
582
+ * The rollup smart contract expects attestations to appear in the order of the committee
583
+ *
584
+ * @todo: perform this logic within the memory attestation store instead?
585
+ */
586
+ async function orderAttestations(attestations: BlockAttestation[], orderAddresses: EthAddress[]): Promise<Signature[]> {
587
+ // Create a map of sender addresses to BlockAttestations
588
+ const attestationMap = new Map<string, BlockAttestation>();
589
+
590
+ for (const attestation of attestations) {
591
+ const sender = await attestation.getSender();
592
+ if (sender) {
593
+ attestationMap.set(sender.toString(), attestation);
594
+ }
595
+ }
596
+
597
+ // Create the ordered array based on the orderAddresses, else return an empty signature
598
+ const orderedAttestations = orderAddresses.map(address => {
599
+ const addressString = address.toString();
600
+ return attestationMap.get(addressString)?.signature || Signature.empty();
601
+ });
602
+
603
+ return orderedAttestations;
604
+ }
@@ -1,17 +0,0 @@
1
- import { type L1ReaderConfig } from '@aztec/ethereum';
2
- import { type L1GlobalReader } from './global_builder.js';
3
- /**
4
- * Reads values from L1 state using viem.
5
- */
6
- export declare class ViemReader implements L1GlobalReader {
7
- private rollupContract;
8
- private publicClient;
9
- constructor(config: L1ReaderConfig);
10
- getVersion(): Promise<bigint>;
11
- getChainId(): Promise<bigint>;
12
- getL1CurrentTime(): Promise<bigint>;
13
- getCurrentSlot(): Promise<bigint>;
14
- getSlotAt(timestamp: readonly [bigint]): Promise<bigint>;
15
- getTimestampForSlot(slot: readonly [bigint]): Promise<bigint>;
16
- }
17
- //# sourceMappingURL=viem-reader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viem-reader.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/viem-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AAc3E,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,UAAW,YAAW,cAAc;IAC/C,OAAO,CAAC,cAAc,CAAqF;IAC3G,OAAO,CAAC,YAAY,CAA4C;gBAEpD,MAAM,EAAE,cAAc;IAiBrB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7B,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjC,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,mBAAmB,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAG3E"}
@@ -1,40 +0,0 @@
1
- import { createEthereumChain } from '@aztec/ethereum';
2
- import { RollupAbi } from '@aztec/l1-artifacts';
3
- import { createPublicClient, getAddress, getContract, http, } from 'viem';
4
- /**
5
- * Reads values from L1 state using viem.
6
- */
7
- export class ViemReader {
8
- constructor(config) {
9
- const { l1RpcUrl, l1ChainId: chainId, l1Contracts } = config;
10
- const chain = createEthereumChain(l1RpcUrl, chainId);
11
- this.publicClient = createPublicClient({
12
- chain: chain.chainInfo,
13
- transport: http(chain.rpcUrl),
14
- });
15
- this.rollupContract = getContract({
16
- address: getAddress(l1Contracts.rollupAddress.toString()),
17
- abi: RollupAbi,
18
- client: this.publicClient,
19
- });
20
- }
21
- async getVersion() {
22
- return BigInt(await this.rollupContract.read.VERSION());
23
- }
24
- async getChainId() {
25
- return await Promise.resolve(BigInt(this.publicClient.chain.id));
26
- }
27
- async getL1CurrentTime() {
28
- return await Promise.resolve((await this.publicClient.getBlock()).timestamp);
29
- }
30
- async getCurrentSlot() {
31
- return BigInt(await this.rollupContract.read.getCurrentSlot());
32
- }
33
- async getSlotAt(timestamp) {
34
- return BigInt(await this.rollupContract.read.getSlotAt(timestamp));
35
- }
36
- async getTimestampForSlot(slot) {
37
- return BigInt(await this.rollupContract.read.getTimestampForSlot(slot));
38
- }
39
- }
40
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmllbS1yZWFkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZ2xvYmFsX3ZhcmlhYmxlX2J1aWxkZXIvdmllbS1yZWFkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUF1QixtQkFBbUIsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQzNFLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUVoRCxPQUFPLEVBSUwsa0JBQWtCLEVBQ2xCLFVBQVUsRUFDVixXQUFXLEVBQ1gsSUFBSSxHQUNMLE1BQU0sTUFBTSxDQUFDO0FBS2Q7O0dBRUc7QUFDSCxNQUFNLE9BQU8sVUFBVTtJQUlyQixZQUFZLE1BQXNCO1FBQ2hDLE1BQU0sRUFBRSxRQUFRLEVBQUUsU0FBUyxFQUFFLE9BQU8sRUFBRSxXQUFXLEVBQUUsR0FBRyxNQUFNLENBQUM7UUFFN0QsTUFBTSxLQUFLLEdBQUcsbUJBQW1CLENBQUMsUUFBUSxFQUFFLE9BQU8sQ0FBQyxDQUFDO1FBRXJELElBQUksQ0FBQyxZQUFZLEdBQUc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LFNBQTRCO1FBQ2pELE9BQU8sTUFBTSxDQUFDLE1BQU0sSUFBSSxDQUFDLGNBQWMsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUM7SUFDckUsQ0FBQztJQUVNLEtBQUssQ0FBQyxtQkFBbUIsQ0FBQyxJQUF1QjtRQUN0RCxPQUFPLE1BQU0sQ0FBQyxNQUFNLElBQUksQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLG1CQUFtQixDQUFDLElBQUksQ0FBQyxDQUFDLENBQUM7SUFDMUUsQ0FBQztDQUNGIn0=
@@ -1,59 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { type L2Block } from '@aztec/circuit-types';
3
- import { EthAddress } from '@aztec/circuits.js';
4
- import { type TxSenderConfig } from './config.js';
5
- import { type Attestation, type L1PublisherTxSender, type L1SubmitProofArgs, type MinimalTransactionReceipt, type L1ProcessArgs as ProcessTxArgs, type TransactionStats } from './l1-publisher.js';
6
- /**
7
- * Pushes transactions to the L1 rollup contract using viem.
8
- */
9
- export declare class ViemTxSender implements L1PublisherTxSender {
10
- private availabilityOracleContract;
11
- private rollupContract;
12
- private log;
13
- private publicClient;
14
- private account;
15
- constructor(config: TxSenderConfig);
16
- attest(archive: `0x{string}`): Promise<Attestation>;
17
- getSenderAddress(): Promise<EthAddress>;
18
- getProposerAtNextEthBlock(): Promise<EthAddress>;
19
- getCurrentArchive(): Promise<Buffer>;
20
- checkIfTxsAreAvailable(block: L2Block): Promise<boolean>;
21
- getTransactionStats(txHash: string): Promise<TransactionStats | undefined>;
22
- /**
23
- * Returns a tx receipt if the tx has been mined.
24
- * @param txHash - Hash of the tx to look for.
25
- * @returns Undefined if the tx hasn't been mined yet, the receipt otherwise.
26
- */
27
- getTransactionReceipt(txHash: string): Promise<MinimalTransactionReceipt | undefined>;
28
- /**
29
- * Publishes tx effects to Availability Oracle.
30
- * @param encodedBody - Encoded block body.
31
- * @returns The hash of the mined tx.
32
- */
33
- sendPublishTx(encodedBody: Buffer): Promise<string | undefined>;
34
- /**
35
- * Sends a tx to the L1 rollup contract with a new L2 block. Returns once the tx has been mined.
36
- * @param encodedData - Serialized data for processing the new L2 block.
37
- * @returns The hash of the mined tx.
38
- */
39
- sendProcessTx(encodedData: ProcessTxArgs): Promise<string | undefined>;
40
- /**
41
- * @notice Publishes the body AND process the block in one transaction
42
- * @param encodedData - Serialized data for processing the new L2 block.
43
- * @returns The hash of the transaction
44
- */
45
- sendPublishAndProcessTx(encodedData: ProcessTxArgs): Promise<string | undefined>;
46
- /**
47
- * Sends a tx to the L1 rollup contract with a proof. Returns once the tx has been mined.
48
- * @param encodedData - Serialized data for the proof.
49
- * @returns The hash of the mined tx.
50
- */
51
- sendSubmitProofTx(submitProofArgs: L1SubmitProofArgs): Promise<string | undefined>;
52
- /**
53
- * Gets the chain object for the given chain id.
54
- * @param chainId - Chain id of the target EVM chain.
55
- * @returns Viem's chain object.
56
- */
57
- private getChain;
58
- }
59
- //# sourceMappingURL=viem-tx-sender.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viem-tx-sender.d.ts","sourceRoot":"","sources":["../../src/publisher/viem-tx-sender.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAA0B,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAsBxE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,qBAAa,YAAa,YAAW,mBAAmB;IACtD,OAAO,CAAC,0BAA0B,CAGhC;IACF,OAAO,CAAC,cAAc,CAGpB;IAEF,OAAO,CAAC,GAA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