@aztec/sequencer-client 3.0.0-nightly.20250921 → 3.0.0-nightly.20250923
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.map +1 -1
- package/dest/client/sequencer-client.js +5 -4
- package/dest/publisher/config.d.ts +3 -3
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +6 -1
- package/dest/publisher/index.d.ts +1 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/index.js +1 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts +5 -1
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +8 -1
- package/dest/publisher/sequencer-publisher.d.ts +7 -8
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +20 -19
- package/package.json +26 -26
- package/src/client/sequencer-client.ts +4 -2
- package/src/publisher/config.ts +14 -4
- package/src/publisher/index.ts +1 -1
- package/src/publisher/sequencer-publisher-factory.ts +12 -2
- package/src/publisher/sequencer-publisher.ts +31 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-client.d.ts","sourceRoot":"","sources":["../../src/client/sequencer-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAEL,gBAAgB,EAIjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EA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,eAAe,CAAC;KAC/B;IAoHH;;;OAGG;IACI,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAMhF,4BAA4B;IACf,KAAK;IAMlB;;OAEG;IACU,IAAI;IAOV,YAAY,IAAI,SAAS;IAIhC,IAAI,kBAAkB,IAAI,UAAU,EAAE,GAAG,SAAS,CAEjD;IAED,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAEtC;CACF"}
|
|
@@ -37,11 +37,11 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
37
37
|
*/ static async new(config, deps) {
|
|
38
38
|
const { validatorClient, p2pClient, worldStateSynchronizer, slasherClient, blockBuilder, l2BlockSource, l1ToL2MessageSource, telemetry: telemetryClient } = deps;
|
|
39
39
|
const { l1RpcUrls: rpcUrls, l1ChainId: chainId } = config;
|
|
40
|
-
const log = createLogger('sequencer
|
|
40
|
+
const log = createLogger('sequencer');
|
|
41
41
|
const publicClient = getPublicClient(config);
|
|
42
42
|
const l1TxUtils = deps.l1TxUtils;
|
|
43
43
|
const l1Metrics = new L1Metrics(telemetryClient.getMeter('L1PublisherMetrics'), publicClient, l1TxUtils.map((x)=>x.getSenderAddress()));
|
|
44
|
-
const publisherManager = new PublisherManager(l1TxUtils);
|
|
44
|
+
const publisherManager = new PublisherManager(l1TxUtils, config);
|
|
45
45
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
46
46
|
const [l1GenesisTime, slotDuration] = await Promise.all([
|
|
47
47
|
rollupContract.getL1GenesisTime(),
|
|
@@ -66,7 +66,8 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
66
66
|
rollupContract,
|
|
67
67
|
dateProvider: deps.dateProvider,
|
|
68
68
|
publisherManager,
|
|
69
|
-
nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore)
|
|
69
|
+
nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
|
|
70
|
+
logger: log
|
|
70
71
|
});
|
|
71
72
|
const globalsBuilder = new GlobalVariableBuilder(config);
|
|
72
73
|
const ethereumSlotDuration = config.ethereumSlotDuration;
|
|
@@ -92,7 +93,7 @@ import { Sequencer } from '../sequencer/index.js';
|
|
|
92
93
|
...config,
|
|
93
94
|
maxL1TxInclusionTimeIntoSlot,
|
|
94
95
|
maxL2BlockGas: sequencerManaLimit
|
|
95
|
-
}, telemetryClient);
|
|
96
|
+
}, telemetryClient, log);
|
|
96
97
|
await sequencer.init();
|
|
97
98
|
return new SequencerClient(publisherManager, sequencer, blockBuilder, validatorClient, l1Metrics);
|
|
98
99
|
}
|
|
@@ -19,10 +19,10 @@ export type TxSenderConfig = L1ReaderConfig & {
|
|
|
19
19
|
* Configuration of the L1Publisher.
|
|
20
20
|
*/
|
|
21
21
|
export type PublisherConfig = L1TxUtilsConfig & BlobSinkConfig & {
|
|
22
|
-
/**
|
|
23
|
-
* The interval to wait between publish retries.
|
|
24
|
-
*/
|
|
22
|
+
/** The interval to wait between publish retries. */
|
|
25
23
|
l1PublishRetryIntervalMS: number;
|
|
24
|
+
/** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
|
|
25
|
+
publisherAllowInvalidStates?: boolean;
|
|
26
26
|
};
|
|
27
27
|
export declare const getTxSenderConfigMappings: (scope: 'PROVER' | 'SEQ') => ConfigMappingsType<Omit<TxSenderConfig, 'l1Contracts'>>;
|
|
28
28
|
export declare function getTxSenderConfigFromEnv(scope: 'PROVER' | 'SEQ'): Omit<TxSenderConfig, 'l1Contracts'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/publisher/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/publisher/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C;;OAEG;IACH,oBAAoB,CAAC,EAAE,WAAW,CAAC,KAAK,MAAM,EAAE,CAAC,EAAE,CAAC;IAEpD;;OAEG;IACH,kBAAkB,CAAC,EAAE,UAAU,EAAE,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAC3C,cAAc,GAAG;IACf,oDAAoD;IACpD,wBAAwB,EAAE,MAAM,CAAC;IACjC,oGAAoG;IACpG,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,CAAC;AAEJ,eAAO,MAAM,yBAAyB,EAAE,CACtC,KAAK,EAAE,QAAQ,GAAG,KAAK,KACpB,kBAAkB,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAezD,CAAC;AAEH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAErG;AAED,eAAO,MAAM,0BAA0B,EAAE,CACvC,KAAK,EAAE,QAAQ,GAAG,KAAK,KACpB,kBAAkB,CAAC,eAAe,GAAG,eAAe,CAcvD,CAAC;AAEH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,QAAQ,GAAG,KAAK,GAAG,eAAe,CAElF"}
|
package/dest/publisher/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { blobSinkConfigMapping } from '@aztec/blob-sink/client';
|
|
2
2
|
import { l1ReaderConfigMappings, l1TxUtilsConfigMappings } from '@aztec/ethereum';
|
|
3
|
-
import { SecretValue, getConfigFromMappings } from '@aztec/foundation/config';
|
|
3
|
+
import { SecretValue, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
|
|
4
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
5
|
export const getTxSenderConfigMappings = (scope)=>({
|
|
6
6
|
...l1ReaderConfigMappings,
|
|
@@ -32,6 +32,11 @@ export const getPublisherConfigMappings = (scope)=>({
|
|
|
32
32
|
defaultValue: 1000,
|
|
33
33
|
description: 'The interval to wait between publish retries.'
|
|
34
34
|
},
|
|
35
|
+
publisherAllowInvalidStates: {
|
|
36
|
+
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
37
|
+
env: scope === `PROVER` ? `PROVER_PUBLISHER_ALLOW_INVALID_STATES` : `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
38
|
+
...booleanConfigHelper(false)
|
|
39
|
+
},
|
|
35
40
|
...l1TxUtilsConfigMappings,
|
|
36
41
|
...blobSinkConfigMapping
|
|
37
42
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SequencerPublisher
|
|
1
|
+
export { SequencerPublisher } from './sequencer-publisher.js';
|
|
2
2
|
export { SequencerPublisherFactory } from './sequencer-publisher-factory.js';
|
|
3
3
|
export { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publisher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publisher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAG7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC"}
|
package/dest/publisher/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SequencerPublisher
|
|
1
|
+
export { SequencerPublisher } from './sequencer-publisher.js';
|
|
2
2
|
export { SequencerPublisherFactory } from './sequencer-publisher-factory.js';
|
|
3
3
|
// Used for tests
|
|
4
4
|
export { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/aztec.js';
|
|
1
|
+
import { EthAddress, type Logger } from '@aztec/aztec.js';
|
|
2
2
|
import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
3
3
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
4
4
|
import type { GovernanceProposerContract, PublisherManager, RollupContract } from '@aztec/ethereum';
|
|
@@ -17,6 +17,9 @@ export declare class SequencerPublisherFactory {
|
|
|
17
17
|
private sequencerConfig;
|
|
18
18
|
private deps;
|
|
19
19
|
private publisherMetrics;
|
|
20
|
+
/** Stores the last slot in which every action was carried out by a publisher */
|
|
21
|
+
private lastActions;
|
|
22
|
+
private logger;
|
|
20
23
|
constructor(sequencerConfig: SequencerClientConfig, deps: {
|
|
21
24
|
telemetry: TelemetryClient;
|
|
22
25
|
publisherManager: PublisherManager<L1TxUtilsWithBlobs>;
|
|
@@ -27,6 +30,7 @@ export declare class SequencerPublisherFactory {
|
|
|
27
30
|
governanceProposerContract: GovernanceProposerContract;
|
|
28
31
|
slashFactoryContract: SlashFactoryContract;
|
|
29
32
|
nodeKeyStore: NodeKeystoreAdapter;
|
|
33
|
+
logger?: Logger;
|
|
30
34
|
});
|
|
31
35
|
/**
|
|
32
36
|
* Creates a new SequencerPublisher instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-publisher-factory.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"sequencer-publisher-factory.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,MAAM,EAAgB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,0BAA0B,EAAmB,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAe,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE3E,MAAM,MAAM,qBAAqB,GAAG;IAClC,eAAe,EAAE,UAAU,CAAC;IAC5B,SAAS,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AAEF,qBAAa,yBAAyB;IASlC,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,IAAI;IATd,OAAO,CAAC,gBAAgB,CAA4B;IAEpD,gFAAgF;IAChF,OAAO,CAAC,WAAW,CAAuC;IAE1D,OAAO,CAAC,MAAM,CAAS;gBAGb,eAAe,EAAE,qBAAqB,EACtC,IAAI,EAAE;QACZ,SAAS,EAAE,eAAe,CAAC;QAC3B,gBAAgB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;QACvD,cAAc,CAAC,EAAE,uBAAuB,CAAC;QACzC,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,EAAE,UAAU,CAAC;QACvB,cAAc,EAAE,cAAc,CAAC;QAC/B,0BAA0B,EAAE,0BAA0B,CAAC;QACvD,oBAAoB,EAAE,oBAAoB,CAAC;QAC3C,YAAY,EAAE,mBAAmB,CAAC;QAClC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;IAKH;;;;OAIG;IACU,MAAM,CAAC,gBAAgB,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAsCnF"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js';
|
|
1
2
|
import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
2
3
|
import { SequencerPublisher } from './sequencer-publisher.js';
|
|
3
4
|
export class SequencerPublisherFactory {
|
|
4
5
|
sequencerConfig;
|
|
5
6
|
deps;
|
|
6
7
|
publisherMetrics;
|
|
8
|
+
/** Stores the last slot in which every action was carried out by a publisher */ lastActions;
|
|
9
|
+
logger;
|
|
7
10
|
constructor(sequencerConfig, deps){
|
|
8
11
|
this.sequencerConfig = sequencerConfig;
|
|
9
12
|
this.deps = deps;
|
|
13
|
+
this.lastActions = {};
|
|
10
14
|
this.publisherMetrics = new SequencerPublisherMetrics(deps.telemetry, 'SequencerPublisher');
|
|
15
|
+
this.logger = deps.logger ?? createLogger('sequencer');
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
18
|
* Creates a new SequencerPublisher instance.
|
|
@@ -34,7 +39,9 @@ export class SequencerPublisherFactory {
|
|
|
34
39
|
slashingProposerContract,
|
|
35
40
|
slashFactoryContract: this.deps.slashFactoryContract,
|
|
36
41
|
dateProvider: this.deps.dateProvider,
|
|
37
|
-
metrics: this.publisherMetrics
|
|
42
|
+
metrics: this.publisherMetrics,
|
|
43
|
+
lastActions: this.lastActions,
|
|
44
|
+
log: this.logger.createChild('publisher')
|
|
38
45
|
});
|
|
39
46
|
return {
|
|
40
47
|
attestorAddress,
|
|
@@ -6,6 +6,7 @@ import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs'
|
|
|
6
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
7
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
8
8
|
import type { Fr } from '@aztec/foundation/fields';
|
|
9
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
9
10
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
10
11
|
import { type ProposerSlashAction } from '@aztec/slasher';
|
|
11
12
|
import { CommitteeAttestationsAndSigners, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
@@ -15,10 +16,6 @@ import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
|
15
16
|
import { type TransactionReceipt, type TypedDataDefinition } from 'viem';
|
|
16
17
|
import type { PublisherConfig, TxSenderConfig } from './config.js';
|
|
17
18
|
import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
18
|
-
export declare enum SignalType {
|
|
19
|
-
GOVERNANCE = 0,
|
|
20
|
-
SLASHING = 1
|
|
21
|
-
}
|
|
22
19
|
export declare const Actions: readonly ["invalidate-by-invalid-attestation", "invalidate-by-insufficient-attestations", "propose", "governance-signal", "empire-slashing-signal", "create-empire-payload", "execute-empire-payload", "vote-offenses", "execute-slash"];
|
|
23
20
|
export type Action = (typeof Actions)[number];
|
|
24
21
|
export declare const compareActions: (a: Action, b: Action) => number;
|
|
@@ -47,10 +44,10 @@ export declare class SequencerPublisher {
|
|
|
47
44
|
private interrupted;
|
|
48
45
|
private metrics;
|
|
49
46
|
epochCache: EpochCache;
|
|
50
|
-
protected governanceLog:
|
|
51
|
-
protected slashingLog:
|
|
52
|
-
|
|
53
|
-
protected log:
|
|
47
|
+
protected governanceLog: Logger;
|
|
48
|
+
protected slashingLog: Logger;
|
|
49
|
+
protected lastActions: Partial<Record<Action, bigint>>;
|
|
50
|
+
protected log: Logger;
|
|
54
51
|
protected ethereumSlotDuration: bigint;
|
|
55
52
|
private blobSinkClient;
|
|
56
53
|
static PROPOSE_GAS_GUESS: bigint;
|
|
@@ -73,6 +70,8 @@ export declare class SequencerPublisher {
|
|
|
73
70
|
epochCache: EpochCache;
|
|
74
71
|
dateProvider: DateProvider;
|
|
75
72
|
metrics: SequencerPublisherMetrics;
|
|
73
|
+
lastActions: Partial<Record<Action, bigint>>;
|
|
74
|
+
log?: Logger;
|
|
76
75
|
});
|
|
77
76
|
getRollupContract(): RollupContract;
|
|
78
77
|
getSenderAddress(): EthAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequencer-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,KAAK,8BAA8B,EACnC,kBAAkB,EAClB,KAAK,QAAQ,EACb,KAAK,0BAA0B,EAE/B,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAGhB,cAAc,EACd,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EAMtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAGjF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAsB,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
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,CAChC,KAAK,EAAE,OAAO,EACd,sBAAsB,EAAE,+BAA+B,EACvD,+BAA+B,EAAE,SAAS,EAC1C,IAAI,GAAE;QAAE,WAAW,CAAC,EAAE,IAAI,CAAC;QAAC,uBAAuB,CAAC,EAAE,MAAM,CAAA;KAAO,GAClE,OAAO,CAAC,OAAO,CAAC;IAqCZ,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,GAAG,SAAS,EAAE,IAAI,GAAE;QAAE,WAAW,CAAC,EAAE,IAAI,CAAA;KAAO;YA+B9F,yBAAyB;IAoDvC;;;;;OAKG;IACI,SAAS;IAKhB,wDAAwD;IACjD,OAAO;YAKA,gBAAgB;IAsD9B;;;;;OAKG;YACW,iBAAiB;YAoEjB,YAAY;CA+E3B"}
|
|
@@ -15,11 +15,6 @@ import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
|
15
15
|
import pick from 'lodash.pick';
|
|
16
16
|
import { encodeFunctionData, toHex } from 'viem';
|
|
17
17
|
import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
18
|
-
export var SignalType = /*#__PURE__*/ function(SignalType) {
|
|
19
|
-
SignalType[SignalType["GOVERNANCE"] = 0] = "GOVERNANCE";
|
|
20
|
-
SignalType[SignalType["SLASHING"] = 1] = "SLASHING";
|
|
21
|
-
return SignalType;
|
|
22
|
-
}({});
|
|
23
18
|
export const Actions = [
|
|
24
19
|
'invalidate-by-invalid-attestation',
|
|
25
20
|
'invalidate-by-insufficient-attestations',
|
|
@@ -40,7 +35,7 @@ export class SequencerPublisher {
|
|
|
40
35
|
epochCache;
|
|
41
36
|
governanceLog;
|
|
42
37
|
slashingLog;
|
|
43
|
-
|
|
38
|
+
lastActions;
|
|
44
39
|
log;
|
|
45
40
|
ethereumSlotDuration;
|
|
46
41
|
blobSinkClient;
|
|
@@ -63,14 +58,12 @@ export class SequencerPublisher {
|
|
|
63
58
|
this.interrupted = false;
|
|
64
59
|
this.governanceLog = createLogger('sequencer:publisher:governance');
|
|
65
60
|
this.slashingLog = createLogger('sequencer:publisher:slashing');
|
|
66
|
-
this.
|
|
67
|
-
[0]: 0n,
|
|
68
|
-
[1]: 0n
|
|
69
|
-
};
|
|
70
|
-
this.log = createLogger('sequencer:publisher');
|
|
61
|
+
this.lastActions = {};
|
|
71
62
|
this.requests = [];
|
|
63
|
+
this.log = deps.log ?? createLogger('sequencer:publisher');
|
|
72
64
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
73
65
|
this.epochCache = deps.epochCache;
|
|
66
|
+
this.lastActions = deps.lastActions;
|
|
74
67
|
this.blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config, {
|
|
75
68
|
logger: createLogger('sequencer:blob-sink:client')
|
|
76
69
|
});
|
|
@@ -402,7 +395,8 @@ export class SequencerPublisher {
|
|
|
402
395
|
return ts;
|
|
403
396
|
}
|
|
404
397
|
async enqueueCastSignalHelper(slotNumber, timestamp, signalType, payload, base, signerAddress, signer) {
|
|
405
|
-
if (this.
|
|
398
|
+
if (this.lastActions[signalType] && this.lastActions[signalType] === slotNumber) {
|
|
399
|
+
this.log.debug(`Skipping duplicate vote cast signal ${signalType} for slot ${slotNumber}`);
|
|
406
400
|
return false;
|
|
407
401
|
}
|
|
408
402
|
if (payload.equals(EthAddress.ZERO)) {
|
|
@@ -417,9 +411,9 @@ export class SequencerPublisher {
|
|
|
417
411
|
if (roundInfo.lastSignalSlot >= slotNumber) {
|
|
418
412
|
return false;
|
|
419
413
|
}
|
|
420
|
-
const cachedLastVote = this.
|
|
421
|
-
this.
|
|
422
|
-
const action = signalType
|
|
414
|
+
const cachedLastVote = this.lastActions[signalType];
|
|
415
|
+
this.lastActions[signalType] = slotNumber;
|
|
416
|
+
const action = signalType;
|
|
423
417
|
const request = await base.createSignalRequestWithSignature(payload.toString(), slotNumber, this.config.l1ChainId, signerAddress.toString(), signer);
|
|
424
418
|
this.log.debug(`Created ${action} request with signature`, {
|
|
425
419
|
request,
|
|
@@ -456,7 +450,7 @@ export class SequencerPublisher {
|
|
|
456
450
|
};
|
|
457
451
|
if (!success) {
|
|
458
452
|
this.log.error(`Signaling in [${action}] for ${payload} at slot ${slotNumber} in round ${round} failed`, logData);
|
|
459
|
-
this.
|
|
453
|
+
this.lastActions[signalType] = cachedLastVote;
|
|
460
454
|
return false;
|
|
461
455
|
} else {
|
|
462
456
|
this.log.info(`Signaling in [${action}] for ${payload} at slot ${slotNumber} in round ${round} succeeded`, logData);
|
|
@@ -472,7 +466,7 @@ export class SequencerPublisher {
|
|
|
472
466
|
* @param timestamp - The timestamp of the slot to cast a signal for.
|
|
473
467
|
* @returns True if the signal was successfully enqueued, false otherwise.
|
|
474
468
|
*/ enqueueGovernanceCastSignal(governancePayload, slotNumber, timestamp, signerAddress, signer) {
|
|
475
|
-
return this.enqueueCastSignalHelper(slotNumber, timestamp,
|
|
469
|
+
return this.enqueueCastSignalHelper(slotNumber, timestamp, 'governance-signal', governancePayload, this.govProposerContract, signerAddress, signer);
|
|
476
470
|
}
|
|
477
471
|
/** Enqueues all slashing actions as returned by the slasher client. */ async enqueueSlashingActions(actions, slotNumber, timestamp, signerAddress, signer) {
|
|
478
472
|
if (actions.length === 0) {
|
|
@@ -490,7 +484,7 @@ export class SequencerPublisher {
|
|
|
490
484
|
this.log.debug(`Enqueuing slashing vote for payload ${action.payload} at slot ${slotNumber}`, {
|
|
491
485
|
signerAddress
|
|
492
486
|
});
|
|
493
|
-
await this.enqueueCastSignalHelper(slotNumber, timestamp,
|
|
487
|
+
await this.enqueueCastSignalHelper(slotNumber, timestamp, 'empire-slashing-signal', action.payload, this.slashingProposerContract, signerAddress, signer);
|
|
494
488
|
break;
|
|
495
489
|
}
|
|
496
490
|
case 'create-empire-payload':
|
|
@@ -644,8 +638,14 @@ export class SequencerPublisher {
|
|
|
644
638
|
timestamp,
|
|
645
639
|
gasLimit: undefined
|
|
646
640
|
};
|
|
641
|
+
if (this.lastActions[action] && this.lastActions[action] === slotNumber) {
|
|
642
|
+
this.log.debug(`Skipping duplicate action ${action} for slot ${slotNumber}`);
|
|
643
|
+
return false;
|
|
644
|
+
}
|
|
645
|
+
const cachedLastActionSlot = this.lastActions[action];
|
|
646
|
+
this.lastActions[action] = slotNumber;
|
|
647
|
+
this.log.debug(`Simulating ${action} for slot ${slotNumber}`, logData);
|
|
647
648
|
let gasUsed;
|
|
648
|
-
this.log.debug(`Simulating ${action}`, logData);
|
|
649
649
|
try {
|
|
650
650
|
({ gasUsed } = await this.l1TxUtils.simulate(request, {
|
|
651
651
|
time: timestamp
|
|
@@ -678,6 +678,7 @@ export class SequencerPublisher {
|
|
|
678
678
|
...result,
|
|
679
679
|
...logData
|
|
680
680
|
});
|
|
681
|
+
this.lastActions[action] = cachedLastActionSlot;
|
|
681
682
|
} else {
|
|
682
683
|
this.log.info(`Action ${action} at ${slotNumber} succeeded`, {
|
|
683
684
|
...result,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20250923",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -26,37 +26,37 @@
|
|
|
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": "3.0.0-nightly.
|
|
30
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
31
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
32
|
-
"@aztec/blob-sink": "3.0.0-nightly.
|
|
33
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
34
|
-
"@aztec/epoch-cache": "3.0.0-nightly.
|
|
35
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
36
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
37
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
38
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
39
|
-
"@aztec/noir-acvm_js": "3.0.0-nightly.
|
|
40
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
41
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
42
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
43
|
-
"@aztec/p2p": "3.0.0-nightly.
|
|
44
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
45
|
-
"@aztec/prover-client": "3.0.0-nightly.
|
|
46
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
47
|
-
"@aztec/slasher": "3.0.0-nightly.
|
|
48
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
49
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
50
|
-
"@aztec/validator-client": "3.0.0-nightly.
|
|
51
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
29
|
+
"@aztec/aztec.js": "3.0.0-nightly.20250923",
|
|
30
|
+
"@aztec/bb-prover": "3.0.0-nightly.20250923",
|
|
31
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250923",
|
|
32
|
+
"@aztec/blob-sink": "3.0.0-nightly.20250923",
|
|
33
|
+
"@aztec/constants": "3.0.0-nightly.20250923",
|
|
34
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20250923",
|
|
35
|
+
"@aztec/ethereum": "3.0.0-nightly.20250923",
|
|
36
|
+
"@aztec/foundation": "3.0.0-nightly.20250923",
|
|
37
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250923",
|
|
38
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20250923",
|
|
39
|
+
"@aztec/noir-acvm_js": "3.0.0-nightly.20250923",
|
|
40
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20250923",
|
|
41
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20250923",
|
|
42
|
+
"@aztec/noir-types": "3.0.0-nightly.20250923",
|
|
43
|
+
"@aztec/p2p": "3.0.0-nightly.20250923",
|
|
44
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250923",
|
|
45
|
+
"@aztec/prover-client": "3.0.0-nightly.20250923",
|
|
46
|
+
"@aztec/simulator": "3.0.0-nightly.20250923",
|
|
47
|
+
"@aztec/slasher": "3.0.0-nightly.20250923",
|
|
48
|
+
"@aztec/stdlib": "3.0.0-nightly.20250923",
|
|
49
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20250923",
|
|
50
|
+
"@aztec/validator-client": "3.0.0-nightly.20250923",
|
|
51
|
+
"@aztec/world-state": "3.0.0-nightly.20250923",
|
|
52
52
|
"lodash.chunk": "^4.2.0",
|
|
53
53
|
"lodash.pick": "^4.4.0",
|
|
54
54
|
"tslib": "^2.4.0",
|
|
55
55
|
"viem": "2.23.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@aztec/archiver": "3.0.0-nightly.
|
|
59
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
58
|
+
"@aztec/archiver": "3.0.0-nightly.20250923",
|
|
59
|
+
"@aztec/kv-store": "3.0.0-nightly.20250923",
|
|
60
60
|
"@jest/globals": "^30.0.0",
|
|
61
61
|
"@types/jest": "^30.0.0",
|
|
62
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
@@ -84,7 +84,7 @@ export class SequencerClient {
|
|
|
84
84
|
telemetry: telemetryClient,
|
|
85
85
|
} = deps;
|
|
86
86
|
const { l1RpcUrls: rpcUrls, l1ChainId: chainId } = config;
|
|
87
|
-
const log = createLogger('sequencer
|
|
87
|
+
const log = createLogger('sequencer');
|
|
88
88
|
const publicClient = getPublicClient(config);
|
|
89
89
|
const l1TxUtils = deps.l1TxUtils;
|
|
90
90
|
const l1Metrics = new L1Metrics(
|
|
@@ -92,7 +92,7 @@ export class SequencerClient {
|
|
|
92
92
|
publicClient,
|
|
93
93
|
l1TxUtils.map(x => x.getSenderAddress()),
|
|
94
94
|
);
|
|
95
|
-
const publisherManager = new PublisherManager(l1TxUtils);
|
|
95
|
+
const publisherManager = new PublisherManager(l1TxUtils, config);
|
|
96
96
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
97
97
|
const [l1GenesisTime, slotDuration] = await Promise.all([
|
|
98
98
|
rollupContract.getL1GenesisTime(),
|
|
@@ -133,6 +133,7 @@ export class SequencerClient {
|
|
|
133
133
|
dateProvider: deps.dateProvider,
|
|
134
134
|
publisherManager,
|
|
135
135
|
nodeKeyStore: NodeKeystoreAdapter.fromKeyStoreManager(deps.nodeKeyStore),
|
|
136
|
+
logger: log,
|
|
136
137
|
});
|
|
137
138
|
const globalsBuilder = new GlobalVariableBuilder(config);
|
|
138
139
|
|
|
@@ -178,6 +179,7 @@ export class SequencerClient {
|
|
|
178
179
|
rollupContract,
|
|
179
180
|
{ ...config, maxL1TxInclusionTimeIntoSlot, maxL2BlockGas: sequencerManaLimit },
|
|
180
181
|
telemetryClient,
|
|
182
|
+
log,
|
|
181
183
|
);
|
|
182
184
|
|
|
183
185
|
await sequencer.init();
|
package/src/publisher/config.ts
CHANGED
|
@@ -5,7 +5,12 @@ import {
|
|
|
5
5
|
l1ReaderConfigMappings,
|
|
6
6
|
l1TxUtilsConfigMappings,
|
|
7
7
|
} from '@aztec/ethereum';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
type ConfigMappingsType,
|
|
10
|
+
SecretValue,
|
|
11
|
+
booleanConfigHelper,
|
|
12
|
+
getConfigFromMappings,
|
|
13
|
+
} from '@aztec/foundation/config';
|
|
9
14
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
15
|
|
|
11
16
|
/**
|
|
@@ -28,10 +33,10 @@ export type TxSenderConfig = L1ReaderConfig & {
|
|
|
28
33
|
*/
|
|
29
34
|
export type PublisherConfig = L1TxUtilsConfig &
|
|
30
35
|
BlobSinkConfig & {
|
|
31
|
-
/**
|
|
32
|
-
* The interval to wait between publish retries.
|
|
33
|
-
*/
|
|
36
|
+
/** The interval to wait between publish retries. */
|
|
34
37
|
l1PublishRetryIntervalMS: number;
|
|
38
|
+
/** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
|
|
39
|
+
publisherAllowInvalidStates?: boolean;
|
|
35
40
|
};
|
|
36
41
|
|
|
37
42
|
export const getTxSenderConfigMappings: (
|
|
@@ -66,6 +71,11 @@ export const getPublisherConfigMappings: (
|
|
|
66
71
|
defaultValue: 1000,
|
|
67
72
|
description: 'The interval to wait between publish retries.',
|
|
68
73
|
},
|
|
74
|
+
publisherAllowInvalidStates: {
|
|
75
|
+
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
76
|
+
env: scope === `PROVER` ? `PROVER_PUBLISHER_ALLOW_INVALID_STATES` : `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
77
|
+
...booleanConfigHelper(false),
|
|
78
|
+
},
|
|
69
79
|
...l1TxUtilsConfigMappings,
|
|
70
80
|
...blobSinkConfigMapping,
|
|
71
81
|
});
|
package/src/publisher/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/aztec.js';
|
|
1
|
+
import { EthAddress, type Logger, createLogger } from '@aztec/aztec.js';
|
|
2
2
|
import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
3
3
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
4
4
|
import type { GovernanceProposerContract, PublisherFilter, PublisherManager, RollupContract } from '@aztec/ethereum';
|
|
@@ -10,7 +10,7 @@ import { NodeKeystoreAdapter } from '@aztec/validator-client';
|
|
|
10
10
|
|
|
11
11
|
import type { SequencerClientConfig } from '../config.js';
|
|
12
12
|
import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
13
|
-
import { SequencerPublisher } from './sequencer-publisher.js';
|
|
13
|
+
import { type Action, SequencerPublisher } from './sequencer-publisher.js';
|
|
14
14
|
|
|
15
15
|
export type AttestorPublisherPair = {
|
|
16
16
|
attestorAddress: EthAddress;
|
|
@@ -19,6 +19,12 @@ export type AttestorPublisherPair = {
|
|
|
19
19
|
|
|
20
20
|
export class SequencerPublisherFactory {
|
|
21
21
|
private publisherMetrics: SequencerPublisherMetrics;
|
|
22
|
+
|
|
23
|
+
/** Stores the last slot in which every action was carried out by a publisher */
|
|
24
|
+
private lastActions: Partial<Record<Action, bigint>> = {};
|
|
25
|
+
|
|
26
|
+
private logger: Logger;
|
|
27
|
+
|
|
22
28
|
constructor(
|
|
23
29
|
private sequencerConfig: SequencerClientConfig,
|
|
24
30
|
private deps: {
|
|
@@ -31,9 +37,11 @@ export class SequencerPublisherFactory {
|
|
|
31
37
|
governanceProposerContract: GovernanceProposerContract;
|
|
32
38
|
slashFactoryContract: SlashFactoryContract;
|
|
33
39
|
nodeKeyStore: NodeKeystoreAdapter;
|
|
40
|
+
logger?: Logger;
|
|
34
41
|
},
|
|
35
42
|
) {
|
|
36
43
|
this.publisherMetrics = new SequencerPublisherMetrics(deps.telemetry, 'SequencerPublisher');
|
|
44
|
+
this.logger = deps.logger ?? createLogger('sequencer');
|
|
37
45
|
}
|
|
38
46
|
/**
|
|
39
47
|
* Creates a new SequencerPublisher instance.
|
|
@@ -69,6 +77,8 @@ export class SequencerPublisherFactory {
|
|
|
69
77
|
slashFactoryContract: this.deps.slashFactoryContract,
|
|
70
78
|
dateProvider: this.deps.dateProvider,
|
|
71
79
|
metrics: this.publisherMetrics,
|
|
80
|
+
lastActions: this.lastActions,
|
|
81
|
+
log: this.logger.createChild('publisher'),
|
|
72
82
|
});
|
|
73
83
|
|
|
74
84
|
return {
|
|
@@ -29,7 +29,7 @@ import { toHex as toPaddedHex } from '@aztec/foundation/bigint-buffer';
|
|
|
29
29
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
30
30
|
import { Signature, type ViemSignature } from '@aztec/foundation/eth-signature';
|
|
31
31
|
import type { Fr } from '@aztec/foundation/fields';
|
|
32
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
32
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
33
33
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
34
34
|
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
35
35
|
import { EmpireBaseAbi, ErrorsAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
@@ -63,11 +63,6 @@ type L1ProcessArgs = {
|
|
|
63
63
|
attestationsAndSignersSignature: Signature;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export enum SignalType {
|
|
67
|
-
GOVERNANCE,
|
|
68
|
-
SLASHING,
|
|
69
|
-
}
|
|
70
|
-
|
|
71
66
|
export const Actions = [
|
|
72
67
|
'invalidate-by-invalid-attestation',
|
|
73
68
|
'invalidate-by-insufficient-attestations',
|
|
@@ -79,8 +74,11 @@ export const Actions = [
|
|
|
79
74
|
'vote-offenses',
|
|
80
75
|
'execute-slash',
|
|
81
76
|
] as const;
|
|
77
|
+
|
|
82
78
|
export type Action = (typeof Actions)[number];
|
|
83
79
|
|
|
80
|
+
type GovernanceSignalAction = Extract<Action, 'governance-signal' | 'empire-slashing-signal'>;
|
|
81
|
+
|
|
84
82
|
// Sorting for actions such that invalidations go before proposals, and proposals go before votes
|
|
85
83
|
export const compareActions = (a: Action, b: Action) => Actions.indexOf(a) - Actions.indexOf(b);
|
|
86
84
|
|
|
@@ -112,12 +110,9 @@ export class SequencerPublisher {
|
|
|
112
110
|
protected governanceLog = createLogger('sequencer:publisher:governance');
|
|
113
111
|
protected slashingLog = createLogger('sequencer:publisher:slashing');
|
|
114
112
|
|
|
115
|
-
|
|
116
|
-
[SignalType.GOVERNANCE]: 0n,
|
|
117
|
-
[SignalType.SLASHING]: 0n,
|
|
118
|
-
};
|
|
113
|
+
protected lastActions: Partial<Record<Action, bigint>> = {};
|
|
119
114
|
|
|
120
|
-
protected log
|
|
115
|
+
protected log: Logger;
|
|
121
116
|
protected ethereumSlotDuration: bigint;
|
|
122
117
|
|
|
123
118
|
private blobSinkClient: BlobSinkClientInterface;
|
|
@@ -153,10 +148,14 @@ export class SequencerPublisher {
|
|
|
153
148
|
epochCache: EpochCache;
|
|
154
149
|
dateProvider: DateProvider;
|
|
155
150
|
metrics: SequencerPublisherMetrics;
|
|
151
|
+
lastActions: Partial<Record<Action, bigint>>;
|
|
152
|
+
log?: Logger;
|
|
156
153
|
},
|
|
157
154
|
) {
|
|
155
|
+
this.log = deps.log ?? createLogger('sequencer:publisher');
|
|
158
156
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
159
157
|
this.epochCache = deps.epochCache;
|
|
158
|
+
this.lastActions = deps.lastActions;
|
|
160
159
|
|
|
161
160
|
this.blobSinkClient =
|
|
162
161
|
deps.blobSinkClient ?? createBlobSinkClient(config, { logger: createLogger('sequencer:blob-sink:client') });
|
|
@@ -524,13 +523,14 @@ export class SequencerPublisher {
|
|
|
524
523
|
private async enqueueCastSignalHelper(
|
|
525
524
|
slotNumber: bigint,
|
|
526
525
|
timestamp: bigint,
|
|
527
|
-
signalType:
|
|
526
|
+
signalType: GovernanceSignalAction,
|
|
528
527
|
payload: EthAddress,
|
|
529
528
|
base: IEmpireBase,
|
|
530
529
|
signerAddress: EthAddress,
|
|
531
530
|
signer: (msg: TypedDataDefinition) => Promise<`0x${string}`>,
|
|
532
531
|
): Promise<boolean> {
|
|
533
|
-
if (this.
|
|
532
|
+
if (this.lastActions[signalType] && this.lastActions[signalType] === slotNumber) {
|
|
533
|
+
this.log.debug(`Skipping duplicate vote cast signal ${signalType} for slot ${slotNumber}`);
|
|
534
534
|
return false;
|
|
535
535
|
}
|
|
536
536
|
if (payload.equals(EthAddress.ZERO)) {
|
|
@@ -547,10 +547,9 @@ export class SequencerPublisher {
|
|
|
547
547
|
return false;
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
-
const cachedLastVote = this.
|
|
551
|
-
this.
|
|
552
|
-
|
|
553
|
-
const action = signalType === SignalType.GOVERNANCE ? 'governance-signal' : 'empire-slashing-signal';
|
|
550
|
+
const cachedLastVote = this.lastActions[signalType];
|
|
551
|
+
this.lastActions[signalType] = slotNumber;
|
|
552
|
+
const action = signalType;
|
|
554
553
|
|
|
555
554
|
const request = await base.createSignalRequestWithSignature(
|
|
556
555
|
payload.toString(),
|
|
@@ -593,7 +592,7 @@ export class SequencerPublisher {
|
|
|
593
592
|
`Signaling in [${action}] for ${payload} at slot ${slotNumber} in round ${round} failed`,
|
|
594
593
|
logData,
|
|
595
594
|
);
|
|
596
|
-
this.
|
|
595
|
+
this.lastActions[signalType] = cachedLastVote;
|
|
597
596
|
return false;
|
|
598
597
|
} else {
|
|
599
598
|
this.log.info(
|
|
@@ -623,7 +622,7 @@ export class SequencerPublisher {
|
|
|
623
622
|
return this.enqueueCastSignalHelper(
|
|
624
623
|
slotNumber,
|
|
625
624
|
timestamp,
|
|
626
|
-
|
|
625
|
+
'governance-signal',
|
|
627
626
|
governancePayload,
|
|
628
627
|
this.govProposerContract,
|
|
629
628
|
signerAddress,
|
|
@@ -657,7 +656,7 @@ export class SequencerPublisher {
|
|
|
657
656
|
await this.enqueueCastSignalHelper(
|
|
658
657
|
slotNumber,
|
|
659
658
|
timestamp,
|
|
660
|
-
|
|
659
|
+
'empire-slashing-signal',
|
|
661
660
|
action.payload,
|
|
662
661
|
this.slashingProposerContract,
|
|
663
662
|
signerAddress,
|
|
@@ -834,16 +833,24 @@ export class SequencerPublisher {
|
|
|
834
833
|
}
|
|
835
834
|
|
|
836
835
|
private async simulateAndEnqueueRequest(
|
|
837
|
-
action:
|
|
836
|
+
action: Action,
|
|
838
837
|
request: L1TxRequest,
|
|
839
838
|
checkSuccess: (receipt: TransactionReceipt) => boolean | undefined,
|
|
840
839
|
slotNumber: bigint,
|
|
841
840
|
timestamp: bigint,
|
|
842
841
|
) {
|
|
843
842
|
const logData = { slotNumber, timestamp, gasLimit: undefined as bigint | undefined };
|
|
844
|
-
|
|
843
|
+
if (this.lastActions[action] && this.lastActions[action] === slotNumber) {
|
|
844
|
+
this.log.debug(`Skipping duplicate action ${action} for slot ${slotNumber}`);
|
|
845
|
+
return false;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
const cachedLastActionSlot = this.lastActions[action];
|
|
849
|
+
this.lastActions[action] = slotNumber;
|
|
845
850
|
|
|
846
|
-
this.log.debug(`Simulating ${action}`, logData);
|
|
851
|
+
this.log.debug(`Simulating ${action} for slot ${slotNumber}`, logData);
|
|
852
|
+
|
|
853
|
+
let gasUsed: bigint;
|
|
847
854
|
try {
|
|
848
855
|
({ gasUsed } = await this.l1TxUtils.simulate(request, { time: timestamp }, [], ErrorsAbi)); // TODO(palla/slash): Check the timestamp logic
|
|
849
856
|
this.log.verbose(`Simulation for ${action} succeeded`, { ...logData, request, gasUsed });
|
|
@@ -867,6 +874,7 @@ export class SequencerPublisher {
|
|
|
867
874
|
const success = result && result.receipt && result.receipt.status === 'success' && checkSuccess(result.receipt);
|
|
868
875
|
if (!success) {
|
|
869
876
|
this.log.warn(`Action ${action} at ${slotNumber} failed`, { ...result, ...logData });
|
|
877
|
+
this.lastActions[action] = cachedLastActionSlot;
|
|
870
878
|
} else {
|
|
871
879
|
this.log.info(`Action ${action} at ${slotNumber} succeeded`, { ...result, ...logData });
|
|
872
880
|
}
|