@aztec/sequencer-client 0.0.1-commit.9ef841308 → 0.0.1-commit.a4600f49
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 +281 -21
- package/dest/client/sequencer-client.d.ts +20 -5
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +26 -22
- package/dest/config.d.ts +11 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +55 -26
- package/dest/global_variable_builder/fee_predictor.d.ts +37 -0
- package/dest/global_variable_builder/fee_predictor.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_predictor.js +138 -0
- package/dest/global_variable_builder/fee_provider.d.ts +21 -0
- package/dest/global_variable_builder/fee_provider.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_provider.js +80 -0
- package/dest/global_variable_builder/global_builder.d.ts +6 -25
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +7 -65
- package/dest/global_variable_builder/index.d.ts +3 -1
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/global_variable_builder/index.js +2 -0
- package/dest/publisher/config.d.ts +7 -3
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +13 -3
- package/dest/publisher/l1_to_l2_messaging.d.ts +21 -0
- package/dest/publisher/l1_to_l2_messaging.d.ts.map +1 -0
- package/dest/publisher/l1_to_l2_messaging.js +70 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +50 -11
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +68 -1
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +2 -2
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +4 -2
- package/dest/publisher/l1_tx_failed_store/index.d.ts +2 -2
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/index.js +1 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts +96 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts.map +1 -0
- package/dest/publisher/sequencer-bundle-simulator.js +198 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +1 -3
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +0 -1
- package/dest/publisher/sequencer-publisher.d.ts +97 -68
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +603 -536
- package/dest/publisher/write_json.d.ts +11 -0
- package/dest/publisher/write_json.d.ts.map +1 -0
- package/dest/publisher/write_json.js +57 -0
- package/dest/sequencer/automine/automine_factory.d.ts +56 -0
- package/dest/sequencer/automine/automine_factory.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_factory.js +85 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts +189 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_sequencer.js +690 -0
- package/dest/sequencer/automine/index.d.ts +3 -0
- package/dest/sequencer/automine/index.d.ts.map +1 -0
- package/dest/sequencer/automine/index.js +2 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +71 -21
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +724 -212
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts +34 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.js +72 -0
- package/dest/sequencer/events.d.ts +61 -5
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/metrics.d.ts +9 -10
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +34 -20
- package/dest/sequencer/requests_tracker.d.ts +22 -0
- package/dest/sequencer/requests_tracker.d.ts.map +1 -0
- package/dest/sequencer/requests_tracker.js +33 -0
- package/dest/sequencer/sequencer.d.ts +155 -33
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +543 -158
- package/dest/sequencer/types.d.ts +2 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/index.d.ts +3 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/utils.d.ts +15 -1
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +25 -7
- package/package.json +30 -28
- package/src/client/sequencer-client.ts +37 -27
- package/src/config.ts +64 -26
- package/src/global_variable_builder/README.md +44 -0
- package/src/global_variable_builder/fee_predictor.ts +182 -0
- package/src/global_variable_builder/fee_provider.ts +97 -0
- package/src/global_variable_builder/global_builder.ts +12 -80
- package/src/global_variable_builder/index.ts +2 -0
- package/src/publisher/config.ts +30 -7
- package/src/publisher/l1_to_l2_messaging.ts +85 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +117 -8
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +4 -3
- package/src/publisher/l1_tx_failed_store/index.ts +1 -1
- package/src/publisher/sequencer-bundle-simulator.ts +254 -0
- package/src/publisher/sequencer-publisher-factory.ts +0 -3
- package/src/publisher/sequencer-publisher.ts +702 -598
- package/src/publisher/write_json.ts +78 -0
- package/src/sequencer/README.md +162 -450
- package/src/sequencer/automine/README.md +60 -0
- package/src/sequencer/automine/automine_factory.ts +152 -0
- package/src/sequencer/automine/automine_sequencer.ts +796 -0
- package/src/sequencer/automine/index.ts +6 -0
- package/src/sequencer/checkpoint_proposal_job.ts +844 -241
- package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
- package/src/sequencer/events.ts +66 -5
- package/src/sequencer/metrics.ts +43 -24
- package/src/sequencer/requests_tracker.ts +43 -0
- package/src/sequencer/sequencer.ts +625 -175
- package/src/sequencer/types.ts +1 -1
- package/src/test/index.ts +2 -2
- package/src/test/utils.ts +61 -10
- package/dest/sequencer/timetable.d.ts +0 -88
- package/dest/sequencer/timetable.d.ts.map +0 -1
- package/dest/sequencer/timetable.js +0 -222
- package/src/sequencer/timetable.ts +0 -283
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
2
|
-
export type SequencerRollupConstants = Pick<L1RollupConstants, 'ethereumSlotDuration' | 'l1GenesisTime' | 'slotDuration' | 'rollupManaLimit'>;
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
2
|
+
export type SequencerRollupConstants = Pick<L1RollupConstants, 'ethereumSlotDuration' | 'l1GenesisTime' | 'slotDuration' | 'rollupManaLimit' | 'epochDuration'>;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZXF1ZW5jZXIvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVyRSxNQUFNLE1BQU0sd0JBQXdCLEdBQUcsSUFBSSxDQUN6QyxpQkFBaUIsRUFDakIsc0JBQXNCLEdBQUcsZUFBZSxHQUFHLGNBQWMsR0FBRyxpQkFBaUIsR0FBRyxlQUFlLENBQ2hHLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sequencer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,iBAAiB,EACjB,sBAAsB,GAAG,eAAe,GAAG,cAAc,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sequencer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,iBAAiB,EACjB,sBAAsB,GAAG,eAAe,GAAG,cAAc,GAAG,iBAAiB,GAAG,eAAe,CAChG,CAAC"}
|
package/dest/test/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
2
2
|
import type { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
3
3
|
import type { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
4
|
+
import type { ProposerTimetable } from '@aztec/stdlib/timetable';
|
|
4
5
|
import type { FullNodeCheckpointsBuilder, ValidatorClient } from '@aztec/validator-client';
|
|
5
6
|
import { SequencerClient } from '../client/sequencer-client.js';
|
|
6
7
|
import type { SequencerPublisherFactory } from '../publisher/sequencer-publisher-factory.js';
|
|
7
8
|
import { Sequencer } from '../sequencer/sequencer.js';
|
|
8
|
-
import type { SequencerTimetable } from '../sequencer/timetable.js';
|
|
9
9
|
declare class TestSequencer_ extends Sequencer {
|
|
10
10
|
publicProcessorFactory: PublicProcessorFactory;
|
|
11
|
-
timetable:
|
|
11
|
+
timetable: ProposerTimetable;
|
|
12
12
|
publisherFactory: SequencerPublisherFactory;
|
|
13
13
|
validatorClient: ValidatorClient;
|
|
14
14
|
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
@@ -20,4 +20,4 @@ declare class TestSequencerClient_ extends SequencerClient {
|
|
|
20
20
|
}
|
|
21
21
|
export type TestSequencerClient = TestSequencerClient_;
|
|
22
22
|
export {};
|
|
23
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5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DQUFDLENBQUM7Q0FDOUQ7QUFFRCxNQUFNLE1BQU0sbUJBQW1CLEdBQUcsb0JBQW9CLENBQUMifQ==
|
package/dest/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,cAAM,cAAe,SAAQ,SAAS;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,iBAAiB,CAAC;IAC7B,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,0BAA0B,CAAC;CAC/D;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAE3C,cAAM,oBAAqB,SAAQ,eAAe;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,gBAAgB,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;CAC9D;AAED,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC"}
|
package/dest/test/utils.d.ts
CHANGED
|
@@ -4,10 +4,24 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
4
4
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
5
5
|
import type { P2P } from '@aztec/p2p';
|
|
6
6
|
import { CommitteeAttestation, L2Block } from '@aztec/stdlib/block';
|
|
7
|
+
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
7
8
|
import { BlockProposal, CheckpointAttestation, CheckpointProposal } from '@aztec/stdlib/p2p';
|
|
9
|
+
import { ProposerTimetable } from '@aztec/stdlib/timetable';
|
|
8
10
|
import { GlobalVariables, type Tx } from '@aztec/stdlib/tx';
|
|
9
11
|
import type { MockProxy } from 'jest-mock-extended';
|
|
10
12
|
export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint_builder.js';
|
|
13
|
+
/**
|
|
14
|
+
* Builds a {@link ProposerTimetable} for tests from a millisecond block duration and optional budgets,
|
|
15
|
+
* filling unset budgets with the shared `DEFAULT_*` values the sequencer config layer applies. Mirrors how
|
|
16
|
+
* the sequencer constructs its timetable so tests exercise the same budget resolution.
|
|
17
|
+
*/
|
|
18
|
+
export declare function makeProposerTimetable(opts: {
|
|
19
|
+
l1Constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>;
|
|
20
|
+
blockDurationMs?: number;
|
|
21
|
+
minBlockDuration?: number;
|
|
22
|
+
p2pPropagationTime?: number;
|
|
23
|
+
checkpointProposalPrepareTime?: number;
|
|
24
|
+
}): ProposerTimetable;
|
|
11
25
|
/**
|
|
12
26
|
* Creates a mock transaction with a specific seed for deterministic testing
|
|
13
27
|
*/
|
|
@@ -50,4 +64,4 @@ export declare function setupTxsAndBlock(p2p: MockProxy<P2P>, globalVariables: G
|
|
|
50
64
|
txs: Tx[];
|
|
51
65
|
block: L2Block;
|
|
52
66
|
}>;
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUM1RSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV0QyxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsT0FBTyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFcEUsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNyRSxPQUFPLEVBQUUsYUFBYSxFQUFFLHFCQUFxQixFQUFFLGtCQUFrQixFQUFvQixNQUFNLG1CQUFtQixDQUFDO0FBTy9HLE9BQU8sRUFLTCxpQkFBaUIsRUFDbEIs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CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAoB,MAAM,mBAAmB,CAAC;AAO/G,OAAO,EAKL,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAe,eAAe,EAAE,KAAK,EAAE,EAAoC,MAAM,kBAAkB,CAAC;AAE3G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,C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,OAAO,EACd,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,UAAU,EAClB,qBAAqB,GAAE,MAAW,GACjC,qBAAqB,CAavB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,EACnB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,EAAE,GACV,OAAO,CAAC;IAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAKxC"}
|
package/dest/test/utils.js
CHANGED
|
@@ -5,12 +5,28 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
5
5
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
6
6
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
7
7
|
import { CommitteeAttestation, L2Block } from '@aztec/stdlib/block';
|
|
8
|
+
import { DEFAULT_BLOCK_DURATION_MS } from '@aztec/stdlib/config';
|
|
8
9
|
import { BlockProposal, CheckpointAttestation, CheckpointProposal, ConsensusPayload } from '@aztec/stdlib/p2p';
|
|
9
10
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
10
|
-
import { makeAppendOnlyTreeSnapshot, mockTxForRollup } from '@aztec/stdlib/testing';
|
|
11
|
+
import { TEST_COORDINATION_SIGNATURE_CONTEXT, makeAppendOnlyTreeSnapshot, mockTxForRollup } from '@aztec/stdlib/testing';
|
|
12
|
+
import { DEFAULT_CHECKPOINT_PROPOSAL_INIT_TIME, DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME, DEFAULT_MIN_BLOCK_DURATION, DEFAULT_P2P_PROPAGATION_TIME, ProposerTimetable } from '@aztec/stdlib/timetable';
|
|
11
13
|
import { BlockHeader, makeProcessedTxFromPrivateOnlyTx } from '@aztec/stdlib/tx';
|
|
12
14
|
// Re-export mock classes from their dedicated file
|
|
13
15
|
export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint_builder.js';
|
|
16
|
+
/**
|
|
17
|
+
* Builds a {@link ProposerTimetable} for tests from a millisecond block duration and optional budgets,
|
|
18
|
+
* filling unset budgets with the shared `DEFAULT_*` values the sequencer config layer applies. Mirrors how
|
|
19
|
+
* the sequencer constructs its timetable so tests exercise the same budget resolution.
|
|
20
|
+
*/ export function makeProposerTimetable(opts) {
|
|
21
|
+
return new ProposerTimetable({
|
|
22
|
+
l1Constants: opts.l1Constants,
|
|
23
|
+
blockDuration: (opts.blockDurationMs ?? DEFAULT_BLOCK_DURATION_MS) / 1000,
|
|
24
|
+
minBlockDuration: opts.minBlockDuration ?? DEFAULT_MIN_BLOCK_DURATION,
|
|
25
|
+
p2pPropagationTime: opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME,
|
|
26
|
+
checkpointProposalPrepareTime: opts.checkpointProposalPrepareTime ?? DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME,
|
|
27
|
+
checkpointProposalInitTime: DEFAULT_CHECKPOINT_PROPOSAL_INIT_TIME
|
|
28
|
+
});
|
|
29
|
+
}
|
|
14
30
|
/**
|
|
15
31
|
* Creates a mock transaction with a specific seed for deterministic testing
|
|
16
32
|
*/ export async function makeTx(seed, chainId) {
|
|
@@ -35,6 +51,7 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
35
51
|
* Mocks the P2P client to return specific pending transactions
|
|
36
52
|
*/ export function mockPendingTxs(p2p, txs) {
|
|
37
53
|
p2p.getPendingTxCount.mockResolvedValue(txs.length);
|
|
54
|
+
p2p.hasEligiblePendingTxs.mockImplementation((minCount)=>Promise.resolve(txs.length >= minCount));
|
|
38
55
|
p2p.iteratePendingTxs.mockImplementation(()=>mockTxIterator(Promise.resolve(txs)));
|
|
39
56
|
p2p.iterateEligiblePendingTxs.mockImplementation(()=>mockTxIterator(Promise.resolve(txs)));
|
|
40
57
|
}
|
|
@@ -58,20 +75,20 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
58
75
|
* Uses mock values for blockHeadersHash, blobsHash and inHash since L2Block doesn't have these fields.
|
|
59
76
|
*/ function createCheckpointHeaderFromBlock(block) {
|
|
60
77
|
const gv = block.header.globalVariables;
|
|
61
|
-
return new CheckpointHeader(block.header.lastArchive.root, Fr.random(), Fr.random(), Fr.random(), Fr.random(), gv.slotNumber, gv.timestamp, gv.coinbase, gv.feeRecipient, gv.gasFees, block.header.totalManaUsed);
|
|
78
|
+
return new CheckpointHeader(block.header.lastArchive.root, Fr.random(), Fr.random(), Fr.random(), Fr.random(), gv.slotNumber, gv.timestamp, gv.coinbase, gv.feeRecipient, gv.gasFees, block.header.totalManaUsed, block.header.totalFees);
|
|
62
79
|
}
|
|
63
80
|
/**
|
|
64
81
|
* Creates a block proposal from a block and signature
|
|
65
82
|
*/ export function createBlockProposal(block, signature) {
|
|
66
83
|
const txHashes = block.body.txEffects.map((tx)=>tx.txHash);
|
|
67
|
-
return new BlockProposal(block.header, block.indexWithinCheckpoint, Fr.ZERO, block.archive.root, txHashes, signature);
|
|
84
|
+
return new BlockProposal(block.header, block.indexWithinCheckpoint, Fr.ZERO, block.archive.root, txHashes, signature, TEST_COORDINATION_SIGNATURE_CONTEXT);
|
|
68
85
|
}
|
|
69
86
|
/**
|
|
70
87
|
* Creates a checkpoint proposal from a block and signature
|
|
71
88
|
*/ export function createCheckpointProposal(block, checkpointSignature, blockSignature, feeAssetPriceModifier = 0n) {
|
|
72
89
|
const txHashes = block.body.txEffects.map((tx)=>tx.txHash);
|
|
73
90
|
const checkpointHeader = createCheckpointHeaderFromBlock(block);
|
|
74
|
-
return new CheckpointProposal(checkpointHeader, block.archive.root, feeAssetPriceModifier, checkpointSignature, {
|
|
91
|
+
return new CheckpointProposal(checkpointHeader, block.archive.root, feeAssetPriceModifier, checkpointSignature, TEST_COORDINATION_SIGNATURE_CONTEXT, {
|
|
75
92
|
blockHeader: block.header,
|
|
76
93
|
indexWithinCheckpoint: block.indexWithinCheckpoint,
|
|
77
94
|
txHashes,
|
|
@@ -84,10 +101,11 @@ export { MockCheckpointBuilder, MockCheckpointsBuilder } from './mock_checkpoint
|
|
|
84
101
|
* In production, the sender is recovered from the signature.
|
|
85
102
|
*/ export function createCheckpointAttestation(block, signature, sender, feeAssetPriceModifier = 0n) {
|
|
86
103
|
const checkpointHeader = createCheckpointHeaderFromBlock(block);
|
|
87
|
-
const payload = new ConsensusPayload(checkpointHeader, block.archive.root, feeAssetPriceModifier);
|
|
104
|
+
const payload = new ConsensusPayload(checkpointHeader, block.archive.root, feeAssetPriceModifier, TEST_COORDINATION_SIGNATURE_CONTEXT);
|
|
88
105
|
const attestation = new CheckpointAttestation(payload, signature, signature);
|
|
89
|
-
//
|
|
90
|
-
attestation.
|
|
106
|
+
// Bypass signature recovery for testing since we use random signatures
|
|
107
|
+
attestation.getSender = ()=>sender;
|
|
108
|
+
attestation.getProposer = ()=>sender;
|
|
91
109
|
return attestation;
|
|
92
110
|
}
|
|
93
111
|
/**
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/sequencer-client",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.a4600f49",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
7
|
+
"./automine": "./dest/sequencer/automine/index.js",
|
|
7
8
|
"./config": "./dest/config.js",
|
|
8
9
|
"./test": "./dest/test/index.js"
|
|
9
10
|
},
|
|
@@ -26,37 +27,38 @@
|
|
|
26
27
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --config jest.integration.config.json"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
30
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
31
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
32
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
33
|
-
"@aztec/constants": "0.0.1-commit.
|
|
34
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
35
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
36
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
37
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
38
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
39
|
-
"@aztec/noir-acvm_js": "0.0.1-commit.
|
|
40
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
41
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
42
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
43
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
44
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
45
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
46
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
47
|
-
"@aztec/slasher": "0.0.1-commit.
|
|
48
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
49
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
50
|
-
"@aztec/validator-client": "0.0.1-commit.
|
|
51
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
52
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
30
|
+
"@aztec/aztec.js": "0.0.1-commit.a4600f49",
|
|
31
|
+
"@aztec/bb-prover": "0.0.1-commit.a4600f49",
|
|
32
|
+
"@aztec/blob-client": "0.0.1-commit.a4600f49",
|
|
33
|
+
"@aztec/blob-lib": "0.0.1-commit.a4600f49",
|
|
34
|
+
"@aztec/constants": "0.0.1-commit.a4600f49",
|
|
35
|
+
"@aztec/epoch-cache": "0.0.1-commit.a4600f49",
|
|
36
|
+
"@aztec/ethereum": "0.0.1-commit.a4600f49",
|
|
37
|
+
"@aztec/foundation": "0.0.1-commit.a4600f49",
|
|
38
|
+
"@aztec/l1-artifacts": "0.0.1-commit.a4600f49",
|
|
39
|
+
"@aztec/node-keystore": "0.0.1-commit.a4600f49",
|
|
40
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.a4600f49",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.a4600f49",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.a4600f49",
|
|
43
|
+
"@aztec/noir-types": "0.0.1-commit.a4600f49",
|
|
44
|
+
"@aztec/p2p": "0.0.1-commit.a4600f49",
|
|
45
|
+
"@aztec/protocol-contracts": "0.0.1-commit.a4600f49",
|
|
46
|
+
"@aztec/prover-client": "0.0.1-commit.a4600f49",
|
|
47
|
+
"@aztec/simulator": "0.0.1-commit.a4600f49",
|
|
48
|
+
"@aztec/slasher": "0.0.1-commit.a4600f49",
|
|
49
|
+
"@aztec/stdlib": "0.0.1-commit.a4600f49",
|
|
50
|
+
"@aztec/telemetry-client": "0.0.1-commit.a4600f49",
|
|
51
|
+
"@aztec/validator-client": "0.0.1-commit.a4600f49",
|
|
52
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.a4600f49",
|
|
53
|
+
"@aztec/world-state": "0.0.1-commit.a4600f49",
|
|
53
54
|
"lodash.chunk": "^4.2.0",
|
|
54
55
|
"tslib": "^2.4.0",
|
|
55
|
-
"viem": "npm:@aztec/viem@2.38.2"
|
|
56
|
+
"viem": "npm:@aztec/viem@2.38.2",
|
|
57
|
+
"zod": "^4"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
59
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
60
|
+
"@aztec/archiver": "0.0.1-commit.a4600f49",
|
|
61
|
+
"@aztec/kv-store": "0.0.1-commit.a4600f49",
|
|
60
62
|
"@electric-sql/pglite": "^0.3.14",
|
|
61
63
|
"@jest/globals": "^30.0.0",
|
|
62
64
|
"@types/jest": "^30.0.0",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
2
2
|
import { MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
|
|
3
3
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
4
|
-
import { isAnvilTestChain } from '@aztec/ethereum/chain';
|
|
5
4
|
import { getPublicClient } from '@aztec/ethereum/client';
|
|
6
5
|
import { GovernanceProposerContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
7
6
|
import { type Delayer, L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
@@ -12,9 +11,8 @@ import type { DateProvider } from '@aztec/foundation/timer';
|
|
|
12
11
|
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
13
12
|
import type { P2P } from '@aztec/p2p';
|
|
14
13
|
import type { SlasherClientInterface } from '@aztec/slasher';
|
|
15
|
-
import type { L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
|
|
14
|
+
import type { L2BlockSink, L2BlockSource, ProposedCheckpointSink } from '@aztec/stdlib/block';
|
|
16
15
|
import type { ValidatorClientFullConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
17
|
-
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
18
16
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
19
17
|
import { L1Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
20
18
|
import { FullNodeCheckpointsBuilder, NodeKeystoreAdapter, type ValidatorClient } from '@aztec/validator-client';
|
|
@@ -57,7 +55,7 @@ export class SequencerClient {
|
|
|
57
55
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
58
56
|
slasherClient: SlasherClientInterface | undefined;
|
|
59
57
|
checkpointsBuilder: FullNodeCheckpointsBuilder;
|
|
60
|
-
l2BlockSource: L2BlockSource & L2BlockSink;
|
|
58
|
+
l2BlockSource: L2BlockSource & L2BlockSink & ProposedCheckpointSink;
|
|
61
59
|
l1ToL2MessageSource: L1ToL2MessageSource;
|
|
62
60
|
telemetry: TelemetryClient;
|
|
63
61
|
publisherFactory?: SequencerPublisherFactory;
|
|
@@ -93,7 +91,7 @@ export class SequencerClient {
|
|
|
93
91
|
bindings: log.getBindings(),
|
|
94
92
|
funder: deps.funderL1TxUtils,
|
|
95
93
|
});
|
|
96
|
-
const rollupContract = new RollupContract(publicClient, config.
|
|
94
|
+
const rollupContract = new RollupContract(publicClient, config.rollupAddress.toString());
|
|
97
95
|
const [l1GenesisTime, slotDuration, rollupManaLimit] = await Promise.all([
|
|
98
96
|
rollupContract.getL1GenesisTime(),
|
|
99
97
|
rollupContract.getSlotDuration(),
|
|
@@ -102,27 +100,21 @@ export class SequencerClient {
|
|
|
102
100
|
|
|
103
101
|
const governanceProposerContract = new GovernanceProposerContract(
|
|
104
102
|
publicClient,
|
|
105
|
-
config.
|
|
103
|
+
config.governanceProposerAddress.toString(),
|
|
106
104
|
);
|
|
107
105
|
const epochCache =
|
|
108
106
|
deps.epochCache ??
|
|
109
107
|
(await EpochCache.create(
|
|
110
|
-
config.
|
|
108
|
+
config.rollupAddress,
|
|
111
109
|
{
|
|
112
110
|
l1RpcUrls: rpcUrls,
|
|
113
111
|
l1ChainId: chainId,
|
|
114
112
|
viemPollingIntervalMS: config.viemPollingIntervalMS,
|
|
115
113
|
ethereumSlotDuration: config.ethereumSlotDuration,
|
|
116
|
-
enableProposerPipelining: config.enableProposerPipelining,
|
|
117
114
|
},
|
|
118
115
|
{ dateProvider: deps.dateProvider },
|
|
119
116
|
));
|
|
120
117
|
|
|
121
|
-
const slashFactoryContract = new SlashFactoryContract(
|
|
122
|
-
publicClient,
|
|
123
|
-
config.l1Contracts.slashFactoryAddress?.toString() ?? EthAddress.ZERO.toString(),
|
|
124
|
-
);
|
|
125
|
-
|
|
126
118
|
const publisherFactory =
|
|
127
119
|
deps.publisherFactory ??
|
|
128
120
|
new SequencerPublisherFactory(config, {
|
|
@@ -130,7 +122,6 @@ export class SequencerClient {
|
|
|
130
122
|
blobClient: deps.blobClient,
|
|
131
123
|
epochCache,
|
|
132
124
|
governanceProposerContract,
|
|
133
|
-
slashFactoryContract,
|
|
134
125
|
rollupContract,
|
|
135
126
|
dateProvider: deps.dateProvider,
|
|
136
127
|
publisherManager,
|
|
@@ -142,17 +133,15 @@ export class SequencerClient {
|
|
|
142
133
|
|
|
143
134
|
const globalsBuilder = deps.globalVariableBuilder;
|
|
144
135
|
|
|
145
|
-
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
146
|
-
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
147
|
-
// In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
|
|
148
|
-
// reduce the publishing time allowance. However, we prefer being conservative.
|
|
149
|
-
// See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
|
|
150
|
-
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
151
|
-
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
152
|
-
|
|
153
136
|
const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = capPerBlockLimits(config, rollupManaLimit, log);
|
|
154
137
|
|
|
155
|
-
const l1Constants = {
|
|
138
|
+
const l1Constants = {
|
|
139
|
+
l1GenesisTime,
|
|
140
|
+
slotDuration: Number(slotDuration),
|
|
141
|
+
ethereumSlotDuration,
|
|
142
|
+
rollupManaLimit,
|
|
143
|
+
epochDuration: config.aztecEpochDuration,
|
|
144
|
+
};
|
|
156
145
|
|
|
157
146
|
const sequencer = new Sequencer(
|
|
158
147
|
publisherFactory,
|
|
@@ -168,7 +157,7 @@ export class SequencerClient {
|
|
|
168
157
|
deps.dateProvider,
|
|
169
158
|
epochCache,
|
|
170
159
|
rollupContract,
|
|
171
|
-
{ ...config,
|
|
160
|
+
{ ...config, maxL2BlockGas, maxDABlockGas, maxTxsPerBlock },
|
|
172
161
|
telemetryClient,
|
|
173
162
|
log,
|
|
174
163
|
);
|
|
@@ -191,16 +180,23 @@ export class SequencerClient {
|
|
|
191
180
|
this.validatorClient?.updateConfig(config);
|
|
192
181
|
}
|
|
193
182
|
|
|
194
|
-
/**
|
|
183
|
+
/**
|
|
184
|
+
* Starts (or resumes) the sequencer, validator, publishers, and metrics. Each underlying start is
|
|
185
|
+
* idempotent, so this is safe to call after a previous {@link pause} to resume building and publishing.
|
|
186
|
+
* The publisher manager is started before the sequencer's poll loop so publishing is ready before the
|
|
187
|
+
* sequencer first tries to publish to L1.
|
|
188
|
+
*/
|
|
195
189
|
public async start() {
|
|
196
190
|
await this.validatorClient?.start();
|
|
191
|
+
await this.publisherManager.start();
|
|
197
192
|
this.sequencer.start();
|
|
198
193
|
this.l1Metrics?.start();
|
|
199
|
-
await this.publisherManager.start();
|
|
200
194
|
}
|
|
201
195
|
|
|
202
196
|
/**
|
|
203
|
-
* Stops the sequencer
|
|
197
|
+
* Stops the sequencer, validator, publishers, and metrics for good, draining in-flight work. This is the
|
|
198
|
+
* final teardown path: stopping the validator client closes its slashing-protection database. For a
|
|
199
|
+
* restartable pause (e.g. around a test clock warp) use {@link pause} instead.
|
|
204
200
|
*/
|
|
205
201
|
public async stop() {
|
|
206
202
|
await this.sequencer.stop();
|
|
@@ -209,6 +205,20 @@ export class SequencerClient {
|
|
|
209
205
|
this.l1Metrics?.stop();
|
|
210
206
|
}
|
|
211
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Gracefully pauses block production, waiting for in-flight work to finish rather than interrupting it,
|
|
210
|
+
* while leaving the validator, publishers, and metrics running so the sequencer can be resumed with
|
|
211
|
+
* {@link start}. Used by tests that pause sequencers around an L1 clock warp.
|
|
212
|
+
*/
|
|
213
|
+
public async pause() {
|
|
214
|
+
await this.sequencer.pause();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Triggers an immediate run of the sequencer, bypassing the polling interval. */
|
|
218
|
+
public trigger() {
|
|
219
|
+
return this.sequencer.trigger();
|
|
220
|
+
}
|
|
221
|
+
|
|
212
222
|
public getSequencer(): Sequencer {
|
|
213
223
|
return this.sequencer;
|
|
214
224
|
}
|
package/src/config.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum/l1-
|
|
|
3
3
|
import {
|
|
4
4
|
type ConfigMappingsType,
|
|
5
5
|
booleanConfigHelper,
|
|
6
|
+
floatConfigHelper,
|
|
6
7
|
getConfigFromMappings,
|
|
7
8
|
numberConfigHelper,
|
|
9
|
+
optionalNumberConfigHelper,
|
|
8
10
|
pickConfigMappings,
|
|
9
11
|
} from '@aztec/foundation/config';
|
|
10
12
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -13,12 +15,13 @@ import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
|
13
15
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
16
|
import {
|
|
15
17
|
type ChainConfig,
|
|
16
|
-
|
|
18
|
+
DEFAULT_BLOCK_DURATION_MS,
|
|
19
|
+
DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
|
|
17
20
|
type SequencerConfig,
|
|
18
21
|
chainConfigMappings,
|
|
19
|
-
pipelineConfigMappings,
|
|
20
22
|
sharedSequencerConfigMappings,
|
|
21
23
|
} from '@aztec/stdlib/config';
|
|
24
|
+
import { MIN_PER_BLOCK_ALLOCATION_MULTIPLIER, MIN_PER_BLOCK_DA_ALLOCATION_MULTIPLIER } from '@aztec/stdlib/gas';
|
|
22
25
|
import type { ResolvedSequencerConfig } from '@aztec/stdlib/interfaces/server';
|
|
23
26
|
import { DEFAULT_P2P_PROPAGATION_TIME } from '@aztec/stdlib/timetable';
|
|
24
27
|
import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
|
|
@@ -42,22 +45,29 @@ export const DefaultSequencerConfig = {
|
|
|
42
45
|
minTxsPerBlock: 1,
|
|
43
46
|
buildCheckpointIfEmpty: false,
|
|
44
47
|
publishTxsWithProposals: false,
|
|
45
|
-
perBlockAllocationMultiplier:
|
|
48
|
+
perBlockAllocationMultiplier: MIN_PER_BLOCK_ALLOCATION_MULTIPLIER,
|
|
49
|
+
perBlockDAAllocationMultiplier: MIN_PER_BLOCK_DA_ALLOCATION_MULTIPLIER,
|
|
46
50
|
redistributeCheckpointBudget: true,
|
|
47
|
-
|
|
51
|
+
blockDurationMs: DEFAULT_BLOCK_DURATION_MS,
|
|
52
|
+
l1PublishingTime: 12,
|
|
53
|
+
checkpointProposalSyncGraceSeconds: 2 * (DEFAULT_BLOCK_DURATION_MS / 1000),
|
|
48
54
|
attestationPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
|
|
49
55
|
secondsBeforeInvalidatingBlockAsCommitteeMember: 144, // 12 L1 blocks
|
|
50
56
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember: 432, // 36 L1 blocks
|
|
51
57
|
skipCollectingAttestations: false,
|
|
52
58
|
skipInvalidateBlockAsProposer: false,
|
|
59
|
+
skipWaitForValidParentCheckpointOnL1: false,
|
|
53
60
|
broadcastInvalidBlockProposal: false,
|
|
61
|
+
broadcastInvalidCheckpointProposalOnly: false,
|
|
54
62
|
injectFakeAttestation: false,
|
|
55
63
|
injectHighSValueAttestation: false,
|
|
56
64
|
injectUnrecoverableSignatureAttestation: false,
|
|
65
|
+
injectYParityAttestation: false,
|
|
57
66
|
fishermanMode: false,
|
|
58
67
|
shuffleAttestationOrdering: false,
|
|
59
68
|
skipPushProposedBlocksToArchiver: false,
|
|
60
69
|
skipPublishingCheckpointsPercent: 0,
|
|
70
|
+
maxBlocksPerCheckpoint: DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
|
|
61
71
|
} satisfies ResolvedSequencerConfig;
|
|
62
72
|
|
|
63
73
|
/**
|
|
@@ -70,7 +80,6 @@ export type SequencerClientConfig = SequencerPublisherConfig &
|
|
|
70
80
|
SequencerConfig &
|
|
71
81
|
L1ReaderConfig &
|
|
72
82
|
ChainConfig &
|
|
73
|
-
PipelineConfig &
|
|
74
83
|
Pick<P2PConfig, 'txPublicSetupAllowListExtend'> &
|
|
75
84
|
Pick<L1ContractsConfig, 'ethereumSlotDuration' | 'aztecSlotDuration' | 'aztecEpochDuration'>;
|
|
76
85
|
|
|
@@ -83,7 +92,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
83
92
|
maxTxsPerCheckpoint: {
|
|
84
93
|
env: 'SEQ_MAX_TX_PER_CHECKPOINT',
|
|
85
94
|
description: 'The maximum number of txs across all blocks in a checkpoint.',
|
|
86
|
-
|
|
95
|
+
...optionalNumberConfigHelper(),
|
|
87
96
|
},
|
|
88
97
|
minTxsPerBlock: {
|
|
89
98
|
env: 'SEQ_MIN_TX_PER_BLOCK',
|
|
@@ -102,19 +111,26 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
102
111
|
maxL2BlockGas: {
|
|
103
112
|
env: 'SEQ_MAX_L2_BLOCK_GAS',
|
|
104
113
|
description: 'The maximum L2 block gas.',
|
|
105
|
-
|
|
114
|
+
...optionalNumberConfigHelper(),
|
|
106
115
|
},
|
|
107
116
|
maxDABlockGas: {
|
|
108
117
|
env: 'SEQ_MAX_DA_BLOCK_GAS',
|
|
109
118
|
description: 'The maximum DA block gas.',
|
|
110
|
-
|
|
119
|
+
...optionalNumberConfigHelper(),
|
|
111
120
|
},
|
|
112
121
|
perBlockAllocationMultiplier: {
|
|
113
122
|
env: 'SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER',
|
|
114
123
|
description:
|
|
115
124
|
'Per-block gas budget multiplier for both L2 and DA gas. Budget per block is (checkpointLimit / maxBlocks) * multiplier.' +
|
|
116
125
|
' Values greater than one allow early blocks to use more than their even share, relying on checkpoint-level capping for later blocks.',
|
|
117
|
-
...
|
|
126
|
+
...floatConfigHelper(DefaultSequencerConfig.perBlockAllocationMultiplier),
|
|
127
|
+
},
|
|
128
|
+
perBlockDAAllocationMultiplier: {
|
|
129
|
+
env: 'SEQ_PER_BLOCK_DA_ALLOCATION_MULTIPLIER',
|
|
130
|
+
description:
|
|
131
|
+
'Per-block budget multiplier applied to DA gas and blob fields in place of perBlockAllocationMultiplier.' +
|
|
132
|
+
' Defaults higher than the general multiplier so the largest contract class deploy fits a single block.',
|
|
133
|
+
...floatConfigHelper(DefaultSequencerConfig.perBlockDAAllocationMultiplier),
|
|
118
134
|
},
|
|
119
135
|
redistributeCheckpointBudget: {
|
|
120
136
|
env: 'SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET',
|
|
@@ -124,12 +140,12 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
124
140
|
},
|
|
125
141
|
coinbase: {
|
|
126
142
|
env: 'COINBASE',
|
|
127
|
-
parseEnv: (val: string) =>
|
|
143
|
+
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
128
144
|
description: 'Recipient of block reward.',
|
|
129
145
|
},
|
|
130
146
|
feeRecipient: {
|
|
131
147
|
env: 'FEE_RECIPIENT',
|
|
132
|
-
parseEnv: (val: string) => AztecAddress.
|
|
148
|
+
parseEnv: (val: string) => AztecAddress.fromStringUnsafe(val),
|
|
133
149
|
description: 'Address to receive fees.',
|
|
134
150
|
},
|
|
135
151
|
acvmWorkingDirectory: {
|
|
@@ -140,11 +156,6 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
140
156
|
env: 'ACVM_BINARY_PATH',
|
|
141
157
|
description: 'The path to the ACVM binary',
|
|
142
158
|
},
|
|
143
|
-
enforceTimeTable: {
|
|
144
|
-
env: 'SEQ_ENFORCE_TIME_TABLE',
|
|
145
|
-
description: 'Whether to enforce the time table when building blocks',
|
|
146
|
-
...booleanConfigHelper(DefaultSequencerConfig.enforceTimeTable),
|
|
147
|
-
},
|
|
148
159
|
governanceProposerPayload: {
|
|
149
160
|
env: 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS',
|
|
150
161
|
description: 'The address of the payload for the governanceProposer',
|
|
@@ -152,13 +163,8 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
152
163
|
},
|
|
153
164
|
l1PublishingTime: {
|
|
154
165
|
env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
|
|
155
|
-
description: 'How much time
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
attestationPropagationTime: {
|
|
159
|
-
env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
|
|
160
|
-
description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way)',
|
|
161
|
-
...numberConfigHelper(DefaultSequencerConfig.attestationPropagationTime),
|
|
166
|
+
description: 'How much time in seconds to allow in the slot for publishing the L1 transaction.',
|
|
167
|
+
...numberConfigHelper(DefaultSequencerConfig.l1PublishingTime),
|
|
162
168
|
},
|
|
163
169
|
fakeProcessingDelayPerTxMs: {
|
|
164
170
|
description: 'Used for testing to introduce a fake delay after processing each tx',
|
|
@@ -189,10 +195,25 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
189
195
|
description: 'Do not invalidate the previous block if invalid when we are the proposer (for testing only)',
|
|
190
196
|
...booleanConfigHelper(DefaultSequencerConfig.skipInvalidateBlockAsProposer),
|
|
191
197
|
},
|
|
198
|
+
skipWaitForValidParentCheckpointOnL1: {
|
|
199
|
+
description:
|
|
200
|
+
'Bypass the parent checkpoint validity check before submitting a pipelined checkpoint, ' +
|
|
201
|
+
'allowing the proposer to publish even when the parent landed on L1 with invalid attestations (for testing only)',
|
|
202
|
+
...booleanConfigHelper(DefaultSequencerConfig.skipWaitForValidParentCheckpointOnL1),
|
|
203
|
+
},
|
|
192
204
|
broadcastInvalidBlockProposal: {
|
|
193
205
|
description: 'Broadcast invalid block proposals with corrupted state (for testing only)',
|
|
194
206
|
...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidBlockProposal),
|
|
195
207
|
},
|
|
208
|
+
invalidBlockProposalIndexWithinCheckpoint: {
|
|
209
|
+
description: 'Broadcast an invalid block proposal only at this indexWithinCheckpoint (for testing only)',
|
|
210
|
+
...optionalNumberConfigHelper(),
|
|
211
|
+
},
|
|
212
|
+
broadcastInvalidCheckpointProposalOnly: {
|
|
213
|
+
description:
|
|
214
|
+
'Broadcast invalid checkpoint proposals while keeping the underlying block proposals valid (for testing only). When unset, the checkpoint follows broadcastInvalidBlockProposal.',
|
|
215
|
+
...booleanConfigHelper(DefaultSequencerConfig.broadcastInvalidCheckpointProposalOnly),
|
|
216
|
+
},
|
|
196
217
|
injectFakeAttestation: {
|
|
197
218
|
description: 'Inject a fake attestation (for testing only)',
|
|
198
219
|
...booleanConfigHelper(DefaultSequencerConfig.injectFakeAttestation),
|
|
@@ -205,6 +226,10 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
205
226
|
description: 'Inject an attestation with an unrecoverable signature (for testing only)',
|
|
206
227
|
...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation),
|
|
207
228
|
},
|
|
229
|
+
injectYParityAttestation: {
|
|
230
|
+
description: 'Inject a non-proposer attestation slot in yParity form in the packed L1 tuple (for testing only)',
|
|
231
|
+
...booleanConfigHelper(DefaultSequencerConfig.injectYParityAttestation),
|
|
232
|
+
},
|
|
208
233
|
fishermanMode: {
|
|
209
234
|
env: 'FISHERMAN_MODE',
|
|
210
235
|
description:
|
|
@@ -222,7 +247,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
222
247
|
...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty),
|
|
223
248
|
},
|
|
224
249
|
skipPushProposedBlocksToArchiver: {
|
|
225
|
-
description: 'Skip pushing proposed blocks to archiver (
|
|
250
|
+
description: 'Skip pushing proposed blocks to archiver (test only)',
|
|
226
251
|
...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver),
|
|
227
252
|
},
|
|
228
253
|
minBlocksForCheckpoint: {
|
|
@@ -233,18 +258,31 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
233
258
|
description: 'Percent probability (0 - 100) of sequencer skipping checkpoint publishing (testing only)',
|
|
234
259
|
...numberConfigHelper(DefaultSequencerConfig.skipPublishingCheckpointsPercent),
|
|
235
260
|
},
|
|
261
|
+
skipBroadcastProposals: {
|
|
262
|
+
description: 'Skip broadcasting checkpoint and block proposals via gossipsub when proposer (for testing only)',
|
|
263
|
+
...booleanConfigHelper(false),
|
|
264
|
+
},
|
|
265
|
+
skipBroadcastCheckpointProposal: {
|
|
266
|
+
description:
|
|
267
|
+
'Skip broadcasting only the CheckpointProposal via gossipsub when proposer; the held last block is broadcast ' +
|
|
268
|
+
'standalone instead so peers still receive it as a proposed-but-uncheckpointed tip (for testing only)',
|
|
269
|
+
...booleanConfigHelper(false),
|
|
270
|
+
},
|
|
271
|
+
pauseProposingForSlots: {
|
|
272
|
+
description:
|
|
273
|
+
'List of slots for which the sequencer will not produce a proposal (for testing only). Attestation paths are unaffected.',
|
|
274
|
+
},
|
|
236
275
|
...pickConfigMappings(p2pConfigMappings, ['txPublicSetupAllowListExtend']),
|
|
237
276
|
};
|
|
238
277
|
|
|
239
278
|
export const sequencerClientConfigMappings: ConfigMappingsType<SequencerClientConfig> = {
|
|
279
|
+
...chainConfigMappings,
|
|
240
280
|
...validatorClientConfigMappings,
|
|
241
281
|
...sequencerConfigMappings,
|
|
242
282
|
...keyStoreConfigMappings,
|
|
243
283
|
...l1ReaderConfigMappings,
|
|
244
284
|
...sequencerTxSenderConfigMappings,
|
|
245
285
|
...sequencerPublisherConfigMappings,
|
|
246
|
-
...chainConfigMappings,
|
|
247
|
-
...pipelineConfigMappings,
|
|
248
286
|
...pickConfigMappings(l1ContractsConfigMappings, ['ethereumSlotDuration', 'aztecSlotDuration', 'aztecEpochDuration']),
|
|
249
287
|
};
|
|
250
288
|
|