@aztec/sequencer-client 3.0.0-devnet.2 → 3.0.0-devnet.2-patch.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.
- package/dest/client/index.d.ts +1 -1
- package/dest/client/sequencer-client.d.ts +2 -2
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +6 -2
- package/dest/config.d.ts +3 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +11 -1
- package/dest/global_variable_builder/global_builder.d.ts +5 -7
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +12 -8
- package/dest/global_variable_builder/index.d.ts +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/publisher/config.d.ts +7 -2
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +12 -1
- package/dest/publisher/index.d.ts +1 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts +3 -2
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.d.ts +1 -1
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.d.ts +40 -31
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +117 -62
- package/dest/sequencer/block_builder.d.ts +4 -3
- package/dest/sequencer/block_builder.d.ts.map +1 -1
- package/dest/sequencer/block_builder.js +5 -8
- package/dest/sequencer/config.d.ts +2 -2
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/errors.d.ts +1 -1
- package/dest/sequencer/errors.d.ts.map +1 -1
- package/dest/sequencer/index.d.ts +1 -1
- package/dest/sequencer/metrics.d.ts +12 -3
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +38 -0
- package/dest/sequencer/sequencer.d.ts +48 -27
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +418 -166
- package/dest/sequencer/timetable.d.ts +3 -1
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/utils.d.ts +1 -1
- package/dest/test/index.d.ts +2 -2
- package/dest/test/index.d.ts.map +1 -1
- package/dest/tx_validator/nullifier_cache.d.ts +1 -1
- package/dest/tx_validator/nullifier_cache.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.d.ts +4 -3
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -1
- package/dest/tx_validator/tx_validator_factory.js +1 -1
- package/package.json +31 -30
- package/src/client/sequencer-client.ts +6 -9
- package/src/config.ts +12 -6
- package/src/global_variable_builder/global_builder.ts +19 -17
- package/src/publisher/config.ts +17 -6
- package/src/publisher/sequencer-publisher-factory.ts +4 -2
- package/src/publisher/sequencer-publisher.ts +165 -94
- package/src/sequencer/block_builder.ts +8 -12
- package/src/sequencer/config.ts +1 -1
- package/src/sequencer/metrics.ts +52 -3
- package/src/sequencer/sequencer.ts +480 -198
- package/src/sequencer/timetable.ts +7 -0
- package/src/test/index.ts +1 -1
- package/src/tx_validator/tx_validator_factory.ts +3 -2
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Blob, getBlobsPerL1Block, getPrefixedEthBlobCommitments } from '@aztec/blob-lib';
|
|
2
2
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
3
|
-
import {
|
|
3
|
+
import { MULTI_CALL_3_ADDRESS, Multicall3, RollupContract } from '@aztec/ethereum/contracts';
|
|
4
|
+
import { WEI_CONST } from '@aztec/ethereum/l1-tx-utils';
|
|
5
|
+
import { FormattedViemError, formatViemError, tryExtractEvent } from '@aztec/ethereum/utils';
|
|
4
6
|
import { sumBigint } from '@aztec/foundation/bigint';
|
|
5
7
|
import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
8
|
+
import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
6
9
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
10
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
8
11
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -38,6 +41,7 @@ export class SequencerPublisher {
|
|
|
38
41
|
log;
|
|
39
42
|
ethereumSlotDuration;
|
|
40
43
|
blobSinkClient;
|
|
44
|
+
/** Address to use for simulations in fisherman mode (actual proposer's address) */ proposerAddressForSimulation;
|
|
41
45
|
// @note - with blobs, the below estimate seems too large.
|
|
42
46
|
// Total used for full block from int_l1_pub e2e test: 1m (of which 86k is 1x blob)
|
|
43
47
|
// Total used for emptier block from above test: 429k (of which 84k is 1x blob)
|
|
@@ -85,6 +89,12 @@ export class SequencerPublisher {
|
|
|
85
89
|
getSenderAddress() {
|
|
86
90
|
return this.l1TxUtils.getSenderAddress();
|
|
87
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Sets the proposer address to use for simulations in fisherman mode.
|
|
94
|
+
* @param proposerAddress - The actual proposer's address to use for balance lookups in simulations
|
|
95
|
+
*/ setProposerAddressForSimulation(proposerAddress) {
|
|
96
|
+
this.proposerAddressForSimulation = proposerAddress;
|
|
97
|
+
}
|
|
88
98
|
addRequest(request) {
|
|
89
99
|
this.requests.push(request);
|
|
90
100
|
}
|
|
@@ -92,6 +102,15 @@ export class SequencerPublisher {
|
|
|
92
102
|
return this.epochCache.getEpochAndSlotNow().slot;
|
|
93
103
|
}
|
|
94
104
|
/**
|
|
105
|
+
* Clears all pending requests without sending them.
|
|
106
|
+
*/ clearPendingRequests() {
|
|
107
|
+
const count = this.requests.length;
|
|
108
|
+
this.requests = [];
|
|
109
|
+
if (count > 0) {
|
|
110
|
+
this.log.debug(`Cleared ${count} pending request(s)`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
95
114
|
* Sends all requests that are still valid.
|
|
96
115
|
* @returns one of:
|
|
97
116
|
* - A receipt and stats if the tx succeeded
|
|
@@ -211,7 +230,9 @@ export class SequencerPublisher {
|
|
|
211
230
|
'InvalidProposer',
|
|
212
231
|
'InvalidArchive'
|
|
213
232
|
];
|
|
214
|
-
return this.rollupContract.canProposeAtNextEthBlock(tipArchive.toBuffer(), msgSender.toString(), this.ethereumSlotDuration,
|
|
233
|
+
return this.rollupContract.canProposeAtNextEthBlock(tipArchive.toBuffer(), msgSender.toString(), Number(this.ethereumSlotDuration), {
|
|
234
|
+
forcePendingCheckpointNumber: opts.forcePendingBlockNumber !== undefined ? CheckpointNumber.fromBlockNumber(opts.forcePendingBlockNumber) : undefined
|
|
235
|
+
}).catch((err)=>{
|
|
215
236
|
if (err instanceof FormattedViemError && ignoredErrors.find((e)=>err.message.includes(e))) {
|
|
216
237
|
this.log.warn(`Failed canProposeAtTime check with ${ignoredErrors.find((e)=>err.message.includes(e))}`, {
|
|
217
238
|
error: err.message
|
|
@@ -242,9 +263,20 @@ export class SequencerPublisher {
|
|
|
242
263
|
flags
|
|
243
264
|
];
|
|
244
265
|
const ts = BigInt((await this.l1TxUtils.getBlock()).timestamp + this.ethereumSlotDuration);
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
|
|
266
|
+
const optsForcePendingCheckpointNumber = opts?.forcePendingBlockNumber !== undefined ? CheckpointNumber.fromBlockNumber(opts.forcePendingBlockNumber) : undefined;
|
|
267
|
+
const stateOverrides = await this.rollupContract.makePendingCheckpointNumberOverride(optsForcePendingCheckpointNumber);
|
|
268
|
+
let balance = 0n;
|
|
269
|
+
if (this.config.fishermanMode) {
|
|
270
|
+
// In fisherman mode, we can't know where the proposer is publishing from
|
|
271
|
+
// so we just add sufficient balance to the multicall3 address
|
|
272
|
+
balance = 10n * WEI_CONST * WEI_CONST; // 10 ETH
|
|
273
|
+
} else {
|
|
274
|
+
balance = await this.l1TxUtils.getSenderBalance();
|
|
275
|
+
}
|
|
276
|
+
stateOverrides.push({
|
|
277
|
+
address: MULTI_CALL_3_ADDRESS,
|
|
278
|
+
balance
|
|
279
|
+
});
|
|
248
280
|
await this.l1TxUtils.simulate({
|
|
249
281
|
to: this.rollupContract.address,
|
|
250
282
|
data: encodeFunctionData({
|
|
@@ -255,13 +287,7 @@ export class SequencerPublisher {
|
|
|
255
287
|
from: MULTI_CALL_3_ADDRESS
|
|
256
288
|
}, {
|
|
257
289
|
time: ts + 1n
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
address: MULTI_CALL_3_ADDRESS,
|
|
261
|
-
balance
|
|
262
|
-
},
|
|
263
|
-
...await this.rollupContract.makePendingBlockNumberOverride(opts?.forcePendingBlockNumber)
|
|
264
|
-
]);
|
|
290
|
+
}, stateOverrides);
|
|
265
291
|
this.log.debug(`Simulated validateHeader`);
|
|
266
292
|
}
|
|
267
293
|
/**
|
|
@@ -277,7 +303,7 @@ export class SequencerPublisher {
|
|
|
277
303
|
...block,
|
|
278
304
|
reason
|
|
279
305
|
};
|
|
280
|
-
const currentBlockNumber = await this.rollupContract.
|
|
306
|
+
const currentBlockNumber = await this.rollupContract.getCheckpointNumber();
|
|
281
307
|
if (currentBlockNumber < validationResult.block.blockNumber) {
|
|
282
308
|
this.log.verbose(`Skipping block ${blockNumber} invalidation since it has already been removed from the pending chain`, {
|
|
283
309
|
currentBlockNumber,
|
|
@@ -301,7 +327,7 @@ export class SequencerPublisher {
|
|
|
301
327
|
request,
|
|
302
328
|
gasUsed,
|
|
303
329
|
blockNumber,
|
|
304
|
-
forcePendingBlockNumber: blockNumber - 1,
|
|
330
|
+
forcePendingBlockNumber: BlockNumber(blockNumber - 1),
|
|
305
331
|
reason
|
|
306
332
|
};
|
|
307
333
|
} catch (err) {
|
|
@@ -314,7 +340,7 @@ export class SequencerPublisher {
|
|
|
314
340
|
request,
|
|
315
341
|
error: viemError.message
|
|
316
342
|
});
|
|
317
|
-
const latestPendingBlockNumber = await this.rollupContract.
|
|
343
|
+
const latestPendingBlockNumber = await this.rollupContract.getCheckpointNumber();
|
|
318
344
|
if (latestPendingBlockNumber < blockNumber) {
|
|
319
345
|
this.log.verbose(`Block number ${blockNumber} has already been invalidated`, {
|
|
320
346
|
...logData
|
|
@@ -346,9 +372,9 @@ export class SequencerPublisher {
|
|
|
346
372
|
this.log.debug(`Simulating invalidate block ${block.blockNumber}`, logData);
|
|
347
373
|
const attestationsAndSigners = new CommitteeAttestationsAndSigners(validationResult.attestations).getPackedAttestations();
|
|
348
374
|
if (reason === 'invalid-attestation') {
|
|
349
|
-
return this.rollupContract.buildInvalidateBadAttestationRequest(block.blockNumber, attestationsAndSigners, committee, validationResult.invalidIndex);
|
|
375
|
+
return this.rollupContract.buildInvalidateBadAttestationRequest(CheckpointNumber.fromBlockNumber(block.blockNumber), attestationsAndSigners, committee, validationResult.invalidIndex);
|
|
350
376
|
} else if (reason === 'insufficient-attestations') {
|
|
351
|
-
return this.rollupContract.buildInvalidateInsufficientAttestationsRequest(block.blockNumber, attestationsAndSigners, committee);
|
|
377
|
+
return this.rollupContract.buildInvalidateInsufficientAttestationsRequest(CheckpointNumber.fromBlockNumber(block.blockNumber), attestationsAndSigners, committee);
|
|
352
378
|
} else {
|
|
353
379
|
const _ = reason;
|
|
354
380
|
throw new Error(`Unknown reason for invalidation`);
|
|
@@ -368,10 +394,10 @@ export class SequencerPublisher {
|
|
|
368
394
|
// so that the committee is recalculated correctly
|
|
369
395
|
const ignoreSignatures = attestationsAndSigners.attestations.length === 0;
|
|
370
396
|
if (ignoreSignatures) {
|
|
371
|
-
const { committee } = await this.epochCache.getCommittee(block.header.globalVariables.slotNumber
|
|
397
|
+
const { committee } = await this.epochCache.getCommittee(block.header.globalVariables.slotNumber);
|
|
372
398
|
if (!committee) {
|
|
373
|
-
this.log.warn(`No committee found for slot ${block.header.globalVariables.slotNumber
|
|
374
|
-
throw new Error(`No committee found for slot ${block.header.globalVariables.slotNumber
|
|
399
|
+
this.log.warn(`No committee found for slot ${block.header.globalVariables.slotNumber}`);
|
|
400
|
+
throw new Error(`No committee found for slot ${block.header.globalVariables.slotNumber}`);
|
|
375
401
|
}
|
|
376
402
|
attestationsAndSigners.attestations = committee.map((committeeMember)=>CommitteeAttestation.fromAddress(committeeMember));
|
|
377
403
|
}
|
|
@@ -382,7 +408,6 @@ export class SequencerPublisher {
|
|
|
382
408
|
{
|
|
383
409
|
header: block.getCheckpointHeader().toViem(),
|
|
384
410
|
archive: toHex(block.archive.root.toBuffer()),
|
|
385
|
-
stateReference: block.header.state.toViem(),
|
|
386
411
|
oracleInput: {
|
|
387
412
|
feeAssetPriceModifier: 0n
|
|
388
413
|
}
|
|
@@ -568,7 +593,6 @@ export class SequencerPublisher {
|
|
|
568
593
|
const proposeTxArgs = {
|
|
569
594
|
header: checkpointHeader,
|
|
570
595
|
archive: block.archive.root.toBuffer(),
|
|
571
|
-
stateReference: block.header.state,
|
|
572
596
|
body: block.body.toBuffer(),
|
|
573
597
|
blobs,
|
|
574
598
|
attestationsAndSigners,
|
|
@@ -585,7 +609,7 @@ export class SequencerPublisher {
|
|
|
585
609
|
} catch (err) {
|
|
586
610
|
this.log.error(`Block validation failed. ${err instanceof Error ? err.message : 'No error message'}`, err, {
|
|
587
611
|
...block.getStats(),
|
|
588
|
-
slotNumber: block.header.globalVariables.slotNumber
|
|
612
|
+
slotNumber: block.header.globalVariables.slotNumber,
|
|
589
613
|
forcePendingBlockNumber: opts.forcePendingBlockNumber
|
|
590
614
|
});
|
|
591
615
|
throw err;
|
|
@@ -618,9 +642,9 @@ export class SequencerPublisher {
|
|
|
618
642
|
gasLimit,
|
|
619
643
|
txTimeoutAt: opts.txTimeoutAt
|
|
620
644
|
},
|
|
621
|
-
lastValidL2Slot: this.getCurrentL2Slot() +
|
|
645
|
+
lastValidL2Slot: SlotNumber(this.getCurrentL2Slot() + 2),
|
|
622
646
|
checkSuccess: (_req, result)=>{
|
|
623
|
-
const success = result && result.receipt && result.receipt.status === 'success' && tryExtractEvent(result.receipt.logs, this.rollupContract.address, RollupAbi, '
|
|
647
|
+
const success = result && result.receipt && result.receipt.status === 'success' && tryExtractEvent(result.receipt.logs, this.rollupContract.address, RollupAbi, 'CheckpointInvalidated');
|
|
624
648
|
if (!success) {
|
|
625
649
|
this.log.warn(`Invalidate block ${request.blockNumber} failed`, {
|
|
626
650
|
...result,
|
|
@@ -713,31 +737,40 @@ export class SequencerPublisher {
|
|
|
713
737
|
this.log.debug('Validating blob input', {
|
|
714
738
|
blobInput
|
|
715
739
|
});
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
740
|
+
// Get blob evaluation gas
|
|
741
|
+
let blobEvaluationGas;
|
|
742
|
+
if (this.config.fishermanMode) {
|
|
743
|
+
// In fisherman mode, we can't estimate blob gas because estimateGas doesn't support state overrides
|
|
744
|
+
// Use a fixed estimate.
|
|
745
|
+
blobEvaluationGas = BigInt(encodedData.blobs.length) * 21_000n;
|
|
746
|
+
this.log.debug(`Using fixed blob evaluation gas estimate in fisherman mode: ${blobEvaluationGas}`);
|
|
747
|
+
} else {
|
|
748
|
+
// Normal mode - use estimateGas with blob inputs
|
|
749
|
+
blobEvaluationGas = await this.l1TxUtils.estimateGas(this.getSenderAddress().toString(), {
|
|
750
|
+
to: this.rollupContract.address,
|
|
751
|
+
data: encodeFunctionData({
|
|
752
|
+
abi: RollupAbi,
|
|
753
|
+
functionName: 'validateBlobs',
|
|
754
|
+
args: [
|
|
755
|
+
blobInput
|
|
756
|
+
]
|
|
757
|
+
})
|
|
758
|
+
}, {}, {
|
|
759
|
+
blobs: encodedData.blobs.map((b)=>b.data),
|
|
760
|
+
kzg
|
|
761
|
+
}).catch((err)=>{
|
|
762
|
+
const { message, metaMessages } = formatViemError(err);
|
|
763
|
+
this.log.error(`Failed to validate blobs`, message, {
|
|
764
|
+
metaMessages
|
|
765
|
+
});
|
|
766
|
+
throw new Error('Failed to validate blobs');
|
|
732
767
|
});
|
|
733
|
-
|
|
734
|
-
});
|
|
768
|
+
}
|
|
735
769
|
const signers = encodedData.attestationsAndSigners.getSigners().map((signer)=>signer.toString());
|
|
736
770
|
const args = [
|
|
737
771
|
{
|
|
738
772
|
header: encodedData.header.toViem(),
|
|
739
773
|
archive: toHex(encodedData.archive),
|
|
740
|
-
stateReference: encodedData.stateReference.toViem(),
|
|
741
774
|
oracleInput: {
|
|
742
775
|
// We are currently not modifying these. See #9963
|
|
743
776
|
feeAssetPriceModifier: 0n
|
|
@@ -767,18 +800,10 @@ export class SequencerPublisher {
|
|
|
767
800
|
functionName: 'propose',
|
|
768
801
|
args
|
|
769
802
|
});
|
|
770
|
-
// override the pending
|
|
771
|
-
const
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
data: rollupData,
|
|
775
|
-
gas: SequencerPublisher.PROPOSE_GAS_GUESS
|
|
776
|
-
}, {
|
|
777
|
-
// @note we add 1n to the timestamp because geth implementation doesn't like simulation timestamp to be equal to the current block timestamp
|
|
778
|
-
time: timestamp + 1n,
|
|
779
|
-
// @note reth should have a 30m gas limit per block but throws errors that this tx is beyond limit so we increase here
|
|
780
|
-
gasLimit: SequencerPublisher.PROPOSE_GAS_GUESS * 2n
|
|
781
|
-
}, [
|
|
803
|
+
// override the pending checkpoint number if requested
|
|
804
|
+
const optsForcePendingCheckpointNumber = options.forcePendingBlockNumber !== undefined ? CheckpointNumber.fromBlockNumber(options.forcePendingBlockNumber) : undefined;
|
|
805
|
+
const forcePendingCheckpointNumberStateDiff = (optsForcePendingCheckpointNumber !== undefined ? await this.rollupContract.makePendingCheckpointNumberOverride(optsForcePendingCheckpointNumber) : []).flatMap((override)=>override.stateDiff ?? []);
|
|
806
|
+
const stateOverrides = [
|
|
782
807
|
{
|
|
783
808
|
address: this.rollupContract.address,
|
|
784
809
|
// @note we override checkBlob to false since blobs are not part simulate()
|
|
@@ -787,14 +812,44 @@ export class SequencerPublisher {
|
|
|
787
812
|
slot: toPaddedHex(RollupContract.checkBlobStorageSlot, true),
|
|
788
813
|
value: toPaddedHex(0n, true)
|
|
789
814
|
},
|
|
790
|
-
...
|
|
815
|
+
...forcePendingCheckpointNumberStateDiff
|
|
791
816
|
]
|
|
792
817
|
}
|
|
793
|
-
]
|
|
818
|
+
];
|
|
819
|
+
// In fisherman mode, simulate as the proposer but with sufficient balance
|
|
820
|
+
if (this.proposerAddressForSimulation) {
|
|
821
|
+
stateOverrides.push({
|
|
822
|
+
address: this.proposerAddressForSimulation.toString(),
|
|
823
|
+
balance: 10n * WEI_CONST * WEI_CONST
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
const simulationResult = await this.l1TxUtils.simulate({
|
|
827
|
+
to: this.rollupContract.address,
|
|
828
|
+
data: rollupData,
|
|
829
|
+
gas: SequencerPublisher.PROPOSE_GAS_GUESS,
|
|
830
|
+
...this.proposerAddressForSimulation && {
|
|
831
|
+
from: this.proposerAddressForSimulation.toString()
|
|
832
|
+
}
|
|
833
|
+
}, {
|
|
834
|
+
// @note we add 1n to the timestamp because geth implementation doesn't like simulation timestamp to be equal to the current block timestamp
|
|
835
|
+
time: timestamp + 1n,
|
|
836
|
+
// @note reth should have a 30m gas limit per block but throws errors that this tx is beyond limit so we increase here
|
|
837
|
+
gasLimit: SequencerPublisher.PROPOSE_GAS_GUESS * 2n
|
|
838
|
+
}, stateOverrides, RollupAbi, {
|
|
794
839
|
// @note fallback gas estimate to use if the node doesn't support simulation API
|
|
795
840
|
fallbackGasEstimate: SequencerPublisher.PROPOSE_GAS_GUESS
|
|
796
841
|
}).catch((err)=>{
|
|
797
|
-
|
|
842
|
+
// In fisherman mode, we expect ValidatorSelection__MissingProposerSignature since fisherman doesn't have proposer signature
|
|
843
|
+
const viemError = formatViemError(err);
|
|
844
|
+
if (this.config.fishermanMode && viemError.message?.includes('ValidatorSelection__MissingProposerSignature')) {
|
|
845
|
+
this.log.debug(`Ignoring expected ValidatorSelection__MissingProposerSignature error in fisherman mode`);
|
|
846
|
+
// Return a minimal simulation result with the fallback gas estimate
|
|
847
|
+
return {
|
|
848
|
+
gasUsed: SequencerPublisher.PROPOSE_GAS_GUESS,
|
|
849
|
+
logs: []
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
this.log.error(`Failed to simulate propose tx`, viemError);
|
|
798
853
|
throw err;
|
|
799
854
|
});
|
|
800
855
|
return {
|
|
@@ -819,7 +874,7 @@ export class SequencerPublisher {
|
|
|
819
874
|
to: this.rollupContract.address,
|
|
820
875
|
data: rollupData
|
|
821
876
|
},
|
|
822
|
-
lastValidL2Slot: block.header.globalVariables.slotNumber
|
|
877
|
+
lastValidL2Slot: block.header.globalVariables.slotNumber,
|
|
823
878
|
gasConfig: {
|
|
824
879
|
...opts,
|
|
825
880
|
gasLimit
|
|
@@ -833,7 +888,7 @@ export class SequencerPublisher {
|
|
|
833
888
|
return false;
|
|
834
889
|
}
|
|
835
890
|
const { receipt, stats, errorMsg } = result;
|
|
836
|
-
const success = receipt && receipt.status === 'success' && tryExtractEvent(receipt.logs, this.rollupContract.address, RollupAbi, '
|
|
891
|
+
const success = receipt && receipt.status === 'success' && tryExtractEvent(receipt.logs, this.rollupContract.address, RollupAbi, 'CheckpointProposed');
|
|
837
892
|
if (success) {
|
|
838
893
|
const endBlock = receipt.blockNumber;
|
|
839
894
|
const inclusionBlocks = Number(endBlock - startBlock);
|
|
@@ -865,7 +920,7 @@ export class SequencerPublisher {
|
|
|
865
920
|
...block.getStats(),
|
|
866
921
|
receipt,
|
|
867
922
|
txHash: receipt.transactionHash,
|
|
868
|
-
slotNumber: block.header.globalVariables.slotNumber
|
|
923
|
+
slotNumber: block.header.globalVariables.slotNumber
|
|
869
924
|
});
|
|
870
925
|
return false;
|
|
871
926
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
3
4
|
import { PublicProcessor } from '@aztec/simulator/server';
|
|
4
5
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
@@ -22,6 +23,6 @@ export declare class FullNodeBlockBuilder implements IFullNodeBlockBuilder {
|
|
|
22
23
|
}>;
|
|
23
24
|
private syncToPreviousBlock;
|
|
24
25
|
buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, l1ToL2Messages: Fr[], globalVariables: GlobalVariables, opts: PublicProcessorLimits, suppliedFork?: MerkleTreeWriteOperations): Promise<BuildBlockResult>;
|
|
25
|
-
getFork(blockNumber:
|
|
26
|
+
getFork(blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations>;
|
|
26
27
|
}
|
|
27
|
-
//# sourceMappingURL=
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfYnVpbGRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NlcXVlbmNlci9ibG9ja19idWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUU5RCxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUl6RCxPQUFPLEVBQUUsWUFBWSxFQUFrQixNQUFNLHlCQUF5QixDQUFDO0FBR3ZFLE9BQU8sRUFHTCxlQUFlLEVBRWhCLE1BQU0seUJBQXlCLENBQUM7QUFDakMsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUNqRSxPQUFPLEVBQUUsS0FBSyxpQkFBaUIsRUFBdUIsTUFBTSw2QkFBNkIsQ0FBQztBQUUxRixPQUFPLEtBQUssRUFDVixnQkFBZ0IsRUFDaEIsMEJBQTBCLEV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lQUFlLEdBQUUsZUFBc0MsRUFDN0Q7SUFFRyxTQUFTLElBQUksMEJBQTBCLENBRTdDO0lBRU0sWUFBWSxDQUFDLE1BQU0sRUFBRSxPQUFPLENBQUMsMEJBQTBCLENBQUMsUUFFOUQ7SUFFWSxvQkFBb0IsQ0FBQyxlQUFlLEVBQUUsZUFBZSxFQUFFLElBQUksRUFBRSx5QkFBeUI7OztPQWtDbEc7WUFFYSxtQkFBbUI7SUFVM0IsVUFBVSxDQUNkLFVBQVUsRUFBRSxRQUFRLENBQUMsRUFBRSxDQUFDLEdBQUcsYUFBYSxDQUFDLEVBQUUsQ0FBQyxFQUM1QyxjQUFjLEVBQUUsRUFBRSxFQUFFLEVBQ3BCLGVBQWUsRUFBRSxlQUFlLEVBQ2hDLElBQUksRUFBRSxxQkFBcUIsRUFDM0IsWUFBWSxDQUFDLEVBQUUseUJBQXlCLEdBQ3ZDLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQXNDM0I7SUFFRCxPQUFPLENBQUMsV0FBVyxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMseUJBQXlCLENBQUMsQ0FFcEU7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_builder.d.ts","sourceRoot":"","sources":["../../src/sequencer/block_builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block_builder.d.ts","sourceRoot":"","sources":["../../src/sequencer/block_builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAkB,MAAM,yBAAyB,CAAC;AAGvE,OAAO,EAGL,eAAe,EAEhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,KAAK,iBAAiB,EAAuB,MA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EAAE,CAAC,GAAG,aAAa,CAAC,EAAE,CAAC,EAC5C,cAAc,EAAE,EAAE,EAAE,EACpB,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,qBAAqB,EAC3B,YAAY,CAAC,EAAE,yBAAyB,GACvC,OAAO,CAAC,gBAAgB,CAAC,CAsC3B;IAED,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAEpE;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MerkleTreeId } from '@aztec/aztec.js/trees';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { merge, pick } from '@aztec/foundation/collection';
|
|
3
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -6,7 +7,7 @@ import { bufferToHex } from '@aztec/foundation/string';
|
|
|
6
7
|
import { Timer, elapsed } from '@aztec/foundation/timer';
|
|
7
8
|
import { getDefaultAllowedSetupFunctions } from '@aztec/p2p/msg_validators';
|
|
8
9
|
import { LightweightBlockFactory } from '@aztec/prover-client/block-factory';
|
|
9
|
-
import { GuardedMerkleTreeOperations, PublicContractsDB, PublicProcessor,
|
|
10
|
+
import { GuardedMerkleTreeOperations, PublicContractsDB, PublicProcessor, createPublicTxSimulatorForBlockBuilding } from '@aztec/simulator/server';
|
|
10
11
|
import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
11
12
|
import { Gas } from '@aztec/stdlib/gas';
|
|
12
13
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -15,7 +16,7 @@ const log = createLogger('block-builder');
|
|
|
15
16
|
export async function buildBlock(pendingTxs, l1ToL2Messages, newGlobalVariables, opts = {}, worldStateFork, processor, validator, l1Constants, dateProvider, telemetryClient = getTelemetryClient()) {
|
|
16
17
|
const blockBuildingTimer = new Timer();
|
|
17
18
|
const blockNumber = newGlobalVariables.blockNumber;
|
|
18
|
-
const slot = newGlobalVariables.slotNumber
|
|
19
|
+
const slot = newGlobalVariables.slotNumber;
|
|
19
20
|
const msgCount = l1ToL2Messages.length;
|
|
20
21
|
const stateReference = await worldStateFork.getStateReference();
|
|
21
22
|
const archiveTree = await worldStateFork.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
@@ -81,11 +82,7 @@ export class FullNodeBlockBuilder {
|
|
|
81
82
|
const txPublicSetupAllowList = this.config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions();
|
|
82
83
|
const contractsDB = new PublicContractsDB(this.contractDataSource);
|
|
83
84
|
const guardedFork = new GuardedMerkleTreeOperations(fork);
|
|
84
|
-
const publicTxSimulator =
|
|
85
|
-
doMerkleOperations: true,
|
|
86
|
-
skipFeeEnforcement: true,
|
|
87
|
-
clientInitiatedSimulation: false
|
|
88
|
-
});
|
|
85
|
+
const publicTxSimulator = createPublicTxSimulatorForBlockBuilding(guardedFork, contractsDB, globalVariables, this.telemetryClient);
|
|
89
86
|
const processor = new PublicProcessor(globalVariables, guardedFork, contractsDB, publicTxSimulator, this.dateProvider, this.telemetryClient, undefined, this.config);
|
|
90
87
|
const validator = createValidatorForBlockBuilding(fork, this.contractDataSource, globalVariables, txPublicSetupAllowList);
|
|
91
88
|
return {
|
|
@@ -98,7 +95,7 @@ export class FullNodeBlockBuilder {
|
|
|
98
95
|
log.debug(`Synced to previous block ${parentBlockNumber}`);
|
|
99
96
|
}
|
|
100
97
|
async buildBlock(pendingTxs, l1ToL2Messages, globalVariables, opts, suppliedFork) {
|
|
101
|
-
const parentBlockNumber = globalVariables.blockNumber - 1;
|
|
98
|
+
const parentBlockNumber = BlockNumber(globalVariables.blockNumber - 1);
|
|
102
99
|
const syncTimeout = opts.deadline ? (opts.deadline.getTime() - this.dateProvider.now()) / 1000 : undefined;
|
|
103
100
|
await this.syncToPreviousBlock(parentBlockNumber, syncTimeout);
|
|
104
101
|
const fork = suppliedFork ?? await this.worldState.fork(parentBlockNumber);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { GovernanceProposerContract, RollupContract } from '@aztec/ethereum';
|
|
1
|
+
import type { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
2
2
|
export { type SequencerConfig } from '@aztec/stdlib/config';
|
|
3
3
|
export type SequencerContracts = {
|
|
4
4
|
rollupContract: RollupContract;
|
|
5
5
|
governanceProposerContract: GovernanceProposerContract;
|
|
6
6
|
};
|
|
7
|
-
//# sourceMappingURL=
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2VxdWVuY2VyL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSwwQkFBMEIsRUFBRSxjQUFjLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUU1RixPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUU1RCxNQUFNLE1BQU0sa0JBQWtCLEdBQUc7SUFDL0IsY0FBYyxFQUFFLGNBQWMsQ0FBQztJQUMvQiwwQkFBMEIsRUFBRSwwQkFBMEIsQ0FBQztDQUN4RCxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/sequencer/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/sequencer/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE5F,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,0BAA0B,EAAE,0BAA0B,CAAC;CACxD,CAAC"}
|
|
@@ -8,4 +8,4 @@ export declare class SequencerTooSlowError extends Error {
|
|
|
8
8
|
export declare class SequencerInterruptedError extends Error {
|
|
9
9
|
constructor();
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2VxdWVuY2VyL2Vycm9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFFakQscUJBQWEscUJBQXNCLFNBQVEsS0FBSzthQUU1QixhQUFhLEVBQUUsY0FBYzthQUM3QixjQUFjLEVBQUUsTUFBTTthQUN0QixXQUFXLEVBQUUsTUFBTTtJQUhyQyxZQUNrQixhQUFhLEVBQUUsY0FBYyxFQUM3QixjQUFjLEVBQUUsTUFBTSxFQUN0QixXQUFXLEVBQUUsTUFBTSxFQU1wQztDQUNGO0FBRUQscUJBQWEseUJBQTBCLFNBQVEsS0FBSztJQUNsRCxjQUdDO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/sequencer/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,qBAAsB,SAAQ,KAAK;aAE5B,aAAa,EAAE,cAAc;aAC7B,cAAc,EAAE,MAAM;aACtB,WAAW,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/sequencer/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,qBAAsB,SAAQ,KAAK;aAE5B,aAAa,EAAE,cAAc;aAC7B,cAAc,EAAE,MAAM;aACtB,WAAW,EAAE,MAAM;IAHrC,YACkB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EAMpC;CACF;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,cAGC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './block_builder.js';
|
|
2
2
|
export * from './config.js';
|
|
3
3
|
export * from './sequencer.js';
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZXF1ZW5jZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLGdCQUFnQixDQUFDIn0=
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import type { RollupContract } from '@aztec/ethereum';
|
|
2
|
+
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
3
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
4
5
|
import { type Hex } from 'viem';
|
|
5
6
|
import type { SequencerState } from './utils.js';
|
|
@@ -18,6 +19,10 @@ export declare class SequencerMetrics {
|
|
|
18
19
|
private rewards;
|
|
19
20
|
private slots;
|
|
20
21
|
private filledSlots;
|
|
22
|
+
private blockProposalFailed;
|
|
23
|
+
private blockProposalSuccess;
|
|
24
|
+
private blockProposalPrecheckFailed;
|
|
25
|
+
private slashingAttempts;
|
|
21
26
|
private lastSeenSlot?;
|
|
22
27
|
constructor(client: TelemetryClient, rollup: RollupContract, name?: string);
|
|
23
28
|
recordRequiredAttestations(requiredAttestationsCount: number, allowanceMs: number): void;
|
|
@@ -25,7 +30,11 @@ export declare class SequencerMetrics {
|
|
|
25
30
|
recordBuiltBlock(buildDurationMs: number, totalMana: number): void;
|
|
26
31
|
recordFailedBlock(): void;
|
|
27
32
|
recordStateTransitionBufferMs(durationMs: number, state: SequencerState): void;
|
|
28
|
-
incOpenSlot(slot:
|
|
33
|
+
incOpenSlot(slot: SlotNumber, proposer: string): void;
|
|
29
34
|
incFilledSlot(proposer: string, coinbase: Hex | EthAddress | undefined): Promise<void>;
|
|
35
|
+
recordBlockProposalFailed(reason?: string): void;
|
|
36
|
+
recordBlockProposalSuccess(): void;
|
|
37
|
+
recordBlockProposalPrecheckFailed(checkType: string): void;
|
|
38
|
+
recordSlashingAttempt(actionCount: number): void;
|
|
30
39
|
}
|
|
31
|
-
//# sourceMappingURL=
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWV0cmljcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NlcXVlbmNlci9tZXRyaWNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNsRSxPQUFPLEVBTUwsS0FBSyxlQUFlLEVBQ3BCLEtBQUssTUFBTSxFQUdaLE1BQU0seUJBQXlCLENBQUM7QUFFakMsT0FBTyxFQUFFLEtBQUssR0FBRyxFQ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UFBTSxFQUFFLFVBQVUsRUFBRSxNQUFNLFFBR25FO0lBRUQsZ0JBQWdCLENBQUMsZUFBZSxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxRQU0xRDtJQUVELGlCQUFpQixTQUloQjtJQUVELDZCQUE2QixDQUFDLFVBQVUsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFLGNBQWMsUUFJdEU7SUFFRCxXQUFXLENBQUMsSUFBSSxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsTUFBTSxRQVc3QztJQUVLLGFBQWEsQ0FBQyxRQUFRLEVBQUUsTUFBTSxFQUFFLFFBQVEsRUFBRSxHQUFHLEdBQUcsVUFBVSxHQUFHLFNBQVMsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBaUIzRjtJQUVELHlCQUF5QixDQUFDLE1BQU0sQ0FBQyxFQUFFLE1BQU0sUUFJeEM7SUFFRCwwQkFBMEIsU0FFekI7SUFFRCxpQ0FBaUMsQ0FBQyxTQUFTLEVBQUUsTUFBTSxRQUlsRDtJQUVELHFCQUFxQixDQUFDLFdBQVcsRUFBRSxNQUFNLFFBRXhDO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,MAAM,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AAM,QAW7C;IAEK,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB3F;IAED,yBAAyB,CAAC,MAAM,CAAC,EAAE,MAAM,QAIxC;IAED,0BAA0B,SAEzB;IAED,iCAAiC,CAAC,SAAS,EAAE,MAAM,QAIlD;IAED,qBAAqB,CAAC,WAAW,EAAE,MAAM,QAExC;CACF"}
|
|
@@ -16,6 +16,10 @@ export class SequencerMetrics {
|
|
|
16
16
|
rewards;
|
|
17
17
|
slots;
|
|
18
18
|
filledSlots;
|
|
19
|
+
blockProposalFailed;
|
|
20
|
+
blockProposalSuccess;
|
|
21
|
+
blockProposalPrecheckFailed;
|
|
22
|
+
slashingAttempts;
|
|
19
23
|
lastSeenSlot;
|
|
20
24
|
constructor(client, rollup, name = 'Sequencer'){
|
|
21
25
|
this.rollup = rollup;
|
|
@@ -77,6 +81,22 @@ export class SequencerMetrics {
|
|
|
77
81
|
valueType: ValueType.INT,
|
|
78
82
|
description: 'The minimum number of attestations required to publish a block'
|
|
79
83
|
});
|
|
84
|
+
this.blockProposalFailed = this.meter.createUpDownCounter(Metrics.SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT, {
|
|
85
|
+
valueType: ValueType.INT,
|
|
86
|
+
description: 'The number of times block proposal failed (including validation builds)'
|
|
87
|
+
});
|
|
88
|
+
this.blockProposalSuccess = this.meter.createUpDownCounter(Metrics.SEQUENCER_BLOCK_PROPOSAL_SUCCESS_COUNT, {
|
|
89
|
+
valueType: ValueType.INT,
|
|
90
|
+
description: 'The number of times block proposal succeeded (including validation builds)'
|
|
91
|
+
});
|
|
92
|
+
this.blockProposalPrecheckFailed = this.meter.createUpDownCounter(Metrics.SEQUENCER_BLOCK_PROPOSAL_PRECHECK_FAILED_COUNT, {
|
|
93
|
+
valueType: ValueType.INT,
|
|
94
|
+
description: 'The number of times block proposal pre-build checks failed'
|
|
95
|
+
});
|
|
96
|
+
this.slashingAttempts = this.meter.createUpDownCounter(Metrics.SEQUENCER_SLASHING_ATTEMPTS_COUNT, {
|
|
97
|
+
valueType: ValueType.INT,
|
|
98
|
+
description: 'The number of slashing action attempts'
|
|
99
|
+
});
|
|
80
100
|
}
|
|
81
101
|
recordRequiredAttestations(requiredAttestationsCount, allowanceMs) {
|
|
82
102
|
this.requiredAttestions.record(requiredAttestationsCount);
|
|
@@ -133,4 +153,22 @@ export class SequencerMetrics {
|
|
|
133
153
|
}
|
|
134
154
|
}
|
|
135
155
|
}
|
|
156
|
+
recordBlockProposalFailed(reason) {
|
|
157
|
+
this.blockProposalFailed.add(1, {
|
|
158
|
+
...reason && {
|
|
159
|
+
[Attributes.ERROR_TYPE]: reason
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
recordBlockProposalSuccess() {
|
|
164
|
+
this.blockProposalSuccess.add(1);
|
|
165
|
+
}
|
|
166
|
+
recordBlockProposalPrecheckFailed(checkType) {
|
|
167
|
+
this.blockProposalPrecheckFailed.add(1, {
|
|
168
|
+
[Attributes.ERROR_TYPE]: checkType
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
recordSlashingAttempt(actionCount) {
|
|
172
|
+
this.slashingAttempts.add(actionCount);
|
|
173
|
+
}
|
|
136
174
|
}
|