@aztec/sequencer-client 0.0.0-test.0
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/README.md +45 -0
- package/dest/client/index.d.ts +2 -0
- package/dest/client/index.d.ts.map +1 -0
- package/dest/client/index.js +1 -0
- package/dest/client/sequencer-client.d.ts +71 -0
- package/dest/client/sequencer-client.d.ts.map +1 -0
- package/dest/client/sequencer-client.js +117 -0
- package/dest/config.d.ts +29 -0
- package/dest/config.d.ts.map +1 -0
- package/dest/config.js +143 -0
- package/dest/global_variable_builder/global_builder.d.ts +32 -0
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -0
- package/dest/global_variable_builder/global_builder.js +79 -0
- package/dest/global_variable_builder/index.d.ts +2 -0
- package/dest/global_variable_builder/index.d.ts.map +1 -0
- package/dest/global_variable_builder/index.js +1 -0
- package/dest/index.d.ts +8 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +9 -0
- package/dest/publisher/config.d.ts +31 -0
- package/dest/publisher/config.d.ts.map +1 -0
- package/dest/publisher/config.js +35 -0
- package/dest/publisher/index.d.ts +2 -0
- package/dest/publisher/index.d.ts.map +1 -0
- package/dest/publisher/index.js +1 -0
- package/dest/publisher/sequencer-publisher-metrics.d.ts +25 -0
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -0
- package/dest/publisher/sequencer-publisher-metrics.js +129 -0
- package/dest/publisher/sequencer-publisher.d.ts +152 -0
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -0
- package/dest/publisher/sequencer-publisher.js +481 -0
- package/dest/sequencer/allowed.d.ts +3 -0
- package/dest/sequencer/allowed.d.ts.map +1 -0
- package/dest/sequencer/allowed.js +27 -0
- package/dest/sequencer/config.d.ts +2 -0
- package/dest/sequencer/config.d.ts.map +1 -0
- package/dest/sequencer/config.js +1 -0
- package/dest/sequencer/index.d.ts +4 -0
- package/dest/sequencer/index.d.ts.map +1 -0
- package/dest/sequencer/index.js +3 -0
- package/dest/sequencer/metrics.d.ts +24 -0
- package/dest/sequencer/metrics.d.ts.map +1 -0
- package/dest/sequencer/metrics.js +102 -0
- package/dest/sequencer/sequencer.d.ts +180 -0
- package/dest/sequencer/sequencer.d.ts.map +1 -0
- package/dest/sequencer/sequencer.js +623 -0
- package/dest/sequencer/timetable.d.ts +38 -0
- package/dest/sequencer/timetable.d.ts.map +1 -0
- package/dest/sequencer/timetable.js +110 -0
- package/dest/sequencer/utils.d.ts +48 -0
- package/dest/sequencer/utils.d.ts.map +1 -0
- package/dest/sequencer/utils.js +53 -0
- package/dest/slasher/factory.d.ts +7 -0
- package/dest/slasher/factory.d.ts.map +1 -0
- package/dest/slasher/factory.js +8 -0
- package/dest/slasher/index.d.ts +3 -0
- package/dest/slasher/index.d.ts.map +1 -0
- package/dest/slasher/index.js +2 -0
- package/dest/slasher/slasher_client.d.ts +75 -0
- package/dest/slasher/slasher_client.d.ts.map +1 -0
- package/dest/slasher/slasher_client.js +132 -0
- package/dest/test/index.d.ts +17 -0
- package/dest/test/index.d.ts.map +1 -0
- package/dest/test/index.js +10 -0
- package/dest/tx_validator/archive_cache.d.ts +14 -0
- package/dest/tx_validator/archive_cache.d.ts.map +1 -0
- package/dest/tx_validator/archive_cache.js +22 -0
- package/dest/tx_validator/gas_validator.d.ts +14 -0
- package/dest/tx_validator/gas_validator.d.ts.map +1 -0
- package/dest/tx_validator/gas_validator.js +78 -0
- package/dest/tx_validator/nullifier_cache.d.ts +16 -0
- package/dest/tx_validator/nullifier_cache.d.ts.map +1 -0
- package/dest/tx_validator/nullifier_cache.js +24 -0
- package/dest/tx_validator/phases_validator.d.ts +12 -0
- package/dest/tx_validator/phases_validator.d.ts.map +1 -0
- package/dest/tx_validator/phases_validator.js +80 -0
- package/dest/tx_validator/test_utils.d.ts +23 -0
- package/dest/tx_validator/test_utils.d.ts.map +1 -0
- package/dest/tx_validator/test_utils.js +26 -0
- package/dest/tx_validator/tx_validator_factory.d.ts +18 -0
- package/dest/tx_validator/tx_validator_factory.d.ts.map +1 -0
- package/dest/tx_validator/tx_validator_factory.js +50 -0
- package/package.json +121 -0
- package/src/client/index.ts +1 -0
- package/src/client/sequencer-client.ts +219 -0
- package/src/config.ts +179 -0
- package/src/global_variable_builder/global_builder.ts +108 -0
- package/src/global_variable_builder/index.ts +1 -0
- package/src/index.ts +10 -0
- package/src/publisher/config.ts +75 -0
- package/src/publisher/index.ts +1 -0
- package/src/publisher/sequencer-publisher-metrics.ts +176 -0
- package/src/publisher/sequencer-publisher.ts +625 -0
- package/src/sequencer/allowed.ts +36 -0
- package/src/sequencer/config.ts +1 -0
- package/src/sequencer/index.ts +3 -0
- package/src/sequencer/metrics.ts +137 -0
- package/src/sequencer/sequencer.ts +759 -0
- package/src/sequencer/timetable.ts +123 -0
- package/src/sequencer/utils.ts +74 -0
- package/src/slasher/factory.ts +15 -0
- package/src/slasher/index.ts +2 -0
- package/src/slasher/slasher_client.ts +193 -0
- package/src/test/index.ts +20 -0
- package/src/tx_validator/archive_cache.ts +28 -0
- package/src/tx_validator/gas_validator.ts +101 -0
- package/src/tx_validator/nullifier_cache.ts +30 -0
- package/src/tx_validator/phases_validator.ts +98 -0
- package/src/tx_validator/test_utils.ts +48 -0
- package/src/tx_validator/tx_validator_factory.ts +120 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { blobSinkConfigMapping } from '@aztec/blob-sink/client';
|
|
2
|
+
import { NULL_KEY, l1ReaderConfigMappings, l1TxUtilsConfigMappings } from '@aztec/ethereum';
|
|
3
|
+
import { getConfigFromMappings } from '@aztec/foundation/config';
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
export const getTxSenderConfigMappings = (scope)=>({
|
|
6
|
+
...l1ReaderConfigMappings,
|
|
7
|
+
customForwarderContractAddress: {
|
|
8
|
+
env: `CUSTOM_FORWARDER_CONTRACT_ADDRESS`,
|
|
9
|
+
parseEnv: (val)=>EthAddress.fromString(val),
|
|
10
|
+
description: 'The address of the custom forwarder contract.',
|
|
11
|
+
defaultValue: EthAddress.ZERO
|
|
12
|
+
},
|
|
13
|
+
publisherPrivateKey: {
|
|
14
|
+
env: scope === 'PROVER' ? `PROVER_PUBLISHER_PRIVATE_KEY` : `SEQ_PUBLISHER_PRIVATE_KEY`,
|
|
15
|
+
description: 'The private key to be used by the publisher.',
|
|
16
|
+
parseEnv: (val)=>val ? `0x${val.replace('0x', '')}` : NULL_KEY,
|
|
17
|
+
defaultValue: NULL_KEY
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export function getTxSenderConfigFromEnv(scope) {
|
|
21
|
+
return getConfigFromMappings(getTxSenderConfigMappings(scope));
|
|
22
|
+
}
|
|
23
|
+
export const getPublisherConfigMappings = (scope)=>({
|
|
24
|
+
l1PublishRetryIntervalMS: {
|
|
25
|
+
env: scope === `PROVER` ? `PROVER_PUBLISH_RETRY_INTERVAL_MS` : `SEQ_PUBLISH_RETRY_INTERVAL_MS`,
|
|
26
|
+
parseEnv: (val)=>+val,
|
|
27
|
+
defaultValue: 1000,
|
|
28
|
+
description: 'The interval to wait between publish retries.'
|
|
29
|
+
},
|
|
30
|
+
...l1TxUtilsConfigMappings,
|
|
31
|
+
...blobSinkConfigMapping
|
|
32
|
+
});
|
|
33
|
+
export function getPublisherConfigFromEnv(scope) {
|
|
34
|
+
return getConfigFromMappings(getPublisherConfigMappings(scope));
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publisher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SequencerPublisher } from './sequencer-publisher.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { L1PublishBlockStats } from '@aztec/stdlib/stats';
|
|
2
|
+
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
3
|
+
export type L1TxType = 'process';
|
|
4
|
+
export declare class SequencerPublisherMetrics {
|
|
5
|
+
private logger;
|
|
6
|
+
private gasPrice;
|
|
7
|
+
private txCount;
|
|
8
|
+
private txDuration;
|
|
9
|
+
private txGas;
|
|
10
|
+
private txCalldataSize;
|
|
11
|
+
private txCalldataGas;
|
|
12
|
+
private txBlobDataGasUsed;
|
|
13
|
+
private txBlobDataGasCost;
|
|
14
|
+
private readonly blobCountHistogram;
|
|
15
|
+
private readonly blobInclusionBlocksHistogram;
|
|
16
|
+
private readonly blobTxSuccessCounter;
|
|
17
|
+
private readonly blobTxFailureCounter;
|
|
18
|
+
private senderBalance;
|
|
19
|
+
constructor(client: TelemetryClient, name?: string, logger?: import("@aztec/aztec.js").Logger);
|
|
20
|
+
recordFailedTx(txType: L1TxType): void;
|
|
21
|
+
recordProcessBlockTx(durationMs: number, stats: L1PublishBlockStats): void;
|
|
22
|
+
recordSenderBalance(wei: bigint, senderAddress: string): void;
|
|
23
|
+
private recordTx;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=sequencer-publisher-metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequencer-publisher-metrics.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher-metrics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC;AAEjC,qBAAa,yBAAyB;IAqBlC,OAAO,CAAC,MAAM;IApBhB,OAAO,CAAC,QAAQ,CAAY;IAE5B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,cAAc,CAAY;IAClC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,iBAAiB,CAAY;IACrC,OAAO,CAAC,iBAAiB,CAAY;IAErC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAY;IAC/C,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAY;IACzD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAgB;IACrD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAgB;IAErD,OAAO,CAAC,aAAa,CAAQ;gBAG3B,MAAM,EAAE,eAAe,EACvB,IAAI,SAAuB,EACnB,MAAM,mCAA8C;IA6E9D,cAAc,CAAC,MAAM,EAAE,QAAQ;IAW/B,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB;IAcnE,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAOtD,OAAO,CAAC,QAAQ;CA6BjB"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js';
|
|
2
|
+
import { Attributes, Metrics, ValueType } from '@aztec/telemetry-client';
|
|
3
|
+
import { formatEther } from 'viem/utils';
|
|
4
|
+
export class SequencerPublisherMetrics {
|
|
5
|
+
logger;
|
|
6
|
+
gasPrice;
|
|
7
|
+
txCount;
|
|
8
|
+
txDuration;
|
|
9
|
+
txGas;
|
|
10
|
+
txCalldataSize;
|
|
11
|
+
txCalldataGas;
|
|
12
|
+
txBlobDataGasUsed;
|
|
13
|
+
txBlobDataGasCost;
|
|
14
|
+
blobCountHistogram;
|
|
15
|
+
blobInclusionBlocksHistogram;
|
|
16
|
+
blobTxSuccessCounter;
|
|
17
|
+
blobTxFailureCounter;
|
|
18
|
+
senderBalance;
|
|
19
|
+
constructor(client, name = 'SequencerPublisher', logger = createLogger('sequencer:publisher:metrics')){
|
|
20
|
+
this.logger = logger;
|
|
21
|
+
const meter = client.getMeter(name);
|
|
22
|
+
this.gasPrice = meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE, {
|
|
23
|
+
description: 'The gas price used for transactions',
|
|
24
|
+
unit: 'gwei',
|
|
25
|
+
valueType: ValueType.DOUBLE
|
|
26
|
+
});
|
|
27
|
+
this.txCount = meter.createUpDownCounter(Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
28
|
+
description: 'The number of transactions processed'
|
|
29
|
+
});
|
|
30
|
+
this.txDuration = meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION, {
|
|
31
|
+
description: 'The duration of transaction processing',
|
|
32
|
+
unit: 'ms',
|
|
33
|
+
valueType: ValueType.INT
|
|
34
|
+
});
|
|
35
|
+
this.txGas = meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS, {
|
|
36
|
+
description: 'The gas consumed by transactions',
|
|
37
|
+
unit: 'gas',
|
|
38
|
+
valueType: ValueType.INT
|
|
39
|
+
});
|
|
40
|
+
this.txCalldataSize = meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE, {
|
|
41
|
+
description: 'The size of the calldata in transactions',
|
|
42
|
+
unit: 'By',
|
|
43
|
+
valueType: ValueType.INT
|
|
44
|
+
});
|
|
45
|
+
this.txCalldataGas = meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS, {
|
|
46
|
+
description: 'The gas consumed by the calldata in transactions',
|
|
47
|
+
unit: 'gas',
|
|
48
|
+
valueType: ValueType.INT
|
|
49
|
+
});
|
|
50
|
+
this.txBlobDataGasUsed = meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED, {
|
|
51
|
+
description: 'The amount of blob gas used in transactions',
|
|
52
|
+
unit: 'gas',
|
|
53
|
+
valueType: ValueType.INT
|
|
54
|
+
});
|
|
55
|
+
this.txBlobDataGasCost = meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST, {
|
|
56
|
+
description: 'The gas cost of blobs in transactions',
|
|
57
|
+
unit: 'gwei',
|
|
58
|
+
valueType: ValueType.INT
|
|
59
|
+
});
|
|
60
|
+
this.blobCountHistogram = meter.createHistogram(Metrics.L1_PUBLISHER_BLOB_COUNT, {
|
|
61
|
+
description: 'Number of blobs in L1 transactions',
|
|
62
|
+
unit: 'blobs',
|
|
63
|
+
valueType: ValueType.INT
|
|
64
|
+
});
|
|
65
|
+
this.blobInclusionBlocksHistogram = meter.createHistogram(Metrics.L1_PUBLISHER_BLOB_INCLUSION_BLOCKS, {
|
|
66
|
+
description: 'Number of L1 blocks between blob tx submission and inclusion',
|
|
67
|
+
unit: 'blocks',
|
|
68
|
+
valueType: ValueType.INT
|
|
69
|
+
});
|
|
70
|
+
this.blobTxSuccessCounter = meter.createUpDownCounter(Metrics.L1_PUBLISHER_BLOB_TX_SUCCESS, {
|
|
71
|
+
description: 'Number of successful L1 transactions with blobs'
|
|
72
|
+
});
|
|
73
|
+
this.blobTxFailureCounter = meter.createUpDownCounter(Metrics.L1_PUBLISHER_BLOB_TX_FAILURE, {
|
|
74
|
+
description: 'Number of failed L1 transactions with blobs'
|
|
75
|
+
});
|
|
76
|
+
this.senderBalance = meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
|
|
77
|
+
unit: 'eth',
|
|
78
|
+
description: 'The balance of the sender address',
|
|
79
|
+
valueType: ValueType.DOUBLE
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
recordFailedTx(txType) {
|
|
83
|
+
this.txCount.add(1, {
|
|
84
|
+
[Attributes.L1_TX_TYPE]: txType,
|
|
85
|
+
[Attributes.OK]: false
|
|
86
|
+
});
|
|
87
|
+
if (txType === 'process') {
|
|
88
|
+
this.blobTxFailureCounter.add(1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
recordProcessBlockTx(durationMs, stats) {
|
|
92
|
+
this.recordTx('process', durationMs, stats);
|
|
93
|
+
if (stats.blobCount && stats.blobCount > 0) {
|
|
94
|
+
this.blobCountHistogram.record(stats.blobCount);
|
|
95
|
+
if (stats.inclusionBlocks !== undefined) {
|
|
96
|
+
this.blobInclusionBlocksHistogram.record(stats.inclusionBlocks);
|
|
97
|
+
}
|
|
98
|
+
this.blobTxSuccessCounter.add(1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
recordSenderBalance(wei, senderAddress) {
|
|
102
|
+
const eth = parseFloat(formatEther(wei, 'wei'));
|
|
103
|
+
this.senderBalance.record(eth, {
|
|
104
|
+
[Attributes.SENDER_ADDRESS]: senderAddress
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
recordTx(txType, durationMs, stats) {
|
|
108
|
+
const attributes = {
|
|
109
|
+
[Attributes.L1_TX_TYPE]: txType,
|
|
110
|
+
[Attributes.L1_SENDER]: stats.sender
|
|
111
|
+
};
|
|
112
|
+
this.txCount.add(1, {
|
|
113
|
+
...attributes,
|
|
114
|
+
[Attributes.OK]: true
|
|
115
|
+
});
|
|
116
|
+
this.txDuration.record(Math.ceil(durationMs), attributes);
|
|
117
|
+
this.txGas.record(// safe to downcast - total block limit is 30M gas which fits in a JS number
|
|
118
|
+
Number(stats.gasUsed), attributes);
|
|
119
|
+
this.txCalldataGas.record(stats.calldataGas, attributes);
|
|
120
|
+
this.txCalldataSize.record(stats.calldataSize, attributes);
|
|
121
|
+
this.txBlobDataGasCost.record(Number(stats.blobDataGas), attributes);
|
|
122
|
+
this.txBlobDataGasUsed.record(Number(stats.blobGasUsed), attributes);
|
|
123
|
+
try {
|
|
124
|
+
this.gasPrice.record(parseInt(formatEther(stats.gasPrice, 'gwei'), 10));
|
|
125
|
+
} catch (e) {
|
|
126
|
+
// ignore
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import type { L2Block } from '@aztec/aztec.js';
|
|
4
|
+
import { Blob } from '@aztec/blob-lib';
|
|
5
|
+
import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
6
|
+
import type { EpochCache } from '@aztec/epoch-cache';
|
|
7
|
+
import { type ForwarderContract, type GasPrice, type GovernanceProposerContract, type L1BlobInputs, type L1ContractsConfig, type L1GasConfig, type L1TxRequest, RollupContract, type SlashingProposerContract, type TransactionStats } from '@aztec/ethereum';
|
|
8
|
+
import type { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
9
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
|
+
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
11
|
+
import { type BlockHeader, TxHash } from '@aztec/stdlib/tx';
|
|
12
|
+
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
13
|
+
import { type TransactionReceipt } from 'viem';
|
|
14
|
+
import type { PublisherConfig, TxSenderConfig } from './config.js';
|
|
15
|
+
export declare enum VoteType {
|
|
16
|
+
GOVERNANCE = 0,
|
|
17
|
+
SLASHING = 1
|
|
18
|
+
}
|
|
19
|
+
type GetSlashPayloadCallBack = (slotNumber: bigint) => Promise<EthAddress | undefined>;
|
|
20
|
+
type Action = 'propose' | 'governance-vote' | 'slashing-vote';
|
|
21
|
+
interface RequestWithExpiry {
|
|
22
|
+
action: Action;
|
|
23
|
+
request: L1TxRequest;
|
|
24
|
+
lastValidL2Slot: bigint;
|
|
25
|
+
gasConfig?: L1GasConfig;
|
|
26
|
+
blobConfig?: L1BlobInputs;
|
|
27
|
+
onResult?: (request: L1TxRequest, result?: {
|
|
28
|
+
receipt: TransactionReceipt;
|
|
29
|
+
gasPrice: GasPrice;
|
|
30
|
+
stats?: TransactionStats;
|
|
31
|
+
errorMsg?: string;
|
|
32
|
+
}) => void;
|
|
33
|
+
}
|
|
34
|
+
export declare class SequencerPublisher {
|
|
35
|
+
private interrupted;
|
|
36
|
+
private metrics;
|
|
37
|
+
private epochCache;
|
|
38
|
+
private forwarderContract;
|
|
39
|
+
protected governanceLog: import("@aztec/aztec.js").Logger;
|
|
40
|
+
protected governanceProposerAddress?: EthAddress;
|
|
41
|
+
private governancePayload;
|
|
42
|
+
protected slashingLog: import("@aztec/aztec.js").Logger;
|
|
43
|
+
protected slashingProposerAddress?: EthAddress;
|
|
44
|
+
private getSlashPayload?;
|
|
45
|
+
private myLastVotes;
|
|
46
|
+
protected log: import("@aztec/aztec.js").Logger;
|
|
47
|
+
protected ethereumSlotDuration: bigint;
|
|
48
|
+
private blobSinkClient;
|
|
49
|
+
static PROPOSE_GAS_GUESS: bigint;
|
|
50
|
+
l1TxUtils: L1TxUtilsWithBlobs;
|
|
51
|
+
rollupContract: RollupContract;
|
|
52
|
+
govProposerContract: GovernanceProposerContract;
|
|
53
|
+
slashingProposerContract: SlashingProposerContract;
|
|
54
|
+
protected requests: RequestWithExpiry[];
|
|
55
|
+
constructor(config: TxSenderConfig & PublisherConfig & Pick<L1ContractsConfig, 'ethereumSlotDuration'>, deps: {
|
|
56
|
+
telemetry?: TelemetryClient;
|
|
57
|
+
blobSinkClient?: BlobSinkClientInterface;
|
|
58
|
+
forwarderContract: ForwarderContract;
|
|
59
|
+
l1TxUtils: L1TxUtilsWithBlobs;
|
|
60
|
+
rollupContract: RollupContract;
|
|
61
|
+
slashingProposerContract: SlashingProposerContract;
|
|
62
|
+
governanceProposerContract: GovernanceProposerContract;
|
|
63
|
+
epochCache: EpochCache;
|
|
64
|
+
});
|
|
65
|
+
registerSlashPayloadGetter(callback: GetSlashPayloadCallBack): void;
|
|
66
|
+
getForwarderAddress(): EthAddress;
|
|
67
|
+
getSenderAddress(): EthAddress;
|
|
68
|
+
getGovernancePayload(): EthAddress;
|
|
69
|
+
setGovernancePayload(payload: EthAddress): void;
|
|
70
|
+
addRequest(request: RequestWithExpiry): void;
|
|
71
|
+
getCurrentL2Slot(): bigint;
|
|
72
|
+
/**
|
|
73
|
+
* Sends all requests that are still valid.
|
|
74
|
+
* @returns one of:
|
|
75
|
+
* - A receipt and stats if the tx succeeded
|
|
76
|
+
* - a receipt and errorMsg if it failed on L1
|
|
77
|
+
* - undefined if no valid requests are found OR the tx failed to send.
|
|
78
|
+
*/
|
|
79
|
+
sendRequests(): Promise<{
|
|
80
|
+
receipt: TransactionReceipt<bigint, number, "success" | "reverted", import("viem").TransactionType>;
|
|
81
|
+
gasPrice: GasPrice;
|
|
82
|
+
stats: TransactionStats | undefined;
|
|
83
|
+
errorMsg?: undefined;
|
|
84
|
+
} | {
|
|
85
|
+
receipt: TransactionReceipt<bigint, number, "success" | "reverted", import("viem").TransactionType>;
|
|
86
|
+
gasPrice: GasPrice;
|
|
87
|
+
errorMsg: string | undefined;
|
|
88
|
+
stats?: undefined;
|
|
89
|
+
} | undefined>;
|
|
90
|
+
private callbackBundledTransactions;
|
|
91
|
+
/**
|
|
92
|
+
* @notice Will call `canProposeAtNextEthBlock` to make sure that it is possible to propose
|
|
93
|
+
* @param tipArchive - The archive to check
|
|
94
|
+
* @returns The slot and block number if it is possible to propose, undefined otherwise
|
|
95
|
+
*/
|
|
96
|
+
canProposeAtNextEthBlock(tipArchive: Buffer): Promise<[bigint, bigint] | undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* @notice Will call `validateHeader` to make sure that it is possible to propose
|
|
99
|
+
*
|
|
100
|
+
* @dev Throws if unable to propose
|
|
101
|
+
*
|
|
102
|
+
* @param header - The header to propose
|
|
103
|
+
* @param digest - The digest that attestations are signing over
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
106
|
+
validateBlockForSubmission(header: BlockHeader, attestationData?: {
|
|
107
|
+
digest: Buffer;
|
|
108
|
+
signatures: Signature[];
|
|
109
|
+
}): Promise<bigint>;
|
|
110
|
+
getCurrentEpochCommittee(): Promise<EthAddress[]>;
|
|
111
|
+
private enqueueCastVoteHelper;
|
|
112
|
+
private getVoteConfig;
|
|
113
|
+
/**
|
|
114
|
+
* Enqueues a castVote transaction to cast a vote for a given slot number.
|
|
115
|
+
* @param slotNumber - The slot number to cast a vote for.
|
|
116
|
+
* @param timestamp - The timestamp of the slot to cast a vote for.
|
|
117
|
+
* @param voteType - The type of vote to cast.
|
|
118
|
+
* @returns True if the vote was successfully enqueued, false otherwise.
|
|
119
|
+
*/
|
|
120
|
+
enqueueCastVote(slotNumber: bigint, timestamp: bigint, voteType: VoteType): Promise<boolean>;
|
|
121
|
+
/**
|
|
122
|
+
* Proposes a L2 block on L1.
|
|
123
|
+
*
|
|
124
|
+
* @param block - L2 block to propose.
|
|
125
|
+
* @returns True if the tx has been enqueued, throws otherwise. See #9315
|
|
126
|
+
*/
|
|
127
|
+
enqueueProposeL2Block(block: L2Block, attestations?: Signature[], txHashes?: TxHash[], opts?: {
|
|
128
|
+
txTimeoutAt?: Date;
|
|
129
|
+
}): Promise<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Calling `interrupt` will cause any in progress call to `publishRollup` to return `false` asap.
|
|
132
|
+
* Be warned, the call may return false even if the tx subsequently gets successfully mined.
|
|
133
|
+
* In practice this shouldn't matter, as we'll only ever be calling `interrupt` when we know it's going to fail.
|
|
134
|
+
* A call to `restart` is required before you can continue publishing.
|
|
135
|
+
*/
|
|
136
|
+
interrupt(): void;
|
|
137
|
+
/** Restarts the publisher after calling `interrupt`. */
|
|
138
|
+
restart(): void;
|
|
139
|
+
private prepareProposeTx;
|
|
140
|
+
private addProposeTx;
|
|
141
|
+
/**
|
|
142
|
+
* Send blobs to the blob sink
|
|
143
|
+
*
|
|
144
|
+
* If a blob sink url is configured, then we send blobs to the blob sink
|
|
145
|
+
* - for now we use the blockHash as the identifier for the blobs;
|
|
146
|
+
* In the future this will move to be the beacon block id - which takes a bit more work
|
|
147
|
+
* to calculate and will need to be mocked in e2e tests
|
|
148
|
+
*/
|
|
149
|
+
protected sendBlobsToBlobSink(blockHash: string, blobs: Blob[]): Promise<boolean>;
|
|
150
|
+
}
|
|
151
|
+
export {};
|
|
152
|
+
//# sourceMappingURL=sequencer-publisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequencer-publisher.d.ts","sourceRoot":"","sources":["../../src/publisher/sequencer-publisher.ts"],"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