@aztec/p2p 0.0.1-commit.9badcec54 → 0.0.1-commit.9ebd450e8
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/factory.d.ts +3 -2
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +16 -15
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +4 -1
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +2 -1
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/index.js +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.js +62 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +4 -1
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +5 -2
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +7 -4
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +2 -1
- package/dest/msg_validators/tx_validator/factory.d.ts +2 -2
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +3 -3
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +36 -4
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +46 -31
- package/dest/services/libp2p/libp2p_service.d.ts +5 -3
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +8 -18
- package/dest/test-helpers/make-test-p2p-clients.d.ts +1 -1
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- package/dest/test-helpers/make-test-p2p-clients.js +4 -1
- package/dest/test-helpers/mock-pubsub.d.ts +1 -1
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +1 -1
- package/dest/test-helpers/reqresp-nodes.d.ts +1 -1
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +4 -1
- package/dest/testbench/p2p_client_testbench_worker.d.ts +1 -1
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +7 -2
- package/package.json +14 -14
- package/src/client/factory.ts +23 -18
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +2 -0
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +1 -0
- package/src/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.ts +65 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +3 -0
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +12 -6
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +2 -0
- package/src/msg_validators/tx_validator/README.md +11 -3
- package/src/msg_validators/tx_validator/factory.ts +3 -1
- package/src/msg_validators/tx_validator/gas_validator.ts +64 -31
- package/src/services/libp2p/libp2p_service.ts +8 -13
- package/src/test-helpers/make-test-p2p-clients.ts +2 -0
- package/src/test-helpers/mock-pubsub.ts +3 -0
- package/src/test-helpers/reqresp-nodes.ts +2 -0
- package/src/testbench/p2p_client_testbench_worker.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/p2p",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.9ebd450e8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -67,17 +67,17 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/constants": "0.0.1-commit.
|
|
71
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
72
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
73
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
74
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
75
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
76
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
77
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
78
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
79
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
80
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
70
|
+
"@aztec/constants": "0.0.1-commit.9ebd450e8",
|
|
71
|
+
"@aztec/epoch-cache": "0.0.1-commit.9ebd450e8",
|
|
72
|
+
"@aztec/ethereum": "0.0.1-commit.9ebd450e8",
|
|
73
|
+
"@aztec/foundation": "0.0.1-commit.9ebd450e8",
|
|
74
|
+
"@aztec/kv-store": "0.0.1-commit.9ebd450e8",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.9ebd450e8",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.9ebd450e8",
|
|
77
|
+
"@aztec/protocol-contracts": "0.0.1-commit.9ebd450e8",
|
|
78
|
+
"@aztec/simulator": "0.0.1-commit.9ebd450e8",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.9ebd450e8",
|
|
80
|
+
"@aztec/telemetry-client": "0.0.1-commit.9ebd450e8",
|
|
81
81
|
"@chainsafe/libp2p-gossipsub": "13.0.0",
|
|
82
82
|
"@chainsafe/libp2p-noise": "^15.0.0",
|
|
83
83
|
"@chainsafe/libp2p-yamux": "^6.0.2",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"xxhash-wasm": "^1.1.0"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
108
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
107
|
+
"@aztec/archiver": "0.0.1-commit.9ebd450e8",
|
|
108
|
+
"@aztec/world-state": "0.0.1-commit.9ebd450e8",
|
|
109
109
|
"@jest/globals": "^30.0.0",
|
|
110
110
|
"@types/jest": "^30.0.0",
|
|
111
111
|
"@types/node": "^22.15.17",
|
package/src/client/factory.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { AztecLMDBStoreV2, createStore } from '@aztec/kv-store/lmdb-v2';
|
|
|
7
7
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
8
8
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
9
9
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
|
+
import type { BlockMinFeesProvider } from '@aztec/stdlib/gas';
|
|
10
11
|
import type { AztecNode, ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
11
12
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
12
13
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -52,6 +53,7 @@ export async function createP2PClient(
|
|
|
52
53
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
53
54
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
54
55
|
epochCache: EpochCacheInterface,
|
|
56
|
+
blockMinFeesProvider: BlockMinFeesProvider,
|
|
55
57
|
packageVersion: string,
|
|
56
58
|
dateProvider: DateProvider = new DateProvider(),
|
|
57
59
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
@@ -90,23 +92,6 @@ export async function createP2PClient(
|
|
|
90
92
|
() => epochCache.getEpochAndSlotInNextL1Slot().ts,
|
|
91
93
|
);
|
|
92
94
|
|
|
93
|
-
const createTxValidator = async () => {
|
|
94
|
-
// We accept transactions if they are not expired by the next slot and block number (checked based on the ExpirationTimestamp field)
|
|
95
|
-
const currentBlockNumber = await archiver.getBlockNumber();
|
|
96
|
-
const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
|
|
97
|
-
const l1Constants = await archiver.getL1Constants();
|
|
98
|
-
return createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
99
|
-
worldStateSynchronizer,
|
|
100
|
-
nextSlotTimestamp,
|
|
101
|
-
BlockNumber(currentBlockNumber + 1),
|
|
102
|
-
{
|
|
103
|
-
rollupManaLimit: l1Constants.rollupManaLimit,
|
|
104
|
-
maxBlockL2Gas: config.validateMaxL2BlockGas,
|
|
105
|
-
maxBlockDAGas: config.validateMaxDABlockGas,
|
|
106
|
-
},
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
95
|
const txPool =
|
|
111
96
|
deps.txPool ??
|
|
112
97
|
new AztecKVTxPoolV2(
|
|
@@ -116,7 +101,24 @@ export async function createP2PClient(
|
|
|
116
101
|
l2BlockSource: archiver,
|
|
117
102
|
worldStateSynchronizer,
|
|
118
103
|
checkAllowedSetupCalls,
|
|
119
|
-
createTxValidator
|
|
104
|
+
createTxValidator: async () => {
|
|
105
|
+
const currentBlockNumber = await archiver.getBlockNumber();
|
|
106
|
+
const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
|
|
107
|
+
const l1Constants = await archiver.getL1Constants();
|
|
108
|
+
const gasFees = await blockMinFeesProvider.getCurrentMinFees();
|
|
109
|
+
return createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
110
|
+
worldStateSynchronizer,
|
|
111
|
+
nextSlotTimestamp,
|
|
112
|
+
BlockNumber(currentBlockNumber + 1),
|
|
113
|
+
{
|
|
114
|
+
rollupManaLimit: l1Constants.rollupManaLimit,
|
|
115
|
+
maxBlockL2Gas: config.validateMaxL2BlockGas,
|
|
116
|
+
maxBlockDAGas: config.validateMaxDABlockGas,
|
|
117
|
+
},
|
|
118
|
+
gasFees,
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
blockMinFeesProvider,
|
|
120
122
|
},
|
|
121
123
|
telemetry,
|
|
122
124
|
{
|
|
@@ -140,6 +142,7 @@ export async function createP2PClient(
|
|
|
140
142
|
proofVerifier,
|
|
141
143
|
worldStateSynchronizer,
|
|
142
144
|
epochCache,
|
|
145
|
+
blockMinFeesProvider,
|
|
143
146
|
store,
|
|
144
147
|
peerStore,
|
|
145
148
|
mempools,
|
|
@@ -216,6 +219,7 @@ async function createP2PService(
|
|
|
216
219
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
217
220
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
218
221
|
epochCache: EpochCacheInterface,
|
|
222
|
+
blockMinFeesProvider: BlockMinFeesProvider,
|
|
219
223
|
store: AztecAsyncKVStore,
|
|
220
224
|
peerStore: AztecLMDBStoreV2,
|
|
221
225
|
mempools: MemPools,
|
|
@@ -243,6 +247,7 @@ async function createP2PService(
|
|
|
243
247
|
proofVerifier,
|
|
244
248
|
worldStateSynchronizer,
|
|
245
249
|
peerStore,
|
|
250
|
+
blockMinFeesProvider,
|
|
246
251
|
telemetry,
|
|
247
252
|
logger: logger.createChild(`libp2p_service`),
|
|
248
253
|
});
|
|
@@ -6,6 +6,7 @@ import { DateProvider, Timer, executeTimeout } from '@aztec/foundation/timer';
|
|
|
6
6
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
7
7
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
8
8
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
9
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
9
10
|
import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
|
|
10
11
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
11
12
|
import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
@@ -119,6 +120,7 @@ async function startClient(config: P2PConfig, clientIndex: number) {
|
|
|
119
120
|
proofVerifier as ClientProtocolCircuitVerifier,
|
|
120
121
|
worldState,
|
|
121
122
|
epochCache,
|
|
123
|
+
{ getCurrentMinFees: () => Promise.resolve(GasFees.empty()) },
|
|
122
124
|
'proposal-tx-collector-bench-worker',
|
|
123
125
|
new DateProvider(),
|
|
124
126
|
telemetry as TelemetryClient,
|
|
@@ -21,6 +21,7 @@ export { FeePayerBalancePreAddRule } from './fee_payer_balance_pre_add_rule.js';
|
|
|
21
21
|
export { LowPriorityPreAddRule } from './low_priority_pre_add_rule.js';
|
|
22
22
|
|
|
23
23
|
// Post-event eviction rules
|
|
24
|
+
export { InsufficientFeePerGasEvictionRule } from './insufficient_fee_per_gas_eviction_rule.js';
|
|
24
25
|
export { InvalidTxsAfterMiningRule } from './invalid_txs_after_mining_rule.js';
|
|
25
26
|
export { InvalidTxsAfterReorgRule } from './invalid_txs_after_reorg_rule.js';
|
|
26
27
|
export { FeePayerBalanceEvictionRule } from './fee_payer_balance_eviction_rule.js';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import type { BlockMinFeesProvider } from '@aztec/stdlib/gas';
|
|
3
|
+
|
|
4
|
+
import type { EvictionContext, EvictionResult, EvictionRule, PoolOperations } from './interfaces.js';
|
|
5
|
+
import { EvictionEvent } from './interfaces.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Eviction rule that removes transactions whose maxFeesPerGas no longer meets
|
|
9
|
+
* the projected minimum gas fees after a new block is mined.
|
|
10
|
+
* Uses the BlockMinFeesProvider (forward-looking) to get the projected minimum fees.
|
|
11
|
+
* Only triggers on BLOCK_MINED events.
|
|
12
|
+
*/
|
|
13
|
+
export class InsufficientFeePerGasEvictionRule implements EvictionRule {
|
|
14
|
+
public readonly name = 'InsufficientFeePerGas';
|
|
15
|
+
|
|
16
|
+
private log = createLogger('p2p:tx_pool_v2:insufficient_fee_per_gas_eviction_rule');
|
|
17
|
+
|
|
18
|
+
constructor(private blockMinFeesProvider: BlockMinFeesProvider) {}
|
|
19
|
+
|
|
20
|
+
async evict(context: EvictionContext, pool: PoolOperations): Promise<EvictionResult> {
|
|
21
|
+
if (context.event !== EvictionEvent.BLOCK_MINED) {
|
|
22
|
+
return {
|
|
23
|
+
reason: 'insufficient_fee_per_gas',
|
|
24
|
+
success: true,
|
|
25
|
+
txsEvicted: [],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const gasFees = await this.blockMinFeesProvider.getCurrentMinFees();
|
|
31
|
+
const txsToEvict: string[] = [];
|
|
32
|
+
const pendingTxs = pool.getPendingTxs();
|
|
33
|
+
|
|
34
|
+
for (const meta of pendingTxs) {
|
|
35
|
+
const maxFeesPerGas = meta.data.constants.txContext.gasSettings.maxFeesPerGas;
|
|
36
|
+
if (maxFeesPerGas.feePerDaGas < gasFees.feePerDaGas || maxFeesPerGas.feePerL2Gas < gasFees.feePerL2Gas) {
|
|
37
|
+
this.log.verbose(`Evicting tx ${meta.txHash} from pool due to insufficient fee per gas`, {
|
|
38
|
+
txMaxFeesPerGas: maxFeesPerGas.toInspect(),
|
|
39
|
+
blockGasFees: gasFees.toInspect(),
|
|
40
|
+
});
|
|
41
|
+
txsToEvict.push(meta.txHash);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (txsToEvict.length > 0) {
|
|
46
|
+
this.log.info(`Evicted ${txsToEvict.length} txs with insufficient fee per gas after block mined`);
|
|
47
|
+
await pool.deleteTxs(txsToEvict, this.name);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
reason: 'insufficient_fee_per_gas',
|
|
52
|
+
success: true,
|
|
53
|
+
txsEvicted: txsToEvict,
|
|
54
|
+
};
|
|
55
|
+
} catch (err) {
|
|
56
|
+
this.log.error('Failed to evict transactions with insufficient fee per gas', { err });
|
|
57
|
+
return {
|
|
58
|
+
reason: 'insufficient_fee_per_gas',
|
|
59
|
+
success: false,
|
|
60
|
+
txsEvicted: [],
|
|
61
|
+
error: new Error('Failed to evict txs with insufficient fee per gas', { cause: err }),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
3
3
|
import type { L2Block, L2BlockId, L2BlockSource } from '@aztec/stdlib/block';
|
|
4
|
+
import type { BlockMinFeesProvider } from '@aztec/stdlib/gas';
|
|
4
5
|
import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
5
6
|
import type { BlockHeader, Tx, TxHash, TxValidator } from '@aztec/stdlib/tx';
|
|
6
7
|
|
|
@@ -74,6 +75,8 @@ export type TxPoolV2Dependencies = {
|
|
|
74
75
|
createTxValidator: () => Promise<TxValidator<TxMetaData>>;
|
|
75
76
|
/** Checks whether a tx's setup-phase calls are on the allow list. Precomputed at receipt time. */
|
|
76
77
|
checkAllowedSetupCalls: (tx: Tx) => Promise<boolean>;
|
|
78
|
+
/** Provides projected minimum fees for the next block. Used by eviction rules instead of stale block header fees. */
|
|
79
|
+
blockMinFeesProvider: BlockMinFeesProvider;
|
|
77
80
|
};
|
|
78
81
|
|
|
79
82
|
/**
|
|
@@ -3,7 +3,7 @@ import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
5
|
import { BlockHash, type L2BlockId } from '@aztec/stdlib/block';
|
|
6
|
-
import { Gas } from '@aztec/stdlib/gas';
|
|
6
|
+
import { Gas, GasFees } from '@aztec/stdlib/gas';
|
|
7
7
|
import { type Tx, TxHash } from '@aztec/stdlib/tx';
|
|
8
8
|
|
|
9
9
|
import { getFeePayerBalanceDelta } from '../../msg_validators/tx_validator/fee_payer_balance.js';
|
|
@@ -23,7 +23,7 @@ export type TxMetaValidationData = {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
txContext: {
|
|
26
|
-
gasSettings: { gasLimits: Gas };
|
|
26
|
+
gasSettings: { gasLimits: Gas; maxFeesPerGas: GasFees };
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
};
|
|
@@ -132,7 +132,10 @@ export async function buildTxMetaData(tx: Tx, allowedSetupCalls: boolean = true)
|
|
|
132
132
|
globalVariables: { blockNumber: anchorBlockNumber },
|
|
133
133
|
},
|
|
134
134
|
txContext: {
|
|
135
|
-
gasSettings: {
|
|
135
|
+
gasSettings: {
|
|
136
|
+
gasLimits: tx.data.constants.txContext.gasSettings.gasLimits,
|
|
137
|
+
maxFeesPerGas: tx.data.constants.txContext.gasSettings.maxFeesPerGas,
|
|
138
|
+
},
|
|
136
139
|
},
|
|
137
140
|
},
|
|
138
141
|
},
|
|
@@ -285,7 +288,9 @@ export function checkNullifierConflict(
|
|
|
285
288
|
}
|
|
286
289
|
|
|
287
290
|
/** Creates a stub TxMetaValidationData for tests that don't exercise validators. */
|
|
288
|
-
export function stubTxMetaValidationData(
|
|
291
|
+
export function stubTxMetaValidationData(
|
|
292
|
+
overrides: { expirationTimestamp?: bigint; maxFeesPerGas?: GasFees } = {},
|
|
293
|
+
): TxMetaValidationData {
|
|
289
294
|
return {
|
|
290
295
|
getNonEmptyNullifiers: () => [],
|
|
291
296
|
expirationTimestamp: overrides.expirationTimestamp ?? 0n,
|
|
@@ -295,7 +300,7 @@ export function stubTxMetaValidationData(overrides: { expirationTimestamp?: bigi
|
|
|
295
300
|
globalVariables: { blockNumber: BlockNumber(0) },
|
|
296
301
|
},
|
|
297
302
|
txContext: {
|
|
298
|
-
gasSettings: { gasLimits: Gas.empty() },
|
|
303
|
+
gasSettings: { gasLimits: Gas.empty(), maxFeesPerGas: overrides.maxFeesPerGas ?? GasFees.empty() },
|
|
299
304
|
},
|
|
300
305
|
},
|
|
301
306
|
};
|
|
@@ -313,6 +318,7 @@ export function stubTxMetaData(
|
|
|
313
318
|
expirationTimestamp?: bigint;
|
|
314
319
|
anchorBlockHeaderHash?: string;
|
|
315
320
|
allowedSetupCalls?: boolean;
|
|
321
|
+
maxFeesPerGas?: GasFees;
|
|
316
322
|
} = {},
|
|
317
323
|
): TxMetaData {
|
|
318
324
|
const txHashBigInt = Fr.fromHexString(txHash).toBigInt();
|
|
@@ -332,7 +338,7 @@ export function stubTxMetaData(
|
|
|
332
338
|
allowedSetupCalls: overrides.allowedSetupCalls ?? true,
|
|
333
339
|
receivedAt: 0,
|
|
334
340
|
estimatedSizeBytes: 0,
|
|
335
|
-
data: stubTxMetaValidationData({ expirationTimestamp }),
|
|
341
|
+
data: stubTxMetaValidationData({ expirationTimestamp, maxFeesPerGas: overrides.maxFeesPerGas }),
|
|
336
342
|
};
|
|
337
343
|
}
|
|
338
344
|
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
EvictionManager,
|
|
18
18
|
FeePayerBalanceEvictionRule,
|
|
19
19
|
FeePayerBalancePreAddRule,
|
|
20
|
+
InsufficientFeePerGasEvictionRule,
|
|
20
21
|
InvalidTxsAfterMiningRule,
|
|
21
22
|
InvalidTxsAfterReorgRule,
|
|
22
23
|
LowPriorityEvictionRule,
|
|
@@ -116,6 +117,7 @@ export class TxPoolV2Impl {
|
|
|
116
117
|
|
|
117
118
|
// Post-event eviction rules (run after events to check ALL pending txs)
|
|
118
119
|
this.#evictionManager.registerRule(new InvalidTxsAfterMiningRule());
|
|
120
|
+
this.#evictionManager.registerRule(new InsufficientFeePerGasEvictionRule(deps.blockMinFeesProvider));
|
|
119
121
|
this.#evictionManager.registerRule(new InvalidTxsAfterReorgRule(deps.worldStateSynchronizer));
|
|
120
122
|
this.#evictionManager.registerRule(new FeePayerBalanceEvictionRule(deps.worldStateSynchronizer));
|
|
121
123
|
// LowPriorityEvictionRule handles cases where txs become pending via prepareForSlot (unprotect)
|
|
@@ -75,7 +75,7 @@ This validator is invoked on **every** transaction potentially entering the pend
|
|
|
75
75
|
- Startup hydration — revalidating persisted non-mined txs on node restart
|
|
76
76
|
|
|
77
77
|
Runs:
|
|
78
|
-
- DoubleSpend, BlockHeader, GasLimits, Timestamp, AllowedSetupCalls
|
|
78
|
+
- DoubleSpend, BlockHeader, GasLimits, MaxFeePerGas, Timestamp, AllowedSetupCalls
|
|
79
79
|
|
|
80
80
|
Operates on `TxMetaData` (pre-built by the pool) rather than full `Tx` objects.
|
|
81
81
|
|
|
@@ -91,8 +91,9 @@ The `AllowedSetupCallsMetaValidator` checks a precomputed boolean flag (`TxMetaD
|
|
|
91
91
|
| `MetadataTxValidator` | Chain ID, rollup version, protocol contracts hash, VK tree root | 4.18 us |
|
|
92
92
|
| `TimestampTxValidator` | Transaction has not expired (expiration timestamp vs next slot) | 1.56 us |
|
|
93
93
|
| `DoubleSpendTxValidator` | Nullifiers do not already exist in the nullifier tree | 106.08 us |
|
|
94
|
-
| `GasTxValidator` | Gas limits are within bounds (delegates to `GasLimitsValidator`), max fee per gas meets current block fees, and fee payer has sufficient FeeJuice balance | 1.02 ms |
|
|
94
|
+
| `GasTxValidator` | Gas limits are within bounds (delegates to `GasLimitsValidator`), max fee per gas meets current block fees (delegates to `MaxFeePerGasValidator`), and fee payer has sufficient FeeJuice balance | 1.02 ms |
|
|
95
95
|
| `GasLimitsValidator` | Gas limits are >= fixed minimums and <= AVM max processable L2 gas. Used standalone in pool migration; also called internally by `GasTxValidator` | 3–10 us |
|
|
96
|
+
| `MaxFeePerGasValidator` | Max fee per gas >= current block gas fees on both dimensions (DA and L2). Used standalone in pool migration; also called internally by `GasTxValidator` | 3–10 us |
|
|
96
97
|
| `PhasesTxValidator` | Public function calls in setup phase are on the allow list | 10.12–13.12 us |
|
|
97
98
|
| `AllowedSetupCallsMetaValidator` | Checks the precomputed `allowedSetupCalls` flag on `TxMetaData`. Used in pool migration instead of the full `PhasesTxValidator` | — |
|
|
98
99
|
| `BlockHeaderTxValidator` | Transaction's anchor block hash exists in the archive tree | 98.88 us |
|
|
@@ -110,10 +111,17 @@ The `AllowedSetupCallsMetaValidator` checks a precomputed boolean flag (`TxMetaD
|
|
|
110
111
|
| DoubleSpend | Stage 1 | Yes | — | Yes | Yes |
|
|
111
112
|
| Gas (balance + limits) | Stage 1 | Optional* | — | Yes | — |
|
|
112
113
|
| GasLimits (standalone) | — | — | — | — | Yes |
|
|
114
|
+
| MaxFeePerGas (standalone) | — | — | — | — | Yes |
|
|
113
115
|
| Phases | Stage 1 | Yes | — | Yes | — |
|
|
114
116
|
| AllowedSetupCalls | — | — | — | — | Yes |
|
|
115
117
|
| BlockHeader | Stage 1 | Yes | — | Yes | Yes |
|
|
116
118
|
| Proof | Stage 2 | Optional** | Yes | — | — |
|
|
117
119
|
|
|
118
|
-
\* Gas balance check is skipped when `skipFeeEnforcement` is set (testing/dev). `GasTxValidator` internally delegates to `GasLimitsValidator` as its first
|
|
120
|
+
\* Gas balance check is skipped when `skipFeeEnforcement` is set (testing/dev). `GasTxValidator` internally delegates to `GasLimitsValidator` and `MaxFeePerGasValidator` as its first steps, so gas limits and fee-per-gas are checked wherever `GasTxValidator` runs. Pool migration uses `GasLimitsValidator` and `MaxFeePerGasValidator` standalone because it doesn't need the balance check.
|
|
119
121
|
\** Proof verification is skipped for simulations (no verifier provided).
|
|
122
|
+
|
|
123
|
+
## Fee-Per-Gas Rejection Strategy
|
|
124
|
+
|
|
125
|
+
The `MaxFeePerGasValidator` and `InsufficientFeePerGasEvictionRule` reject and evict transactions whose `maxFeesPerGas` falls below the current block's gas fees. This is a simple strategy: if a tx can't pay the current fees, it gets rejected on entry and evicted after each new block.
|
|
126
|
+
|
|
127
|
+
**Caveat**: This may evict transactions that would become valid again if block fees drop. A more nuanced approach would be to define a threshold (e.g., 50%) and only reject/evict when the tx's max fee falls below that fraction of the current fees. The current approach is simpler and ensures the pool doesn't accumulate transactions with low max fees that are unlikely to be mined soon.
|
|
@@ -56,7 +56,7 @@ import { type ArchiveSource, BlockHeaderTxValidator } from './block_header_valid
|
|
|
56
56
|
import { ContractInstanceTxValidator } from './contract_instance_validator.js';
|
|
57
57
|
import { DataTxValidator } from './data_validator.js';
|
|
58
58
|
import { DoubleSpendTxValidator, type NullifierSource } from './double_spend_validator.js';
|
|
59
|
-
import { GasLimitsValidator, GasTxValidator } from './gas_validator.js';
|
|
59
|
+
import { GasLimitsValidator, GasTxValidator, MaxFeePerGasValidator } from './gas_validator.js';
|
|
60
60
|
import { MetadataTxValidator } from './metadata_validator.js';
|
|
61
61
|
import { NullifierCache } from './nullifier_cache.js';
|
|
62
62
|
import { AllowedSetupCallsMetaValidator, PhasesTxValidator } from './phases_validator.js';
|
|
@@ -423,6 +423,7 @@ export async function createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
|
423
423
|
timestamp: bigint,
|
|
424
424
|
blockNumber: BlockNumber,
|
|
425
425
|
gasLimitOpts: { rollupManaLimit?: number; maxBlockL2Gas?: number; maxBlockDAGas?: number },
|
|
426
|
+
gasFees: GasFees,
|
|
426
427
|
bindings?: LoggerBindings,
|
|
427
428
|
): Promise<TxValidator<TxMetaData>> {
|
|
428
429
|
await worldStateSynchronizer.syncImmediate();
|
|
@@ -440,6 +441,7 @@ export async function createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
|
440
441
|
};
|
|
441
442
|
return new AggregateTxValidator<TxMetaData>(
|
|
442
443
|
new GasLimitsValidator<TxMetaData>({ ...gasLimitOpts, bindings }),
|
|
444
|
+
new MaxFeePerGasValidator<TxMetaData>(gasFees, bindings),
|
|
443
445
|
new TimestampTxValidator<TxMetaData>({ timestamp, blockNumber }, bindings),
|
|
444
446
|
new DoubleSpendTxValidator<TxMetaData>(nullifierSource, bindings),
|
|
445
447
|
new BlockHeaderTxValidator<TxMetaData>(archiveSource, bindings),
|
|
@@ -36,6 +36,18 @@ export interface HasGasLimitData {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/** Structural interface for types that carry max fee per gas data, used by {@link MaxFeePerGasValidator}. */
|
|
40
|
+
export interface HasMaxFeePerGasData {
|
|
41
|
+
txHash: { toString(): string };
|
|
42
|
+
data: {
|
|
43
|
+
constants: {
|
|
44
|
+
txContext: {
|
|
45
|
+
gasSettings: { maxFeesPerGas: GasFees };
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
39
51
|
/**
|
|
40
52
|
* Validates that a transaction's gas limits are within acceptable bounds.
|
|
41
53
|
*
|
|
@@ -124,15 +136,60 @@ export class GasLimitsValidator<T extends HasGasLimitData> implements TxValidato
|
|
|
124
136
|
}
|
|
125
137
|
}
|
|
126
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Validates that a transaction's max fee per gas meets the current block's gas fees.
|
|
141
|
+
*
|
|
142
|
+
* Rejects transactions whose maxFeesPerGas is below the current block's gas fees
|
|
143
|
+
* on either dimension (DA or L2). This is a cheap, stateless check.
|
|
144
|
+
*
|
|
145
|
+
* Generic over T so it can validate both full {@link Tx} objects and {@link TxMetaData}
|
|
146
|
+
* (used during pending pool migration).
|
|
147
|
+
*
|
|
148
|
+
* Used by: pending pool migration (via factory), and indirectly by {@link GasTxValidator}.
|
|
149
|
+
*/
|
|
150
|
+
export class MaxFeePerGasValidator<T extends HasMaxFeePerGasData> implements TxValidator<T> {
|
|
151
|
+
#log: Logger;
|
|
152
|
+
#gasFees: GasFees;
|
|
153
|
+
|
|
154
|
+
constructor(gasFees: GasFees, bindings?: LoggerBindings) {
|
|
155
|
+
this.#log = createLogger('sequencer:tx_validator:tx_gas', bindings);
|
|
156
|
+
this.#gasFees = gasFees;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
validateTx(tx: T): Promise<TxValidationResult> {
|
|
160
|
+
return Promise.resolve(this.validateMaxFeePerGas(tx));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Checks maxFeesPerGas >= current block gas fees on both dimensions. */
|
|
164
|
+
validateMaxFeePerGas(tx: T): TxValidationResult {
|
|
165
|
+
const maxFeesPerGas = tx.data.constants.txContext.gasSettings.maxFeesPerGas;
|
|
166
|
+
const notEnoughMaxFees =
|
|
167
|
+
maxFeesPerGas.feePerDaGas < this.#gasFees.feePerDaGas || maxFeesPerGas.feePerL2Gas < this.#gasFees.feePerL2Gas;
|
|
168
|
+
|
|
169
|
+
if (notEnoughMaxFees) {
|
|
170
|
+
this.#log.verbose(`Rejecting transaction ${tx.txHash.toString()} due to insufficient fee per gas`, {
|
|
171
|
+
txMaxFeesPerGas: maxFeesPerGas.toInspect(),
|
|
172
|
+
currentGasFees: this.#gasFees.toInspect(),
|
|
173
|
+
});
|
|
174
|
+
return {
|
|
175
|
+
result: 'invalid',
|
|
176
|
+
reason: [
|
|
177
|
+
`${TX_ERROR_INSUFFICIENT_FEE_PER_GAS} (maxFee=da:${maxFeesPerGas.feePerDaGas},l2:${maxFeesPerGas.feePerL2Gas} required=da:${this.#gasFees.feePerDaGas},l2:${this.#gasFees.feePerL2Gas})`,
|
|
178
|
+
],
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return { result: 'valid' };
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
127
185
|
/**
|
|
128
186
|
* Validates that a transaction can pay its gas fees.
|
|
129
187
|
*
|
|
130
188
|
* Runs three checks in order:
|
|
131
189
|
* 1. **Gas limits** (delegates to {@link GasLimitsValidator}) — rejects if limits are
|
|
132
190
|
* out of bounds.
|
|
133
|
-
* 2. **Max fee per gas** —
|
|
134
|
-
* the current block's gas fees.
|
|
135
|
-
* become eligible in a later block with lower fees.
|
|
191
|
+
* 2. **Max fee per gas** — rejects the tx if its maxFeesPerGas is below
|
|
192
|
+
* the current block's gas fees.
|
|
136
193
|
* 3. **Fee payer balance** — reads the fee payer's FeeJuice balance from public state,
|
|
137
194
|
* adds any pending claim from a setup-phase `_increase_public_balance` call, and
|
|
138
195
|
* rejects if the total is less than the tx's fee limit (gasLimits * maxFeePerGas).
|
|
@@ -166,39 +223,15 @@ export class GasTxValidator implements TxValidator<Tx> {
|
|
|
166
223
|
bindings: this.bindings,
|
|
167
224
|
}).validateGasLimit(tx);
|
|
168
225
|
if (gasLimitValidation.result === 'invalid') {
|
|
169
|
-
return
|
|
226
|
+
return gasLimitValidation;
|
|
170
227
|
}
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
return
|
|
228
|
+
const maxFeeValidation = new MaxFeePerGasValidator(this.#gasFees, this.bindings).validateMaxFeePerGas(tx);
|
|
229
|
+
if (maxFeeValidation.result === 'invalid') {
|
|
230
|
+
return maxFeeValidation;
|
|
174
231
|
}
|
|
175
232
|
return await this.validateTxFee(tx);
|
|
176
233
|
}
|
|
177
234
|
|
|
178
|
-
/**
|
|
179
|
-
* Check whether the tx's max fees are valid for the current block, and return a skip reason if not.
|
|
180
|
-
* We skip instead of invalidating since the tx may become eligible later.
|
|
181
|
-
* Note that circuits check max fees even if fee payer is unset, so we
|
|
182
|
-
* keep this validation even if the tx does not pay fees.
|
|
183
|
-
*/
|
|
184
|
-
#getSkipReason(tx: Tx): string | undefined {
|
|
185
|
-
const gasSettings = tx.data.constants.txContext.gasSettings;
|
|
186
|
-
|
|
187
|
-
// Skip the tx if its max fees are not enough for the current block's gas fees.
|
|
188
|
-
const maxFeesPerGas = gasSettings.maxFeesPerGas;
|
|
189
|
-
const notEnoughMaxFees =
|
|
190
|
-
maxFeesPerGas.feePerDaGas < this.#gasFees.feePerDaGas || maxFeesPerGas.feePerL2Gas < this.#gasFees.feePerL2Gas;
|
|
191
|
-
|
|
192
|
-
if (notEnoughMaxFees) {
|
|
193
|
-
this.#log.verbose(`Skipping transaction ${tx.getTxHash().toString()} due to insufficient fee per gas`, {
|
|
194
|
-
txMaxFeesPerGas: maxFeesPerGas.toInspect(),
|
|
195
|
-
currentGasFees: this.#gasFees.toInspect(),
|
|
196
|
-
});
|
|
197
|
-
return `${TX_ERROR_INSUFFICIENT_FEE_PER_GAS} (maxFee=da:${maxFeesPerGas.feePerDaGas},l2:${maxFeesPerGas.feePerL2Gas} required=da:${this.#gasFees.feePerDaGas},l2:${this.#gasFees.feePerL2Gas})`;
|
|
198
|
-
}
|
|
199
|
-
return undefined;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
235
|
/**
|
|
203
236
|
* Checks the fee payer has enough FeeJuice balance to cover the tx's fee limit.
|
|
204
237
|
* Accounts for any pending claim from a setup-phase `_increase_public_balance` call.
|
|
@@ -8,7 +8,7 @@ import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
|
8
8
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
9
9
|
import type { EthAddress, L2BlockSource } from '@aztec/stdlib/block';
|
|
10
10
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
11
|
-
import { GasFees } from '@aztec/stdlib/gas';
|
|
11
|
+
import { type BlockMinFeesProvider, GasFees } from '@aztec/stdlib/gas';
|
|
12
12
|
import type { ClientProtocolCircuitVerifier, PeerInfo, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
13
13
|
import {
|
|
14
14
|
BlockProposal,
|
|
@@ -146,8 +146,6 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
146
146
|
private protocolVersion = '';
|
|
147
147
|
private topicStrings: Record<TopicType, string> = {} as Record<TopicType, string>;
|
|
148
148
|
|
|
149
|
-
private feesCache: { blockNumber: BlockNumber; gasFees: GasFees } | undefined;
|
|
150
|
-
|
|
151
149
|
/** Callback invoked when a duplicate proposal is detected (triggers slashing). */
|
|
152
150
|
private duplicateProposalCallback?: (info: {
|
|
153
151
|
slot: SlotNumber;
|
|
@@ -197,6 +195,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
197
195
|
private epochCache: EpochCacheInterface,
|
|
198
196
|
private proofVerifier: ClientProtocolCircuitVerifier,
|
|
199
197
|
private worldStateSynchronizer: WorldStateSynchronizer,
|
|
198
|
+
private blockMinFeesProvider: BlockMinFeesProvider,
|
|
200
199
|
telemetry: TelemetryClient,
|
|
201
200
|
logger: Logger = createLogger('p2p:libp2p_service'),
|
|
202
201
|
) {
|
|
@@ -285,6 +284,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
285
284
|
proofVerifier: ClientProtocolCircuitVerifier;
|
|
286
285
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
287
286
|
peerStore: AztecAsyncKVStore;
|
|
287
|
+
blockMinFeesProvider: BlockMinFeesProvider;
|
|
288
288
|
telemetry: TelemetryClient;
|
|
289
289
|
logger: Logger;
|
|
290
290
|
packageVersion: string;
|
|
@@ -297,6 +297,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
297
297
|
mempools,
|
|
298
298
|
proofVerifier,
|
|
299
299
|
peerStore,
|
|
300
|
+
blockMinFeesProvider,
|
|
300
301
|
telemetry,
|
|
301
302
|
logger,
|
|
302
303
|
packageVersion,
|
|
@@ -503,6 +504,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
503
504
|
epochCache,
|
|
504
505
|
proofVerifier,
|
|
505
506
|
worldStateSynchronizer,
|
|
507
|
+
blockMinFeesProvider,
|
|
506
508
|
telemetry,
|
|
507
509
|
logger,
|
|
508
510
|
);
|
|
@@ -1616,15 +1618,8 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1616
1618
|
});
|
|
1617
1619
|
}
|
|
1618
1620
|
|
|
1619
|
-
private
|
|
1620
|
-
|
|
1621
|
-
return this.feesCache.gasFees;
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
const header = await this.archiver.getBlockHeader(blockNumber);
|
|
1625
|
-
const gasFees = header?.globalVariables.gasFees ?? GasFees.empty();
|
|
1626
|
-
this.feesCache = { blockNumber, gasFees };
|
|
1627
|
-
return gasFees;
|
|
1621
|
+
private getGasFees(): Promise<GasFees> {
|
|
1622
|
+
return this.blockMinFeesProvider.getCurrentMinFees();
|
|
1628
1623
|
}
|
|
1629
1624
|
|
|
1630
1625
|
/**
|
|
@@ -1666,7 +1661,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1666
1661
|
currentBlockNumber: BlockNumber,
|
|
1667
1662
|
nextSlotTimestamp: UInt64,
|
|
1668
1663
|
): Promise<Record<string, TransactionValidator>> {
|
|
1669
|
-
const gasFees = await this.getGasFees(
|
|
1664
|
+
const gasFees = await this.getGasFees();
|
|
1670
1665
|
const allowedInSetup = [
|
|
1671
1666
|
...(await getDefaultAllowedSetupFunctions()),
|
|
1672
1667
|
...(this.config.txPublicSetupAllowListExtend ?? []),
|
|
@@ -5,6 +5,7 @@ import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
|
5
5
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
6
6
|
import { sleep } from '@aztec/foundation/sleep';
|
|
7
7
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
8
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
8
9
|
import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
9
10
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
10
11
|
|
|
@@ -102,6 +103,7 @@ export async function makeTestP2PClient(
|
|
|
102
103
|
proofVerifier,
|
|
103
104
|
mockWorldState,
|
|
104
105
|
mockEpochCache,
|
|
106
|
+
{ getCurrentMinFees: () => Promise.resolve(GasFees.empty()) },
|
|
105
107
|
'test-p2p-client',
|
|
106
108
|
undefined,
|
|
107
109
|
undefined,
|
|
@@ -4,6 +4,7 @@ import { sleep } from '@aztec/foundation/sleep';
|
|
|
4
4
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
5
5
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
6
6
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
7
|
+
import type { BlockMinFeesProvider } from '@aztec/stdlib/gas';
|
|
7
8
|
import type { ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
8
9
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
9
10
|
|
|
@@ -56,6 +57,7 @@ export function getMockPubSubP2PServiceFactory(
|
|
|
56
57
|
proofVerifier: ClientProtocolCircuitVerifier;
|
|
57
58
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
58
59
|
peerStore: AztecAsyncKVStore;
|
|
60
|
+
blockMinFeesProvider: BlockMinFeesProvider;
|
|
59
61
|
telemetry: TelemetryClient;
|
|
60
62
|
logger: Logger;
|
|
61
63
|
},
|
|
@@ -76,6 +78,7 @@ export function getMockPubSubP2PServiceFactory(
|
|
|
76
78
|
deps.epochCache,
|
|
77
79
|
deps.proofVerifier,
|
|
78
80
|
deps.worldStateSynchronizer,
|
|
81
|
+
deps.blockMinFeesProvider,
|
|
79
82
|
deps.telemetry,
|
|
80
83
|
deps.logger,
|
|
81
84
|
);
|
|
@@ -6,6 +6,7 @@ import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
|
6
6
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
7
7
|
import { type ChainConfig, emptyChainConfig } from '@aztec/stdlib/config';
|
|
8
8
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
9
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
9
10
|
import type {
|
|
10
11
|
ClientProtocolCircuitVerifier,
|
|
11
12
|
IVCProofVerificationResult,
|
|
@@ -170,6 +171,7 @@ export async function createTestLibP2PService(
|
|
|
170
171
|
epochCache,
|
|
171
172
|
proofVerifier,
|
|
172
173
|
worldStateSynchronizer,
|
|
174
|
+
{ getCurrentMinFees: () => Promise.resolve(GasFees.empty()) },
|
|
173
175
|
telemetry,
|
|
174
176
|
);
|
|
175
177
|
}
|