@aztec/sequencer-client 0.69.0-devnet → 0.69.1-devnet
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.
- package/dest/client/sequencer-client.d.ts +2 -0
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +3 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +11 -1
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +3 -2
- package/dest/publisher/config.d.ts +4 -0
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +6 -1
- package/dest/publisher/index.d.ts +0 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/index.js +1 -2
- package/dest/publisher/l1-publisher.d.ts +21 -2
- package/dest/publisher/l1-publisher.d.ts.map +1 -1
- package/dest/publisher/l1-publisher.js +91 -95
- package/dest/sequencer/index.d.ts +1 -0
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +2 -1
- package/dest/sequencer/sequencer.d.ts +21 -30
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +60 -130
- package/dest/sequencer/utils.d.ts +2 -2
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +3 -3
- package/dest/test/index.d.ts +18 -0
- package/dest/test/index.d.ts.map +1 -0
- package/dest/test/index.js +8 -0
- package/dest/{publisher → test}/test-l1-publisher.d.ts +1 -1
- package/dest/test/test-l1-publisher.d.ts.map +1 -0
- package/dest/test/test-l1-publisher.js +11 -0
- package/dest/tx_validator/archive_cache.d.ts +14 -0
- package/dest/tx_validator/archive_cache.d.ts.map +1 -0
- package/dest/tx_validator/archive_cache.js +22 -0
- package/dest/tx_validator/gas_validator.d.ts +2 -3
- package/dest/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/tx_validator/gas_validator.js +9 -22
- package/dest/tx_validator/nullifier_cache.d.ts +16 -0
- package/dest/tx_validator/nullifier_cache.d.ts.map +1 -0
- package/dest/tx_validator/nullifier_cache.js +24 -0
- package/dest/tx_validator/phases_validator.d.ts +2 -3
- package/dest/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/tx_validator/phases_validator.js +15 -24
- package/dest/tx_validator/tx_validator_factory.d.ts +15 -14
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.js +41 -24
- package/package.json +23 -20
- package/src/client/sequencer-client.ts +5 -3
- package/src/config.ts +10 -0
- package/src/index.ts +2 -1
- package/src/publisher/config.ts +10 -0
- package/src/publisher/index.ts +0 -1
- package/src/publisher/l1-publisher.ts +119 -93
- package/src/sequencer/index.ts +1 -0
- package/src/sequencer/sequencer.ts +82 -193
- package/src/sequencer/utils.ts +2 -2
- package/src/test/index.ts +23 -0
- package/src/{publisher → test}/test-l1-publisher.ts +1 -1
- package/src/tx_validator/archive_cache.ts +27 -0
- package/src/tx_validator/gas_validator.ts +11 -24
- package/src/tx_validator/nullifier_cache.ts +29 -0
- package/src/tx_validator/phases_validator.ts +22 -33
- package/src/tx_validator/tx_validator_factory.ts +89 -40
- package/dest/publisher/test-l1-publisher.d.ts.map +0 -1
- package/dest/publisher/test-l1-publisher.js +0 -11
- package/dest/publisher/utils.d.ts +0 -2
- package/dest/publisher/utils.d.ts.map +0 -1
- package/dest/publisher/utils.js +0 -13
- package/src/publisher/utils.ts +0 -14
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type BlobSinkClientInterface, createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
1
2
|
import {
|
|
2
3
|
ConsensusPayload,
|
|
3
4
|
type EpochProofClaim,
|
|
4
5
|
type EpochProofQuote,
|
|
5
6
|
type L2Block,
|
|
6
|
-
|
|
7
|
+
SignatureDomainSeparator,
|
|
7
8
|
type TxHash,
|
|
8
9
|
getHashedSignaturePayload,
|
|
9
10
|
} from '@aztec/circuit-types';
|
|
@@ -16,7 +17,14 @@ import {
|
|
|
16
17
|
type Proof,
|
|
17
18
|
} from '@aztec/circuits.js';
|
|
18
19
|
import { type FeeRecipient, type RootRollupPublicInputs } from '@aztec/circuits.js/rollup';
|
|
19
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
type EthereumChain,
|
|
22
|
+
type GasPrice,
|
|
23
|
+
type L1ContractsConfig,
|
|
24
|
+
L1TxUtils,
|
|
25
|
+
createEthereumChain,
|
|
26
|
+
formatViemError,
|
|
27
|
+
} from '@aztec/ethereum';
|
|
20
28
|
import { makeTuple } from '@aztec/foundation/array';
|
|
21
29
|
import { toHex } from '@aztec/foundation/bigint-buffer';
|
|
22
30
|
import { Blob } from '@aztec/foundation/blob';
|
|
@@ -27,15 +35,16 @@ import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
|
27
35
|
import { type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
28
36
|
import { InterruptibleSleep } from '@aztec/foundation/sleep';
|
|
29
37
|
import { Timer } from '@aztec/foundation/timer';
|
|
30
|
-
import { EmpireBaseAbi,
|
|
38
|
+
import { EmpireBaseAbi, RollupAbi, SlasherAbi } from '@aztec/l1-artifacts';
|
|
31
39
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
40
|
+
import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
|
|
32
41
|
|
|
33
42
|
import pick from 'lodash.pick';
|
|
34
43
|
import {
|
|
35
44
|
type BaseError,
|
|
36
45
|
type Chain,
|
|
37
46
|
type Client,
|
|
38
|
-
ContractFunctionExecutionError,
|
|
47
|
+
type ContractFunctionExecutionError,
|
|
39
48
|
ContractFunctionRevertedError,
|
|
40
49
|
type GetContractReturnType,
|
|
41
50
|
type Hex,
|
|
@@ -63,7 +72,6 @@ import { privateKeyToAccount } from 'viem/accounts';
|
|
|
63
72
|
|
|
64
73
|
import { type PublisherConfig, type TxSenderConfig } from './config.js';
|
|
65
74
|
import { L1PublisherMetrics } from './l1-publisher-metrics.js';
|
|
66
|
-
import { prettyLogViemErrorMsg } from './utils.js';
|
|
67
75
|
|
|
68
76
|
/**
|
|
69
77
|
* Stats for a sent transaction.
|
|
@@ -95,6 +103,8 @@ export type MinimalTransactionReceipt = {
|
|
|
95
103
|
logs: any[];
|
|
96
104
|
/** Block number in which this tx was mined. */
|
|
97
105
|
blockNumber: bigint;
|
|
106
|
+
/** The block hash in which this tx was mined */
|
|
107
|
+
blockHash: `0x${string}`;
|
|
98
108
|
};
|
|
99
109
|
|
|
100
110
|
/** Arguments to the process method of the rollup contract */
|
|
@@ -115,6 +125,14 @@ type L1ProcessArgs = {
|
|
|
115
125
|
attestations?: Signature[];
|
|
116
126
|
};
|
|
117
127
|
|
|
128
|
+
type L1ProcessReturnType = {
|
|
129
|
+
receipt: TransactionReceipt | undefined;
|
|
130
|
+
args: any;
|
|
131
|
+
functionName: string;
|
|
132
|
+
data: Hex;
|
|
133
|
+
gasPrice: GasPrice;
|
|
134
|
+
};
|
|
135
|
+
|
|
118
136
|
/** Arguments to the submitEpochProof method of the rollup contract */
|
|
119
137
|
export type L1SubmitEpochProofArgs = {
|
|
120
138
|
epochSize: number;
|
|
@@ -175,6 +193,7 @@ export class L1Publisher {
|
|
|
175
193
|
protected account: PrivateKeyAccount;
|
|
176
194
|
protected ethereumSlotDuration: bigint;
|
|
177
195
|
|
|
196
|
+
private blobSinkClient: BlobSinkClientInterface;
|
|
178
197
|
// @note - with blobs, the below estimate seems too large.
|
|
179
198
|
// Total used for full block from int_l1_pub e2e test: 1m (of which 86k is 1x blob)
|
|
180
199
|
// Total used for emptier block from above test: 429k (of which 84k is 1x blob)
|
|
@@ -185,11 +204,15 @@ export class L1Publisher {
|
|
|
185
204
|
|
|
186
205
|
constructor(
|
|
187
206
|
config: TxSenderConfig & PublisherConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>,
|
|
188
|
-
|
|
207
|
+
deps: { telemetry?: TelemetryClient; blobSinkClient?: BlobSinkClientInterface } = {},
|
|
189
208
|
) {
|
|
190
209
|
this.sleepTimeMs = config?.l1PublishRetryIntervalMS ?? 60_000;
|
|
191
210
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
192
|
-
|
|
211
|
+
|
|
212
|
+
const telemetry = deps.telemetry ?? new NoopTelemetryClient();
|
|
213
|
+
this.blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config.blobSinkUrl);
|
|
214
|
+
|
|
215
|
+
this.metrics = new L1PublisherMetrics(telemetry, 'L1Publisher');
|
|
193
216
|
|
|
194
217
|
const { l1RpcUrl: rpcUrl, l1ChainId: chainId, publisherPrivateKey, l1Contracts } = config;
|
|
195
218
|
const chain = createEthereumChain(rpcUrl, chainId);
|
|
@@ -416,38 +439,6 @@ export class L1Publisher {
|
|
|
416
439
|
if (error instanceof ContractFunctionRevertedError) {
|
|
417
440
|
const err = error as ContractFunctionRevertedError;
|
|
418
441
|
this.log.debug(`Validation failed: ${err.message}`, err.data);
|
|
419
|
-
} else if (error instanceof ContractFunctionExecutionError) {
|
|
420
|
-
let err = error as ContractFunctionRevertedError;
|
|
421
|
-
if (!tryGetCustomErrorName(err)) {
|
|
422
|
-
// If we get here, it's because the custom error no longer exists in Rollup.sol,
|
|
423
|
-
// but in another lib. The below reconstructs the error message.
|
|
424
|
-
try {
|
|
425
|
-
await this.publicClient.estimateGas({
|
|
426
|
-
data: encodeFunctionData({
|
|
427
|
-
abi: this.rollupContract.abi,
|
|
428
|
-
functionName: 'validateHeader',
|
|
429
|
-
args,
|
|
430
|
-
}),
|
|
431
|
-
account: this.account,
|
|
432
|
-
to: this.rollupContract.address,
|
|
433
|
-
});
|
|
434
|
-
} catch (estGasErr: unknown) {
|
|
435
|
-
const possibleAbis = [ExtRollupLibAbi, LeonidasLibAbi];
|
|
436
|
-
possibleAbis.forEach(abi => {
|
|
437
|
-
const possibleErr = getContractError(estGasErr as BaseError, {
|
|
438
|
-
args: [],
|
|
439
|
-
abi: abi,
|
|
440
|
-
functionName: 'validateHeader',
|
|
441
|
-
address: this.rollupContract.address,
|
|
442
|
-
sender: this.account.address,
|
|
443
|
-
});
|
|
444
|
-
err = tryGetCustomErrorName(possibleErr) ? possibleErr : err;
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
throw err;
|
|
448
|
-
}
|
|
449
|
-
} else {
|
|
450
|
-
this.log.debug(`Unexpected error during validation: ${error}`);
|
|
451
442
|
}
|
|
452
443
|
throw error;
|
|
453
444
|
}
|
|
@@ -555,7 +546,7 @@ export class L1Publisher {
|
|
|
555
546
|
account: this.account,
|
|
556
547
|
});
|
|
557
548
|
} catch (err) {
|
|
558
|
-
const msg =
|
|
549
|
+
const msg = formatViemError(err);
|
|
559
550
|
logger.error(`Failed to vote`, msg);
|
|
560
551
|
this.myLastVotes[voteType] = cachedMyLastVote;
|
|
561
552
|
return false;
|
|
@@ -584,6 +575,7 @@ export class L1Publisher {
|
|
|
584
575
|
attestations?: Signature[],
|
|
585
576
|
txHashes?: TxHash[],
|
|
586
577
|
proofQuote?: EpochProofQuote,
|
|
578
|
+
opts: { txTimeoutAt?: Date } = {},
|
|
587
579
|
): Promise<boolean> {
|
|
588
580
|
const ctx = {
|
|
589
581
|
blockNumber: block.number,
|
|
@@ -593,16 +585,19 @@ export class L1Publisher {
|
|
|
593
585
|
|
|
594
586
|
const consensusPayload = new ConsensusPayload(block.header, block.archive.root, txHashes ?? []);
|
|
595
587
|
|
|
596
|
-
const digest = getHashedSignaturePayload(consensusPayload,
|
|
588
|
+
const digest = getHashedSignaturePayload(consensusPayload, SignatureDomainSeparator.blockAttestation);
|
|
589
|
+
|
|
590
|
+
const blobs = Blob.getBlobs(block.body.toBlobFields());
|
|
597
591
|
const proposeTxArgs = {
|
|
598
592
|
header: block.header.toBuffer(),
|
|
599
593
|
archive: block.archive.root.toBuffer(),
|
|
600
594
|
blockHash: block.header.hash().toBuffer(),
|
|
601
595
|
body: block.body.toBuffer(),
|
|
602
|
-
blobs
|
|
596
|
+
blobs,
|
|
603
597
|
attestations,
|
|
604
598
|
txHashes: txHashes ?? [],
|
|
605
599
|
};
|
|
600
|
+
|
|
606
601
|
// Publish body and propose block (if not already published)
|
|
607
602
|
if (this.interrupted) {
|
|
608
603
|
this.log.verbose('L2 block data syncing interrupted while processing blocks.', ctx);
|
|
@@ -622,15 +617,15 @@ export class L1Publisher {
|
|
|
622
617
|
|
|
623
618
|
this.log.debug(`Submitting propose transaction`);
|
|
624
619
|
const result = proofQuote
|
|
625
|
-
? await this.sendProposeAndClaimTx(proposeTxArgs, proofQuote)
|
|
626
|
-
: await this.sendProposeTx(proposeTxArgs);
|
|
620
|
+
? await this.sendProposeAndClaimTx(proposeTxArgs, proofQuote, opts)
|
|
621
|
+
: await this.sendProposeTx(proposeTxArgs, opts);
|
|
627
622
|
|
|
628
623
|
if (!result?.receipt) {
|
|
629
624
|
this.log.info(`Failed to publish block ${block.number} to L1`, ctx);
|
|
630
625
|
return false;
|
|
631
626
|
}
|
|
632
627
|
|
|
633
|
-
const { receipt, args, functionName, data } = result;
|
|
628
|
+
const { receipt, args, functionName, data, gasPrice } = result;
|
|
634
629
|
|
|
635
630
|
// Tx was mined successfully
|
|
636
631
|
if (receipt.status === 'success') {
|
|
@@ -647,6 +642,12 @@ export class L1Publisher {
|
|
|
647
642
|
};
|
|
648
643
|
this.log.verbose(`Published L2 block to L1 rollup contract`, { ...stats, ...ctx });
|
|
649
644
|
this.metrics.recordProcessBlockTx(timer.ms(), stats);
|
|
645
|
+
|
|
646
|
+
// Send the blobs to the blob sink
|
|
647
|
+
this.sendBlobsToBlobSink(receipt.blockHash, blobs).catch(_err => {
|
|
648
|
+
this.log.error('Failed to send blobs to blob sink');
|
|
649
|
+
});
|
|
650
|
+
|
|
650
651
|
return true;
|
|
651
652
|
}
|
|
652
653
|
|
|
@@ -661,9 +662,9 @@ export class L1Publisher {
|
|
|
661
662
|
address: this.rollupContract.address,
|
|
662
663
|
},
|
|
663
664
|
{
|
|
664
|
-
blobs: proposeTxArgs.blobs.map(b => b.
|
|
665
|
+
blobs: proposeTxArgs.blobs.map(b => b.dataWithZeros),
|
|
665
666
|
kzg,
|
|
666
|
-
maxFeePerBlobGas: 10000000000n,
|
|
667
|
+
maxFeePerBlobGas: gasPrice.maxFeePerBlobGas ?? 10000000000n,
|
|
667
668
|
},
|
|
668
669
|
);
|
|
669
670
|
this.log.error(`Rollup process tx reverted. ${errorMsg}`, undefined, {
|
|
@@ -677,11 +678,10 @@ export class L1Publisher {
|
|
|
677
678
|
/** Calls claimEpochProofRight in the Rollup contract to submit a chosen prover quote for the previous epoch. */
|
|
678
679
|
public async claimEpochProofRight(proofQuote: EpochProofQuote) {
|
|
679
680
|
const timer = new Timer();
|
|
680
|
-
|
|
681
|
-
let receipt;
|
|
681
|
+
let result;
|
|
682
682
|
try {
|
|
683
683
|
this.log.debug(`Submitting claimEpochProofRight transaction`);
|
|
684
|
-
|
|
684
|
+
result = await this.l1TxUtils.sendAndMonitorTransaction({
|
|
685
685
|
to: this.rollupContract.address,
|
|
686
686
|
data: encodeFunctionData({
|
|
687
687
|
abi: RollupAbi,
|
|
@@ -690,12 +690,14 @@ export class L1Publisher {
|
|
|
690
690
|
}),
|
|
691
691
|
});
|
|
692
692
|
} catch (err) {
|
|
693
|
-
this.log.error(`Failed to claim epoch proof right
|
|
693
|
+
this.log.error(`Failed to claim epoch proof right`, err, {
|
|
694
694
|
proofQuote: proofQuote.toInspect(),
|
|
695
695
|
});
|
|
696
696
|
return false;
|
|
697
697
|
}
|
|
698
698
|
|
|
699
|
+
const { receipt } = result;
|
|
700
|
+
|
|
699
701
|
if (receipt.status === 'success') {
|
|
700
702
|
const tx = await this.getTransactionStats(receipt.transactionHash);
|
|
701
703
|
const stats: L1PublishStats = {
|
|
@@ -757,8 +759,7 @@ export class L1Publisher {
|
|
|
757
759
|
},
|
|
758
760
|
],
|
|
759
761
|
});
|
|
760
|
-
// If the above passes, we have a blob error. We cannot simulate blob txs, and failed txs no longer throw errors
|
|
761
|
-
// and viem provides no way to get the revert reason from a given tx.
|
|
762
|
+
// If the above passes, we have a blob error. We cannot simulate blob txs, and failed txs no longer throw errors.
|
|
762
763
|
// Strangely, the only way to throw the revert reason as an error and provide blobs is prepareTransactionRequest.
|
|
763
764
|
// See: https://github.com/wevm/viem/issues/2075
|
|
764
765
|
// This throws a EstimateGasExecutionError with the custom error information:
|
|
@@ -770,13 +771,13 @@ export class L1Publisher {
|
|
|
770
771
|
});
|
|
771
772
|
return undefined;
|
|
772
773
|
} catch (simulationErr: any) {
|
|
773
|
-
// If we don't have a ContractFunctionExecutionError, we have a blob related error => use
|
|
774
|
+
// If we don't have a ContractFunctionExecutionError, we have a blob related error => use getContractError to get the error msg.
|
|
774
775
|
const contractErr =
|
|
775
776
|
simulationErr.name === 'ContractFunctionExecutionError'
|
|
776
777
|
? simulationErr
|
|
777
778
|
: getContractError(simulationErr as BaseError, {
|
|
778
779
|
args: [],
|
|
779
|
-
abi:
|
|
780
|
+
abi: RollupAbi,
|
|
780
781
|
functionName: args.functionName,
|
|
781
782
|
address: args.address,
|
|
782
783
|
sender: this.account.address,
|
|
@@ -919,35 +920,42 @@ export class L1Publisher {
|
|
|
919
920
|
publicInputs: RootRollupPublicInputs;
|
|
920
921
|
proof: Proof;
|
|
921
922
|
}): Promise<string | undefined> {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
const argsArray = this.getSubmitEpochProofArgs(args);
|
|
925
|
-
|
|
926
|
-
const txArgs = [
|
|
927
|
-
{
|
|
928
|
-
epochSize: argsArray[0],
|
|
929
|
-
args: argsArray[1],
|
|
930
|
-
fees: argsArray[2],
|
|
931
|
-
blobPublicInputs: argsArray[3],
|
|
932
|
-
aggregationObject: argsArray[4],
|
|
933
|
-
proof: proofHex,
|
|
934
|
-
},
|
|
935
|
-
] as const;
|
|
923
|
+
const proofHex: Hex = `0x${args.proof.withoutPublicInputs().toString('hex')}`;
|
|
924
|
+
const argsArray = this.getSubmitEpochProofArgs(args);
|
|
936
925
|
|
|
937
|
-
|
|
926
|
+
const txArgs = [
|
|
927
|
+
{
|
|
928
|
+
epochSize: argsArray[0],
|
|
929
|
+
args: argsArray[1],
|
|
930
|
+
fees: argsArray[2],
|
|
931
|
+
blobPublicInputs: argsArray[3],
|
|
932
|
+
aggregationObject: argsArray[4],
|
|
933
|
+
proof: proofHex,
|
|
934
|
+
},
|
|
935
|
+
] as const;
|
|
938
936
|
|
|
939
|
-
|
|
937
|
+
this.log.info(`SubmitEpochProof proofSize=${args.proof.withoutPublicInputs().length} bytes`);
|
|
938
|
+
const data = encodeFunctionData({
|
|
939
|
+
abi: this.rollupContract.abi,
|
|
940
|
+
functionName: 'submitEpochRootProof',
|
|
941
|
+
args: txArgs,
|
|
942
|
+
});
|
|
943
|
+
try {
|
|
944
|
+
const { receipt } = await this.l1TxUtils.sendAndMonitorTransaction({
|
|
940
945
|
to: this.rollupContract.address,
|
|
941
|
-
data
|
|
942
|
-
abi: this.rollupContract.abi,
|
|
943
|
-
functionName: 'submitEpochRootProof',
|
|
944
|
-
args: txArgs,
|
|
945
|
-
}),
|
|
946
|
+
data,
|
|
946
947
|
});
|
|
947
948
|
|
|
948
|
-
return
|
|
949
|
+
return receipt.transactionHash;
|
|
949
950
|
} catch (err) {
|
|
950
951
|
this.log.error(`Rollup submit epoch proof failed`, err);
|
|
952
|
+
const errorMsg = await this.tryGetErrorFromRevertedTx(data, {
|
|
953
|
+
args: [...txArgs],
|
|
954
|
+
functionName: 'submitEpochRootProof',
|
|
955
|
+
abi: this.rollupContract.abi,
|
|
956
|
+
address: this.rollupContract.address,
|
|
957
|
+
});
|
|
958
|
+
this.log.error(`Rollup submit epoch proof tx reverted. ${errorMsg}`);
|
|
951
959
|
return undefined;
|
|
952
960
|
}
|
|
953
961
|
}
|
|
@@ -966,9 +974,8 @@ export class L1Publisher {
|
|
|
966
974
|
},
|
|
967
975
|
{},
|
|
968
976
|
{
|
|
969
|
-
blobs: encodedData.blobs.map(b => b.
|
|
977
|
+
blobs: encodedData.blobs.map(b => b.dataWithZeros),
|
|
970
978
|
kzg,
|
|
971
|
-
maxFeePerBlobGas: 10000000000n, //This is 10 gwei, taken from DEFAULT_MAX_FEE_PER_GAS
|
|
972
979
|
},
|
|
973
980
|
);
|
|
974
981
|
|
|
@@ -1035,7 +1042,8 @@ export class L1Publisher {
|
|
|
1035
1042
|
|
|
1036
1043
|
private async sendProposeTx(
|
|
1037
1044
|
encodedData: L1ProcessArgs,
|
|
1038
|
-
|
|
1045
|
+
opts: { txTimeoutAt?: Date } = {},
|
|
1046
|
+
): Promise<L1ProcessReturnType | undefined> {
|
|
1039
1047
|
if (this.interrupted) {
|
|
1040
1048
|
return undefined;
|
|
1041
1049
|
}
|
|
@@ -1047,28 +1055,29 @@ export class L1Publisher {
|
|
|
1047
1055
|
functionName: 'propose',
|
|
1048
1056
|
args,
|
|
1049
1057
|
});
|
|
1050
|
-
const
|
|
1058
|
+
const result = await this.l1TxUtils.sendAndMonitorTransaction(
|
|
1051
1059
|
{
|
|
1052
1060
|
to: this.rollupContract.address,
|
|
1053
1061
|
data,
|
|
1054
1062
|
},
|
|
1055
1063
|
{
|
|
1056
1064
|
fixedGas: gas,
|
|
1065
|
+
...opts,
|
|
1057
1066
|
},
|
|
1058
1067
|
{
|
|
1059
|
-
blobs: encodedData.blobs.map(b => b.
|
|
1068
|
+
blobs: encodedData.blobs.map(b => b.dataWithZeros),
|
|
1060
1069
|
kzg,
|
|
1061
|
-
maxFeePerBlobGas: 10000000000n, //This is 10 gwei, taken from DEFAULT_MAX_FEE_PER_GAS
|
|
1062
1070
|
},
|
|
1063
1071
|
);
|
|
1064
1072
|
return {
|
|
1065
|
-
receipt,
|
|
1073
|
+
receipt: result.receipt,
|
|
1074
|
+
gasPrice: result.gasPrice,
|
|
1066
1075
|
args,
|
|
1067
1076
|
functionName: 'propose',
|
|
1068
1077
|
data,
|
|
1069
1078
|
};
|
|
1070
1079
|
} catch (err) {
|
|
1071
|
-
this.log.error(`Rollup publish failed
|
|
1080
|
+
this.log.error(`Rollup publish failed.`, err);
|
|
1072
1081
|
return undefined;
|
|
1073
1082
|
}
|
|
1074
1083
|
}
|
|
@@ -1076,7 +1085,8 @@ export class L1Publisher {
|
|
|
1076
1085
|
private async sendProposeAndClaimTx(
|
|
1077
1086
|
encodedData: L1ProcessArgs,
|
|
1078
1087
|
quote: EpochProofQuote,
|
|
1079
|
-
|
|
1088
|
+
opts: { txTimeoutAt?: Date } = {},
|
|
1089
|
+
): Promise<L1ProcessReturnType | undefined> {
|
|
1080
1090
|
if (this.interrupted) {
|
|
1081
1091
|
return undefined;
|
|
1082
1092
|
}
|
|
@@ -1088,27 +1098,30 @@ export class L1Publisher {
|
|
|
1088
1098
|
functionName: 'proposeAndClaim',
|
|
1089
1099
|
args: [...args, quote.toViemArgs()],
|
|
1090
1100
|
});
|
|
1091
|
-
const
|
|
1101
|
+
const result = await this.l1TxUtils.sendAndMonitorTransaction(
|
|
1092
1102
|
{
|
|
1093
1103
|
to: this.rollupContract.address,
|
|
1094
1104
|
data,
|
|
1095
1105
|
},
|
|
1096
|
-
{ fixedGas: gas },
|
|
1097
1106
|
{
|
|
1098
|
-
|
|
1107
|
+
fixedGas: gas,
|
|
1108
|
+
...opts,
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
blobs: encodedData.blobs.map(b => b.dataWithZeros),
|
|
1099
1112
|
kzg,
|
|
1100
|
-
maxFeePerBlobGas: 10000000000n, //This is 10 gwei, taken from DEFAULT_MAX_FEE_PER_GAS
|
|
1101
1113
|
},
|
|
1102
1114
|
);
|
|
1103
1115
|
|
|
1104
1116
|
return {
|
|
1105
|
-
receipt,
|
|
1117
|
+
receipt: result.receipt,
|
|
1118
|
+
gasPrice: result.gasPrice,
|
|
1106
1119
|
args: [...args, quote.toViemArgs()],
|
|
1107
1120
|
functionName: 'proposeAndClaim',
|
|
1108
1121
|
data,
|
|
1109
1122
|
};
|
|
1110
1123
|
} catch (err) {
|
|
1111
|
-
this.log.error(`Rollup publish failed
|
|
1124
|
+
this.log.error(`Rollup publish failed.`, err);
|
|
1112
1125
|
return undefined;
|
|
1113
1126
|
}
|
|
1114
1127
|
}
|
|
@@ -1137,6 +1150,7 @@ export class L1Publisher {
|
|
|
1137
1150
|
gasPrice: receipt.effectiveGasPrice,
|
|
1138
1151
|
logs: receipt.logs,
|
|
1139
1152
|
blockNumber: receipt.blockNumber,
|
|
1153
|
+
blockHash: receipt.blockHash,
|
|
1140
1154
|
};
|
|
1141
1155
|
}
|
|
1142
1156
|
|
|
@@ -1152,9 +1166,21 @@ export class L1Publisher {
|
|
|
1152
1166
|
protected async sleepOrInterrupted() {
|
|
1153
1167
|
await this.interruptibleSleep.sleep(this.sleepTimeMs);
|
|
1154
1168
|
}
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Send blobs to the blob sink
|
|
1172
|
+
*
|
|
1173
|
+
* If a blob sink url is configured, then we send blobs to the blob sink
|
|
1174
|
+
* - for now we use the blockHash as the identifier for the blobs;
|
|
1175
|
+
* In the future this will move to be the beacon block id - which takes a bit more work
|
|
1176
|
+
* to calculate and will need to be mocked in e2e tests
|
|
1177
|
+
*/
|
|
1178
|
+
protected sendBlobsToBlobSink(blockHash: string, blobs: Blob[]): Promise<boolean> {
|
|
1179
|
+
return this.blobSinkClient.sendBlobsToBlobSink(blockHash, blobs);
|
|
1180
|
+
}
|
|
1155
1181
|
}
|
|
1156
1182
|
|
|
1157
|
-
|
|
1183
|
+
/*
|
|
1158
1184
|
* Returns cost of calldata usage in Ethereum.
|
|
1159
1185
|
* @param data - Calldata.
|
|
1160
1186
|
* @returns 4 for each zero byte, 16 for each nonzero.
|
package/src/sequencer/index.ts
CHANGED