@aztec/sequencer-client 0.0.1-commit.f504929 → 0.0.1-commit.f81dbcf
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 +12 -1
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +85 -13
- package/dest/config.d.ts +22 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +14 -12
- package/dest/publisher/config.d.ts +1 -5
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +1 -6
- package/dest/publisher/index.d.ts +1 -2
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts +1 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +0 -14
- package/dest/publisher/sequencer-publisher.d.ts +2 -12
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +9 -258
- 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 +55 -58
- package/dest/sequencer/sequencer.d.ts +7 -6
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +11 -13
- 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/mock_checkpoint_builder.d.ts +10 -8
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +41 -30
- package/package.json +28 -28
- package/src/client/sequencer-client.ts +111 -12
- package/src/config.ts +17 -14
- package/src/publisher/config.ts +0 -9
- package/src/publisher/index.ts +0 -3
- package/src/publisher/sequencer-publisher-factory.ts +0 -15
- package/src/publisher/sequencer-publisher.ts +15 -237
- package/src/sequencer/checkpoint_proposal_job.ts +65 -65
- package/src/sequencer/sequencer.ts +12 -14
- package/src/sequencer/timetable.ts +7 -7
- package/src/sequencer/types.ts +1 -1
- package/src/test/mock_checkpoint_builder.ts +52 -47
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +0 -11
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +0 -1
- package/dest/publisher/l1_tx_failed_store/factory.js +0 -22
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +0 -59
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +0 -1
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +0 -1
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +0 -15
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +0 -1
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +0 -34
- package/dest/publisher/l1_tx_failed_store/index.d.ts +0 -4
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +0 -1
- package/dest/publisher/l1_tx_failed_store/index.js +0 -2
- package/src/publisher/l1_tx_failed_store/factory.ts +0 -32
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +0 -55
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +0 -46
- package/src/publisher/l1_tx_failed_store/index.ts +0 -3
|
@@ -14,7 +14,7 @@ import type { P2P } from '@aztec/p2p';
|
|
|
14
14
|
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
15
15
|
import type { BlockData, L2BlockSink, L2BlockSource, ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
16
16
|
import type { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
17
|
-
import {
|
|
17
|
+
import { getSlotStartBuildTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
18
18
|
import {
|
|
19
19
|
type ResolvedSequencerConfig,
|
|
20
20
|
type SequencerConfig,
|
|
@@ -281,8 +281,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
281
281
|
|
|
282
282
|
const logCtx = {
|
|
283
283
|
now,
|
|
284
|
-
|
|
285
|
-
syncedToL2Slot: getSlotAtTimestamp(syncedTo.l1Timestamp, this.l1Constants),
|
|
284
|
+
syncedToL2Slot: syncedTo.syncedL2Slot,
|
|
286
285
|
slot,
|
|
287
286
|
slotTs: ts,
|
|
288
287
|
checkpointNumber,
|
|
@@ -475,16 +474,15 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
475
474
|
* We don't check against the previous block submitted since it may have been reorg'd out.
|
|
476
475
|
*/
|
|
477
476
|
protected async checkSync(args: { ts: bigint; slot: SlotNumber }): Promise<SequencerSyncCheckResult | undefined> {
|
|
478
|
-
// Check that the archiver
|
|
477
|
+
// Check that the archiver has fully synced the L2 slot before the one we want to propose in.
|
|
479
478
|
// TODO(#14766): Archiver reports L1 timestamp based on L1 blocks seen, which means that a missed L1 block will
|
|
480
479
|
// cause the archiver L1 timestamp to fall behind, and cause this sequencer to start processing one L1 slot later.
|
|
481
|
-
const
|
|
482
|
-
const { slot
|
|
483
|
-
if (
|
|
480
|
+
const syncedL2Slot = await this.l2BlockSource.getSyncedL2SlotNumber();
|
|
481
|
+
const { slot } = args;
|
|
482
|
+
if (syncedL2Slot === undefined || syncedL2Slot + 1 < slot) {
|
|
484
483
|
this.log.debug(`Cannot propose block at next L2 slot ${slot} due to pending sync from L1`, {
|
|
485
484
|
slot,
|
|
486
|
-
|
|
487
|
-
l1Timestamp,
|
|
485
|
+
syncedL2Slot,
|
|
488
486
|
});
|
|
489
487
|
return undefined;
|
|
490
488
|
}
|
|
@@ -524,7 +522,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
524
522
|
checkpointNumber: CheckpointNumber.ZERO,
|
|
525
523
|
blockNumber: BlockNumber.ZERO,
|
|
526
524
|
archive,
|
|
527
|
-
|
|
525
|
+
syncedL2Slot,
|
|
528
526
|
pendingChainValidationStatus,
|
|
529
527
|
};
|
|
530
528
|
}
|
|
@@ -541,7 +539,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
541
539
|
blockNumber: blockData.header.getBlockNumber(),
|
|
542
540
|
checkpointNumber: blockData.checkpointNumber,
|
|
543
541
|
archive: blockData.archive.root,
|
|
544
|
-
|
|
542
|
+
syncedL2Slot,
|
|
545
543
|
pendingChainValidationStatus,
|
|
546
544
|
};
|
|
547
545
|
}
|
|
@@ -720,7 +718,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
720
718
|
syncedTo: SequencerSyncCheckResult,
|
|
721
719
|
currentSlot: SlotNumber,
|
|
722
720
|
): Promise<void> {
|
|
723
|
-
const { pendingChainValidationStatus,
|
|
721
|
+
const { pendingChainValidationStatus, syncedL2Slot } = syncedTo;
|
|
724
722
|
if (pendingChainValidationStatus.valid) {
|
|
725
723
|
return;
|
|
726
724
|
}
|
|
@@ -735,7 +733,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
735
733
|
|
|
736
734
|
const logData = {
|
|
737
735
|
invalidL1Timestamp: invalidCheckpointTimestamp,
|
|
738
|
-
|
|
736
|
+
syncedL2Slot,
|
|
739
737
|
invalidCheckpoint: pendingChainValidationStatus.checkpoint,
|
|
740
738
|
secondsBeforeInvalidatingBlockAsCommitteeMember,
|
|
741
739
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember,
|
|
@@ -882,6 +880,6 @@ type SequencerSyncCheckResult = {
|
|
|
882
880
|
checkpointNumber: CheckpointNumber;
|
|
883
881
|
blockNumber: BlockNumber;
|
|
884
882
|
archive: Fr;
|
|
885
|
-
|
|
883
|
+
syncedL2Slot: SlotNumber;
|
|
886
884
|
pendingChainValidationStatus: ValidateCheckpointResult;
|
|
887
885
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
2
2
|
import {
|
|
3
3
|
CHECKPOINT_ASSEMBLE_TIME,
|
|
4
4
|
CHECKPOINT_INITIALIZATION_TIME,
|
|
@@ -80,7 +80,7 @@ export class SequencerTimetable {
|
|
|
80
80
|
enforce: boolean;
|
|
81
81
|
},
|
|
82
82
|
private readonly metrics?: SequencerMetrics,
|
|
83
|
-
private readonly log
|
|
83
|
+
private readonly log?: Logger,
|
|
84
84
|
) {
|
|
85
85
|
this.ethereumSlotDuration = opts.ethereumSlotDuration;
|
|
86
86
|
this.aztecSlotDuration = opts.aztecSlotDuration;
|
|
@@ -132,7 +132,7 @@ export class SequencerTimetable {
|
|
|
132
132
|
const initializeDeadline = this.aztecSlotDuration - minWorkToDo;
|
|
133
133
|
this.initializeDeadline = initializeDeadline;
|
|
134
134
|
|
|
135
|
-
this.log
|
|
135
|
+
this.log?.info(
|
|
136
136
|
`Sequencer timetable initialized with ${this.maxNumberOfBlocks} blocks per slot (${this.enforce ? 'enforced' : 'not enforced'})`,
|
|
137
137
|
{
|
|
138
138
|
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
@@ -206,7 +206,7 @@ export class SequencerTimetable {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
this.metrics?.recordStateTransitionBufferMs(Math.floor(bufferSeconds * 1000), newState);
|
|
209
|
-
this.log
|
|
209
|
+
this.log?.trace(`Enough time to transition to ${newState}`, { maxAllowedTime, secondsIntoSlot });
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
/**
|
|
@@ -242,7 +242,7 @@ export class SequencerTimetable {
|
|
|
242
242
|
const canStart = available >= this.minExecutionTime;
|
|
243
243
|
const deadline = secondsIntoSlot + available;
|
|
244
244
|
|
|
245
|
-
this.log
|
|
245
|
+
this.log?.verbose(
|
|
246
246
|
`${canStart ? 'Can' : 'Cannot'} start single-block checkpoint at ${secondsIntoSlot}s into slot`,
|
|
247
247
|
{ secondsIntoSlot, maxAllowed, available, deadline },
|
|
248
248
|
);
|
|
@@ -262,7 +262,7 @@ export class SequencerTimetable {
|
|
|
262
262
|
// Found an available sub-slot! Is this the last one?
|
|
263
263
|
const isLastBlock = subSlot === this.maxNumberOfBlocks;
|
|
264
264
|
|
|
265
|
-
this.log
|
|
265
|
+
this.log?.verbose(
|
|
266
266
|
`Can start ${isLastBlock ? 'last block' : 'block'} in sub-slot ${subSlot} with deadline ${deadline}s`,
|
|
267
267
|
{ secondsIntoSlot, deadline, timeUntilDeadline, subSlot, maxBlocks: this.maxNumberOfBlocks },
|
|
268
268
|
);
|
|
@@ -272,7 +272,7 @@ export class SequencerTimetable {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
// No sub-slots available with enough time
|
|
275
|
-
this.log
|
|
275
|
+
this.log?.verbose(`No time left to start any more blocks`, {
|
|
276
276
|
secondsIntoSlot,
|
|
277
277
|
maxBlocks: this.maxNumberOfBlocks,
|
|
278
278
|
initializationOffset: this.initializationOffset,
|
package/src/sequencer/types.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
|
2
2
|
|
|
3
3
|
export type SequencerRollupConstants = Pick<
|
|
4
4
|
L1RollupConstants,
|
|
5
|
-
'ethereumSlotDuration' | 'l1GenesisTime' | 'slotDuration'
|
|
5
|
+
'ethereumSlotDuration' | 'l1GenesisTime' | 'slotDuration' | 'rollupManaLimit'
|
|
6
6
|
>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import { type BlockNumber, CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { unfreeze } from '@aztec/foundation/types';
|
|
3
4
|
import { L2Block } from '@aztec/stdlib/block';
|
|
4
5
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
5
|
-
import { Gas } from '@aztec/stdlib/gas';
|
|
6
6
|
import type {
|
|
7
7
|
FullNodeBlockBuilderConfig,
|
|
8
8
|
ICheckpointBlockBuilder,
|
|
@@ -32,7 +32,7 @@ export class MockCheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
32
32
|
public buildBlockCalls: Array<{
|
|
33
33
|
blockNumber: BlockNumber;
|
|
34
34
|
timestamp: bigint;
|
|
35
|
-
opts: PublicProcessorLimits;
|
|
35
|
+
opts: PublicProcessorLimits & { minValidTxs?: number };
|
|
36
36
|
}> = [];
|
|
37
37
|
/** Track all consumed transaction hashes across buildBlock calls */
|
|
38
38
|
public consumedTxHashes: Set<string> = new Set();
|
|
@@ -74,7 +74,7 @@ export class MockCheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
74
74
|
pendingTxs: Iterable<Tx> | AsyncIterable<Tx>,
|
|
75
75
|
blockNumber: BlockNumber,
|
|
76
76
|
timestamp: bigint,
|
|
77
|
-
opts: PublicProcessorLimits,
|
|
77
|
+
opts: PublicProcessorLimits & { minValidTxs?: number },
|
|
78
78
|
): Promise<BuildBlockInCheckpointResult> {
|
|
79
79
|
this.buildBlockCalls.push({ blockNumber, timestamp, opts });
|
|
80
80
|
|
|
@@ -86,8 +86,10 @@ export class MockCheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
86
86
|
let usedTxs: Tx[];
|
|
87
87
|
|
|
88
88
|
if (this.blockProvider) {
|
|
89
|
-
// Dynamic mode: get block from provider
|
|
90
|
-
block = this.blockProvider();
|
|
89
|
+
// Dynamic mode: get block from provider, cloning to avoid shared references across multiple buildBlock calls
|
|
90
|
+
block = L2Block.fromBuffer(this.blockProvider().toBuffer());
|
|
91
|
+
block.header.globalVariables.blockNumber = blockNumber;
|
|
92
|
+
await block.header.recomputeHash();
|
|
91
93
|
usedTxs = [];
|
|
92
94
|
this.builtBlocks.push(block);
|
|
93
95
|
} else {
|
|
@@ -113,81 +115,79 @@ export class MockCheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
113
115
|
|
|
114
116
|
return {
|
|
115
117
|
block,
|
|
116
|
-
publicGas: Gas.empty(),
|
|
117
118
|
publicProcessorDuration: 0,
|
|
118
119
|
numTxs: block?.body?.txEffects?.length ?? usedTxs.length,
|
|
119
120
|
usedTxs,
|
|
120
121
|
failedTxs: [],
|
|
121
|
-
usedTxBlobFields: block?.body?.txEffects?.reduce((sum, tx) => sum + tx.getNumBlobFields(), 0) ?? 0,
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
completeCheckpoint(): Promise<Checkpoint> {
|
|
126
126
|
this.completeCheckpointCalled = true;
|
|
127
127
|
const allBlocks = this.blockProvider ? this.builtBlocks : this.blocks;
|
|
128
|
-
|
|
129
|
-
// Create a CheckpointHeader from the last block's header for testing
|
|
130
|
-
const checkpointHeader = this.createCheckpointHeader(lastBlock);
|
|
131
|
-
return Promise.resolve(
|
|
132
|
-
new Checkpoint(
|
|
133
|
-
makeAppendOnlyTreeSnapshot(lastBlock.header.globalVariables.blockNumber + 1),
|
|
134
|
-
checkpointHeader,
|
|
135
|
-
allBlocks,
|
|
136
|
-
this.checkpointNumber,
|
|
137
|
-
),
|
|
138
|
-
);
|
|
128
|
+
return this.buildCheckpoint(allBlocks);
|
|
139
129
|
}
|
|
140
130
|
|
|
141
131
|
getCheckpoint(): Promise<Checkpoint> {
|
|
142
132
|
this.getCheckpointCalled = true;
|
|
143
133
|
const builtBlocks = this.blockProvider ? this.builtBlocks : this.blocks.slice(0, this.blockIndex);
|
|
144
|
-
|
|
145
|
-
if (!lastBlock) {
|
|
134
|
+
if (builtBlocks.length === 0) {
|
|
146
135
|
throw new Error('No blocks built yet');
|
|
147
136
|
}
|
|
148
|
-
|
|
149
|
-
const checkpointHeader = this.createCheckpointHeader(lastBlock);
|
|
150
|
-
return Promise.resolve(
|
|
151
|
-
new Checkpoint(
|
|
152
|
-
makeAppendOnlyTreeSnapshot(lastBlock.header.globalVariables.blockNumber + 1),
|
|
153
|
-
checkpointHeader,
|
|
154
|
-
builtBlocks,
|
|
155
|
-
this.checkpointNumber,
|
|
156
|
-
),
|
|
157
|
-
);
|
|
137
|
+
return this.buildCheckpoint(builtBlocks);
|
|
158
138
|
}
|
|
159
139
|
|
|
160
|
-
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
140
|
+
/** Builds a structurally valid Checkpoint from a list of blocks, fixing up indexes and archive chaining. */
|
|
141
|
+
private async buildCheckpoint(blocks: L2Block[]): Promise<Checkpoint> {
|
|
142
|
+
// Fix up indexWithinCheckpoint and archive chaining so the checkpoint passes structural validation.
|
|
143
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
144
|
+
blocks[i].indexWithinCheckpoint = IndexWithinCheckpoint(i);
|
|
145
|
+
if (i > 0) {
|
|
146
|
+
unfreeze(blocks[i].header).lastArchive = blocks[i - 1].archive;
|
|
147
|
+
await blocks[i].header.recomputeHash();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const firstBlock = blocks[0];
|
|
152
|
+
const lastBlock = blocks[blocks.length - 1];
|
|
153
|
+
const gv = firstBlock.header.globalVariables;
|
|
154
|
+
|
|
155
|
+
const checkpointHeader = CheckpointHeader.empty({
|
|
156
|
+
lastArchiveRoot: firstBlock.header.lastArchive.root,
|
|
157
|
+
blockHeadersHash: Fr.random(),
|
|
170
158
|
slotNumber: gv.slotNumber,
|
|
171
159
|
timestamp: gv.timestamp,
|
|
172
160
|
coinbase: gv.coinbase,
|
|
173
161
|
feeRecipient: gv.feeRecipient,
|
|
174
162
|
gasFees: gv.gasFees,
|
|
175
|
-
totalManaUsed: header.totalManaUsed,
|
|
163
|
+
totalManaUsed: lastBlock.header.totalManaUsed,
|
|
176
164
|
});
|
|
165
|
+
|
|
166
|
+
return new Checkpoint(
|
|
167
|
+
makeAppendOnlyTreeSnapshot(lastBlock.header.globalVariables.blockNumber + 1),
|
|
168
|
+
checkpointHeader,
|
|
169
|
+
blocks,
|
|
170
|
+
this.checkpointNumber,
|
|
171
|
+
);
|
|
177
172
|
}
|
|
178
173
|
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
this.blocks = [];
|
|
174
|
+
/** Resets per-checkpoint state (built blocks, consumed txs) while preserving config (blockProvider, seeded blocks). */
|
|
175
|
+
resetCheckpointState(): void {
|
|
182
176
|
this.builtBlocks = [];
|
|
183
|
-
this.usedTxsPerBlock = [];
|
|
184
177
|
this.blockIndex = 0;
|
|
185
|
-
this.buildBlockCalls = [];
|
|
186
178
|
this.consumedTxHashes.clear();
|
|
187
179
|
this.completeCheckpointCalled = false;
|
|
188
180
|
this.getCheckpointCalled = false;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** Reset for reuse in another test */
|
|
184
|
+
reset(): void {
|
|
185
|
+
this.blocks = [];
|
|
186
|
+
this.usedTxsPerBlock = [];
|
|
187
|
+
this.buildBlockCalls = [];
|
|
189
188
|
this.errorOnBuild = undefined;
|
|
190
189
|
this.blockProvider = undefined;
|
|
190
|
+
this.resetCheckpointState();
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -249,6 +249,7 @@ export class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
249
249
|
slotDuration: 24,
|
|
250
250
|
l1ChainId: 1,
|
|
251
251
|
rollupVersion: 1,
|
|
252
|
+
rollupManaLimit: 200_000_000,
|
|
252
253
|
};
|
|
253
254
|
}
|
|
254
255
|
|
|
@@ -275,6 +276,8 @@ export class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
275
276
|
if (!this.checkpointBuilder) {
|
|
276
277
|
// Auto-create a builder if none was set
|
|
277
278
|
this.checkpointBuilder = new MockCheckpointBuilder(constants, checkpointNumber);
|
|
279
|
+
} else {
|
|
280
|
+
this.checkpointBuilder.resetCheckpointState();
|
|
278
281
|
}
|
|
279
282
|
|
|
280
283
|
return Promise.resolve(this.checkpointBuilder);
|
|
@@ -301,6 +304,8 @@ export class MockCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
301
304
|
if (!this.checkpointBuilder) {
|
|
302
305
|
// Auto-create a builder if none was set
|
|
303
306
|
this.checkpointBuilder = new MockCheckpointBuilder(constants, checkpointNumber);
|
|
307
|
+
} else {
|
|
308
|
+
this.checkpointBuilder.resetCheckpointState();
|
|
304
309
|
}
|
|
305
310
|
|
|
306
311
|
return Promise.resolve(this.checkpointBuilder);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type Logger } from '@aztec/foundation/log';
|
|
2
|
-
import type { L1TxFailedStore } from './failed_tx_store.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates an L1TxFailedStore from a config string.
|
|
5
|
-
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
6
|
-
* @param config - Config string (e.g., 'gs://bucket/path', 's3://bucket/path', 'file:///path'). If undefined, returns undefined.
|
|
7
|
-
* @param logger - Optional logger.
|
|
8
|
-
* @returns The store instance, or undefined if config is not provided.
|
|
9
|
-
*/
|
|
10
|
-
export declare function createL1TxFailedStore(config: string | undefined, logger?: Logger): Promise<L1TxFailedStore | undefined>;
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3B1Ymxpc2hlci9sMV90eF9mYWlsZWRfc3RvcmUvZmFjdG9yeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFHbEUsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFHNUQ7Ozs7OztHQU1HO0FBQ0gsd0JBQXNCLHFCQUFxQixDQUN6QyxNQUFNLEVBQUUsTUFBTSxHQUFHLFNBQVMsRUFDMUIsTUFBTSxHQUFFLE1BQXFELEdBQzVELE9BQU8sQ0FBQyxlQUFlLEdBQUcsU0FBUyxDQUFDLENBZXRDIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/publisher/l1_tx_failed_store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,GAAE,MAAqD,GAC5D,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAetC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { createFileStore } from '@aztec/stdlib/file-store';
|
|
3
|
-
import { FileStoreL1TxFailedStore } from './file_store_failed_tx_store.js';
|
|
4
|
-
/**
|
|
5
|
-
* Creates an L1TxFailedStore from a config string.
|
|
6
|
-
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
7
|
-
* @param config - Config string (e.g., 'gs://bucket/path', 's3://bucket/path', 'file:///path'). If undefined, returns undefined.
|
|
8
|
-
* @param logger - Optional logger.
|
|
9
|
-
* @returns The store instance, or undefined if config is not provided.
|
|
10
|
-
*/ export async function createL1TxFailedStore(config, logger = createLogger('sequencer:l1-tx-failed-store')) {
|
|
11
|
-
if (!config) {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
const fileStore = await createFileStore(config, logger);
|
|
15
|
-
if (!fileStore) {
|
|
16
|
-
throw new Error(`Failed to create file store from config: '${config}'. ` + `Supported formats: 'gs://bucket/path', 's3://bucket/path', 'file:///path'.`);
|
|
17
|
-
}
|
|
18
|
-
logger.info(`Created L1 tx failed store`, {
|
|
19
|
-
config
|
|
20
|
-
});
|
|
21
|
-
return new FileStoreL1TxFailedStore(fileStore, logger);
|
|
22
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { Hex } from 'viem';
|
|
2
|
-
/** URI pointing to a stored failed L1 transaction. */
|
|
3
|
-
export type FailedL1TxUri = string & {
|
|
4
|
-
__brand: 'FailedL1TxUri';
|
|
5
|
-
};
|
|
6
|
-
/** A failed L1 transaction captured for debugging and replay. */
|
|
7
|
-
export type FailedL1Tx = {
|
|
8
|
-
/** Tx hash (for reverts) or keccak256(request.data) (for simulation/send failures). */
|
|
9
|
-
id: Hex;
|
|
10
|
-
/** Unix timestamp (ms) when failure occurred. */
|
|
11
|
-
timestamp: number;
|
|
12
|
-
/** Whether the failure was during simulation or after sending. */
|
|
13
|
-
failureType: 'simulation' | 'revert' | 'send-error';
|
|
14
|
-
/** The actual L1 transaction for replay (multicall-encoded for bundled txs). */
|
|
15
|
-
request: {
|
|
16
|
-
to: Hex;
|
|
17
|
-
data: Hex;
|
|
18
|
-
value?: string;
|
|
19
|
-
};
|
|
20
|
-
/** Raw blob data as hex for replay. */
|
|
21
|
-
blobData?: Hex[];
|
|
22
|
-
/** L1 block number at time of failure (simulation target or receipt block). */
|
|
23
|
-
l1BlockNumber: string;
|
|
24
|
-
/** Receipt info (present only for on-chain reverts). */
|
|
25
|
-
receipt?: {
|
|
26
|
-
transactionHash: Hex;
|
|
27
|
-
blockNumber: string;
|
|
28
|
-
gasUsed: string;
|
|
29
|
-
status: 'reverted';
|
|
30
|
-
};
|
|
31
|
-
/** Error information. */
|
|
32
|
-
error: {
|
|
33
|
-
message: string;
|
|
34
|
-
/** Decoded error name (e.g., 'Rollup__InvalidProposer'). */
|
|
35
|
-
name?: string;
|
|
36
|
-
};
|
|
37
|
-
/** Context metadata. */
|
|
38
|
-
context: {
|
|
39
|
-
/** Actions involved (e.g., ['propose', 'governance-signal']). */
|
|
40
|
-
actions: string[];
|
|
41
|
-
/** Individual request data for each action (metadata, not used for replay). */
|
|
42
|
-
requests?: Array<{
|
|
43
|
-
action: string;
|
|
44
|
-
to: Hex;
|
|
45
|
-
data: Hex;
|
|
46
|
-
}>;
|
|
47
|
-
checkpointNumber?: number;
|
|
48
|
-
slot?: number;
|
|
49
|
-
sender: Hex;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
/** Store for failed L1 transactions for debugging purposes. */
|
|
53
|
-
export interface L1TxFailedStore {
|
|
54
|
-
/** Saves a failed transaction and returns its URI. */
|
|
55
|
-
saveFailedTx(tx: FailedL1Tx): Promise<FailedL1TxUri>;
|
|
56
|
-
/** Retrieves a failed transaction by its URI. */
|
|
57
|
-
getFailedTx(uri: FailedL1TxUri): Promise<FailedL1Tx>;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFpbGVkX3R4X3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGlzaGVyL2wxX3R4X2ZhaWxlZF9zdG9yZS9mYWlsZWRfdHhfc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsR0FBRyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBRWhDLHNEQUFzRDtBQUN0RCxNQUFNLE1BQU0sYUFBYSxHQUFHLE1BQU0sR0FBRztJQUFFLE9BQU8sRUFBRSxlQUFlLENBQUE7Q0FBRSxDQUFDO0FBRWxFLGlFQUFpRTtBQUNqRSxNQUFNLE1BQU0sVUFBVSxHQUFHO0lBQ3ZCLHVGQUF1RjtJQUN2RixFQUFFLEVBQUUsR0FBRyxDQUFDO0lBQ1IsaURBQWlEO0lBQ2pELFNBQVMsRUFBRSxNQUFNLENBQU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AAM,CAAC;QAChB,MAAM,EAAE,UAAU,CAAC;KACpB,CAAC;IACF,yBAAyB;IACzB,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,4DAA4D;QAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,wBAAwB;IACxB,OAAO,EAAE;QACP,iEAAiE;QACjE,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,+EAA+E;QAC/E,QAAQ,CAAC,EAAE,KAAK,CAAC;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,GAAG,CAAC;YAAC,IAAI,EAAE,GAAG,CAAA;SAAE,CAAC,CAAC;QACzD,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,GAAG,CAAC;KACb,CAAC;CACH,CAAC;AAEF,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACrD,iDAAiD;IACjD,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/** Store for failed L1 transactions for debugging purposes. */ export { };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type Logger } from '@aztec/foundation/log';
|
|
2
|
-
import type { FileStore } from '@aztec/stdlib/file-store';
|
|
3
|
-
import type { FailedL1Tx, FailedL1TxUri, L1TxFailedStore } from './failed_tx_store.js';
|
|
4
|
-
/**
|
|
5
|
-
* L1TxFailedStore implementation using the FileStore abstraction.
|
|
6
|
-
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
7
|
-
*/
|
|
8
|
-
export declare class FileStoreL1TxFailedStore implements L1TxFailedStore {
|
|
9
|
-
private readonly fileStore;
|
|
10
|
-
private readonly log;
|
|
11
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0 @@
|
|
|
1
|
-
{"version":3,"file":"file_store_failed_tx_store.d.ts","sourceRoot":"","sources":["../../../src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvF;;;GAGG;AACH,qBAAa,wBAAyB,YAAW,eAAe;IAI5D,OAAO,CAAC,QAAQ,CAAC,SAAS;IAH5B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAE7B,YACmB,SAAS,EAAE,SAAS,EACrC,MAAM,CAAC,EAAE,MAAM,EAGhB;IAEY,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAoBhE;IAEY,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAGhE;CACF"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
/**
|
|
3
|
-
* L1TxFailedStore implementation using the FileStore abstraction.
|
|
4
|
-
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
5
|
-
*/ export class FileStoreL1TxFailedStore {
|
|
6
|
-
fileStore;
|
|
7
|
-
log;
|
|
8
|
-
constructor(fileStore, logger){
|
|
9
|
-
this.fileStore = fileStore;
|
|
10
|
-
this.log = logger ?? createLogger('sequencer:l1-tx-failed-store');
|
|
11
|
-
}
|
|
12
|
-
async saveFailedTx(tx) {
|
|
13
|
-
const prefix = tx.receipt ? 'tx' : 'data';
|
|
14
|
-
const path = `${tx.failureType}/${prefix}-${tx.id}.json`;
|
|
15
|
-
const json = JSON.stringify(tx, null, 2);
|
|
16
|
-
const uri = await this.fileStore.save(path, Buffer.from(json), {
|
|
17
|
-
metadata: {
|
|
18
|
-
'content-type': 'application/json',
|
|
19
|
-
actions: tx.context.actions.join(','),
|
|
20
|
-
'failure-type': tx.failureType
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
this.log.info(`Saved failed L1 tx to ${uri}`, {
|
|
24
|
-
id: tx.id,
|
|
25
|
-
failureType: tx.failureType,
|
|
26
|
-
actions: tx.context.actions.join(',')
|
|
27
|
-
});
|
|
28
|
-
return uri;
|
|
29
|
-
}
|
|
30
|
-
async getFailedTx(uri) {
|
|
31
|
-
const data = await this.fileStore.read(uri);
|
|
32
|
-
return JSON.parse(data.toString());
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { type FailedL1Tx, type FailedL1TxUri, type L1TxFailedStore } from './failed_tx_store.js';
|
|
2
|
-
export { createL1TxFailedStore } from './factory.js';
|
|
3
|
-
export { FileStoreL1TxFailedStore } from './file_store_failed_tx_store.js';
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaXNoZXIvbDFfdHhfZmFpbGVkX3N0b3JlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLFVBQVUsRUFBRSxLQUFLLGFBQWEsRUFBRSxLQUFLLGVBQWUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ2pHLE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUNyRCxPQUFPLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQyJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/publisher/l1_tx_failed_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { createFileStore } from '@aztec/stdlib/file-store';
|
|
3
|
-
|
|
4
|
-
import type { L1TxFailedStore } from './failed_tx_store.js';
|
|
5
|
-
import { FileStoreL1TxFailedStore } from './file_store_failed_tx_store.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Creates an L1TxFailedStore from a config string.
|
|
9
|
-
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
10
|
-
* @param config - Config string (e.g., 'gs://bucket/path', 's3://bucket/path', 'file:///path'). If undefined, returns undefined.
|
|
11
|
-
* @param logger - Optional logger.
|
|
12
|
-
* @returns The store instance, or undefined if config is not provided.
|
|
13
|
-
*/
|
|
14
|
-
export async function createL1TxFailedStore(
|
|
15
|
-
config: string | undefined,
|
|
16
|
-
logger: Logger = createLogger('sequencer:l1-tx-failed-store'),
|
|
17
|
-
): Promise<L1TxFailedStore | undefined> {
|
|
18
|
-
if (!config) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const fileStore = await createFileStore(config, logger);
|
|
23
|
-
if (!fileStore) {
|
|
24
|
-
throw new Error(
|
|
25
|
-
`Failed to create file store from config: '${config}'. ` +
|
|
26
|
-
`Supported formats: 'gs://bucket/path', 's3://bucket/path', 'file:///path'.`,
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
logger.info(`Created L1 tx failed store`, { config });
|
|
31
|
-
return new FileStoreL1TxFailedStore(fileStore, logger);
|
|
32
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { Hex } from 'viem';
|
|
2
|
-
|
|
3
|
-
/** URI pointing to a stored failed L1 transaction. */
|
|
4
|
-
export type FailedL1TxUri = string & { __brand: 'FailedL1TxUri' };
|
|
5
|
-
|
|
6
|
-
/** A failed L1 transaction captured for debugging and replay. */
|
|
7
|
-
export type FailedL1Tx = {
|
|
8
|
-
/** Tx hash (for reverts) or keccak256(request.data) (for simulation/send failures). */
|
|
9
|
-
id: Hex;
|
|
10
|
-
/** Unix timestamp (ms) when failure occurred. */
|
|
11
|
-
timestamp: number;
|
|
12
|
-
/** Whether the failure was during simulation or after sending. */
|
|
13
|
-
failureType: 'simulation' | 'revert' | 'send-error';
|
|
14
|
-
/** The actual L1 transaction for replay (multicall-encoded for bundled txs). */
|
|
15
|
-
request: {
|
|
16
|
-
to: Hex;
|
|
17
|
-
data: Hex;
|
|
18
|
-
value?: string; // bigint as string
|
|
19
|
-
};
|
|
20
|
-
/** Raw blob data as hex for replay. */
|
|
21
|
-
blobData?: Hex[];
|
|
22
|
-
/** L1 block number at time of failure (simulation target or receipt block). */
|
|
23
|
-
l1BlockNumber: string; // bigint as string
|
|
24
|
-
/** Receipt info (present only for on-chain reverts). */
|
|
25
|
-
receipt?: {
|
|
26
|
-
transactionHash: Hex;
|
|
27
|
-
blockNumber: string; // bigint as string
|
|
28
|
-
gasUsed: string; // bigint as string
|
|
29
|
-
status: 'reverted';
|
|
30
|
-
};
|
|
31
|
-
/** Error information. */
|
|
32
|
-
error: {
|
|
33
|
-
message: string;
|
|
34
|
-
/** Decoded error name (e.g., 'Rollup__InvalidProposer'). */
|
|
35
|
-
name?: string;
|
|
36
|
-
};
|
|
37
|
-
/** Context metadata. */
|
|
38
|
-
context: {
|
|
39
|
-
/** Actions involved (e.g., ['propose', 'governance-signal']). */
|
|
40
|
-
actions: string[];
|
|
41
|
-
/** Individual request data for each action (metadata, not used for replay). */
|
|
42
|
-
requests?: Array<{ action: string; to: Hex; data: Hex }>;
|
|
43
|
-
checkpointNumber?: number;
|
|
44
|
-
slot?: number;
|
|
45
|
-
sender: Hex;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/** Store for failed L1 transactions for debugging purposes. */
|
|
50
|
-
export interface L1TxFailedStore {
|
|
51
|
-
/** Saves a failed transaction and returns its URI. */
|
|
52
|
-
saveFailedTx(tx: FailedL1Tx): Promise<FailedL1TxUri>;
|
|
53
|
-
/** Retrieves a failed transaction by its URI. */
|
|
54
|
-
getFailedTx(uri: FailedL1TxUri): Promise<FailedL1Tx>;
|
|
55
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import type { FileStore } from '@aztec/stdlib/file-store';
|
|
3
|
-
|
|
4
|
-
import type { FailedL1Tx, FailedL1TxUri, L1TxFailedStore } from './failed_tx_store.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* L1TxFailedStore implementation using the FileStore abstraction.
|
|
8
|
-
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
9
|
-
*/
|
|
10
|
-
export class FileStoreL1TxFailedStore implements L1TxFailedStore {
|
|
11
|
-
private readonly log: Logger;
|
|
12
|
-
|
|
13
|
-
constructor(
|
|
14
|
-
private readonly fileStore: FileStore,
|
|
15
|
-
logger?: Logger,
|
|
16
|
-
) {
|
|
17
|
-
this.log = logger ?? createLogger('sequencer:l1-tx-failed-store');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public async saveFailedTx(tx: FailedL1Tx): Promise<FailedL1TxUri> {
|
|
21
|
-
const prefix = tx.receipt ? 'tx' : 'data';
|
|
22
|
-
const path = `${tx.failureType}/${prefix}-${tx.id}.json`;
|
|
23
|
-
const json = JSON.stringify(tx, null, 2);
|
|
24
|
-
|
|
25
|
-
const uri = await this.fileStore.save(path, Buffer.from(json), {
|
|
26
|
-
metadata: {
|
|
27
|
-
'content-type': 'application/json',
|
|
28
|
-
actions: tx.context.actions.join(','),
|
|
29
|
-
'failure-type': tx.failureType,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
this.log.info(`Saved failed L1 tx to ${uri}`, {
|
|
34
|
-
id: tx.id,
|
|
35
|
-
failureType: tx.failureType,
|
|
36
|
-
actions: tx.context.actions.join(','),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
return uri as FailedL1TxUri;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public async getFailedTx(uri: FailedL1TxUri): Promise<FailedL1Tx> {
|
|
43
|
-
const data = await this.fileStore.read(uri);
|
|
44
|
-
return JSON.parse(data.toString()) as FailedL1Tx;
|
|
45
|
-
}
|
|
46
|
-
}
|