@aztec/sequencer-client 0.0.1-commit.0c875d939 → 0.0.1-commit.10bd49492
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 +23 -7
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +99 -16
- package/dest/config.d.ts +24 -5
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +36 -20
- package/dest/global_variable_builder/global_builder.d.ts +2 -4
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/publisher/config.d.ts +35 -17
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +106 -42
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +59 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/index.js +2 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +11 -3
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +27 -2
- package/dest/publisher/sequencer-publisher.d.ts +19 -7
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +285 -25
- package/dest/sequencer/checkpoint_proposal_job.d.ts +2 -4
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +99 -47
- package/dest/sequencer/metrics.d.ts +14 -5
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +61 -15
- package/dest/sequencer/sequencer.d.ts +24 -13
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +35 -39
- package/dest/sequencer/timetable.d.ts +4 -3
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +6 -7
- package/dest/sequencer/types.d.ts +2 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/index.d.ts +3 -5
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +4 -6
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +39 -30
- package/package.json +28 -28
- package/src/client/sequencer-client.ts +135 -18
- package/src/config.ts +45 -27
- package/src/global_variable_builder/global_builder.ts +1 -1
- package/src/publisher/config.ts +121 -43
- package/src/publisher/index.ts +3 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +55 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-publisher-factory.ts +38 -6
- package/src/publisher/sequencer-publisher.ts +273 -38
- package/src/sequencer/checkpoint_proposal_job.ts +133 -56
- package/src/sequencer/metrics.ts +68 -18
- package/src/sequencer/sequencer.ts +44 -45
- package/src/sequencer/timetable.ts +7 -7
- package/src/sequencer/types.ts +1 -1
- package/src/test/index.ts +2 -4
- package/src/test/mock_checkpoint_builder.ts +48 -45
|
@@ -436,22 +436,21 @@ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
|
436
436
|
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
437
437
|
}
|
|
438
438
|
var _dec, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _initProto;
|
|
439
|
-
import { NUM_CHECKPOINT_END_MARKER_FIELDS, getNumBlockEndBlobFields } from '@aztec/blob-lib/encoding';
|
|
440
|
-
import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB } from '@aztec/constants';
|
|
441
439
|
import { BlockNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
442
440
|
import { randomInt } from '@aztec/foundation/crypto/random';
|
|
443
|
-
import {
|
|
441
|
+
import { flipSignature, generateRecoverableSignature, generateUnrecoverableSignature } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
444
442
|
import { filter } from '@aztec/foundation/iterator';
|
|
445
443
|
import { createLogger } from '@aztec/foundation/log';
|
|
446
444
|
import { sleep, sleepUntil } from '@aztec/foundation/sleep';
|
|
447
445
|
import { Timer } from '@aztec/foundation/timer';
|
|
448
446
|
import { isErrorClass, unfreeze } from '@aztec/foundation/types';
|
|
449
447
|
import { CommitteeAttestationsAndSigners, MaliciousCommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
448
|
+
import { validateCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
450
449
|
import { getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
451
450
|
import { Gas } from '@aztec/stdlib/gas';
|
|
452
451
|
import { NoValidTxsError } from '@aztec/stdlib/interfaces/server';
|
|
453
452
|
import { computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
|
|
454
|
-
import { orderAttestations } from '@aztec/stdlib/p2p';
|
|
453
|
+
import { orderAttestations, trimAttestations } from '@aztec/stdlib/p2p';
|
|
455
454
|
import { AttestationTimeoutError } from '@aztec/stdlib/validators';
|
|
456
455
|
import { Attributes, trackSpan } from '@aztec/telemetry-client';
|
|
457
456
|
import { DutyAlreadySignedError, SlashingProtectionError } from '@aztec/validator-ha-signer/errors';
|
|
@@ -590,7 +589,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
590
589
|
// Wait until the voting promises have resolved, so all requests are enqueued (not sent)
|
|
591
590
|
await Promise.all(votesPromises);
|
|
592
591
|
if (checkpoint) {
|
|
593
|
-
this.metrics.
|
|
592
|
+
this.metrics.recordCheckpointProposalSuccess();
|
|
594
593
|
}
|
|
595
594
|
// Do not post anything to L1 if we are fishermen, but do perform L1 fee analysis
|
|
596
595
|
if (this.config.fishermanMode) {
|
|
@@ -640,13 +639,12 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
640
639
|
const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(this.checkpointNumber);
|
|
641
640
|
const inHash = computeInHashFromL1ToL2Messages(l1ToL2Messages);
|
|
642
641
|
// Collect the out hashes of all the checkpoints before this one in the same epoch
|
|
643
|
-
const
|
|
644
|
-
const previousCheckpointOutHashes = previousCheckpoints.map((c)=>c.getCheckpointOutHash());
|
|
642
|
+
const previousCheckpointOutHashes = (await this.l2BlockSource.getCheckpointsDataForEpoch(this.epoch)).filter((c)=>c.checkpointNumber < this.checkpointNumber).map((c)=>c.checkpointOutHash);
|
|
645
643
|
// Get the fee asset price modifier from the oracle
|
|
646
644
|
const feeAssetPriceModifier = await this.publisher.getFeeAssetPriceModifier();
|
|
647
645
|
const fork = _ts_add_disposable_resource(env, await this.worldState.fork(this.syncedToBlockNumber, {
|
|
648
646
|
closeDelayMs: 12_000
|
|
649
|
-
}),
|
|
647
|
+
}), true);
|
|
650
648
|
// Create checkpoint builder for the entire slot
|
|
651
649
|
const checkpointBuilder = await this.checkpointsBuilder.startCheckpoint(this.checkpointNumber, checkpointGlobalVariables, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, this.log.getBindings());
|
|
652
650
|
// Options for the validator client when creating block and checkpoint proposals
|
|
@@ -660,6 +658,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
660
658
|
};
|
|
661
659
|
let blocksInCheckpoint = [];
|
|
662
660
|
let blockPendingBroadcast = undefined;
|
|
661
|
+
const checkpointBuildTimer = new Timer();
|
|
663
662
|
try {
|
|
664
663
|
// Main loop: build blocks for the checkpoint
|
|
665
664
|
const result = await this.buildBlocksForCheckpoint(checkpointBuilder, checkpointGlobalVariables.timestamp, inHash, blockProposalOptions);
|
|
@@ -683,10 +682,36 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
683
682
|
});
|
|
684
683
|
return undefined;
|
|
685
684
|
}
|
|
685
|
+
const minBlocksForCheckpoint = this.config.minBlocksForCheckpoint;
|
|
686
|
+
if (minBlocksForCheckpoint !== undefined && blocksInCheckpoint.length < minBlocksForCheckpoint) {
|
|
687
|
+
this.log.warn(`Checkpoint has fewer blocks than minimum (${blocksInCheckpoint.length} < ${minBlocksForCheckpoint}), skipping proposal`, {
|
|
688
|
+
slot: this.slot,
|
|
689
|
+
blocksBuilt: blocksInCheckpoint.length,
|
|
690
|
+
minBlocksForCheckpoint
|
|
691
|
+
});
|
|
692
|
+
return undefined;
|
|
693
|
+
}
|
|
686
694
|
// Assemble and broadcast the checkpoint proposal, including the last block that was not
|
|
687
695
|
// broadcasted yet, and wait to collect the committee attestations.
|
|
688
696
|
this.setStateFn(SequencerState.ASSEMBLING_CHECKPOINT, this.slot);
|
|
689
697
|
const checkpoint = await checkpointBuilder.completeCheckpoint();
|
|
698
|
+
// Final validation round for the checkpoint before we propose it, just for safety
|
|
699
|
+
try {
|
|
700
|
+
validateCheckpoint(checkpoint, {
|
|
701
|
+
rollupManaLimit: this.l1Constants.rollupManaLimit,
|
|
702
|
+
maxL2BlockGas: this.config.maxL2BlockGas,
|
|
703
|
+
maxDABlockGas: this.config.maxDABlockGas,
|
|
704
|
+
maxTxsPerBlock: this.config.maxTxsPerBlock,
|
|
705
|
+
maxTxsPerCheckpoint: this.config.maxTxsPerCheckpoint
|
|
706
|
+
});
|
|
707
|
+
} catch (err) {
|
|
708
|
+
this.log.error(`Built an invalid checkpoint at slot ${this.slot} (skipping proposal)`, err, {
|
|
709
|
+
checkpoint: checkpoint.header.toInspect()
|
|
710
|
+
});
|
|
711
|
+
return undefined;
|
|
712
|
+
}
|
|
713
|
+
// Record checkpoint-level build metrics
|
|
714
|
+
this.metrics.recordCheckpointBuild(checkpointBuildTimer.ms(), blocksInCheckpoint.length, checkpoint.getStats().txCount, Number(checkpoint.header.totalManaUsed.toBigInt()));
|
|
690
715
|
// Do not collect attestations nor publish to L1 in fisherman mode
|
|
691
716
|
if (this.config.fishermanMode) {
|
|
692
717
|
this.log.info(`Built checkpoint for slot ${this.slot} with ${blocksInCheckpoint.length} blocks. ` + `Skipping proposal in fisherman mode.`, {
|
|
@@ -729,6 +754,14 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
729
754
|
const aztecSlotDuration = this.l1Constants.slotDuration;
|
|
730
755
|
const slotStartBuildTimestamp = this.getSlotStartBuildTimestamp();
|
|
731
756
|
const txTimeoutAt = new Date((slotStartBuildTimestamp + aztecSlotDuration) * 1000);
|
|
757
|
+
// If we have been configured to potentially skip publishing checkpoint then roll the dice here
|
|
758
|
+
if (this.config.skipPublishingCheckpointsPercent !== undefined && this.config.skipPublishingCheckpointsPercent > 0) {
|
|
759
|
+
const result = Math.max(0, randomInt(100));
|
|
760
|
+
if (result < this.config.skipPublishingCheckpointsPercent) {
|
|
761
|
+
this.log.warn(`Skipping publishing proposal for checkpoint ${checkpoint.number}. Configured percentage: ${this.config.skipPublishingCheckpointsPercent}, generated value: ${result}`);
|
|
762
|
+
return checkpoint;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
732
765
|
await this.publisher.enqueueProposeCheckpoint(checkpoint, attestations, attestationsSignature, {
|
|
733
766
|
txTimeoutAt,
|
|
734
767
|
forcePendingCheckpointNumber: this.invalidateCheckpoint?.forcePendingCheckpointNumber
|
|
@@ -738,7 +771,8 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
738
771
|
env.error = e;
|
|
739
772
|
env.hasError = true;
|
|
740
773
|
} finally{
|
|
741
|
-
_ts_dispose_resources(env);
|
|
774
|
+
const result = _ts_dispose_resources(env);
|
|
775
|
+
if (result) await result;
|
|
742
776
|
}
|
|
743
777
|
} catch (err) {
|
|
744
778
|
if (err && (err instanceof DutyAlreadySignedError || err instanceof SlashingProtectionError)) {
|
|
@@ -755,8 +789,6 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
755
789
|
const blocksInCheckpoint = [];
|
|
756
790
|
const txHashesAlreadyIncluded = new Set();
|
|
757
791
|
const initialBlockNumber = BlockNumber(this.syncedToBlockNumber + 1);
|
|
758
|
-
// Remaining blob fields available for blocks (checkpoint end marker already subtracted)
|
|
759
|
-
let remainingBlobFields = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB - NUM_CHECKPOINT_END_MARKER_FIELDS;
|
|
760
792
|
// Last block in the checkpoint will usually be flagged as pending broadcast, so we send it along with the checkpoint proposal
|
|
761
793
|
let blockPendingBroadcast = undefined;
|
|
762
794
|
while(true){
|
|
@@ -782,8 +814,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
782
814
|
buildDeadline: timingInfo.deadline ? new Date((this.getSlotStartBuildTimestamp() + timingInfo.deadline) * 1000) : undefined,
|
|
783
815
|
blockNumber,
|
|
784
816
|
indexWithinCheckpoint,
|
|
785
|
-
txHashesAlreadyIncluded
|
|
786
|
-
remainingBlobFields
|
|
817
|
+
txHashesAlreadyIncluded
|
|
787
818
|
});
|
|
788
819
|
// TODO(palla/mbps): Review these conditions. We may want to keep trying in some scenarios.
|
|
789
820
|
if (!buildResult && timingInfo.isLastBlock) {
|
|
@@ -805,10 +836,8 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
805
836
|
}
|
|
806
837
|
break;
|
|
807
838
|
}
|
|
808
|
-
const { block, usedTxs
|
|
839
|
+
const { block, usedTxs } = buildResult;
|
|
809
840
|
blocksInCheckpoint.push(block);
|
|
810
|
-
// Update remaining blob fields for the next block
|
|
811
|
-
remainingBlobFields = newRemainingBlobFields;
|
|
812
841
|
// Sync the proposed block to the archiver to make it available
|
|
813
842
|
// Note that the checkpoint builder uses its own fork so it should not need to wait for this syncing
|
|
814
843
|
// Eventually we should refactor the checkpoint builder to not need a separate long-lived fork
|
|
@@ -859,15 +888,14 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
859
888
|
await this.waitUntilTimeInSlot(nextSubslotStart);
|
|
860
889
|
}
|
|
861
890
|
/** Builds a single block. Called from the main block building loop. */ async buildSingleBlock(checkpointBuilder, opts) {
|
|
862
|
-
const { blockTimestamp, forceCreate, blockNumber, indexWithinCheckpoint, buildDeadline, txHashesAlreadyIncluded
|
|
891
|
+
const { blockTimestamp, forceCreate, blockNumber, indexWithinCheckpoint, buildDeadline, txHashesAlreadyIncluded } = opts;
|
|
863
892
|
this.log.verbose(`Preparing block ${blockNumber} index ${indexWithinCheckpoint} at checkpoint ${this.checkpointNumber} for slot ${this.slot}`, {
|
|
864
893
|
...checkpointBuilder.getConstantData(),
|
|
865
894
|
...opts
|
|
866
895
|
});
|
|
867
896
|
try {
|
|
868
897
|
// Wait until we have enough txs to build the block
|
|
869
|
-
const minTxs = this.
|
|
870
|
-
const { availableTxs, canStartBuilding } = await this.waitForMinTxs(opts);
|
|
898
|
+
const { availableTxs, canStartBuilding, minTxs } = await this.waitForMinTxs(opts);
|
|
871
899
|
if (!canStartBuilding) {
|
|
872
900
|
this.log.warn(`Not enough txs to build block ${blockNumber} at index ${indexWithinCheckpoint} in slot ${this.slot} (got ${availableTxs} txs but needs ${minTxs})`, {
|
|
873
901
|
blockNumber,
|
|
@@ -891,15 +919,13 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
891
919
|
indexWithinCheckpoint
|
|
892
920
|
});
|
|
893
921
|
this.setStateFn(SequencerState.CREATING_BLOCK, this.slot);
|
|
894
|
-
//
|
|
895
|
-
|
|
896
|
-
const maxBlobFieldsForTxs = remainingBlobFields - blockEndOverhead;
|
|
922
|
+
// Per-block limits derived at startup by computeBlockLimits(), further capped
|
|
923
|
+
// by remaining checkpoint-level budgets inside CheckpointBuilder before each block is built.
|
|
897
924
|
const blockBuilderOptions = {
|
|
898
925
|
maxTransactions: this.config.maxTxsPerBlock,
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
deadline: buildDeadline
|
|
926
|
+
maxBlockGas: this.config.maxL2BlockGas !== undefined || this.config.maxDABlockGas !== undefined ? new Gas(this.config.maxDABlockGas ?? Infinity, this.config.maxL2BlockGas ?? Infinity) : undefined,
|
|
927
|
+
deadline: buildDeadline,
|
|
928
|
+
isBuildingProposal: true
|
|
903
929
|
};
|
|
904
930
|
// Actually build the block by executing txs
|
|
905
931
|
const buildResult = await this.buildSingleBlockWithCheckpointBuilder(checkpointBuilder, pendingTxs, blockNumber, blockTimestamp, blockBuilderOptions);
|
|
@@ -926,7 +952,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
926
952
|
return undefined;
|
|
927
953
|
}
|
|
928
954
|
// Block creation succeeded, emit stats and metrics
|
|
929
|
-
const {
|
|
955
|
+
const { block, publicProcessorDuration, usedTxs, blockBuildDuration } = buildResult;
|
|
930
956
|
const blockStats = {
|
|
931
957
|
eventName: 'l2-block-built',
|
|
932
958
|
duration: blockBuildDuration,
|
|
@@ -935,7 +961,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
935
961
|
};
|
|
936
962
|
const blockHash = await block.hash();
|
|
937
963
|
const txHashes = block.body.txEffects.map((tx)=>tx.txHash);
|
|
938
|
-
const manaPerSec =
|
|
964
|
+
const manaPerSec = block.header.totalManaUsed.toNumberUnsafe() / (blockBuildDuration / 1000);
|
|
939
965
|
this.log.info(`Built block ${block.number} at checkpoint ${this.checkpointNumber} for slot ${this.slot} with ${numTxs} txs`, {
|
|
940
966
|
blockHash,
|
|
941
967
|
txHashes,
|
|
@@ -946,11 +972,10 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
946
972
|
blockNumber: block.number,
|
|
947
973
|
slot: this.slot
|
|
948
974
|
});
|
|
949
|
-
this.metrics.recordBuiltBlock(blockBuildDuration,
|
|
975
|
+
this.metrics.recordBuiltBlock(blockBuildDuration, block.header.totalManaUsed.toNumberUnsafe());
|
|
950
976
|
return {
|
|
951
977
|
block,
|
|
952
|
-
usedTxs
|
|
953
|
-
remainingBlobFields: maxBlobFieldsForTxs - usedTxBlobFields
|
|
978
|
+
usedTxs
|
|
954
979
|
};
|
|
955
980
|
} catch (err) {
|
|
956
981
|
this.eventEmitter.emit('block-build-failed', {
|
|
@@ -1001,7 +1026,8 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1001
1026
|
if (startBuildingDeadline === undefined || now >= startBuildingDeadline) {
|
|
1002
1027
|
return {
|
|
1003
1028
|
canStartBuilding: false,
|
|
1004
|
-
availableTxs
|
|
1029
|
+
availableTxs,
|
|
1030
|
+
minTxs
|
|
1005
1031
|
};
|
|
1006
1032
|
}
|
|
1007
1033
|
// Wait a bit before checking again
|
|
@@ -1016,7 +1042,8 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1016
1042
|
}
|
|
1017
1043
|
return {
|
|
1018
1044
|
canStartBuilding: true,
|
|
1019
|
-
availableTxs
|
|
1045
|
+
availableTxs,
|
|
1046
|
+
minTxs
|
|
1020
1047
|
};
|
|
1021
1048
|
}
|
|
1022
1049
|
/**
|
|
@@ -1053,10 +1080,16 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1053
1080
|
try {
|
|
1054
1081
|
const attestations = await this.validatorClient.collectAttestations(proposal, numberOfRequiredAttestations, attestationDeadline);
|
|
1055
1082
|
collectedAttestationsCount = attestations.length;
|
|
1083
|
+
// Trim attestations to minimum required to save L1 calldata gas
|
|
1084
|
+
const localAddresses = this.validatorClient.getValidatorAddresses();
|
|
1085
|
+
const trimmed = trimAttestations(attestations, numberOfRequiredAttestations, this.attestorAddress, localAddresses);
|
|
1086
|
+
if (trimmed.length < attestations.length) {
|
|
1087
|
+
this.log.debug(`Trimmed attestations from ${attestations.length} to ${trimmed.length} for L1 submission`);
|
|
1088
|
+
}
|
|
1056
1089
|
// Rollup contract requires that the signatures are provided in the order of the committee
|
|
1057
|
-
const sorted = orderAttestations(
|
|
1090
|
+
const sorted = orderAttestations(trimmed, committee);
|
|
1058
1091
|
// Manipulate the attestations if we've been configured to do so
|
|
1059
|
-
if (this.config.injectFakeAttestation || this.config.shuffleAttestationOrdering) {
|
|
1092
|
+
if (this.config.injectFakeAttestation || this.config.injectHighSValueAttestation || this.config.injectUnrecoverableSignatureAttestation || this.config.shuffleAttestationOrdering) {
|
|
1060
1093
|
return this.manipulateAttestations(proposal.slotNumber, epoch, seed, committee, sorted);
|
|
1061
1094
|
}
|
|
1062
1095
|
return new CommitteeAttestationsAndSigners(sorted);
|
|
@@ -1073,7 +1106,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1073
1106
|
// Compute the proposer index in the committee, since we dont want to tweak it.
|
|
1074
1107
|
// Otherwise, the L1 rollup contract will reject the block outright.
|
|
1075
1108
|
const proposerIndex = Number(this.epochCache.computeProposerIndex(slotNumber, epoch, seed, BigInt(committee.length)));
|
|
1076
|
-
if (this.config.injectFakeAttestation) {
|
|
1109
|
+
if (this.config.injectFakeAttestation || this.config.injectHighSValueAttestation || this.config.injectUnrecoverableSignatureAttestation) {
|
|
1077
1110
|
// Find non-empty attestations that are not from the proposer
|
|
1078
1111
|
const nonProposerIndices = [];
|
|
1079
1112
|
for(let i = 0; i < attestations.length; i++){
|
|
@@ -1083,8 +1116,16 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1083
1116
|
}
|
|
1084
1117
|
if (nonProposerIndices.length > 0) {
|
|
1085
1118
|
const targetIndex = nonProposerIndices[randomInt(nonProposerIndices.length)];
|
|
1086
|
-
this.
|
|
1087
|
-
|
|
1119
|
+
if (this.config.injectHighSValueAttestation) {
|
|
1120
|
+
this.log.warn(`Injecting high-s value attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
1121
|
+
unfreeze(attestations[targetIndex]).signature = flipSignature(attestations[targetIndex].signature);
|
|
1122
|
+
} else if (this.config.injectUnrecoverableSignatureAttestation) {
|
|
1123
|
+
this.log.warn(`Injecting unrecoverable signature attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
1124
|
+
unfreeze(attestations[targetIndex]).signature = generateUnrecoverableSignature();
|
|
1125
|
+
} else {
|
|
1126
|
+
this.log.warn(`Injecting fake attestation in checkpoint for slot ${slotNumber} at index ${targetIndex}`);
|
|
1127
|
+
unfreeze(attestations[targetIndex]).signature = generateRecoverableSignature();
|
|
1128
|
+
}
|
|
1088
1129
|
}
|
|
1089
1130
|
return new CommitteeAttestationsAndSigners(attestations);
|
|
1090
1131
|
}
|
|
@@ -1093,14 +1134,25 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1093
1134
|
const shuffled = [
|
|
1094
1135
|
...attestations
|
|
1095
1136
|
];
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
];
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1137
|
+
// Find two non-proposer positions that both have non-empty signatures to swap.
|
|
1138
|
+
// This ensures the bitmap doesn't change, so the MaliciousCommitteeAttestationsAndSigners
|
|
1139
|
+
// signers array stays correctly aligned with L1's committee reconstruction.
|
|
1140
|
+
const swappable = [];
|
|
1141
|
+
for(let k = 0; k < shuffled.length; k++){
|
|
1142
|
+
if (!shuffled[k].signature.isEmpty() && k !== proposerIndex) {
|
|
1143
|
+
swappable.push(k);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
if (swappable.length >= 2) {
|
|
1147
|
+
const [i, j] = [
|
|
1148
|
+
swappable[0],
|
|
1149
|
+
swappable[1]
|
|
1150
|
+
];
|
|
1151
|
+
[shuffled[i], shuffled[j]] = [
|
|
1152
|
+
shuffled[j],
|
|
1153
|
+
shuffled[i]
|
|
1154
|
+
];
|
|
1155
|
+
}
|
|
1104
1156
|
const signers = new CommitteeAttestationsAndSigners(attestations).getSigners();
|
|
1105
1157
|
return new MaliciousCommitteeAttestationsAndSigners(shuffled, signers);
|
|
1106
1158
|
}
|
|
@@ -1148,7 +1200,7 @@ _dec = trackSpan('CheckpointProposalJob.execute'), _dec1 = trackSpan('Checkpoint
|
|
|
1148
1200
|
slot: this.slot,
|
|
1149
1201
|
feeAnalysisId: feeAnalysis?.id
|
|
1150
1202
|
});
|
|
1151
|
-
this.metrics.
|
|
1203
|
+
this.metrics.recordCheckpointProposalFailed('block_build_failed');
|
|
1152
1204
|
}
|
|
1153
1205
|
this.publisher.clearPendingRequests();
|
|
1154
1206
|
}
|
|
@@ -21,11 +21,16 @@ export declare class SequencerMetrics {
|
|
|
21
21
|
private slots;
|
|
22
22
|
private filledSlots;
|
|
23
23
|
private blockProposalFailed;
|
|
24
|
-
private
|
|
25
|
-
private
|
|
24
|
+
private checkpointProposalSuccess;
|
|
25
|
+
private checkpointPrecheckFailed;
|
|
26
|
+
private checkpointProposalFailed;
|
|
26
27
|
private checkpointSuccess;
|
|
27
28
|
private slashingAttempts;
|
|
28
29
|
private checkpointAttestationDelay;
|
|
30
|
+
private checkpointBuildDuration;
|
|
31
|
+
private checkpointBlockCount;
|
|
32
|
+
private checkpointTxCount;
|
|
33
|
+
private checkpointTotalMana;
|
|
29
34
|
private fishermanWouldBeIncluded;
|
|
30
35
|
private fishermanTimeBeforeBlock;
|
|
31
36
|
private fishermanPendingBlobTxCount;
|
|
@@ -33,6 +38,7 @@ export declare class SequencerMetrics {
|
|
|
33
38
|
private fishermanPendingBlobCount;
|
|
34
39
|
private fishermanIncludedBlobCount;
|
|
35
40
|
private fishermanBlockBlobsFull;
|
|
41
|
+
private fishermanMaxBlobCapacity;
|
|
36
42
|
private fishermanCalculatedPriorityFee;
|
|
37
43
|
private fishermanPriorityFeeDelta;
|
|
38
44
|
private fishermanEstimatedCost;
|
|
@@ -51,8 +57,11 @@ export declare class SequencerMetrics {
|
|
|
51
57
|
incFilledSlot(proposer: string, coinbase: Hex | EthAddress | undefined): Promise<void>;
|
|
52
58
|
recordCheckpointSuccess(): void;
|
|
53
59
|
recordBlockProposalFailed(reason?: string): void;
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
recordCheckpointProposalSuccess(): void;
|
|
61
|
+
recordCheckpointPrecheckFailed(checkType: 'slot_already_taken' | 'rollup_contract_check_failed' | 'slot_mismatch' | 'block_number_mismatch'): void;
|
|
62
|
+
recordCheckpointProposalFailed(reason?: string): void;
|
|
63
|
+
/** Records aggregate metrics for a completed checkpoint build. */
|
|
64
|
+
recordCheckpointBuild(durationMs: number, blockCount: number, txCount: number, totalMana: number): void;
|
|
56
65
|
recordSlashingAttempt(actionCount: number): void;
|
|
57
66
|
/**
|
|
58
67
|
* Records metrics for a completed fisherman fee analysis
|
|
@@ -60,4 +69,4 @@ export declare class SequencerMetrics {
|
|
|
60
69
|
*/
|
|
61
70
|
recordFishermanFeeAnalysis(analysis: L1FeeAnalysisResult): void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E4QixDQUFDLE1BQU0sQ0FBQyxFQUFFLE1BQU0sUUFJN0M7SUFFRCxrRUFBa0U7SUFDbEUscUJBQXFCLENBQUMsVUFBVSxFQUFFLE1BQU0sRUFBRSxVQUFVLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxNQUFNLEVBQUUsU0FBUyxFQUFFLE1BQU0sUUFLL0Y7SUFFRCxxQkFBcUIsQ0FBQyxXQUFXLEVBQUUsTUFBTSxRQUV4QztJQUVEOzs7T0FHRztJQUNILDBCQUEwQixDQUFDLFFBQVEsRUFBRSxtQkFBbUIsUUFrSHZEO0NBQ0YifQ==
|
|
@@ -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,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
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,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAML,KA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O,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAK/F;IAED,qBAAqB,CAAC,WAAW,EAAE,MAAM,QAExC;IAED;;;OAGG;IACH,0BAA0B,CAAC,QAAQ,EAAE,mBAAmB,QAkHvD;CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Attributes, Metrics, createUpDownCounterWithDefault } from '@aztec/telemetry-client';
|
|
2
2
|
import { formatUnits } from 'viem';
|
|
3
|
-
// TODO(palla/mbps): Review all metrics and add any missing ones per checkpoint
|
|
4
3
|
export class SequencerMetrics {
|
|
5
4
|
rollup;
|
|
6
5
|
tracer;
|
|
@@ -18,11 +17,16 @@ export class SequencerMetrics {
|
|
|
18
17
|
slots;
|
|
19
18
|
filledSlots;
|
|
20
19
|
blockProposalFailed;
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
checkpointProposalSuccess;
|
|
21
|
+
checkpointPrecheckFailed;
|
|
22
|
+
checkpointProposalFailed;
|
|
23
23
|
checkpointSuccess;
|
|
24
24
|
slashingAttempts;
|
|
25
25
|
checkpointAttestationDelay;
|
|
26
|
+
checkpointBuildDuration;
|
|
27
|
+
checkpointBlockCount;
|
|
28
|
+
checkpointTxCount;
|
|
29
|
+
checkpointTotalMana;
|
|
26
30
|
// Fisherman fee analysis metrics
|
|
27
31
|
fishermanWouldBeIncluded;
|
|
28
32
|
fishermanTimeBeforeBlock;
|
|
@@ -31,6 +35,7 @@ export class SequencerMetrics {
|
|
|
31
35
|
fishermanPendingBlobCount;
|
|
32
36
|
fishermanIncludedBlobCount;
|
|
33
37
|
fishermanBlockBlobsFull;
|
|
38
|
+
fishermanMaxBlobCapacity;
|
|
34
39
|
fishermanCalculatedPriorityFee;
|
|
35
40
|
fishermanPriorityFeeDelta;
|
|
36
41
|
fishermanEstimatedCost;
|
|
@@ -52,7 +57,7 @@ export class SequencerMetrics {
|
|
|
52
57
|
this.blockBuildManaPerSecond = this.meter.createGauge(Metrics.SEQUENCER_BLOCK_BUILD_MANA_PER_SECOND);
|
|
53
58
|
this.stateTransitionBufferDuration = this.meter.createHistogram(Metrics.SEQUENCER_STATE_TRANSITION_BUFFER_DURATION);
|
|
54
59
|
this.checkpointAttestationDelay = this.meter.createHistogram(Metrics.SEQUENCER_CHECKPOINT_ATTESTATION_DELAY);
|
|
55
|
-
this.rewards = this.meter.createGauge(Metrics.
|
|
60
|
+
this.rewards = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_SLOT_REWARDS);
|
|
56
61
|
this.slots = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_SLOT_COUNT);
|
|
57
62
|
/**
|
|
58
63
|
* NOTE: we do not track missed slots as a separate metric. That would be difficult to determine
|
|
@@ -63,9 +68,9 @@ export class SequencerMetrics {
|
|
|
63
68
|
this.requiredAttestions = this.meter.createGauge(Metrics.SEQUENCER_REQUIRED_ATTESTATIONS_COUNT);
|
|
64
69
|
this.collectedAttestions = this.meter.createGauge(Metrics.SEQUENCER_COLLECTED_ATTESTATIONS_COUNT);
|
|
65
70
|
this.blockProposalFailed = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT);
|
|
66
|
-
this.
|
|
71
|
+
this.checkpointProposalSuccess = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_PROPOSAL_SUCCESS_COUNT);
|
|
67
72
|
this.checkpointSuccess = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_SUCCESS_COUNT);
|
|
68
|
-
this.
|
|
73
|
+
this.checkpointPrecheckFailed = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_PRECHECK_FAILED_COUNT, {
|
|
69
74
|
[Attributes.ERROR_TYPE]: [
|
|
70
75
|
'slot_already_taken',
|
|
71
76
|
'rollup_contract_check_failed',
|
|
@@ -73,12 +78,21 @@ export class SequencerMetrics {
|
|
|
73
78
|
'block_number_mismatch'
|
|
74
79
|
]
|
|
75
80
|
});
|
|
81
|
+
this.checkpointProposalFailed = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_PROPOSAL_FAILED_COUNT);
|
|
82
|
+
this.checkpointBuildDuration = this.meter.createHistogram(Metrics.SEQUENCER_CHECKPOINT_BUILD_DURATION);
|
|
83
|
+
this.checkpointBlockCount = this.meter.createGauge(Metrics.SEQUENCER_CHECKPOINT_BLOCK_COUNT);
|
|
84
|
+
this.checkpointTxCount = this.meter.createGauge(Metrics.SEQUENCER_CHECKPOINT_TX_COUNT);
|
|
85
|
+
this.checkpointTotalMana = this.meter.createGauge(Metrics.SEQUENCER_CHECKPOINT_TOTAL_MANA);
|
|
76
86
|
this.slashingAttempts = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_SLASHING_ATTEMPTS_COUNT);
|
|
77
87
|
// Fisherman fee analysis metrics
|
|
78
88
|
this.fishermanWouldBeIncluded = createUpDownCounterWithDefault(this.meter, Metrics.FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED, {
|
|
79
89
|
[Attributes.OK]: [
|
|
80
90
|
true,
|
|
81
91
|
false
|
|
92
|
+
],
|
|
93
|
+
[Attributes.BLOCK_FULL]: [
|
|
94
|
+
'true',
|
|
95
|
+
'false'
|
|
82
96
|
]
|
|
83
97
|
});
|
|
84
98
|
this.fishermanTimeBeforeBlock = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_TIME_BEFORE_BLOCK);
|
|
@@ -98,6 +112,7 @@ export class SequencerMetrics {
|
|
|
98
112
|
false
|
|
99
113
|
]
|
|
100
114
|
});
|
|
115
|
+
this.fishermanMaxBlobCapacity = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_MAX_BLOB_CAPACITY);
|
|
101
116
|
}
|
|
102
117
|
recordRequiredAttestations(requiredAttestationsCount, allowanceMs) {
|
|
103
118
|
this.requiredAttestions.record(requiredAttestationsCount);
|
|
@@ -167,14 +182,27 @@ export class SequencerMetrics {
|
|
|
167
182
|
}
|
|
168
183
|
});
|
|
169
184
|
}
|
|
170
|
-
|
|
171
|
-
this.
|
|
185
|
+
recordCheckpointProposalSuccess() {
|
|
186
|
+
this.checkpointProposalSuccess.add(1);
|
|
172
187
|
}
|
|
173
|
-
|
|
174
|
-
this.
|
|
188
|
+
recordCheckpointPrecheckFailed(checkType) {
|
|
189
|
+
this.checkpointPrecheckFailed.add(1, {
|
|
175
190
|
[Attributes.ERROR_TYPE]: checkType
|
|
176
191
|
});
|
|
177
192
|
}
|
|
193
|
+
recordCheckpointProposalFailed(reason) {
|
|
194
|
+
this.checkpointProposalFailed.add(1, {
|
|
195
|
+
...reason && {
|
|
196
|
+
[Attributes.ERROR_TYPE]: reason
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/** Records aggregate metrics for a completed checkpoint build. */ recordCheckpointBuild(durationMs, blockCount, txCount, totalMana) {
|
|
201
|
+
this.checkpointBuildDuration.record(Math.ceil(durationMs));
|
|
202
|
+
this.checkpointBlockCount.record(blockCount);
|
|
203
|
+
this.checkpointTxCount.record(txCount);
|
|
204
|
+
this.checkpointTotalMana.record(totalMana);
|
|
205
|
+
}
|
|
178
206
|
recordSlashingAttempt(actionCount) {
|
|
179
207
|
this.slashingAttempts.add(actionCount);
|
|
180
208
|
}
|
|
@@ -236,16 +264,22 @@ export class SequencerMetrics {
|
|
|
236
264
|
[Attributes.OK]: false
|
|
237
265
|
});
|
|
238
266
|
}
|
|
267
|
+
// Record the max blob capacity for this block
|
|
268
|
+
this.fishermanMaxBlobCapacity.record(analysis.analysis.maxBlobCapacity, strategyAttributes);
|
|
239
269
|
// Record strategy-specific inclusion result
|
|
240
270
|
if (strategyResult.wouldBeIncluded !== undefined) {
|
|
271
|
+
const inclusionAttributes = {
|
|
272
|
+
...strategyAttributes,
|
|
273
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
274
|
+
};
|
|
241
275
|
if (strategyResult.wouldBeIncluded) {
|
|
242
276
|
this.fishermanWouldBeIncluded.add(1, {
|
|
243
|
-
...
|
|
277
|
+
...inclusionAttributes,
|
|
244
278
|
[Attributes.OK]: true
|
|
245
279
|
});
|
|
246
280
|
} else {
|
|
247
281
|
this.fishermanWouldBeIncluded.add(1, {
|
|
248
|
-
...
|
|
282
|
+
...inclusionAttributes,
|
|
249
283
|
[Attributes.OK]: false,
|
|
250
284
|
...strategyResult.exclusionReason && {
|
|
251
285
|
[Attributes.ERROR_TYPE]: strategyResult.exclusionReason
|
|
@@ -256,15 +290,27 @@ export class SequencerMetrics {
|
|
|
256
290
|
// Record strategy-specific priority fee delta
|
|
257
291
|
if (strategyResult.priorityFeeDelta !== undefined) {
|
|
258
292
|
const priorityFeeDeltaGwei = Number(strategyResult.priorityFeeDelta) / 1e9;
|
|
259
|
-
|
|
293
|
+
const deltaAttributes = {
|
|
294
|
+
...strategyAttributes,
|
|
295
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
296
|
+
};
|
|
297
|
+
this.fishermanPriorityFeeDelta.record(priorityFeeDeltaGwei, deltaAttributes);
|
|
260
298
|
}
|
|
261
299
|
// Record estimated cost if available
|
|
262
300
|
if (strategyResult.estimatedCostEth !== undefined) {
|
|
263
|
-
|
|
301
|
+
const costAttributes = {
|
|
302
|
+
...strategyAttributes,
|
|
303
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
304
|
+
};
|
|
305
|
+
this.fishermanEstimatedCost.record(strategyResult.estimatedCostEth, costAttributes);
|
|
264
306
|
}
|
|
265
307
|
// Record estimated overpayment if available
|
|
266
308
|
if (strategyResult.estimatedOverpaymentEth !== undefined) {
|
|
267
|
-
|
|
309
|
+
const overpaymentAttributes = {
|
|
310
|
+
...strategyAttributes,
|
|
311
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
312
|
+
};
|
|
313
|
+
this.fishermanEstimatedOverpayment.record(strategyResult.estimatedOverpaymentEth, overpaymentAttributes);
|
|
268
314
|
}
|
|
269
315
|
}
|
|
270
316
|
}
|