@aztec/sequencer-client 0.0.1-commit.4eabbdb → 0.0.1-commit.5358163d3
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/config.d.ts +2 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +13 -8
- package/dest/publisher/config.d.ts +5 -1
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +6 -1
- 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 +1 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +14 -0
- package/dest/publisher/sequencer-publisher.d.ts +12 -2
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +258 -9
- package/dest/sequencer/checkpoint_proposal_job.d.ts +1 -1
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +40 -15
- package/dest/sequencer/sequencer.d.ts +8 -2
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +6 -1
- package/dest/sequencer/timetable.js +1 -1
- package/package.json +28 -28
- package/src/config.ts +14 -8
- package/src/publisher/config.ts +9 -0
- 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 +15 -0
- package/src/publisher/sequencer-publisher.ts +237 -15
- package/src/sequencer/checkpoint_proposal_job.ts +58 -11
- package/src/sequencer/sequencer.ts +8 -1
- package/src/sequencer/timetable.ts +1 -1
|
@@ -81,7 +81,7 @@ export class SequencerTimetable {
|
|
|
81
81
|
this.checkpointFinalizationTime;
|
|
82
82
|
const initializeDeadline = this.aztecSlotDuration - minWorkToDo;
|
|
83
83
|
this.initializeDeadline = initializeDeadline;
|
|
84
|
-
this.log.
|
|
84
|
+
this.log.info(`Sequencer timetable initialized with ${this.maxNumberOfBlocks} blocks per slot (${this.enforce ? 'enforced' : 'not enforced'})`, {
|
|
85
85
|
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
86
86
|
aztecSlotDuration: this.aztecSlotDuration,
|
|
87
87
|
l1PublishingTime: this.l1PublishingTime,
|
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.5358163d3",
|
|
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.5358163d3",
|
|
30
|
+
"@aztec/bb-prover": "0.0.1-commit.5358163d3",
|
|
31
|
+
"@aztec/blob-client": "0.0.1-commit.5358163d3",
|
|
32
|
+
"@aztec/blob-lib": "0.0.1-commit.5358163d3",
|
|
33
|
+
"@aztec/constants": "0.0.1-commit.5358163d3",
|
|
34
|
+
"@aztec/epoch-cache": "0.0.1-commit.5358163d3",
|
|
35
|
+
"@aztec/ethereum": "0.0.1-commit.5358163d3",
|
|
36
|
+
"@aztec/foundation": "0.0.1-commit.5358163d3",
|
|
37
|
+
"@aztec/l1-artifacts": "0.0.1-commit.5358163d3",
|
|
38
|
+
"@aztec/merkle-tree": "0.0.1-commit.5358163d3",
|
|
39
|
+
"@aztec/node-keystore": "0.0.1-commit.5358163d3",
|
|
40
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.5358163d3",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.5358163d3",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.5358163d3",
|
|
43
|
+
"@aztec/noir-types": "0.0.1-commit.5358163d3",
|
|
44
|
+
"@aztec/p2p": "0.0.1-commit.5358163d3",
|
|
45
|
+
"@aztec/protocol-contracts": "0.0.1-commit.5358163d3",
|
|
46
|
+
"@aztec/prover-client": "0.0.1-commit.5358163d3",
|
|
47
|
+
"@aztec/simulator": "0.0.1-commit.5358163d3",
|
|
48
|
+
"@aztec/slasher": "0.0.1-commit.5358163d3",
|
|
49
|
+
"@aztec/stdlib": "0.0.1-commit.5358163d3",
|
|
50
|
+
"@aztec/telemetry-client": "0.0.1-commit.5358163d3",
|
|
51
|
+
"@aztec/validator-client": "0.0.1-commit.5358163d3",
|
|
52
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.5358163d3",
|
|
53
|
+
"@aztec/world-state": "0.0.1-commit.5358163d3",
|
|
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.5358163d3",
|
|
60
|
+
"@aztec/kv-store": "0.0.1-commit.5358163d3",
|
|
61
61
|
"@electric-sql/pglite": "^0.3.14",
|
|
62
62
|
"@jest/globals": "^30.0.0",
|
|
63
63
|
"@types/jest": "^30.0.0",
|
package/src/config.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
|
13
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
14
|
import {
|
|
15
15
|
type ChainConfig,
|
|
16
|
+
DEFAULT_MAX_TXS_PER_BLOCK,
|
|
16
17
|
type SequencerConfig,
|
|
17
18
|
chainConfigMappings,
|
|
18
19
|
sharedSequencerConfigMappings,
|
|
@@ -37,7 +38,7 @@ export type { SequencerConfig };
|
|
|
37
38
|
*/
|
|
38
39
|
export const DefaultSequencerConfig: ResolvedSequencerConfig = {
|
|
39
40
|
sequencerPollingIntervalMS: 500,
|
|
40
|
-
maxTxsPerBlock:
|
|
41
|
+
maxTxsPerBlock: DEFAULT_MAX_TXS_PER_BLOCK,
|
|
41
42
|
minTxsPerBlock: 1,
|
|
42
43
|
buildCheckpointIfEmpty: false,
|
|
43
44
|
publishTxsWithProposals: false,
|
|
@@ -52,6 +53,8 @@ export const DefaultSequencerConfig: ResolvedSequencerConfig = {
|
|
|
52
53
|
skipInvalidateBlockAsProposer: false,
|
|
53
54
|
broadcastInvalidBlockProposal: false,
|
|
54
55
|
injectFakeAttestation: false,
|
|
56
|
+
injectHighSValueAttestation: false,
|
|
57
|
+
injectUnrecoverableSignatureAttestation: false,
|
|
55
58
|
fishermanMode: false,
|
|
56
59
|
shuffleAttestationOrdering: false,
|
|
57
60
|
skipPushProposedBlocksToArchiver: false,
|
|
@@ -68,7 +71,7 @@ export type SequencerClientConfig = SequencerPublisherConfig &
|
|
|
68
71
|
SequencerConfig &
|
|
69
72
|
L1ReaderConfig &
|
|
70
73
|
ChainConfig &
|
|
71
|
-
Pick<P2PConfig, '
|
|
74
|
+
Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
|
|
72
75
|
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
|
|
73
76
|
|
|
74
77
|
export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
@@ -77,11 +80,6 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
77
80
|
description: 'The number of ms to wait between polling for checking to build on the next slot.',
|
|
78
81
|
...numberConfigHelper(DefaultSequencerConfig.sequencerPollingIntervalMS),
|
|
79
82
|
},
|
|
80
|
-
maxTxsPerBlock: {
|
|
81
|
-
env: 'SEQ_MAX_TX_PER_BLOCK',
|
|
82
|
-
description: 'The maximum number of txs to include in a block.',
|
|
83
|
-
...numberConfigHelper(DefaultSequencerConfig.maxTxsPerBlock),
|
|
84
|
-
},
|
|
85
83
|
minTxsPerBlock: {
|
|
86
84
|
env: 'SEQ_MIN_TX_PER_BLOCK',
|
|
87
85
|
description: 'The minimum number of txs to include in a block.',
|
|
@@ -186,6 +184,14 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
186
184
|
description: 'Inject a fake attestation (for testing only)',
|
|
187
185
|
...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation),
|
|
188
186
|
},
|
|
187
|
+
injectHighSValueAttestation: {
|
|
188
|
+
description: 'Inject a malleable attestation with a high-s value (for testing only)',
|
|
189
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectHighSValueAttestation),
|
|
190
|
+
},
|
|
191
|
+
injectUnrecoverableSignatureAttestation: {
|
|
192
|
+
description: 'Inject an attestation with an unrecoverable signature (for testing only)',
|
|
193
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation),
|
|
194
|
+
},
|
|
189
195
|
fishermanMode: {
|
|
190
196
|
env: 'FISHERMAN_MODE',
|
|
191
197
|
description:
|
|
@@ -214,7 +220,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
214
220
|
description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
|
|
215
221
|
...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
|
|
216
222
|
},
|
|
217
|
-
...pickConfigMappings(p2pConfigMappings, ['
|
|
223
|
+
...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowListExtend']),
|
|
218
224
|
};
|
|
219
225
|
|
|
220
226
|
export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
|
package/src/publisher/config.ts
CHANGED
|
@@ -48,6 +48,8 @@ export type PublisherConfig = L1TxUtilsConfig &
|
|
|
48
48
|
fishermanMode?: boolean;
|
|
49
49
|
/** Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only) */
|
|
50
50
|
publisherForwarderAddress?: EthAddress;
|
|
51
|
+
/** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
|
|
52
|
+
l1TxFailedStore?: string;
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
export type ProverPublisherConfig = L1TxUtilsConfig &
|
|
@@ -62,6 +64,8 @@ export type SequencerPublisherConfig = L1TxUtilsConfig &
|
|
|
62
64
|
fishermanMode?: boolean;
|
|
63
65
|
sequencerPublisherAllowInvalidStates?: boolean;
|
|
64
66
|
sequencerPublisherForwarderAddress?: EthAddress;
|
|
67
|
+
/** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
|
|
68
|
+
l1TxFailedStore?: string;
|
|
65
69
|
};
|
|
66
70
|
|
|
67
71
|
export function getPublisherConfigFromProverConfig(config: ProverPublisherConfig): PublisherConfig {
|
|
@@ -77,6 +81,7 @@ export function getPublisherConfigFromSequencerConfig(config: SequencerPublisher
|
|
|
77
81
|
...config,
|
|
78
82
|
publisherAllowInvalidStates: config.sequencerPublisherAllowInvalidStates,
|
|
79
83
|
publisherForwarderAddress: config.sequencerPublisherForwarderAddress,
|
|
84
|
+
l1TxFailedStore: config.l1TxFailedStore,
|
|
80
85
|
};
|
|
81
86
|
}
|
|
82
87
|
|
|
@@ -133,6 +138,10 @@ export const sequencerPublisherConfigMappings: ConfigMappingsType<SequencerPubli
|
|
|
133
138
|
description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
|
|
134
139
|
parseEnv: (val: string) => (val ? EthAddress.fromString(val) : undefined),
|
|
135
140
|
},
|
|
141
|
+
l1TxFailedStore: {
|
|
142
|
+
env: 'L1_TX_FAILED_STORE',
|
|
143
|
+
description: 'Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path',
|
|
144
|
+
},
|
|
136
145
|
};
|
|
137
146
|
|
|
138
147
|
export const proverPublisherConfigMappings: ConfigMappingsType<ProverPublisherConfig & L1TxUtilsConfig> = {
|
package/src/publisher/index.ts
CHANGED
|
@@ -3,3 +3,6 @@ export { SequencerPublisherFactory } from './sequencer-publisher-factory.js';
|
|
|
3
3
|
|
|
4
4
|
// Used for tests
|
|
5
5
|
export { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
6
|
+
|
|
7
|
+
// Failed L1 tx store (optional, for test networks)
|
|
8
|
+
export { type FailedL1Tx, type FailedL1TxUri, type L1TxFailedStore } from './l1_tx_failed_store/index.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
}
|
|
@@ -81,8 +81,23 @@ export class SequencerPublisherFactory {
|
|
|
81
81
|
const rollup = this.deps.rollupContract;
|
|
82
82
|
const slashingProposerContract = await rollup.getSlashingProposer();
|
|
83
83
|
|
|
84
|
+
const getNextPublisher = async (excludeAddresses: EthAddress[]): Promise<L1TxUtils | undefined> => {
|
|
85
|
+
const exclusionFilter: PublisherFilter<L1TxUtils> = (utils: L1TxUtils) => {
|
|
86
|
+
if (excludeAddresses.some(addr => addr.equals(utils.getSenderAddress()))) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return filter(utils);
|
|
90
|
+
};
|
|
91
|
+
try {
|
|
92
|
+
return await this.deps.publisherManager.getAvailablePublisher(exclusionFilter);
|
|
93
|
+
} catch {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
84
98
|
const publisher = new SequencerPublisher(this.sequencerConfig, {
|
|
85
99
|
l1TxUtils: l1Publisher,
|
|
100
|
+
getNextPublisher,
|
|
86
101
|
telemetry: this.deps.telemetry,
|
|
87
102
|
blobClient: this.deps.blobClient,
|
|
88
103
|
rollupContract: this.deps.rollupContract,
|