@aztec/sequencer-client 0.0.1-commit.2f68f620 → 0.0.1-commit.3100065
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 +27 -27
- package/dest/client/sequencer-client.d.ts +16 -3
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +17 -12
- package/dest/config.d.ts +6 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +23 -14
- package/dest/global_variable_builder/fee_predictor.d.ts +1 -1
- package/dest/global_variable_builder/fee_predictor.d.ts.map +1 -1
- package/dest/global_variable_builder/fee_predictor.js +11 -1
- package/dest/global_variable_builder/fee_provider.d.ts +1 -1
- package/dest/global_variable_builder/fee_provider.d.ts.map +1 -1
- package/dest/global_variable_builder/fee_provider.js +27 -5
- package/dest/global_variable_builder/global_builder.d.ts +3 -16
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +2 -25
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/publisher/config.d.ts +5 -1
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +11 -1
- 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/sequencer-publisher.d.ts +17 -4
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +119 -22
- 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 +5 -3
- package/dest/sequencer/automine/automine_factory.d.ts.map +1 -1
- package/dest/sequencer/automine/automine_factory.js +2 -1
- package/dest/sequencer/automine/automine_sequencer.d.ts +43 -5
- package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -1
- package/dest/sequencer/automine/automine_sequencer.js +199 -18
- 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 +24 -16
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +98 -90
- package/dest/sequencer/errors.d.ts +1 -8
- package/dest/sequencer/errors.d.ts.map +1 -1
- package/dest/sequencer/errors.js +0 -9
- package/dest/sequencer/events.d.ts +16 -5
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/index.d.ts +1 -3
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +0 -2
- 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 +110 -36
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +329 -174
- 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 +18 -1
- package/package.json +28 -27
- package/src/client/sequencer-client.ts +20 -13
- package/src/config.ts +25 -12
- package/src/global_variable_builder/fee_predictor.ts +11 -1
- package/src/global_variable_builder/fee_provider.ts +27 -5
- package/src/global_variable_builder/global_builder.ts +2 -34
- package/src/index.ts +1 -10
- package/src/publisher/config.ts +22 -1
- package/src/publisher/l1_to_l2_messaging.ts +85 -0
- package/src/publisher/sequencer-publisher.ts +116 -23
- package/src/publisher/write_json.ts +78 -0
- package/src/sequencer/automine/README.md +18 -4
- package/src/sequencer/automine/automine_factory.ts +8 -1
- package/src/sequencer/automine/automine_sequencer.ts +221 -20
- package/src/sequencer/automine/index.ts +6 -0
- package/src/sequencer/checkpoint_proposal_job.ts +119 -100
- package/src/sequencer/errors.ts +0 -15
- package/src/sequencer/events.ts +16 -4
- package/src/sequencer/index.ts +0 -2
- package/src/sequencer/requests_tracker.ts +43 -0
- package/src/sequencer/sequencer.ts +360 -187
- package/src/test/index.ts +2 -2
- package/src/test/utils.ts +33 -0
- package/dest/sequencer/chain_state_overrides.d.ts +0 -61
- package/dest/sequencer/chain_state_overrides.d.ts.map +0 -1
- package/dest/sequencer/chain_state_overrides.js +0 -98
- package/dest/sequencer/timetable.d.ts +0 -98
- package/dest/sequencer/timetable.d.ts.map +0 -1
- package/dest/sequencer/timetable.js +0 -227
- package/src/sequencer/README.md +0 -243
- package/src/sequencer/chain_state_overrides.ts +0 -162
- package/src/sequencer/timetable.ts +0 -288
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDMUUsT0FBTyxLQUFLLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLDBCQUEwQixFQUFFLGVBQWUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRTNGLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSx5QkFBeUIsRUFBRSxNQUFNLDZDQUE2QyxDQUFDO0FBQzdGLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV0RCxjQUFNLGNBQWUsU0FBUSxTQUFTO0lBQ3JCLHNCQUFzQixFQUFFLHNCQUFzQixDQUFDO0lBQy9DLFNBQVMsRUFBRSxpQkFBaUIsQ0FBQztJQUM3QixnQkFBZ0IsRUFBRSx5QkFBeUIsQ0FBQztJQUM1QyxlQUFlLEVBQUUsZUFBZSxDQUFDO0lBQ2pDLGtCQUFrQixFQUFFLDBCQUEwQixDQUFDO0NBQy9EO0FBRUQsTUFBTSxNQUFNLGFBQWEsR0FBRyxjQUFjLENBQUM7QUFFM0MsY0FBTSxvQkFBcUIsU0FBUSxlQUFlO0lBQ2pDLFNBQVMsRUFBRSxhQUFhLENBQUM7SUFDekIsZ0JBQWdCLEVBQUUsZ0JBQWdCLENBQUMsU0FBUyxDQUFDLENBQUM7Q0FDOUQ7QUFFRCxNQUFNLE1BQU0sbUJBQW1CLEdBQUcsb0JBQW9CLENBQUMifQ==
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUM1RSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV0QyxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsT0FBTyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFcEUsT0FBTyxLQUFLLEVBQUUsaU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mLE9BQU8sRUFBRSxFQUFFLEdBQ1YsT0FBTyxDQUFDO0lBQUUsR0FBRyxFQUFFLEVBQUUsRUFBRSxDQUFDO0lBQUMsS0FBSyxFQUFFLE9BQU8sQ0FBQTtDQUFFLENBQUMsQ0FLeEMifQ==
|
package/dest/test/utils.d.ts.map
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,CA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B,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,mBAAmB,EAAE,SAAS,EAC9B,cAAc,CAAC,EAAE,SAAS,EAC1B,qBAAqB,GAAE,MAAW,GACjC,kBAAkB,CAgBpB;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,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
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,7 +75,7 @@ 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
|
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.3100065",
|
|
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,37 @@
|
|
|
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.3100065",
|
|
31
|
+
"@aztec/bb-prover": "0.0.1-commit.3100065",
|
|
32
|
+
"@aztec/blob-client": "0.0.1-commit.3100065",
|
|
33
|
+
"@aztec/blob-lib": "0.0.1-commit.3100065",
|
|
34
|
+
"@aztec/constants": "0.0.1-commit.3100065",
|
|
35
|
+
"@aztec/epoch-cache": "0.0.1-commit.3100065",
|
|
36
|
+
"@aztec/ethereum": "0.0.1-commit.3100065",
|
|
37
|
+
"@aztec/foundation": "0.0.1-commit.3100065",
|
|
38
|
+
"@aztec/l1-artifacts": "0.0.1-commit.3100065",
|
|
39
|
+
"@aztec/node-keystore": "0.0.1-commit.3100065",
|
|
40
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.3100065",
|
|
41
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.3100065",
|
|
42
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.3100065",
|
|
43
|
+
"@aztec/noir-types": "0.0.1-commit.3100065",
|
|
44
|
+
"@aztec/p2p": "0.0.1-commit.3100065",
|
|
45
|
+
"@aztec/protocol-contracts": "0.0.1-commit.3100065",
|
|
46
|
+
"@aztec/prover-client": "0.0.1-commit.3100065",
|
|
47
|
+
"@aztec/simulator": "0.0.1-commit.3100065",
|
|
48
|
+
"@aztec/slasher": "0.0.1-commit.3100065",
|
|
49
|
+
"@aztec/stdlib": "0.0.1-commit.3100065",
|
|
50
|
+
"@aztec/telemetry-client": "0.0.1-commit.3100065",
|
|
51
|
+
"@aztec/validator-client": "0.0.1-commit.3100065",
|
|
52
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.3100065",
|
|
53
|
+
"@aztec/world-state": "0.0.1-commit.3100065",
|
|
53
54
|
"lodash.chunk": "^4.2.0",
|
|
54
55
|
"tslib": "^2.4.0",
|
|
55
56
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
59
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
59
|
+
"@aztec/archiver": "0.0.1-commit.3100065",
|
|
60
|
+
"@aztec/kv-store": "0.0.1-commit.3100065",
|
|
60
61
|
"@electric-sql/pglite": "^0.3.14",
|
|
61
62
|
"@jest/globals": "^30.0.0",
|
|
62
63
|
"@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';
|
|
@@ -134,14 +133,6 @@ export class SequencerClient {
|
|
|
134
133
|
|
|
135
134
|
const globalsBuilder = deps.globalVariableBuilder;
|
|
136
135
|
|
|
137
|
-
// When running in anvil, assume we can post a tx up until one second before the end of an L1 slot.
|
|
138
|
-
// Otherwise, we need the full L1 slot duration for publishing to ensure inclusion.
|
|
139
|
-
// In theory, the L1 slot has an initial 4s phase where the block is propagated, so we could
|
|
140
|
-
// reduce the publishing time allowance. However, we prefer being conservative.
|
|
141
|
-
// See https://www.blocknative.com/blog/anatomy-of-a-slot#7 for more info.
|
|
142
|
-
const l1PublishingTimeBasedOnChain = isAnvilTestChain(config.l1ChainId) ? 1 : ethereumSlotDuration;
|
|
143
|
-
const l1PublishingTime = config.l1PublishingTime ?? l1PublishingTimeBasedOnChain;
|
|
144
|
-
|
|
145
136
|
const { maxL2BlockGas, maxDABlockGas, maxTxsPerBlock } = capPerBlockLimits(config, rollupManaLimit, log);
|
|
146
137
|
|
|
147
138
|
const l1Constants = {
|
|
@@ -166,7 +157,7 @@ export class SequencerClient {
|
|
|
166
157
|
deps.dateProvider,
|
|
167
158
|
epochCache,
|
|
168
159
|
rollupContract,
|
|
169
|
-
{ ...config,
|
|
160
|
+
{ ...config, maxL2BlockGas, maxDABlockGas, maxTxsPerBlock },
|
|
170
161
|
telemetryClient,
|
|
171
162
|
log,
|
|
172
163
|
);
|
|
@@ -189,16 +180,23 @@ export class SequencerClient {
|
|
|
189
180
|
this.validatorClient?.updateConfig(config);
|
|
190
181
|
}
|
|
191
182
|
|
|
192
|
-
/**
|
|
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
|
+
*/
|
|
193
189
|
public async start() {
|
|
194
190
|
await this.validatorClient?.start();
|
|
191
|
+
await this.publisherManager.start();
|
|
195
192
|
this.sequencer.start();
|
|
196
193
|
this.l1Metrics?.start();
|
|
197
|
-
await this.publisherManager.start();
|
|
198
194
|
}
|
|
199
195
|
|
|
200
196
|
/**
|
|
201
|
-
* 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.
|
|
202
200
|
*/
|
|
203
201
|
public async stop() {
|
|
204
202
|
await this.sequencer.stop();
|
|
@@ -207,6 +205,15 @@ export class SequencerClient {
|
|
|
207
205
|
this.l1Metrics?.stop();
|
|
208
206
|
}
|
|
209
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
|
+
|
|
210
217
|
/** Triggers an immediate run of the sequencer, bypassing the polling interval. */
|
|
211
218
|
public trigger() {
|
|
212
219
|
return this.sequencer.trigger();
|
package/src/config.ts
CHANGED
|
@@ -3,6 +3,7 @@ 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,
|
|
8
9
|
optionalNumberConfigHelper,
|
|
@@ -14,11 +15,13 @@ import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
|
14
15
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
16
|
import {
|
|
16
17
|
type ChainConfig,
|
|
18
|
+
DEFAULT_BLOCK_DURATION_MS,
|
|
17
19
|
DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
|
|
18
20
|
type SequencerConfig,
|
|
19
21
|
chainConfigMappings,
|
|
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,9 +45,12 @@ 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
|
|
@@ -56,6 +62,7 @@ export const DefaultSequencerConfig = {
|
|
|
56
62
|
injectFakeAttestation: false,
|
|
57
63
|
injectHighSValueAttestation: false,
|
|
58
64
|
injectUnrecoverableSignatureAttestation: false,
|
|
65
|
+
injectYParityAttestation: false,
|
|
59
66
|
fishermanMode: false,
|
|
60
67
|
shuffleAttestationOrdering: false,
|
|
61
68
|
skipPushProposedBlocksToArchiver: false,
|
|
@@ -116,7 +123,14 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
116
123
|
description:
|
|
117
124
|
'Per-block gas budget multiplier for both L2 and DA gas. Budget per block is (checkpointLimit / maxBlocks) * multiplier.' +
|
|
118
125
|
' Values greater than one allow early blocks to use more than their even share, relying on checkpoint-level capping for later blocks.',
|
|
119
|
-
...
|
|
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),
|
|
120
134
|
},
|
|
121
135
|
redistributeCheckpointBudget: {
|
|
122
136
|
env: 'SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET',
|
|
@@ -131,7 +145,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
131
145
|
},
|
|
132
146
|
feeRecipient: {
|
|
133
147
|
env: 'FEE_RECIPIENT',
|
|
134
|
-
parseEnv: (val: string) => AztecAddress.
|
|
148
|
+
parseEnv: (val: string) => AztecAddress.fromStringUnsafe(val),
|
|
135
149
|
description: 'Address to receive fees.',
|
|
136
150
|
},
|
|
137
151
|
acvmWorkingDirectory: {
|
|
@@ -142,11 +156,6 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
142
156
|
env: 'ACVM_BINARY_PATH',
|
|
143
157
|
description: 'The path to the ACVM binary',
|
|
144
158
|
},
|
|
145
|
-
enforceTimeTable: {
|
|
146
|
-
env: 'SEQ_ENFORCE_TIME_TABLE',
|
|
147
|
-
description: 'Whether to enforce the time table when building blocks',
|
|
148
|
-
...booleanConfigHelper(DefaultSequencerConfig.enforceTimeTable),
|
|
149
|
-
},
|
|
150
159
|
governanceProposerPayload: {
|
|
151
160
|
env: 'GOVERNANCE_PROPOSER_PAYLOAD_ADDRESS',
|
|
152
161
|
description: 'The address of the payload for the governanceProposer',
|
|
@@ -154,8 +163,8 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
154
163
|
},
|
|
155
164
|
l1PublishingTime: {
|
|
156
165
|
env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
|
|
157
|
-
description: 'How much time
|
|
158
|
-
...
|
|
166
|
+
description: 'How much time in seconds to allow in the slot for publishing the L1 transaction.',
|
|
167
|
+
...numberConfigHelper(DefaultSequencerConfig.l1PublishingTime),
|
|
159
168
|
},
|
|
160
169
|
fakeProcessingDelayPerTxMs: {
|
|
161
170
|
description: 'Used for testing to introduce a fake delay after processing each tx',
|
|
@@ -217,6 +226,10 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
217
226
|
description: 'Inject an attestation with an unrecoverable signature (for testing only)',
|
|
218
227
|
...booleanConfigHelper(DefaultSequencerConfig.injectUnrecoverableSignatureAttestation),
|
|
219
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
|
+
},
|
|
220
233
|
fishermanMode: {
|
|
221
234
|
env: 'FISHERMAN_MODE',
|
|
222
235
|
description:
|
|
@@ -234,7 +247,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
|
|
|
234
247
|
...booleanConfigHelper(DefaultSequencerConfig.buildCheckpointIfEmpty),
|
|
235
248
|
},
|
|
236
249
|
skipPushProposedBlocksToArchiver: {
|
|
237
|
-
description: 'Skip pushing proposed blocks to archiver (
|
|
250
|
+
description: 'Skip pushing proposed blocks to archiver (test only)',
|
|
238
251
|
...booleanConfigHelper(DefaultSequencerConfig.skipPushProposedBlocksToArchiver),
|
|
239
252
|
},
|
|
240
253
|
minBlocksForCheckpoint: {
|
|
@@ -61,7 +61,17 @@ export class FeePredictor {
|
|
|
61
61
|
const blockNumber = await this.publicClient.getBlockNumber({ cacheTime: 0 });
|
|
62
62
|
if (this.cachedL1BlockNumber === undefined || blockNumber > this.cachedL1BlockNumber) {
|
|
63
63
|
this.cachedL1BlockNumber = blockNumber;
|
|
64
|
-
|
|
64
|
+
// Reset the cached block number on failure so a transient L1 RPC error does not leave a
|
|
65
|
+
// rejected promise cached for this block, which would replay the same rejection on every
|
|
66
|
+
// subsequent call until the next L1 block arrives. Only clear it if it still points at the
|
|
67
|
+
// block this attempt was for, so a stale rejection from an older block cannot wipe a marker
|
|
68
|
+
// a newer call already advanced (which would also defeat the monotonic block-number guard).
|
|
69
|
+
this.cachedState = this.fetchState(blockNumber).catch(err => {
|
|
70
|
+
if (this.cachedL1BlockNumber === blockNumber) {
|
|
71
|
+
this.cachedL1BlockNumber = undefined;
|
|
72
|
+
}
|
|
73
|
+
throw err;
|
|
74
|
+
});
|
|
65
75
|
}
|
|
66
76
|
return this.cachedState!;
|
|
67
77
|
}
|
|
@@ -59,17 +59,39 @@ export class FeeProviderImpl implements FeeProvider {
|
|
|
59
59
|
|
|
60
60
|
public async getCurrentMinFees(): Promise<GasFees> {
|
|
61
61
|
// Get the current block number
|
|
62
|
-
const blockNumber = await this.publicClient.getBlockNumber();
|
|
62
|
+
const blockNumber = await this.publicClient.getBlockNumber({ cacheTime: 0 });
|
|
63
63
|
|
|
64
|
-
// If the L1 block number has changed then chain a new promise to get the current min fees
|
|
64
|
+
// If the L1 block number has changed then chain a new promise to get the current min fees.
|
|
65
|
+
// We chain off the previous promise's settlement (via a swallowing catch) rather than its
|
|
66
|
+
// fulfillment, so a prior rejection does not short-circuit the new computation. If the new
|
|
67
|
+
// computation fails (e.g. a transient L1 RPC error), reset the cached block number so the
|
|
68
|
+
// next call recomputes instead of permanently replaying the rejected promise — otherwise a
|
|
69
|
+
// single transient failure would wedge fee estimation until the next L1 block arrives. Only
|
|
70
|
+
// clear it if it still points at the block this attempt was for, so a stale rejection from an
|
|
71
|
+
// older block cannot wipe a marker a newer call already advanced (which would also defeat the
|
|
72
|
+
// monotonic block-number guard).
|
|
65
73
|
if (this.currentL1BlockNumber === undefined || blockNumber > this.currentL1BlockNumber) {
|
|
66
74
|
this.currentL1BlockNumber = blockNumber;
|
|
67
|
-
this.currentMinFees = this.currentMinFees
|
|
75
|
+
this.currentMinFees = this.currentMinFees
|
|
76
|
+
.catch(() => undefined)
|
|
77
|
+
.then(() =>
|
|
78
|
+
this.computeCurrentMinFees().catch(err => {
|
|
79
|
+
if (this.currentL1BlockNumber === blockNumber) {
|
|
80
|
+
this.currentL1BlockNumber = undefined;
|
|
81
|
+
}
|
|
82
|
+
throw err;
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
68
85
|
}
|
|
69
86
|
return this.currentMinFees;
|
|
70
87
|
}
|
|
71
88
|
|
|
72
|
-
public getPredictedMinFees(manaUsage?: ManaUsageEstimate): Promise<GasFees[]> {
|
|
73
|
-
|
|
89
|
+
public async getPredictedMinFees(manaUsage?: ManaUsageEstimate): Promise<GasFees[]> {
|
|
90
|
+
const [currentMinFees, predictedMinFees] = await Promise.all([
|
|
91
|
+
this.getCurrentMinFees(),
|
|
92
|
+
this.feePredictor.getPredictedMinFees(manaUsage ?? ManaUsageEstimate.Target),
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
return [currentMinFees, ...predictedMinFees];
|
|
74
96
|
}
|
|
75
97
|
}
|
|
@@ -4,18 +4,16 @@ import {
|
|
|
4
4
|
buildSimulationOverridesStateOverride,
|
|
5
5
|
} from '@aztec/ethereum/contracts';
|
|
6
6
|
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
7
|
-
import {
|
|
7
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
8
8
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
9
9
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
|
-
import type { DateProvider } from '@aztec/foundation/timer';
|
|
11
10
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
-
import { type L1RollupConstants,
|
|
11
|
+
import { type L1RollupConstants, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
13
12
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
14
13
|
import type {
|
|
15
14
|
CheckpointGlobalVariables,
|
|
16
15
|
GlobalVariableBuilder as GlobalVariableBuilderInterface,
|
|
17
16
|
} from '@aztec/stdlib/tx';
|
|
18
|
-
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
19
17
|
|
|
20
18
|
/** Configuration for the GlobalVariableBuilder (excludes L1 client config). */
|
|
21
19
|
export type GlobalVariableBuilderConfig = {
|
|
@@ -29,7 +27,6 @@ export type GlobalVariableBuilderConfig = {
|
|
|
29
27
|
*/
|
|
30
28
|
export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
31
29
|
private readonly rollupContract: RollupContract;
|
|
32
|
-
private readonly ethereumSlotDuration: number;
|
|
33
30
|
private readonly aztecSlotDuration: number;
|
|
34
31
|
private readonly l1GenesisTime: bigint;
|
|
35
32
|
|
|
@@ -37,47 +34,18 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface {
|
|
|
37
34
|
private version: Fr;
|
|
38
35
|
|
|
39
36
|
constructor(
|
|
40
|
-
private readonly dateProvider: DateProvider,
|
|
41
37
|
private readonly publicClient: ViemPublicClient,
|
|
42
38
|
config: GlobalVariableBuilderConfig,
|
|
43
39
|
) {
|
|
44
40
|
this.version = new Fr(config.rollupVersion);
|
|
45
41
|
this.chainId = new Fr(this.publicClient.chain!.id);
|
|
46
42
|
|
|
47
|
-
this.ethereumSlotDuration = config.ethereumSlotDuration;
|
|
48
43
|
this.aztecSlotDuration = config.slotDuration;
|
|
49
44
|
this.l1GenesisTime = config.l1GenesisTime;
|
|
50
45
|
|
|
51
46
|
this.rollupContract = new RollupContract(this.publicClient, config.rollupAddress);
|
|
52
47
|
}
|
|
53
48
|
|
|
54
|
-
/**
|
|
55
|
-
* Simple builder of global variables.
|
|
56
|
-
* @param blockNumber - The block number to build global variables for.
|
|
57
|
-
* @param coinbase - The address to receive block reward.
|
|
58
|
-
* @param feeRecipient - The address to receive fees.
|
|
59
|
-
* @param slotNumber - The slot number to use for the global variables, if undefined it will be calculated.
|
|
60
|
-
* @returns The global variables for the given block number.
|
|
61
|
-
*/
|
|
62
|
-
public async buildGlobalVariables(
|
|
63
|
-
blockNumber: BlockNumber,
|
|
64
|
-
coinbase: EthAddress,
|
|
65
|
-
feeRecipient: AztecAddress,
|
|
66
|
-
maybeSlot?: SlotNumber,
|
|
67
|
-
): Promise<GlobalVariables> {
|
|
68
|
-
const slot: SlotNumber =
|
|
69
|
-
maybeSlot ??
|
|
70
|
-
(await this.rollupContract.getSlotAt(
|
|
71
|
-
getNextL1SlotTimestamp(this.dateProvider.nowInSeconds(), {
|
|
72
|
-
l1GenesisTime: this.l1GenesisTime,
|
|
73
|
-
ethereumSlotDuration: this.ethereumSlotDuration,
|
|
74
|
-
}),
|
|
75
|
-
));
|
|
76
|
-
|
|
77
|
-
const checkpointGlobalVariables = await this.buildCheckpointGlobalVariables(coinbase, feeRecipient, slot);
|
|
78
|
-
return GlobalVariables.from({ blockNumber, ...checkpointGlobalVariables });
|
|
79
|
-
}
|
|
80
|
-
|
|
81
49
|
/** Builds global variables that are constant throughout a checkpoint. */
|
|
82
50
|
public async buildCheckpointGlobalVariables(
|
|
83
51
|
coinbase: EthAddress,
|
package/src/index.ts
CHANGED
|
@@ -1,16 +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
|
-
AutomineSequencer,
|
|
6
|
-
type AutomineSequencerConstants,
|
|
7
|
-
type AutomineSequencerDeps,
|
|
8
|
-
createAutomineSequencer,
|
|
9
|
-
type CreateAutomineSequencerArgs,
|
|
10
|
-
Sequencer,
|
|
11
|
-
SequencerState,
|
|
12
|
-
type SequencerEvents,
|
|
13
|
-
} from './sequencer/index.js';
|
|
4
|
+
export { Sequencer, SequencerState, type SequencerEvents } from './sequencer/index.js';
|
|
14
5
|
|
|
15
6
|
// Used by the node to simulate public parts of transactions. Should these be moved to a shared library?
|
|
16
7
|
// ISSUE(#9832)
|
package/src/publisher/config.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { type BlobClientConfig, blobClientConfigMapping } from '@aztec/blob-client/client/config';
|
|
2
2
|
import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
3
3
|
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from '@aztec/ethereum/l1-tx-utils/config';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
type ConfigMappingsType,
|
|
6
|
+
SecretValue,
|
|
7
|
+
booleanConfigHelper,
|
|
8
|
+
numberConfigHelper,
|
|
9
|
+
} from '@aztec/foundation/config';
|
|
5
10
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
11
|
|
|
7
12
|
import { parseEther } from 'viem';
|
|
@@ -90,6 +95,10 @@ export type SequencerPublisherConfig = L1TxUtilsConfig &
|
|
|
90
95
|
fishermanMode?: boolean;
|
|
91
96
|
sequencerPublisherAllowInvalidStates?: boolean;
|
|
92
97
|
sequencerPublisherForwarderAddress?: EthAddress;
|
|
98
|
+
/** How long to wait for the previous L1 block before sending scheduled publisher txs anyway. */
|
|
99
|
+
sequencerPublisherPreviousL1BlockWaitTimeoutMs: number;
|
|
100
|
+
/** Poll interval while waiting for the previous L1 block before scheduled publisher txs. */
|
|
101
|
+
sequencerPublisherPreviousL1BlockWaitPollIntervalMs: number;
|
|
93
102
|
/** Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path */
|
|
94
103
|
l1TxFailedStore?: string;
|
|
95
104
|
/** Min ETH balance below which a publisher gets funded. Undefined = funding disabled. */
|
|
@@ -170,6 +179,18 @@ export const sequencerPublisherConfigMappings: ConfigMappingsType<SequencerPubli
|
|
|
170
179
|
description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
|
|
171
180
|
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
172
181
|
},
|
|
182
|
+
sequencerPublisherPreviousL1BlockWaitTimeoutMs: {
|
|
183
|
+
env: `SEQ_PUBLISHER_PREVIOUS_L1_BLOCK_WAIT_TIMEOUT_MS`,
|
|
184
|
+
description:
|
|
185
|
+
'How long to wait for the previous L1 block before sending scheduled publisher txs anyway, in milliseconds.',
|
|
186
|
+
...numberConfigHelper(8_000),
|
|
187
|
+
},
|
|
188
|
+
sequencerPublisherPreviousL1BlockWaitPollIntervalMs: {
|
|
189
|
+
env: `SEQ_PUBLISHER_PREVIOUS_L1_BLOCK_WAIT_POLL_INTERVAL_MS`,
|
|
190
|
+
description:
|
|
191
|
+
'Poll interval while waiting for the previous L1 block before scheduled publisher txs, in milliseconds.',
|
|
192
|
+
...numberConfigHelper(500),
|
|
193
|
+
},
|
|
173
194
|
l1TxFailedStore: {
|
|
174
195
|
env: 'L1_TX_FAILED_STORE',
|
|
175
196
|
description: 'Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path',
|