@aztec/sequencer-client 0.0.1-commit.e6bd8901 → 0.0.1-commit.f146247c
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.js +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-metrics.js +12 -4
- package/dest/publisher/sequencer-publisher.d.ts +1 -2
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +39 -18
- package/dest/sequencer/checkpoint_proposal_job.d.ts +26 -9
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +48 -20
- package/dest/sequencer/metrics.d.ts +2 -2
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +27 -17
- package/dest/sequencer/sequencer.js +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +6 -3
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +18 -6
- package/package.json +28 -28
- package/src/client/sequencer-client.ts +1 -1
- package/src/publisher/sequencer-publisher-metrics.ts +7 -3
- package/src/publisher/sequencer-publisher.ts +34 -18
- package/src/sequencer/checkpoint_proposal_job.ts +68 -37
- package/src/sequencer/metrics.ts +36 -18
- package/src/sequencer/sequencer.ts +1 -1
- package/src/test/mock_checkpoint_builder.ts +22 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Attributes, Metrics } from '@aztec/telemetry-client';
|
|
1
|
+
import { Attributes, Metrics, createUpDownCounterWithDefault } from '@aztec/telemetry-client';
|
|
2
2
|
import { formatUnits } from 'viem';
|
|
3
3
|
// TODO(palla/mbps): Review all metrics and add any missing ones per checkpoint
|
|
4
4
|
export class SequencerMetrics {
|
|
@@ -39,35 +39,45 @@ export class SequencerMetrics {
|
|
|
39
39
|
this.rollup = rollup;
|
|
40
40
|
this.meter = client.getMeter(name);
|
|
41
41
|
this.tracer = client.getTracer(name);
|
|
42
|
-
this.blockCounter = this.meter
|
|
42
|
+
this.blockCounter = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_BLOCK_COUNT, {
|
|
43
|
+
[Attributes.STATUS]: [
|
|
44
|
+
'failed',
|
|
45
|
+
'built'
|
|
46
|
+
]
|
|
47
|
+
});
|
|
43
48
|
this.blockBuildDuration = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_BUILD_DURATION);
|
|
44
49
|
this.blockBuildManaPerSecond = this.meter.createGauge(Metrics.SEQUENCER_BLOCK_BUILD_MANA_PER_SECOND);
|
|
45
50
|
this.stateTransitionBufferDuration = this.meter.createHistogram(Metrics.SEQUENCER_STATE_TRANSITION_BUFFER_DURATION);
|
|
46
51
|
this.checkpointAttestationDelay = this.meter.createHistogram(Metrics.SEQUENCER_CHECKPOINT_ATTESTATION_DELAY);
|
|
47
|
-
// Init gauges and counters
|
|
48
|
-
this.blockCounter.add(0, {
|
|
49
|
-
[Attributes.STATUS]: 'failed'
|
|
50
|
-
});
|
|
51
|
-
this.blockCounter.add(0, {
|
|
52
|
-
[Attributes.STATUS]: 'built'
|
|
53
|
-
});
|
|
54
52
|
this.rewards = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_BLOCK_REWARDS);
|
|
55
|
-
this.slots = this.meter
|
|
53
|
+
this.slots = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_SLOT_COUNT);
|
|
56
54
|
/**
|
|
57
55
|
* NOTE: we do not track missed slots as a separate metric. That would be difficult to determine
|
|
58
56
|
* Instead, use a computed metric, `slots - filledSlots` to get the number of slots a sequencer has missed.
|
|
59
|
-
*/ this.filledSlots = this.meter
|
|
57
|
+
*/ this.filledSlots = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_FILLED_SLOT_COUNT);
|
|
60
58
|
this.timeToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_DURATION);
|
|
61
59
|
this.allowanceToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_TIME_ALLOWANCE);
|
|
62
60
|
this.requiredAttestions = this.meter.createGauge(Metrics.SEQUENCER_REQUIRED_ATTESTATIONS_COUNT);
|
|
63
61
|
this.collectedAttestions = this.meter.createGauge(Metrics.SEQUENCER_COLLECTED_ATTESTATIONS_COUNT);
|
|
64
|
-
this.blockProposalFailed = this.meter
|
|
65
|
-
this.blockProposalSuccess = this.meter
|
|
66
|
-
this.checkpointSuccess = this.meter
|
|
67
|
-
this.blockProposalPrecheckFailed = this.meter
|
|
68
|
-
|
|
62
|
+
this.blockProposalFailed = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT);
|
|
63
|
+
this.blockProposalSuccess = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_BLOCK_PROPOSAL_SUCCESS_COUNT);
|
|
64
|
+
this.checkpointSuccess = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_SUCCESS_COUNT);
|
|
65
|
+
this.blockProposalPrecheckFailed = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_BLOCK_PROPOSAL_PRECHECK_FAILED_COUNT, {
|
|
66
|
+
[Attributes.ERROR_TYPE]: [
|
|
67
|
+
'slot_already_taken',
|
|
68
|
+
'rollup_contract_check_failed',
|
|
69
|
+
'slot_mismatch',
|
|
70
|
+
'block_number_mismatch'
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
this.slashingAttempts = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_SLASHING_ATTEMPTS_COUNT);
|
|
69
74
|
// Fisherman fee analysis metrics
|
|
70
|
-
this.fishermanWouldBeIncluded = this.meter
|
|
75
|
+
this.fishermanWouldBeIncluded = createUpDownCounterWithDefault(this.meter, Metrics.FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED, {
|
|
76
|
+
[Attributes.OK]: [
|
|
77
|
+
true,
|
|
78
|
+
false
|
|
79
|
+
]
|
|
80
|
+
});
|
|
71
81
|
this.fishermanTimeBeforeBlock = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_TIME_BEFORE_BLOCK);
|
|
72
82
|
this.fishermanPendingBlobTxCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_TX_COUNT);
|
|
73
83
|
this.fishermanIncludedBlobTxCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_TX_COUNT);
|
|
@@ -705,7 +705,7 @@ _dec = trackSpan('Sequencer.work'), _dec1 = trackSpan('Sequencer.prepareCheckpoi
|
|
|
705
705
|
return this.createCheckpointProposalJob(epoch, slot, checkpointNumber, syncedTo.blockNumber, proposer, publisher, attestorAddress, invalidateCheckpoint);
|
|
706
706
|
}
|
|
707
707
|
createCheckpointProposalJob(epoch, slot, checkpointNumber, syncedToBlockNumber, proposer, publisher, attestorAddress, invalidateCheckpoint) {
|
|
708
|
-
return new CheckpointProposalJob(epoch, slot, checkpointNumber, syncedToBlockNumber, proposer, publisher, attestorAddress, invalidateCheckpoint, this.validatorClient, this.globalsBuilder, this.p2pClient, this.worldState, this.l1ToL2MessageSource, this.l2BlockSource, this.checkpointsBuilder, this.l2BlockSource, this.l1Constants, this.config, this.timetable, this.slasherClient, this.epochCache, this.dateProvider, this.metrics, this, this.setState.bind(this), this.
|
|
708
|
+
return new CheckpointProposalJob(epoch, slot, checkpointNumber, syncedToBlockNumber, proposer, publisher, attestorAddress, invalidateCheckpoint, this.validatorClient, this.globalsBuilder, this.p2pClient, this.worldState, this.l1ToL2MessageSource, this.l2BlockSource, this.checkpointsBuilder, this.l2BlockSource, this.l1Constants, this.config, this.timetable, this.slasherClient, this.epochCache, this.dateProvider, this.metrics, this, this.setState.bind(this), this.tracer, this.log.getBindings());
|
|
709
709
|
}
|
|
710
710
|
/**
|
|
711
711
|
* Internal helper for setting the sequencer state and checks if we have enough time left in the slot to transition to the new state.
|
|
@@ -2,8 +2,9 @@ import { type BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-ty
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { L2Block } from '@aztec/stdlib/block';
|
|
4
4
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
5
|
-
import type {
|
|
5
|
+
import type { FullNodeBlockBuilderConfig, ICheckpointBlockBuilder, ICheckpointsBuilder, MerkleTreeWriteOperations, PublicProcessorLimits } from '@aztec/stdlib/interfaces/server';
|
|
6
6
|
import type { CheckpointGlobalVariables, Tx } from '@aztec/stdlib/tx';
|
|
7
|
+
import type { BuildBlockInCheckpointResult } from '@aztec/validator-client';
|
|
7
8
|
/**
|
|
8
9
|
* A fake CheckpointBuilder for testing that implements the same interface as the real one.
|
|
9
10
|
* Can be seeded with blocks to return sequentially on each `buildBlock` call.
|
|
@@ -23,6 +24,8 @@ export declare class MockCheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
23
24
|
timestamp: bigint;
|
|
24
25
|
opts: PublicProcessorLimits;
|
|
25
26
|
}>;
|
|
27
|
+
/** Track all consumed transaction hashes across buildBlock calls */
|
|
28
|
+
consumedTxHashes: Set<string>;
|
|
26
29
|
completeCheckpointCalled: boolean;
|
|
27
30
|
getCheckpointCalled: boolean;
|
|
28
31
|
/** Set to an error to make buildBlock throw on next call */
|
|
@@ -36,7 +39,7 @@ export declare class MockCheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
36
39
|
*/
|
|
37
40
|
setBlockProvider(provider: () => L2Block): this;
|
|
38
41
|
getConstantData(): CheckpointGlobalVariables;
|
|
39
|
-
buildBlock(
|
|
42
|
+
buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, blockNumber: BlockNumber, timestamp: bigint, opts: PublicProcessorLimits): Promise<BuildBlockInCheckpointResult>;
|
|
40
43
|
completeCheckpoint(): Promise<Checkpoint>;
|
|
41
44
|
getCheckpoint(): Promise<Checkpoint>;
|
|
42
45
|
/**
|
|
@@ -89,4 +92,4 @@ export declare class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
89
92
|
/** Reset for reuse in another test */
|
|
90
93
|
reset(): void;
|
|
91
94
|
}
|
|
92
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
95
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9ja19jaGVja3BvaW50X2J1aWxkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L21vY2tfY2hlY2twb2ludF9idWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDOUMsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRXRELE9BQU8sS0FBSyxFQUNWLDBCQUEwQixFQUMxQix1QkFBdUIsRUFDdkIsbUJBQW1CLEVBQ25CLHlCQUF5QixFQUN6QixxQkFBcUIsRUFDdEIsTUFBTSxpQ0FBaUMsQ0FBQztBQUd6QyxPQUFPLEtBQUssRUFBRSx5QkFBeUIsRUFBRSxFQUFFLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUN0RSxPQUFPLEtBQUssRUFBRSw0QkFBNEIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRTVFOzs7R0FHRztBQUNILHFCQUFhLHFCQUFzQixZQUFXLHVCQUF1QjtJQXdCak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NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock_checkpoint_builder.d.ts","sourceRoot":"","sources":["../../src/test/mock_checkpoint_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"mock_checkpoint_builder.d.ts","sourceRoot":"","sources":["../../src/test/mock_checkpoint_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAE5E;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,uBAAuB;IAwBjE,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAxBnC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,WAAW,CAAiB;IACpC,OAAO,CAAC,eAAe,CAAc;IACrC,OAAO,CAAC,UAAU,CAAK;IAEvB,qFAAqF;IACrF,OAAO,CAAC,aAAa,CAA0C;IAE/D,iCAAiC;IAC1B,eAAe,EAAE,KAAK,CAAC;QAC5B,WAAW,EAAE,WAAW,CAAC;QACzB,SAAS,EAAE,M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254';
|
|
2
|
-
import { Timer } from '@aztec/foundation/timer';
|
|
3
2
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
4
3
|
import { Gas } from '@aztec/stdlib/gas';
|
|
5
4
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
@@ -16,6 +15,7 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
16
15
|
blockIndex;
|
|
17
16
|
/** Optional function to dynamically provide the block (alternative to seedBlocks) */ blockProvider;
|
|
18
17
|
/** Track calls for assertions */ buildBlockCalls;
|
|
18
|
+
/** Track all consumed transaction hashes across buildBlock calls */ consumedTxHashes;
|
|
19
19
|
completeCheckpointCalled;
|
|
20
20
|
getCheckpointCalled;
|
|
21
21
|
/** Set to an error to make buildBlock throw on next call */ errorOnBuild;
|
|
@@ -28,6 +28,7 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
28
28
|
this.blockIndex = 0;
|
|
29
29
|
this.blockProvider = undefined;
|
|
30
30
|
this.buildBlockCalls = [];
|
|
31
|
+
this.consumedTxHashes = new Set();
|
|
31
32
|
this.completeCheckpointCalled = false;
|
|
32
33
|
this.getCheckpointCalled = false;
|
|
33
34
|
this.errorOnBuild = undefined;
|
|
@@ -50,14 +51,14 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
50
51
|
getConstantData() {
|
|
51
52
|
return this.constants;
|
|
52
53
|
}
|
|
53
|
-
buildBlock(
|
|
54
|
+
async buildBlock(pendingTxs, blockNumber, timestamp, opts) {
|
|
54
55
|
this.buildBlockCalls.push({
|
|
55
56
|
blockNumber,
|
|
56
57
|
timestamp,
|
|
57
58
|
opts
|
|
58
59
|
});
|
|
59
60
|
if (this.errorOnBuild) {
|
|
60
|
-
|
|
61
|
+
throw this.errorOnBuild;
|
|
61
62
|
}
|
|
62
63
|
let block;
|
|
63
64
|
let usedTxs;
|
|
@@ -73,16 +74,26 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
73
74
|
this.blockIndex++;
|
|
74
75
|
this.builtBlocks.push(block);
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
+
// Check that no pending tx has already been consumed
|
|
78
|
+
for await (const tx of pendingTxs){
|
|
79
|
+
const hash = tx.getTxHash().toString();
|
|
80
|
+
if (this.consumedTxHashes.has(hash)) {
|
|
81
|
+
throw new Error(`Transaction ${hash} was already consumed in a previous block`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Add used txs to consumed set
|
|
85
|
+
for (const tx of usedTxs){
|
|
86
|
+
this.consumedTxHashes.add(tx.getTxHash().toString());
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
77
89
|
block,
|
|
78
90
|
publicGas: Gas.empty(),
|
|
79
91
|
publicProcessorDuration: 0,
|
|
80
92
|
numTxs: block?.body?.txEffects?.length ?? usedTxs.length,
|
|
81
|
-
blockBuildingTimer: new Timer(),
|
|
82
93
|
usedTxs,
|
|
83
94
|
failedTxs: [],
|
|
84
95
|
usedTxBlobFields: block?.body?.txEffects?.reduce((sum, tx)=>sum + tx.getNumBlobFields(), 0) ?? 0
|
|
85
|
-
}
|
|
96
|
+
};
|
|
86
97
|
}
|
|
87
98
|
completeCheckpoint() {
|
|
88
99
|
this.completeCheckpointCalled = true;
|
|
@@ -126,6 +137,7 @@ import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
|
126
137
|
this.usedTxsPerBlock = [];
|
|
127
138
|
this.blockIndex = 0;
|
|
128
139
|
this.buildBlockCalls = [];
|
|
140
|
+
this.consumedTxHashes.clear();
|
|
129
141
|
this.completeCheckpointCalled = false;
|
|
130
142
|
this.getCheckpointCalled = false;
|
|
131
143
|
this.errorOnBuild = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.f146247c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,38 +26,38 @@
|
|
|
26
26
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
30
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
31
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
32
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
33
|
-
"@aztec/constants": "0.0.1-commit.
|
|
34
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
35
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
36
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
37
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
38
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
39
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
40
|
-
"@aztec/noir-acvm_js": "0.0.1-commit.
|
|
41
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
42
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
43
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
44
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
45
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
46
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
47
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
48
|
-
"@aztec/slasher": "0.0.1-commit.
|
|
49
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
50
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
51
|
-
"@aztec/validator-client": "0.0.1-commit.
|
|
52
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
53
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
29
|
+
"@aztec/aztec.js": "0.0.1-commit.f146247c",
|
|
30
|
+
"@aztec/bb-prover": "0.0.1-commit.f146247c",
|
|
31
|
+
"@aztec/blob-client": "0.0.1-commit.f146247c",
|
|
32
|
+
"@aztec/blob-lib": "0.0.1-commit.f146247c",
|
|
33
|
+
"@aztec/constants": "0.0.1-commit.f146247c",
|
|
34
|
+
"@aztec/epoch-cache": "0.0.1-commit.f146247c",
|
|
35
|
+
"@aztec/ethereum": "0.0.1-commit.f146247c",
|
|
36
|
+
"@aztec/foundation": "0.0.1-commit.f146247c",
|
|
37
|
+
"@aztec/l1-artifacts": "0.0.1-commit.f146247c",
|
|
38
|
+
"@aztec/merkle-tree": "0.0.1-commit.f146247c",
|
|
39
|
+
"@aztec/node-keystore": "0.0.1-commit.f146247c",
|
|
40
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.f146247c",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.f146247c",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.f146247c",
|
|
43
|
+
"@aztec/noir-types": "0.0.1-commit.f146247c",
|
|
44
|
+
"@aztec/p2p": "0.0.1-commit.f146247c",
|
|
45
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f146247c",
|
|
46
|
+
"@aztec/prover-client": "0.0.1-commit.f146247c",
|
|
47
|
+
"@aztec/simulator": "0.0.1-commit.f146247c",
|
|
48
|
+
"@aztec/slasher": "0.0.1-commit.f146247c",
|
|
49
|
+
"@aztec/stdlib": "0.0.1-commit.f146247c",
|
|
50
|
+
"@aztec/telemetry-client": "0.0.1-commit.f146247c",
|
|
51
|
+
"@aztec/validator-client": "0.0.1-commit.f146247c",
|
|
52
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.f146247c",
|
|
53
|
+
"@aztec/world-state": "0.0.1-commit.f146247c",
|
|
54
54
|
"lodash.chunk": "^4.2.0",
|
|
55
55
|
"tslib": "^2.4.0",
|
|
56
56
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
60
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
59
|
+
"@aztec/archiver": "0.0.1-commit.f146247c",
|
|
60
|
+
"@aztec/kv-store": "0.0.1-commit.f146247c",
|
|
61
61
|
"@electric-sql/pglite": "^0.3.14",
|
|
62
62
|
"@jest/globals": "^30.0.0",
|
|
63
63
|
"@types/jest": "^30.0.0",
|
|
@@ -85,7 +85,7 @@ export class SequencerClient {
|
|
|
85
85
|
publicClient,
|
|
86
86
|
l1TxUtils.map(x => x.getSenderAddress()),
|
|
87
87
|
);
|
|
88
|
-
const publisherManager = new PublisherManager(l1TxUtils, config);
|
|
88
|
+
const publisherManager = new PublisherManager(l1TxUtils, config, log.getBindings());
|
|
89
89
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
90
90
|
const [l1GenesisTime, slotDuration, rollupVersion, rollupManaLimit] = await Promise.all([
|
|
91
91
|
rollupContract.getL1GenesisTime(),
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Metrics,
|
|
8
8
|
type TelemetryClient,
|
|
9
9
|
type UpDownCounter,
|
|
10
|
+
createUpDownCounterWithDefault,
|
|
10
11
|
} from '@aztec/telemetry-client';
|
|
11
12
|
|
|
12
13
|
import { formatEther } from 'viem/utils';
|
|
@@ -41,7 +42,10 @@ export class SequencerPublisherMetrics {
|
|
|
41
42
|
|
|
42
43
|
this.gasPrice = meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE);
|
|
43
44
|
|
|
44
|
-
this.txCount = meter
|
|
45
|
+
this.txCount = createUpDownCounterWithDefault(meter, Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
46
|
+
[Attributes.L1_TX_TYPE]: ['process'],
|
|
47
|
+
[Attributes.OK]: [true, false],
|
|
48
|
+
});
|
|
45
49
|
|
|
46
50
|
this.txDuration = meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION);
|
|
47
51
|
|
|
@@ -59,9 +63,9 @@ export class SequencerPublisherMetrics {
|
|
|
59
63
|
|
|
60
64
|
this.blobInclusionBlocksHistogram = meter.createHistogram(Metrics.L1_PUBLISHER_BLOB_INCLUSION_BLOCKS);
|
|
61
65
|
|
|
62
|
-
this.blobTxSuccessCounter = meter
|
|
66
|
+
this.blobTxSuccessCounter = createUpDownCounterWithDefault(meter, Metrics.L1_PUBLISHER_BLOB_TX_SUCCESS);
|
|
63
67
|
|
|
64
|
-
this.blobTxFailureCounter = meter
|
|
68
|
+
this.blobTxFailureCounter = createUpDownCounterWithDefault(meter, Metrics.L1_PUBLISHER_BLOB_TX_FAILURE);
|
|
65
69
|
|
|
66
70
|
this.txTotalFee = meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE);
|
|
67
71
|
|
|
@@ -18,11 +18,12 @@ import {
|
|
|
18
18
|
type L1BlobInputs,
|
|
19
19
|
type L1TxConfig,
|
|
20
20
|
type L1TxRequest,
|
|
21
|
+
MAX_L1_TX_LIMIT,
|
|
21
22
|
type TransactionStats,
|
|
22
23
|
WEI_CONST,
|
|
23
24
|
} from '@aztec/ethereum/l1-tx-utils';
|
|
24
25
|
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
25
|
-
import { FormattedViemError, formatViemError, tryExtractEvent } from '@aztec/ethereum/utils';
|
|
26
|
+
import { FormattedViemError, formatViemError, mergeAbis, tryExtractEvent } from '@aztec/ethereum/utils';
|
|
26
27
|
import { sumBigint } from '@aztec/foundation/bigint';
|
|
27
28
|
import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
28
29
|
import { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
@@ -122,11 +123,6 @@ export class SequencerPublisher {
|
|
|
122
123
|
|
|
123
124
|
/** L1 fee analyzer for fisherman mode */
|
|
124
125
|
private l1FeeAnalyzer?: L1FeeAnalyzer;
|
|
125
|
-
// @note - with blobs, the below estimate seems too large.
|
|
126
|
-
// Total used for full block from int_l1_pub e2e test: 1m (of which 86k is 1x blob)
|
|
127
|
-
// Total used for emptier block from above test: 429k (of which 84k is 1x blob)
|
|
128
|
-
public static PROPOSE_GAS_GUESS: bigint = 12_000_000n;
|
|
129
|
-
|
|
130
126
|
// A CALL to a cold address is 2700 gas
|
|
131
127
|
public static MULTICALL_OVERHEAD_GAS_GUESS = 5000n;
|
|
132
128
|
|
|
@@ -273,7 +269,7 @@ export class SequencerPublisher {
|
|
|
273
269
|
// Start the analysis
|
|
274
270
|
const analysisId = await this.l1FeeAnalyzer.startAnalysis(
|
|
275
271
|
l2SlotNumber,
|
|
276
|
-
gasLimit > 0n ? gasLimit :
|
|
272
|
+
gasLimit > 0n ? gasLimit : MAX_L1_TX_LIMIT,
|
|
277
273
|
l1Requests,
|
|
278
274
|
blobConfig,
|
|
279
275
|
onComplete,
|
|
@@ -346,7 +342,16 @@ export class SequencerPublisher {
|
|
|
346
342
|
|
|
347
343
|
// Merge gasConfigs. Yields the sum of gasLimits, and the earliest txTimeoutAt, or undefined if no gasConfig sets them.
|
|
348
344
|
const gasLimits = gasConfigs.map(g => g?.gasLimit).filter((g): g is bigint => g !== undefined);
|
|
349
|
-
|
|
345
|
+
let gasLimit = gasLimits.length > 0 ? sumBigint(gasLimits) : undefined; // sum
|
|
346
|
+
// Cap at L1 block gas limit so the node accepts the tx ("gas limit too high" otherwise).
|
|
347
|
+
const maxGas = MAX_L1_TX_LIMIT;
|
|
348
|
+
if (gasLimit !== undefined && gasLimit > maxGas) {
|
|
349
|
+
this.log.debug('Capping bundled tx gas limit to L1 max', {
|
|
350
|
+
requested: gasLimit,
|
|
351
|
+
capped: maxGas,
|
|
352
|
+
});
|
|
353
|
+
gasLimit = maxGas;
|
|
354
|
+
}
|
|
350
355
|
const txTimeoutAts = gasConfigs.map(g => g?.txTimeoutAt).filter((g): g is Date => g !== undefined);
|
|
351
356
|
const txTimeoutAt = txTimeoutAts.length > 0 ? new Date(Math.min(...txTimeoutAts.map(g => g.getTime()))) : undefined; // earliest
|
|
352
357
|
const txConfig: RequestWithExpiry['gasConfig'] = { gasLimit, txTimeoutAt };
|
|
@@ -517,7 +522,12 @@ export class SequencerPublisher {
|
|
|
517
522
|
this.log.debug(`Simulating invalidate checkpoint ${checkpointNumber}`, { ...logData, request });
|
|
518
523
|
|
|
519
524
|
try {
|
|
520
|
-
const { gasUsed } = await this.l1TxUtils.simulate(
|
|
525
|
+
const { gasUsed } = await this.l1TxUtils.simulate(
|
|
526
|
+
request,
|
|
527
|
+
undefined,
|
|
528
|
+
undefined,
|
|
529
|
+
mergeAbis([request.abi ?? [], ErrorsAbi]),
|
|
530
|
+
);
|
|
521
531
|
this.log.verbose(`Simulation for invalidate checkpoint ${checkpointNumber} succeeded`, {
|
|
522
532
|
...logData,
|
|
523
533
|
request,
|
|
@@ -536,7 +546,7 @@ export class SequencerPublisher {
|
|
|
536
546
|
|
|
537
547
|
// If the error is due to the checkpoint not being in the pending chain, and it was indeed removed by someone else,
|
|
538
548
|
// we can safely ignore it and return undefined so we go ahead with checkpoint building.
|
|
539
|
-
if (viemError.message?.includes('
|
|
549
|
+
if (viemError.message?.includes('Rollup__CheckpointNotInPendingChain')) {
|
|
540
550
|
this.log.verbose(
|
|
541
551
|
`Simulation for invalidate checkpoint ${checkpointNumber} failed due to checkpoint not being in pending chain`,
|
|
542
552
|
{ ...logData, request, error: viemError.message },
|
|
@@ -700,7 +710,7 @@ export class SequencerPublisher {
|
|
|
700
710
|
});
|
|
701
711
|
|
|
702
712
|
try {
|
|
703
|
-
await this.l1TxUtils.simulate(request, { time: timestamp }, [], ErrorsAbi);
|
|
713
|
+
await this.l1TxUtils.simulate(request, { time: timestamp }, [], mergeAbis([request.abi ?? [], ErrorsAbi]));
|
|
704
714
|
this.log.debug(`Simulation for ${action} at slot ${slotNumber} succeeded`, { request });
|
|
705
715
|
} catch (err) {
|
|
706
716
|
this.log.error(`Failed simulation for ${action} at slot ${slotNumber} (enqueuing the action anyway)`, err);
|
|
@@ -999,12 +1009,14 @@ export class SequencerPublisher {
|
|
|
999
1009
|
this.log.debug(`Simulating ${action} for slot ${slotNumber}`, logData);
|
|
1000
1010
|
|
|
1001
1011
|
let gasUsed: bigint;
|
|
1012
|
+
const simulateAbi = mergeAbis([request.abi ?? [], ErrorsAbi]);
|
|
1002
1013
|
try {
|
|
1003
|
-
({ gasUsed } = await this.l1TxUtils.simulate(request, { time: timestamp }, [],
|
|
1014
|
+
({ gasUsed } = await this.l1TxUtils.simulate(request, { time: timestamp }, [], simulateAbi)); // TODO(palla/slash): Check the timestamp logic
|
|
1004
1015
|
this.log.verbose(`Simulation for ${action} succeeded`, { ...logData, request, gasUsed });
|
|
1005
1016
|
} catch (err) {
|
|
1006
|
-
const viemError = formatViemError(err);
|
|
1017
|
+
const viemError = formatViemError(err, simulateAbi);
|
|
1007
1018
|
this.log.error(`Simulation for ${action} at ${slotNumber} failed`, viemError, logData);
|
|
1019
|
+
|
|
1008
1020
|
return false;
|
|
1009
1021
|
}
|
|
1010
1022
|
|
|
@@ -1012,10 +1024,14 @@ export class SequencerPublisher {
|
|
|
1012
1024
|
const gasLimit = this.l1TxUtils.bumpGasLimit(BigInt(Math.ceil((Number(gasUsed) * 64) / 63)));
|
|
1013
1025
|
logData.gasLimit = gasLimit;
|
|
1014
1026
|
|
|
1027
|
+
// Store the ABI used for simulation on the request so Multicall3.forward can decode errors
|
|
1028
|
+
// when the tx is sent and a revert is diagnosed via simulation.
|
|
1029
|
+
const requestWithAbi = { ...request, abi: simulateAbi };
|
|
1030
|
+
|
|
1015
1031
|
this.log.debug(`Enqueuing ${action}`, logData);
|
|
1016
1032
|
this.addRequest({
|
|
1017
1033
|
action,
|
|
1018
|
-
request,
|
|
1034
|
+
request: requestWithAbi,
|
|
1019
1035
|
gasConfig: { gasLimit },
|
|
1020
1036
|
lastValidL2Slot: slotNumber,
|
|
1021
1037
|
checkSuccess: (_req, result) => {
|
|
@@ -1171,20 +1187,20 @@ export class SequencerPublisher {
|
|
|
1171
1187
|
{
|
|
1172
1188
|
to: this.rollupContract.address,
|
|
1173
1189
|
data: rollupData,
|
|
1174
|
-
gas:
|
|
1190
|
+
gas: MAX_L1_TX_LIMIT,
|
|
1175
1191
|
...(this.proposerAddressForSimulation && { from: this.proposerAddressForSimulation.toString() }),
|
|
1176
1192
|
},
|
|
1177
1193
|
{
|
|
1178
1194
|
// @note we add 1n to the timestamp because geth implementation doesn't like simulation timestamp to be equal to the current block timestamp
|
|
1179
1195
|
time: timestamp + 1n,
|
|
1180
1196
|
// @note reth should have a 30m gas limit per block but throws errors that this tx is beyond limit so we increase here
|
|
1181
|
-
gasLimit:
|
|
1197
|
+
gasLimit: MAX_L1_TX_LIMIT * 2n,
|
|
1182
1198
|
},
|
|
1183
1199
|
stateOverrides,
|
|
1184
1200
|
RollupAbi,
|
|
1185
1201
|
{
|
|
1186
1202
|
// @note fallback gas estimate to use if the node doesn't support simulation API
|
|
1187
|
-
fallbackGasEstimate:
|
|
1203
|
+
fallbackGasEstimate: MAX_L1_TX_LIMIT,
|
|
1188
1204
|
},
|
|
1189
1205
|
)
|
|
1190
1206
|
.catch(err => {
|
|
@@ -1194,7 +1210,7 @@ export class SequencerPublisher {
|
|
|
1194
1210
|
this.log.debug(`Ignoring expected ValidatorSelection__MissingProposerSignature error in fisherman mode`);
|
|
1195
1211
|
// Return a minimal simulation result with the fallback gas estimate
|
|
1196
1212
|
return {
|
|
1197
|
-
gasUsed:
|
|
1213
|
+
gasUsed: MAX_L1_TX_LIMIT,
|
|
1198
1214
|
logs: [],
|
|
1199
1215
|
};
|
|
1200
1216
|
}
|