@aztec/sequencer-client 2.0.3-rc.16 → 2.0.3-rc.18
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 +5 -3
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +13 -5
- 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 +8 -8
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +29 -19
- package/dest/sequencer/metrics.d.ts +5 -17
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +22 -88
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +5 -10
- package/package.json +27 -27
- package/src/client/sequencer-client.ts +4 -2
- package/src/publisher/config.ts +23 -5
- package/src/publisher/index.ts +1 -1
- package/src/publisher/sequencer-publisher-factory.ts +12 -2
- package/src/publisher/sequencer-publisher.ts +41 -23
- package/src/sequencer/metrics.ts +24 -100
- package/src/sequencer/sequencer.ts +6 -16
|
@@ -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,wCAAw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gBAAgB,CAAC,EAAE,yBAAyB,CAAC;QAC7C,cAAc,CAAC,EAAE,uBAAuB,CAAC;QACzC,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,SAAS,EAAE,kBAAkB,EAAE,CAAC;QAChC,YAAY,EAAE,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;IAMV,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
|
}
|
|
@@ -14,15 +14,17 @@ export type TxSenderConfig = L1ReaderConfig & {
|
|
|
14
14
|
* Publisher addresses to be used with a remote signer
|
|
15
15
|
*/
|
|
16
16
|
publisherAddresses?: EthAddress[];
|
|
17
|
+
/** Whether this publisher is enabled */
|
|
18
|
+
publisherEnabled?: boolean;
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
* Configuration of the L1Publisher.
|
|
20
22
|
*/
|
|
21
23
|
export type PublisherConfig = L1TxUtilsConfig & BlobSinkConfig & {
|
|
22
|
-
/**
|
|
23
|
-
* The interval to wait between publish retries.
|
|
24
|
-
*/
|
|
24
|
+
/** The interval to wait between publish retries. */
|
|
25
25
|
l1PublishRetryIntervalMS: number;
|
|
26
|
+
/** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
|
|
27
|
+
publisherAllowInvalidStates?: boolean;
|
|
26
28
|
};
|
|
27
29
|
export declare const getTxSenderConfigMappings: (scope: 'PROVER' | 'SEQ') => ConfigMappingsType<Omit<TxSenderConfig, 'l1Contracts'>>;
|
|
28
30
|
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;IAElC,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,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,CAoBzD,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,
|
|
@@ -9,10 +9,8 @@ export const getTxSenderConfigMappings = (scope)=>({
|
|
|
9
9
|
description: 'The private keys to be used by the publisher.',
|
|
10
10
|
parseEnv: (val)=>val.split(',').map((key)=>new SecretValue(`0x${key.replace('0x', '')}`)),
|
|
11
11
|
defaultValue: [],
|
|
12
|
-
fallback:
|
|
13
|
-
'PROVER_PUBLISHER_PRIVATE_KEY
|
|
14
|
-
] : [
|
|
15
|
-
'SEQ_PUBLISHER_PRIVATE_KEY'
|
|
12
|
+
fallback: [
|
|
13
|
+
scope === 'PROVER' ? `PROVER_PUBLISHER_PRIVATE_KEY` : `SEQ_PUBLISHER_PRIVATE_KEY`
|
|
16
14
|
]
|
|
17
15
|
},
|
|
18
16
|
publisherAddresses: {
|
|
@@ -20,6 +18,11 @@ export const getTxSenderConfigMappings = (scope)=>({
|
|
|
20
18
|
description: 'The addresses of the publishers to use with remote signers',
|
|
21
19
|
parseEnv: (val)=>val.split(',').map((address)=>EthAddress.fromString(address)),
|
|
22
20
|
defaultValue: []
|
|
21
|
+
},
|
|
22
|
+
publisherEnabled: {
|
|
23
|
+
env: scope === 'PROVER' ? `PROVER_PUBLISHER_ENABLED` : `SEQ_PUBLISHER_ENABLED`,
|
|
24
|
+
description: 'Whether this L1 publisher is enabled',
|
|
25
|
+
...booleanConfigHelper(true)
|
|
23
26
|
}
|
|
24
27
|
});
|
|
25
28
|
export function getTxSenderConfigFromEnv(scope) {
|
|
@@ -32,6 +35,11 @@ export const getPublisherConfigMappings = (scope)=>({
|
|
|
32
35
|
defaultValue: 1000,
|
|
33
36
|
description: 'The interval to wait between publish retries.'
|
|
34
37
|
},
|
|
38
|
+
publisherAllowInvalidStates: {
|
|
39
|
+
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
40
|
+
env: scope === `PROVER` ? `PROVER_PUBLISHER_ALLOW_INVALID_STATES` : `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
41
|
+
...booleanConfigHelper(false)
|
|
42
|
+
},
|
|
35
43
|
...l1TxUtilsConfigMappings,
|
|
36
44
|
...blobSinkConfigMapping
|
|
37
45
|
});
|
|
@@ -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,
|
|
@@ -5,6 +5,7 @@ import { type EmpireSlashingProposerContract, FormattedViemError, type GasPrice,
|
|
|
5
5
|
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
6
6
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
7
|
import type { Fr } from '@aztec/foundation/fields';
|
|
8
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
8
9
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
10
|
import { type ProposerSlashAction } from '@aztec/slasher';
|
|
10
11
|
import { CommitteeAttestation, type ValidateBlockResult } from '@aztec/stdlib/block';
|
|
@@ -14,10 +15,6 @@ import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
|
14
15
|
import { type TransactionReceipt, type TypedDataDefinition } from 'viem';
|
|
15
16
|
import type { PublisherConfig, TxSenderConfig } from './config.js';
|
|
16
17
|
import { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
17
|
-
export declare enum SignalType {
|
|
18
|
-
GOVERNANCE = 0,
|
|
19
|
-
SLASHING = 1
|
|
20
|
-
}
|
|
21
18
|
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"];
|
|
22
19
|
export type Action = (typeof Actions)[number];
|
|
23
20
|
export declare const compareActions: (a: Action, b: Action) => number;
|
|
@@ -43,13 +40,14 @@ interface RequestWithExpiry {
|
|
|
43
40
|
}
|
|
44
41
|
export declare class SequencerPublisher {
|
|
45
42
|
private config;
|
|
43
|
+
private enabled;
|
|
46
44
|
private interrupted;
|
|
47
45
|
private metrics;
|
|
48
46
|
epochCache: EpochCache;
|
|
49
|
-
protected governanceLog:
|
|
50
|
-
protected slashingLog:
|
|
51
|
-
|
|
52
|
-
protected log:
|
|
47
|
+
protected governanceLog: Logger;
|
|
48
|
+
protected slashingLog: Logger;
|
|
49
|
+
protected lastActions: Partial<Record<Action, bigint>>;
|
|
50
|
+
protected log: Logger;
|
|
53
51
|
protected ethereumSlotDuration: bigint;
|
|
54
52
|
private blobSinkClient;
|
|
55
53
|
static PROPOSE_GAS_GUESS: bigint;
|
|
@@ -72,6 +70,8 @@ export declare class SequencerPublisher {
|
|
|
72
70
|
epochCache: EpochCache;
|
|
73
71
|
dateProvider: DateProvider;
|
|
74
72
|
metrics: SequencerPublisherMetrics;
|
|
73
|
+
lastActions: Partial<Record<Action, bigint>>;
|
|
74
|
+
log?: Logger;
|
|
75
75
|
});
|
|
76
76
|
getRollupContract(): RollupContract;
|
|
77
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,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,MAAM,EAAE,CAAC,GAAG,EAAE,mBAAmB,KAAK,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,GAC3D,OAAO,CAAC,OAAO,CAAC;IAoHnB;;;;;OAKG;IACU,qBAAqB,CAChC,KAAK,EAAE,OAAO,EACd,YAAY,CAAC,EAAE,oBAAoB,EAAE,EACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,EACnB,IAAI,GAAE;QAAE,WAAW,CAAC,EAAE,IAAI,CAAC;QAAC,uBAAuB,CAAC,EAAE,MAAM,CAAA;KAAO,GAClE,OAAO,CAAC,OAAO,CAAC;IAyCZ,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;IA2D9B;;;;;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',
|
|
@@ -35,12 +30,13 @@ export const Actions = [
|
|
|
35
30
|
export const compareActions = (a, b)=>Actions.indexOf(a) - Actions.indexOf(b);
|
|
36
31
|
export class SequencerPublisher {
|
|
37
32
|
config;
|
|
33
|
+
enabled;
|
|
38
34
|
interrupted;
|
|
39
35
|
metrics;
|
|
40
36
|
epochCache;
|
|
41
37
|
governanceLog;
|
|
42
38
|
slashingLog;
|
|
43
|
-
|
|
39
|
+
lastActions;
|
|
44
40
|
log;
|
|
45
41
|
ethereumSlotDuration;
|
|
46
42
|
blobSinkClient;
|
|
@@ -63,14 +59,13 @@ export class SequencerPublisher {
|
|
|
63
59
|
this.interrupted = false;
|
|
64
60
|
this.governanceLog = createLogger('sequencer:publisher:governance');
|
|
65
61
|
this.slashingLog = createLogger('sequencer:publisher:slashing');
|
|
66
|
-
this.
|
|
67
|
-
[0]: 0n,
|
|
68
|
-
[1]: 0n
|
|
69
|
-
};
|
|
70
|
-
this.log = createLogger('sequencer:publisher');
|
|
62
|
+
this.lastActions = {};
|
|
71
63
|
this.requests = [];
|
|
64
|
+
this.enabled = config.publisherEnabled ?? true;
|
|
65
|
+
this.log = deps.log ?? createLogger('sequencer:publisher');
|
|
72
66
|
this.ethereumSlotDuration = BigInt(config.ethereumSlotDuration);
|
|
73
67
|
this.epochCache = deps.epochCache;
|
|
68
|
+
this.lastActions = deps.lastActions;
|
|
74
69
|
this.blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config, {
|
|
75
70
|
logger: createLogger('sequencer:blob-sink:client')
|
|
76
71
|
});
|
|
@@ -106,6 +101,13 @@ export class SequencerPublisher {
|
|
|
106
101
|
* - a receipt and errorMsg if it failed on L1
|
|
107
102
|
* - undefined if no valid requests are found OR the tx failed to send.
|
|
108
103
|
*/ async sendRequests() {
|
|
104
|
+
if (!this.enabled) {
|
|
105
|
+
this.log.warn(`Sending L1 txs is disabled`, {
|
|
106
|
+
requestsDiscarded: this.requests.map((r)=>r.action)
|
|
107
|
+
});
|
|
108
|
+
this.requests = [];
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
109
111
|
const requestsToProcess = [
|
|
110
112
|
...this.requests
|
|
111
113
|
];
|
|
@@ -405,7 +407,8 @@ export class SequencerPublisher {
|
|
|
405
407
|
return ts;
|
|
406
408
|
}
|
|
407
409
|
async enqueueCastSignalHelper(slotNumber, timestamp, signalType, payload, base, signerAddress, signer) {
|
|
408
|
-
if (this.
|
|
410
|
+
if (this.lastActions[signalType] && this.lastActions[signalType] === slotNumber) {
|
|
411
|
+
this.log.debug(`Skipping duplicate vote cast signal ${signalType} for slot ${slotNumber}`);
|
|
409
412
|
return false;
|
|
410
413
|
}
|
|
411
414
|
if (payload.equals(EthAddress.ZERO)) {
|
|
@@ -420,9 +423,9 @@ export class SequencerPublisher {
|
|
|
420
423
|
if (roundInfo.lastSignalSlot >= slotNumber) {
|
|
421
424
|
return false;
|
|
422
425
|
}
|
|
423
|
-
const cachedLastVote = this.
|
|
424
|
-
this.
|
|
425
|
-
const action = signalType
|
|
426
|
+
const cachedLastVote = this.lastActions[signalType];
|
|
427
|
+
this.lastActions[signalType] = slotNumber;
|
|
428
|
+
const action = signalType;
|
|
426
429
|
const request = await base.createSignalRequestWithSignature(payload.toString(), slotNumber, this.config.l1ChainId, signerAddress.toString(), signer);
|
|
427
430
|
this.log.debug(`Created ${action} request with signature`, {
|
|
428
431
|
request,
|
|
@@ -459,7 +462,7 @@ export class SequencerPublisher {
|
|
|
459
462
|
};
|
|
460
463
|
if (!success) {
|
|
461
464
|
this.log.error(`Signaling in [${action}] for ${payload} at slot ${slotNumber} in round ${round} failed`, logData);
|
|
462
|
-
this.
|
|
465
|
+
this.lastActions[signalType] = cachedLastVote;
|
|
463
466
|
return false;
|
|
464
467
|
} else {
|
|
465
468
|
this.log.info(`Signaling in [${action}] for ${payload} at slot ${slotNumber} in round ${round} succeeded`, logData);
|
|
@@ -475,7 +478,7 @@ export class SequencerPublisher {
|
|
|
475
478
|
* @param timestamp - The timestamp of the slot to cast a signal for.
|
|
476
479
|
* @returns True if the signal was successfully enqueued, false otherwise.
|
|
477
480
|
*/ enqueueGovernanceCastSignal(governancePayload, slotNumber, timestamp, signerAddress, signer) {
|
|
478
|
-
return this.enqueueCastSignalHelper(slotNumber, timestamp,
|
|
481
|
+
return this.enqueueCastSignalHelper(slotNumber, timestamp, 'governance-signal', governancePayload, this.govProposerContract, signerAddress, signer);
|
|
479
482
|
}
|
|
480
483
|
/** Enqueues all slashing actions as returned by the slasher client. */ async enqueueSlashingActions(actions, slotNumber, timestamp, signerAddress, signer) {
|
|
481
484
|
if (actions.length === 0) {
|
|
@@ -493,7 +496,7 @@ export class SequencerPublisher {
|
|
|
493
496
|
this.log.debug(`Enqueuing slashing vote for payload ${action.payload} at slot ${slotNumber}`, {
|
|
494
497
|
signerAddress
|
|
495
498
|
});
|
|
496
|
-
await this.enqueueCastSignalHelper(slotNumber, timestamp,
|
|
499
|
+
await this.enqueueCastSignalHelper(slotNumber, timestamp, 'empire-slashing-signal', action.payload, this.slashingProposerContract, signerAddress, signer);
|
|
497
500
|
break;
|
|
498
501
|
}
|
|
499
502
|
case 'create-empire-payload':
|
|
@@ -653,8 +656,14 @@ export class SequencerPublisher {
|
|
|
653
656
|
timestamp,
|
|
654
657
|
gasLimit: undefined
|
|
655
658
|
};
|
|
659
|
+
if (this.lastActions[action] && this.lastActions[action] === slotNumber) {
|
|
660
|
+
this.log.debug(`Skipping duplicate action ${action} for slot ${slotNumber}`);
|
|
661
|
+
return false;
|
|
662
|
+
}
|
|
663
|
+
const cachedLastActionSlot = this.lastActions[action];
|
|
664
|
+
this.lastActions[action] = slotNumber;
|
|
665
|
+
this.log.debug(`Simulating ${action} for slot ${slotNumber}`, logData);
|
|
656
666
|
let gasUsed;
|
|
657
|
-
this.log.debug(`Simulating ${action}`, logData);
|
|
658
667
|
try {
|
|
659
668
|
({ gasUsed } = await this.l1TxUtils.simulate(request, {
|
|
660
669
|
time: timestamp
|
|
@@ -687,6 +696,7 @@ export class SequencerPublisher {
|
|
|
687
696
|
...result,
|
|
688
697
|
...logData
|
|
689
698
|
});
|
|
699
|
+
this.lastActions[action] = cachedLastActionSlot;
|
|
690
700
|
} else {
|
|
691
701
|
this.log.info(`Action ${action} at ${slotNumber} succeeded`, {
|
|
692
702
|
...result,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/aztec.js';
|
|
2
2
|
import type { RollupContract } from '@aztec/ethereum';
|
|
3
3
|
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
4
|
-
import { type
|
|
4
|
+
import { type Hex } from 'viem';
|
|
5
|
+
import type { SequencerState } from './utils.js';
|
|
5
6
|
export declare class SequencerMetrics {
|
|
6
|
-
private coinbase;
|
|
7
7
|
private rollup;
|
|
8
8
|
readonly tracer: Tracer;
|
|
9
9
|
private meter;
|
|
@@ -11,9 +11,6 @@ export declare class SequencerMetrics {
|
|
|
11
11
|
private blockBuildDuration;
|
|
12
12
|
private blockBuildManaPerSecond;
|
|
13
13
|
private stateTransitionBufferDuration;
|
|
14
|
-
private currentBlockNumber;
|
|
15
|
-
private currentBlockSize;
|
|
16
|
-
private blockBuilderInsertions;
|
|
17
14
|
private timeToCollectAttestations;
|
|
18
15
|
private allowanceToCollectAttestations;
|
|
19
16
|
private requiredAttestions;
|
|
@@ -21,23 +18,14 @@ export declare class SequencerMetrics {
|
|
|
21
18
|
private rewards;
|
|
22
19
|
private slots;
|
|
23
20
|
private filledSlots;
|
|
24
|
-
private missedSlots;
|
|
25
21
|
private lastSeenSlot?;
|
|
26
|
-
constructor(client: TelemetryClient,
|
|
27
|
-
setCoinbase(coinbase: EthAddress): void;
|
|
28
|
-
start(): void;
|
|
29
|
-
stop(): void;
|
|
30
|
-
private observe;
|
|
22
|
+
constructor(client: TelemetryClient, rollup: RollupContract, name?: string);
|
|
31
23
|
recordRequiredAttestations(requiredAttestationsCount: number, allowanceMs: number): void;
|
|
32
24
|
recordCollectedAttestations(count: number, durationMs: number): void;
|
|
33
|
-
recordBlockBuilderTreeInsertions(timeUs: number): void;
|
|
34
|
-
recordCancelledBlock(): void;
|
|
35
25
|
recordBuiltBlock(buildDurationMs: number, totalMana: number): void;
|
|
36
26
|
recordFailedBlock(): void;
|
|
37
|
-
recordNewBlock(blockNumber: number, txCount: number): void;
|
|
38
27
|
recordStateTransitionBufferMs(durationMs: number, state: SequencerState): void;
|
|
39
|
-
|
|
40
|
-
incFilledSlot(proposer: string): void
|
|
41
|
-
private setCurrentBlock;
|
|
28
|
+
incOpenSlot(slot: bigint, proposer: string): void;
|
|
29
|
+
incFilledSlot(proposer: string, coinbase: Hex | EthAddress | undefined): Promise<void>;
|
|
42
30
|
}
|
|
43
31
|
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/sequencer/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,gBAAgB;IAwBzB,OAAO,CAAC,MAAM;IAvBhB,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,KAAK,CAAQ;IAErB,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,kBAAkB,CAAY;IACtC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,6BAA6B,CAAY;IAGjD,OAAO,CAAC,yBAAyB,CAAQ;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