@aztec/sequencer-client 0.0.1-commit.9b94fc1 → 0.0.1-commit.9ee6fcc6
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 +24 -16
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +73 -32
- package/dest/config.d.ts +35 -9
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +106 -44
- package/dest/global_variable_builder/global_builder.d.ts +27 -14
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +65 -54
- package/dest/global_variable_builder/index.d.ts +2 -2
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/index.d.ts +2 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/publisher/config.d.ts +53 -20
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +124 -39
- 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 +15 -6
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +28 -3
- package/dest/publisher/sequencer-publisher-metrics.d.ts +3 -3
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +23 -86
- package/dest/publisher/sequencer-publisher.d.ts +79 -49
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +932 -155
- package/dest/sequencer/checkpoint_proposal_job.d.ts +108 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +1289 -0
- package/dest/sequencer/checkpoint_voter.d.ts +35 -0
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_voter.js +109 -0
- package/dest/sequencer/config.d.ts +3 -2
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/events.d.ts +47 -0
- package/dest/sequencer/events.d.ts.map +1 -0
- package/dest/sequencer/events.js +1 -0
- package/dest/sequencer/index.d.ts +4 -2
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +3 -1
- package/dest/sequencer/metrics.d.ts +42 -6
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +227 -72
- package/dest/sequencer/sequencer.d.ts +125 -134
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +754 -652
- package/dest/sequencer/timetable.d.ts +54 -16
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +147 -62
- package/dest/sequencer/types.d.ts +3 -0
- package/dest/sequencer/types.d.ts.map +1 -0
- package/dest/sequencer/types.js +1 -0
- package/dest/sequencer/utils.d.ts +14 -8
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +7 -4
- package/dest/test/index.d.ts +6 -7
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +95 -0
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
- package/dest/test/mock_checkpoint_builder.js +231 -0
- package/dest/test/utils.d.ts +53 -0
- package/dest/test/utils.d.ts.map +1 -0
- package/dest/test/utils.js +104 -0
- package/package.json +31 -30
- package/src/client/sequencer-client.ts +97 -55
- package/src/config.ts +124 -53
- package/src/global_variable_builder/global_builder.ts +76 -73
- package/src/global_variable_builder/index.ts +1 -1
- package/src/index.ts +1 -7
- package/src/publisher/config.ts +163 -50
- 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 +43 -10
- package/src/publisher/sequencer-publisher-metrics.ts +19 -71
- package/src/publisher/sequencer-publisher.ts +635 -200
- package/src/sequencer/README.md +531 -0
- package/src/sequencer/checkpoint_proposal_job.ts +1049 -0
- package/src/sequencer/checkpoint_voter.ts +130 -0
- package/src/sequencer/config.ts +2 -1
- package/src/sequencer/events.ts +27 -0
- package/src/sequencer/index.ts +3 -1
- package/src/sequencer/metrics.ts +282 -82
- package/src/sequencer/sequencer.ts +521 -859
- package/src/sequencer/timetable.ts +178 -83
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +18 -9
- package/src/test/index.ts +5 -6
- package/src/test/mock_checkpoint_builder.ts +323 -0
- package/src/test/utils.ts +167 -0
- package/dest/sequencer/block_builder.d.ts +0 -27
- package/dest/sequencer/block_builder.d.ts.map +0 -1
- package/dest/sequencer/block_builder.js +0 -134
- package/dest/tx_validator/nullifier_cache.d.ts +0 -14
- package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
- package/dest/tx_validator/nullifier_cache.js +0 -24
- package/dest/tx_validator/tx_validator_factory.d.ts +0 -17
- package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
- package/dest/tx_validator/tx_validator_factory.js +0 -53
- package/src/sequencer/block_builder.ts +0 -222
- package/src/tx_validator/nullifier_cache.ts +0 -30
- package/src/tx_validator/tx_validator_factory.ts +0 -132
|
@@ -1,34 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
2
|
+
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
3
|
+
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import type { DateProvider } from '@aztec/foundation/timer';
|
|
4
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
+
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
5
8
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
6
|
-
import type { GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@aztec/stdlib/tx';
|
|
9
|
+
import type { CheckpointGlobalVariables, GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@aztec/stdlib/tx';
|
|
7
10
|
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
11
|
+
/** Configuration for the GlobalVariableBuilder (excludes L1 client config). */
|
|
12
|
+
export type GlobalVariableBuilderConfig = {
|
|
13
|
+
l1Contracts: Pick<L1ContractAddresses, 'rollupAddress'>;
|
|
14
|
+
ethereumSlotDuration: number;
|
|
15
|
+
rollupVersion: bigint;
|
|
16
|
+
} & Pick<L1RollupConstants, 'slotDuration' | 'l1GenesisTime'>;
|
|
8
17
|
/**
|
|
9
18
|
* Simple global variables builder.
|
|
10
19
|
*/
|
|
11
20
|
export declare class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
21
|
+
private readonly dateProvider;
|
|
22
|
+
private readonly publicClient;
|
|
12
23
|
private log;
|
|
13
|
-
private
|
|
24
|
+
private currentMinFees;
|
|
14
25
|
private currentL1BlockNumber;
|
|
15
26
|
private readonly rollupContract;
|
|
16
|
-
private readonly publicClient;
|
|
17
27
|
private readonly ethereumSlotDuration;
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
|
|
21
|
-
private
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
private readonly aztecSlotDuration;
|
|
29
|
+
private readonly l1GenesisTime;
|
|
30
|
+
private chainId;
|
|
31
|
+
private version;
|
|
32
|
+
constructor(dateProvider: DateProvider, publicClient: ViemPublicClient, config: GlobalVariableBuilderConfig);
|
|
33
|
+
private computeCurrentMinFees;
|
|
34
|
+
getCurrentMinFees(): Promise<GasFees>;
|
|
24
35
|
/**
|
|
25
|
-
* Simple builder of global variables
|
|
36
|
+
* Simple builder of global variables.
|
|
26
37
|
* @param blockNumber - The block number to build global variables for.
|
|
27
38
|
* @param coinbase - The address to receive block reward.
|
|
28
39
|
* @param feeRecipient - The address to receive fees.
|
|
29
40
|
* @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
|
|
30
41
|
* @returns The global variables for the given block number.
|
|
31
42
|
*/
|
|
32
|
-
buildGlobalVariables(blockNumber:
|
|
43
|
+
buildGlobalVariables(blockNumber: BlockNumber, coinbase: EthAddress, feeRecipient: AztecAddress, maybeSlot?: SlotNumber): Promise<GlobalVariables>;
|
|
44
|
+
/** Builds global variables that are constant throughout a checkpoint. */
|
|
45
|
+
buildCheckpointGlobalVariables(coinbase: EthAddress, feeRecipient: AztecAddress, slotNumber: SlotNumber): Promise<CheckpointGlobalVariables>;
|
|
33
46
|
}
|
|
34
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
47
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2xvYmFsX2J1aWxkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9nbG9iYWxfdmFyaWFibGVfYnV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LENBYXBDO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global_builder.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/global_builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"global_builder.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/global_builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,KAAK,iBAAiB,EAA+C,MAAM,6BAA6B,CAAC;AAClH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,IAAI,8BAA8B,EACxD,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,+EAA+E;AAC/E,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IACxD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,IAAI,CAAC,iBAAiB,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC;AAE9D;;GAEG;AACH,qBAAa,qBAAsB,YAAW,8BAA8B;IAcxE,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAd/B,OAAO,CAAC,GAAG,CAAqD;IAChE,OAAO,CAAC,cAAc,CAAwD;IAC9E,OAAO,CAAC,oBAAoB,CAAiC;IAE7D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IAEvC,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,OAAO,CAAK;IAEpB,YACmB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,gBAAgB,EAC/C,MAAM,EAAE,2BAA2B,EAUpC;YAMa,qBAAqB;IAkBtB,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAUjD;IAED;;;;;;;OAOG;IACU,oBAAoB,CAC/B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,SAAS,CAAC,EAAE,UAAU,GACrB,OAAO,CAAC,eAAe,CAAC,CAY1B;IAED,yEAAyE;IAC5D,8BAA8B,CACzC,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,yBAAyB,CAAC,CAapC;CACF"}
|
|
@@ -1,87 +1,98 @@
|
|
|
1
|
-
import { RollupContract
|
|
1
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
2
2
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
+
import { getNextL1SlotTimestamp, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
5
6
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
6
7
|
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
7
|
-
import { createPublicClient, fallback, http } from 'viem';
|
|
8
8
|
/**
|
|
9
9
|
* Simple global variables builder.
|
|
10
10
|
*/ export class GlobalVariableBuilder {
|
|
11
|
-
|
|
12
|
-
currentBaseFees = Promise.resolve(new GasFees(0, 0));
|
|
13
|
-
currentL1BlockNumber = undefined;
|
|
14
|
-
rollupContract;
|
|
11
|
+
dateProvider;
|
|
15
12
|
publicClient;
|
|
13
|
+
log;
|
|
14
|
+
currentMinFees;
|
|
15
|
+
currentL1BlockNumber;
|
|
16
|
+
rollupContract;
|
|
16
17
|
ethereumSlotDuration;
|
|
18
|
+
aztecSlotDuration;
|
|
19
|
+
l1GenesisTime;
|
|
17
20
|
chainId;
|
|
18
21
|
version;
|
|
19
|
-
constructor(config){
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
constructor(dateProvider, publicClient, config){
|
|
23
|
+
this.dateProvider = dateProvider;
|
|
24
|
+
this.publicClient = publicClient;
|
|
25
|
+
this.log = createLogger('sequencer:global_variable_builder');
|
|
26
|
+
this.currentMinFees = Promise.resolve(new GasFees(0, 0));
|
|
27
|
+
this.currentL1BlockNumber = undefined;
|
|
28
|
+
this.version = new Fr(config.rollupVersion);
|
|
29
|
+
this.chainId = new Fr(this.publicClient.chain.id);
|
|
22
30
|
this.ethereumSlotDuration = config.ethereumSlotDuration;
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
pollingInterval: config.viemPollingIntervalMS
|
|
27
|
-
});
|
|
28
|
-
this.rollupContract = new RollupContract(this.publicClient, l1Contracts.rollupAddress);
|
|
31
|
+
this.aztecSlotDuration = config.slotDuration;
|
|
32
|
+
this.l1GenesisTime = config.l1GenesisTime;
|
|
33
|
+
this.rollupContract = new RollupContract(this.publicClient, config.l1Contracts.rollupAddress);
|
|
29
34
|
}
|
|
30
35
|
/**
|
|
31
|
-
* Computes the "current"
|
|
32
|
-
* @returns
|
|
33
|
-
*/ async
|
|
36
|
+
* Computes the "current" min fees, e.g., the price that you currently should pay to get include in the next block
|
|
37
|
+
* @returns Min fees for the next block
|
|
38
|
+
*/ async computeCurrentMinFees() {
|
|
34
39
|
// Since this might be called in the middle of a slot where a block might have been published,
|
|
35
40
|
// we need to fetch the last block written, and estimate the earliest timestamp for the next block.
|
|
36
41
|
// The timestamp of that last block will act as a lower bound for the next block.
|
|
37
|
-
const
|
|
38
|
-
const earliestTimestamp = await this.rollupContract.getTimestampForSlot(SlotNumber.fromBigInt(
|
|
39
|
-
const nextEthTimestamp =
|
|
42
|
+
const lastCheckpoint = await this.rollupContract.getPendingCheckpoint();
|
|
43
|
+
const earliestTimestamp = await this.rollupContract.getTimestampForSlot(SlotNumber.fromBigInt(BigInt(lastCheckpoint.slotNumber) + 1n));
|
|
44
|
+
const nextEthTimestamp = getNextL1SlotTimestamp(this.dateProvider.nowInSeconds(), {
|
|
45
|
+
l1GenesisTime: this.l1GenesisTime,
|
|
46
|
+
ethereumSlotDuration: this.ethereumSlotDuration
|
|
47
|
+
});
|
|
40
48
|
const timestamp = earliestTimestamp > nextEthTimestamp ? earliestTimestamp : nextEthTimestamp;
|
|
41
|
-
return new GasFees(0, await this.rollupContract.
|
|
49
|
+
return new GasFees(0, await this.rollupContract.getManaMinFeeAt(timestamp, true));
|
|
42
50
|
}
|
|
43
|
-
async
|
|
51
|
+
async getCurrentMinFees() {
|
|
44
52
|
// Get the current block number
|
|
45
53
|
const blockNumber = await this.publicClient.getBlockNumber();
|
|
46
|
-
// If the L1 block number has changed then chain a new promise to get the current
|
|
54
|
+
// If the L1 block number has changed then chain a new promise to get the current min fees
|
|
47
55
|
if (this.currentL1BlockNumber === undefined || blockNumber > this.currentL1BlockNumber) {
|
|
48
56
|
this.currentL1BlockNumber = blockNumber;
|
|
49
|
-
this.
|
|
57
|
+
this.currentMinFees = this.currentMinFees.then(()=>this.computeCurrentMinFees());
|
|
50
58
|
}
|
|
51
|
-
return this.
|
|
52
|
-
}
|
|
53
|
-
async getGlobalConstantVariables() {
|
|
54
|
-
if (!this.chainId) {
|
|
55
|
-
this.chainId = new Fr(this.publicClient.chain.id);
|
|
56
|
-
}
|
|
57
|
-
if (!this.version) {
|
|
58
|
-
this.version = new Fr(await this.rollupContract.getVersion());
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
chainId: this.chainId,
|
|
62
|
-
version: this.version
|
|
63
|
-
};
|
|
59
|
+
return this.currentMinFees;
|
|
64
60
|
}
|
|
65
61
|
/**
|
|
66
|
-
* Simple builder of global variables
|
|
62
|
+
* Simple builder of global variables.
|
|
67
63
|
* @param blockNumber - The block number to build global variables for.
|
|
68
64
|
* @param coinbase - The address to receive block reward.
|
|
69
65
|
* @param feeRecipient - The address to receive fees.
|
|
70
66
|
* @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
|
|
71
67
|
* @returns The global variables for the given block number.
|
|
72
|
-
*/ async buildGlobalVariables(blockNumber, coinbase, feeRecipient,
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
68
|
+
*/ async buildGlobalVariables(blockNumber, coinbase, feeRecipient, maybeSlot) {
|
|
69
|
+
const slot = maybeSlot ?? await this.rollupContract.getSlotAt(getNextL1SlotTimestamp(this.dateProvider.nowInSeconds(), {
|
|
70
|
+
l1GenesisTime: this.l1GenesisTime,
|
|
71
|
+
ethereumSlotDuration: this.ethereumSlotDuration
|
|
72
|
+
}));
|
|
73
|
+
const checkpointGlobalVariables = await this.buildCheckpointGlobalVariables(coinbase, feeRecipient, slot);
|
|
74
|
+
return GlobalVariables.from({
|
|
75
|
+
blockNumber,
|
|
76
|
+
...checkpointGlobalVariables
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/** Builds global variables that are constant throughout a checkpoint. */ async buildCheckpointGlobalVariables(coinbase, feeRecipient, slotNumber) {
|
|
80
|
+
const { chainId, version } = this;
|
|
81
|
+
const timestamp = getTimestampForSlot(slotNumber, {
|
|
82
|
+
slotDuration: this.aztecSlotDuration,
|
|
83
|
+
l1GenesisTime: this.l1GenesisTime
|
|
84
|
+
});
|
|
85
|
+
// We can skip much of the logic in getCurrentMinFees since it we already check that we are not within a slot elsewhere.
|
|
86
|
+
// TODO(palla/mbps): Can we use a cached value here?
|
|
87
|
+
const gasFees = new GasFees(0, await this.rollupContract.getManaMinFeeAt(timestamp, true));
|
|
88
|
+
return {
|
|
89
|
+
chainId,
|
|
90
|
+
version,
|
|
91
|
+
slotNumber,
|
|
92
|
+
timestamp,
|
|
93
|
+
coinbase,
|
|
94
|
+
feeRecipient,
|
|
95
|
+
gasFees
|
|
96
|
+
};
|
|
86
97
|
}
|
|
87
98
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { GlobalVariableBuilder } from './global_builder.js';
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
export { GlobalVariableBuilder, type GlobalVariableBuilderConfig } from './global_builder.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9nbG9iYWxfdmFyaWFibGVfYnVpbGRlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUscUJBQXFCLEVBQUUsS0FBSywyQkFBMkIsRUFBRSxNQUFNLHFCQUFxQixDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/global_variable_builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,2BAA2B,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dest/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './client/index.js';
|
|
2
2
|
export * from './config.js';
|
|
3
3
|
export * from './publisher/index.js';
|
|
4
|
-
export {
|
|
5
|
-
export * from './tx_validator/tx_validator_factory.js';
|
|
4
|
+
export { Sequencer, SequencerState, type SequencerEvents } from './sequencer/index.js';
|
|
6
5
|
export * from './global_variable_builder/index.js';
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsT0FBTyxFQUFFLFNBQVMsRUFBRSxjQUFjLEVBQUUsS0FBSyxlQUFlLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUl2RixjQUFjLG9DQUFvQyxDQUFDIn0=
|
package/dest/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvF,cAAc,oCAAoC,CAAC"}
|
package/dest/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export * from './client/index.js';
|
|
2
2
|
export * from './config.js';
|
|
3
3
|
export * from './publisher/index.js';
|
|
4
|
-
export {
|
|
5
|
-
export * from './tx_validator/tx_validator_factory.js';
|
|
4
|
+
export { Sequencer, SequencerState } from './sequencer/index.js';
|
|
6
5
|
// Used by the node to simulate public parts of transactions. Should these be moved to a shared library?
|
|
7
6
|
// ISSUE(#9832)
|
|
8
7
|
export * from './global_variable_builder/index.js';
|
|
@@ -1,31 +1,64 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type L1ReaderConfig
|
|
1
|
+
import { type BlobClientConfig } from '@aztec/blob-client/client/config';
|
|
2
|
+
import { type L1ReaderConfig } from '@aztec/ethereum/l1-reader';
|
|
3
|
+
import { type L1TxUtilsConfig } from '@aztec/ethereum/l1-tx-utils/config';
|
|
3
4
|
import { type ConfigMappingsType, SecretValue } from '@aztec/foundation/config';
|
|
4
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
-
/**
|
|
6
|
-
* The configuration of the rollup transaction publisher.
|
|
7
|
-
*/
|
|
6
|
+
/** Configuration of the transaction publisher. */
|
|
8
7
|
export type TxSenderConfig = L1ReaderConfig & {
|
|
9
|
-
/**
|
|
10
|
-
* The private key to be used by the publisher.
|
|
11
|
-
*/
|
|
8
|
+
/** The private key to be used by the publisher. */
|
|
12
9
|
publisherPrivateKeys?: SecretValue<`0x${string}`>[];
|
|
13
|
-
/**
|
|
14
|
-
* Publisher addresses to be used with a remote signer
|
|
15
|
-
*/
|
|
10
|
+
/** Publisher addresses to be used with a remote signer */
|
|
16
11
|
publisherAddresses?: EthAddress[];
|
|
17
12
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
export type ProverTxSenderConfig = L1ReaderConfig & {
|
|
14
|
+
proverPublisherPrivateKeys?: SecretValue<`0x${string}`>[];
|
|
15
|
+
proverPublisherAddresses?: EthAddress[];
|
|
16
|
+
};
|
|
17
|
+
export type SequencerTxSenderConfig = L1ReaderConfig & {
|
|
18
|
+
sequencerPublisherPrivateKeys?: SecretValue<`0x${string}`>[];
|
|
19
|
+
sequencerPublisherAddresses?: EthAddress[];
|
|
20
|
+
};
|
|
21
|
+
export declare function getTxSenderConfigFromProverConfig(config: ProverTxSenderConfig): TxSenderConfig;
|
|
22
|
+
export declare function getTxSenderConfigFromSequencerConfig(config: SequencerTxSenderConfig): TxSenderConfig;
|
|
23
|
+
/** Configuration of the L1Publisher. */
|
|
24
|
+
export type PublisherConfig = L1TxUtilsConfig & BlobClientConfig & {
|
|
22
25
|
/** True to use publishers in invalid states (timed out, cancelled, etc) if no other is available */
|
|
23
26
|
publisherAllowInvalidStates?: boolean;
|
|
24
27
|
/** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1 */
|
|
25
28
|
fishermanMode?: boolean;
|
|
29
|
+
/** Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only) */
|
|
30
|
+
publisherForwarderAddress?: EthAddress;
|
|
31
|
+
/** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
|
|
32
|
+
l1TxFailedStore?: string;
|
|
33
|
+
/** Min ETH balance below which a publisher gets funded. Undefined = funding disabled. */
|
|
34
|
+
publisherFundingThreshold?: bigint;
|
|
35
|
+
/** Amount of ETH to send when funding a publisher. Undefined = funding disabled. */
|
|
36
|
+
publisherFundingAmount?: bigint;
|
|
37
|
+
};
|
|
38
|
+
export type ProverPublisherConfig = L1TxUtilsConfig & BlobClientConfig & {
|
|
39
|
+
fishermanMode?: boolean;
|
|
40
|
+
proverPublisherAllowInvalidStates?: boolean;
|
|
41
|
+
proverPublisherForwarderAddress?: EthAddress;
|
|
42
|
+
/** Min ETH balance below which a publisher gets funded. Undefined = funding disabled. */
|
|
43
|
+
publisherFundingThreshold?: bigint;
|
|
44
|
+
/** Amount of ETH to send when funding a publisher. Undefined = funding disabled. */
|
|
45
|
+
publisherFundingAmount?: bigint;
|
|
46
|
+
};
|
|
47
|
+
export type SequencerPublisherConfig = L1TxUtilsConfig & BlobClientConfig & {
|
|
48
|
+
fishermanMode?: boolean;
|
|
49
|
+
sequencerPublisherAllowInvalidStates?: boolean;
|
|
50
|
+
sequencerPublisherForwarderAddress?: EthAddress;
|
|
51
|
+
/** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
|
|
52
|
+
l1TxFailedStore?: string;
|
|
53
|
+
/** Min ETH balance below which a publisher gets funded. Undefined = funding disabled. */
|
|
54
|
+
publisherFundingThreshold?: bigint;
|
|
55
|
+
/** Amount of ETH to send when funding a publisher. Undefined = funding disabled. */
|
|
56
|
+
publisherFundingAmount?: bigint;
|
|
26
57
|
};
|
|
27
|
-
export declare
|
|
28
|
-
export declare function
|
|
29
|
-
export declare const
|
|
30
|
-
export declare
|
|
31
|
-
|
|
58
|
+
export declare function getPublisherConfigFromProverConfig(config: ProverPublisherConfig): PublisherConfig;
|
|
59
|
+
export declare function getPublisherConfigFromSequencerConfig(config: SequencerPublisherConfig): PublisherConfig;
|
|
60
|
+
export declare const proverTxSenderConfigMappings: ConfigMappingsType<Omit<ProverTxSenderConfig, 'l1Contracts'>>;
|
|
61
|
+
export declare const sequencerTxSenderConfigMappings: ConfigMappingsType<Omit<SequencerTxSenderConfig, 'l1Contracts'>>;
|
|
62
|
+
export declare const sequencerPublisherConfigMappings: ConfigMappingsType<SequencerPublisherConfig & L1TxUtilsConfig>;
|
|
63
|
+
export declare const proverPublisherConfigMappings: ConfigMappingsType<ProverPublisherConfig & L1TxUtilsConfig>;
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHVibGlzaGVyL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sI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LENBQUMsRUFBRSxPQUFPLENBQUM7SUFDL0Msa0NBQWtDLENBQUMsRUFBRSxVQUFVLENBQUM7SUFDaEQsNEZBQTRGO0lBQzVGLGVBQWUsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUN6Qix5RkFBeUY7SUFDekYseUJBQXlCLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDbkMsb0ZBQW9GO0lBQ3BGLHNCQUFzQixDQUFDLEVBQUUsTUFBTSxDQUFDO0NBQ2pDLENBQUM7QUFFSix3QkFBZ0Isa0NBQWtDLENBQUMsTUFBTSxFQUFFLHFCQUFxQixHQUFHLGVBQWUsQ0FNakc7QUFFRCx3QkFBZ0IscUNBQXFDLENBQUMsTUFBTSxFQUFFLHdCQUF3QixHQUFHLGVBQWUsQ0FPdkc7QUFFRCxlQUFPLE1BQU0sNEJBQTRCLEVBQUUsa0JBQWtCLENBQUMsSUFBSSxDQUFDLG9CQUFvQixFQUFFLGFBQWEsQ0FBQyxDQWV0RyxDQUFDO0FBRUYsZUFBTyxNQUFNLCtCQUErQixFQUFFLGtCQUFrQixDQUFDLElBQUksQ0FBQyx1QkFBdUIsRUFBRSxhQUFhLENBQUMsQ0FlNUcsQ0FBQztBQUVGLGVBQU8sTUFBTSxnQ0FBZ0MsRUFBRSxrQkFBa0IsQ0FBQyx3QkFBd0IsR0FBRyxlQUFlLENBd0IzRyxDQUFDO0FBRUYsZUFBTyxNQUFNLDZCQUE2QixFQUFFLGtCQUFrQixDQUFDLHFCQUFxQixHQUFHLGVBQWUsQ0FvQnJHLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/publisher/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/publisher/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAA2B,MAAM,kCAAkC,C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AG,eAAe,CAoBrG,CAAC"}
|
package/dest/publisher/config.js
CHANGED
|
@@ -1,42 +1,127 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l1ReaderConfigMappings
|
|
3
|
-
import {
|
|
1
|
+
import { blobClientConfigMapping } from '@aztec/blob-client/client/config';
|
|
2
|
+
import { l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
3
|
+
import { l1TxUtilsConfigMappings } from '@aztec/ethereum/l1-tx-utils/config';
|
|
4
|
+
import { SecretValue, booleanConfigHelper } from '@aztec/foundation/config';
|
|
4
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
fallback: [
|
|
13
|
-
scope === 'PROVER' ? `PROVER_PUBLISHER_PRIVATE_KEY` : `SEQ_PUBLISHER_PRIVATE_KEY`
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
publisherAddresses: {
|
|
17
|
-
env: scope === 'PROVER' ? `PROVER_PUBLISHER_ADDRESSES` : `SEQ_PUBLISHER_ADDRESSES`,
|
|
18
|
-
description: 'The addresses of the publishers to use with remote signers',
|
|
19
|
-
parseEnv: (val)=>val.split(',').map((address)=>EthAddress.fromString(address)),
|
|
20
|
-
defaultValue: []
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
export function getTxSenderConfigFromEnv(scope) {
|
|
24
|
-
return getConfigFromMappings(getTxSenderConfigMappings(scope));
|
|
6
|
+
import { parseEther } from 'viem';
|
|
7
|
+
export function getTxSenderConfigFromProverConfig(config) {
|
|
8
|
+
return {
|
|
9
|
+
...config,
|
|
10
|
+
publisherPrivateKeys: config.proverPublisherPrivateKeys,
|
|
11
|
+
publisherAddresses: config.proverPublisherAddresses
|
|
12
|
+
};
|
|
25
13
|
}
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
fishermanMode: {
|
|
33
|
-
env: 'FISHERMAN_MODE',
|
|
34
|
-
description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
|
|
35
|
-
...booleanConfigHelper(false)
|
|
36
|
-
},
|
|
37
|
-
...l1TxUtilsConfigMappings,
|
|
38
|
-
...blobSinkConfigMapping
|
|
39
|
-
});
|
|
40
|
-
export function getPublisherConfigFromEnv(scope) {
|
|
41
|
-
return getConfigFromMappings(getPublisherConfigMappings(scope));
|
|
14
|
+
export function getTxSenderConfigFromSequencerConfig(config) {
|
|
15
|
+
return {
|
|
16
|
+
...config,
|
|
17
|
+
publisherPrivateKeys: config.sequencerPublisherPrivateKeys,
|
|
18
|
+
publisherAddresses: config.sequencerPublisherAddresses
|
|
19
|
+
};
|
|
42
20
|
}
|
|
21
|
+
/** Shared config mappings for publisher funding, used by both sequencer and prover publisher configs. */ const publisherFundingConfigMappings = {
|
|
22
|
+
publisherFundingThreshold: {
|
|
23
|
+
env: 'PUBLISHER_FUNDING_THRESHOLD',
|
|
24
|
+
description: 'Min ETH balance below which a publisher gets funded. Specified in ether (e.g. 0.1). Unset = funding disabled.',
|
|
25
|
+
parseEnv: (val)=>parseEther(val)
|
|
26
|
+
},
|
|
27
|
+
publisherFundingAmount: {
|
|
28
|
+
env: 'PUBLISHER_FUNDING_AMOUNT',
|
|
29
|
+
description: 'Amount of ETH to send when funding a publisher. Specified in ether (e.g. 0.5). Unset = funding disabled.',
|
|
30
|
+
parseEnv: (val)=>parseEther(val)
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export function getPublisherConfigFromProverConfig(config) {
|
|
34
|
+
return {
|
|
35
|
+
...config,
|
|
36
|
+
publisherAllowInvalidStates: config.proverPublisherAllowInvalidStates,
|
|
37
|
+
publisherForwarderAddress: config.proverPublisherForwarderAddress
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function getPublisherConfigFromSequencerConfig(config) {
|
|
41
|
+
return {
|
|
42
|
+
...config,
|
|
43
|
+
publisherAllowInvalidStates: config.sequencerPublisherAllowInvalidStates,
|
|
44
|
+
publisherForwarderAddress: config.sequencerPublisherForwarderAddress,
|
|
45
|
+
l1TxFailedStore: config.l1TxFailedStore
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export const proverTxSenderConfigMappings = {
|
|
49
|
+
...l1ReaderConfigMappings,
|
|
50
|
+
proverPublisherPrivateKeys: {
|
|
51
|
+
env: `PROVER_PUBLISHER_PRIVATE_KEYS`,
|
|
52
|
+
description: 'The private keys to be used by the prover publisher.',
|
|
53
|
+
parseEnv: (val)=>val.split(',').map((key)=>new SecretValue(`0x${key.replace('0x', '')}`)),
|
|
54
|
+
defaultValue: [],
|
|
55
|
+
fallback: [
|
|
56
|
+
`PROVER_PUBLISHER_PRIVATE_KEY`
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
proverPublisherAddresses: {
|
|
60
|
+
env: `PROVER_PUBLISHER_ADDRESSES`,
|
|
61
|
+
description: 'The addresses of the publishers to use with remote signers',
|
|
62
|
+
parseEnv: (val)=>val.split(',').map((address)=>EthAddress.fromString(address)),
|
|
63
|
+
defaultValue: []
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export const sequencerTxSenderConfigMappings = {
|
|
67
|
+
...l1ReaderConfigMappings,
|
|
68
|
+
sequencerPublisherPrivateKeys: {
|
|
69
|
+
env: `SEQ_PUBLISHER_PRIVATE_KEYS`,
|
|
70
|
+
description: 'The private keys to be used by the sequencer publisher.',
|
|
71
|
+
parseEnv: (val)=>val.split(',').map((key)=>new SecretValue(`0x${key.replace('0x', '')}`)),
|
|
72
|
+
defaultValue: [],
|
|
73
|
+
fallback: [
|
|
74
|
+
`SEQ_PUBLISHER_PRIVATE_KEY`
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
sequencerPublisherAddresses: {
|
|
78
|
+
env: `SEQ_PUBLISHER_ADDRESSES`,
|
|
79
|
+
description: 'The addresses of the publishers to use with remote signers',
|
|
80
|
+
parseEnv: (val)=>val.split(',').map((address)=>EthAddress.fromString(address)),
|
|
81
|
+
defaultValue: []
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export const sequencerPublisherConfigMappings = {
|
|
85
|
+
...l1TxUtilsConfigMappings,
|
|
86
|
+
...blobClientConfigMapping,
|
|
87
|
+
sequencerPublisherAllowInvalidStates: {
|
|
88
|
+
env: `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
89
|
+
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
90
|
+
...booleanConfigHelper(true)
|
|
91
|
+
},
|
|
92
|
+
fishermanMode: {
|
|
93
|
+
env: 'FISHERMAN_MODE',
|
|
94
|
+
description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
|
|
95
|
+
...booleanConfigHelper(false)
|
|
96
|
+
},
|
|
97
|
+
sequencerPublisherForwarderAddress: {
|
|
98
|
+
env: `SEQ_PUBLISHER_FORWARDER_ADDRESS`,
|
|
99
|
+
description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
|
|
100
|
+
parseEnv: (val)=>val ? EthAddress.fromString(val) : undefined
|
|
101
|
+
},
|
|
102
|
+
l1TxFailedStore: {
|
|
103
|
+
env: 'L1_TX_FAILED_STORE',
|
|
104
|
+
description: 'Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path'
|
|
105
|
+
},
|
|
106
|
+
...publisherFundingConfigMappings
|
|
107
|
+
};
|
|
108
|
+
export const proverPublisherConfigMappings = {
|
|
109
|
+
...l1TxUtilsConfigMappings,
|
|
110
|
+
...blobClientConfigMapping,
|
|
111
|
+
proverPublisherAllowInvalidStates: {
|
|
112
|
+
env: `PROVER_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
113
|
+
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
114
|
+
...booleanConfigHelper(true)
|
|
115
|
+
},
|
|
116
|
+
fishermanMode: {
|
|
117
|
+
env: 'FISHERMAN_MODE',
|
|
118
|
+
description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
|
|
119
|
+
...booleanConfigHelper(false)
|
|
120
|
+
},
|
|
121
|
+
proverPublisherForwarderAddress: {
|
|
122
|
+
env: `PROVER_PUBLISHER_FORWARDER_ADDRESS`,
|
|
123
|
+
description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
|
|
124
|
+
parseEnv: (val)=>val ? EthAddress.fromString(val) : undefined
|
|
125
|
+
},
|
|
126
|
+
...publisherFundingConfigMappings
|
|
127
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
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
|
+
export { type FailedL1Tx, type FailedL1TxUri, type L1TxFailedStore } from './l1_tx_failed_store/index.js';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaXNoZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDOUQsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFHN0UsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFHN0UsT0FBTyxFQUFFLEtBQUssVUFBVSxFQUFFLEtBQUssYUFBYSxFQUFFLEtBQUssZUFBZSxFQUFFLE1BQU0sK0JBQStCLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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;AAG7E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
2
|
+
import type { L1TxFailedStore } from './failed_tx_store.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an L1TxFailedStore from a config string.
|
|
5
|
+
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
6
|
+
* @param config - Config string (e.g., 'gs://bucket/path', 's3://bucket/path', 'file:///path'). If undefined, returns undefined.
|
|
7
|
+
* @param logger - Optional logger.
|
|
8
|
+
* @returns The store instance, or undefined if config is not provided.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createL1TxFailedStore(config: string | undefined, logger?: Logger): Promise<L1TxFailedStore | undefined>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3B1Ymxpc2hlci9sMV90eF9mYWlsZWRfc3RvcmUvZmFjdG9yeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFHbEUsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFHNUQ7Ozs7OztHQU1HO0FBQ0gsd0JBQXNCLHFCQUFxQixDQUN6QyxNQUFNLEVBQUUsTUFBTSxHQUFHLFNBQVMsRUFDMUIsTUFBTSxHQUFFLE1BQXFELEdBQzVELE9BQU8sQ0FBQyxlQUFlLEdBQUcsU0FBUyxDQUFDLENBZXRDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/publisher/l1_tx_failed_store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,GAAE,MAAqD,GAC5D,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAetC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { createFileStore } from '@aztec/stdlib/file-store';
|
|
3
|
+
import { FileStoreL1TxFailedStore } from './file_store_failed_tx_store.js';
|
|
4
|
+
/**
|
|
5
|
+
* Creates an L1TxFailedStore from a config string.
|
|
6
|
+
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
7
|
+
* @param config - Config string (e.g., 'gs://bucket/path', 's3://bucket/path', 'file:///path'). If undefined, returns undefined.
|
|
8
|
+
* @param logger - Optional logger.
|
|
9
|
+
* @returns The store instance, or undefined if config is not provided.
|
|
10
|
+
*/ export async function createL1TxFailedStore(config, logger = createLogger('sequencer:l1-tx-failed-store')) {
|
|
11
|
+
if (!config) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const fileStore = await createFileStore(config, logger);
|
|
15
|
+
if (!fileStore) {
|
|
16
|
+
throw new Error(`Failed to create file store from config: '${config}'. ` + `Supported formats: 'gs://bucket/path', 's3://bucket/path', 'file:///path'.`);
|
|
17
|
+
}
|
|
18
|
+
logger.info(`Created L1 tx failed store`, {
|
|
19
|
+
config
|
|
20
|
+
});
|
|
21
|
+
return new FileStoreL1TxFailedStore(fileStore, logger);
|
|
22
|
+
}
|