Skip to content

Commit d111f82

Browse files
committed
address comments
1 parent a876be3 commit d111f82

File tree

12 files changed

+87
-92
lines changed

12 files changed

+87
-92
lines changed

crates/ethereum/cli/src/debug_cmd/build_block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
116116
let blockchain_db = BlockchainProvider::new(provider_factory.clone())?;
117117
let blob_store = InMemoryBlobStore::default();
118118

119-
let validator = TransactionValidationTaskExecutor::eth_builder(blockchain_db.clone(), None)
119+
let validator = TransactionValidationTaskExecutor::eth_builder(blockchain_db.clone())
120120
.with_head_timestamp(best_block.timestamp)
121121
.kzg_settings(self.kzg_settings()?)
122122
.with_additional_tasks(1)

crates/ethereum/node/src/node.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -405,17 +405,14 @@ where
405405
let blob_store =
406406
reth_node_builder::components::create_blob_store_with_cache(ctx, blob_cache_size)?;
407407

408-
let validator = TransactionValidationTaskExecutor::eth_builder(
409-
ctx.provider().clone(),
410-
Some(pool_config.local_transactions_config.clone()),
411-
)
412-
.with_head_timestamp(ctx.head().timestamp)
413-
.with_max_tx_input_bytes(ctx.config().txpool.max_tx_input_bytes)
414-
.kzg_settings(ctx.kzg_settings()?)
415-
.with_local_transactions_config(pool_config.local_transactions_config.clone())
416-
.set_tx_fee_cap(ctx.config().rpc.rpc_tx_fee_cap)
417-
.with_additional_tasks(ctx.config().txpool.additional_validation_tasks)
418-
.build_with_tasks(ctx.task_executor().clone(), blob_store.clone());
408+
let validator = TransactionValidationTaskExecutor::eth_builder(ctx.provider().clone())
409+
.with_head_timestamp(ctx.head().timestamp)
410+
.with_max_tx_input_bytes(ctx.config().txpool.max_tx_input_bytes)
411+
.kzg_settings(ctx.kzg_settings()?)
412+
.with_local_transactions_config(pool_config.local_transactions_config.clone())
413+
.set_tx_fee_cap(ctx.config().rpc.rpc_tx_fee_cap)
414+
.with_additional_tasks(ctx.config().txpool.additional_validation_tasks)
415+
.build_with_tasks(ctx.task_executor().clone(), blob_store.clone());
419416

420417
let transaction_pool = TxPoolBuilder::new(ctx)
421418
.with_validator(validator)

crates/optimism/node/src/node.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -800,26 +800,25 @@ where
800800
.await;
801801

802802
let blob_store = reth_node_builder::components::create_blob_store(ctx)?;
803-
let validator =
804-
TransactionValidationTaskExecutor::eth_builder(ctx.provider().clone(), None)
805-
.no_eip4844()
806-
.with_head_timestamp(ctx.head().timestamp)
807-
.with_max_tx_input_bytes(ctx.config().txpool.max_tx_input_bytes)
808-
.kzg_settings(ctx.kzg_settings()?)
809-
.set_tx_fee_cap(ctx.config().rpc.rpc_tx_fee_cap)
810-
.with_additional_tasks(
811-
pool_config_overrides
812-
.additional_validation_tasks
813-
.unwrap_or_else(|| ctx.config().txpool.additional_validation_tasks),
814-
)
815-
.build_with_tasks(ctx.task_executor().clone(), blob_store.clone())
816-
.map(|validator| {
817-
OpTransactionValidator::new(validator)
818-
// In --dev mode we can't require gas fees because we're unable to decode
819-
// the L1 block info
820-
.require_l1_data_gas_fee(!ctx.config().dev.dev)
821-
.with_supervisor(supervisor_client.clone())
822-
});
803+
let validator = TransactionValidationTaskExecutor::eth_builder(ctx.provider().clone())
804+
.no_eip4844()
805+
.with_head_timestamp(ctx.head().timestamp)
806+
.with_max_tx_input_bytes(ctx.config().txpool.max_tx_input_bytes)
807+
.kzg_settings(ctx.kzg_settings()?)
808+
.set_tx_fee_cap(ctx.config().rpc.rpc_tx_fee_cap)
809+
.with_additional_tasks(
810+
pool_config_overrides
811+
.additional_validation_tasks
812+
.unwrap_or_else(|| ctx.config().txpool.additional_validation_tasks),
813+
)
814+
.build_with_tasks(ctx.task_executor().clone(), blob_store.clone())
815+
.map(|validator| {
816+
OpTransactionValidator::new(validator)
817+
// In --dev mode we can't require gas fees because we're unable to decode
818+
// the L1 block info
819+
.require_l1_data_gas_fee(!ctx.config().dev.dev)
820+
.with_supervisor(supervisor_client.clone())
821+
});
823822

824823
let final_pool_config = pool_config_overrides.apply(ctx.pool_config());
825824

crates/optimism/txpool/src/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ mod tests {
325325
#[tokio::test]
326326
async fn validate_optimism_transaction() {
327327
let client = MockEthProvider::default().with_chain_spec(OP_MAINNET.clone());
328-
let validator = EthTransactionValidatorBuilder::new(client, None)
328+
let validator = EthTransactionValidatorBuilder::new(client)
329329
.no_shanghai()
330330
.no_cancun()
331331
.build(InMemoryBlobStore::default());

crates/rpc/rpc-eth-api/src/helpers/trace.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,13 @@ pub trait Trace:
327327

328328
// prepare transactions, we do everything upfront to reduce time spent with open
329329
// state
330-
let max_transactions =
331-
highest_index.map_or(block.body().transaction_count(), |highest| {
330+
let max_transactions = highest_index.map_or_else(
331+
|| block.body().transaction_count(),
332+
|highest| {
332333
// we need + 1 because the index is 0-based
333334
highest as usize + 1
334-
});
335+
},
336+
);
335337

336338
let mut idx = 0;
337339

crates/scroll/node/src/builder/pool.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,25 @@ where
6161
let data_dir = ctx.config().datadir();
6262
let blob_store = DiskFileBlobStore::open(data_dir.blobstore(), Default::default())?;
6363

64-
let validator = TransactionValidationTaskExecutor::eth_builder(
65-
ctx.provider().clone(),
66-
Some(pool_config_overrides.clone().apply(ctx.pool_config()).local_transactions_config),
67-
)
68-
.no_eip4844()
69-
.with_head_timestamp(ctx.head().timestamp)
70-
.kzg_settings(ctx.kzg_settings()?)
71-
.with_additional_tasks(
72-
pool_config_overrides
73-
.additional_validation_tasks
74-
.unwrap_or_else(|| ctx.config().txpool.additional_validation_tasks),
75-
)
76-
.build_with_tasks(ctx.task_executor().clone(), blob_store.clone())
77-
.map(|validator| {
78-
ScrollTransactionValidator::new(validator)
79-
// In --dev mode we can't require gas fees because we're unable to decode
80-
// the L1 block info
81-
.require_l1_data_gas_fee(!ctx.config().dev.dev)
82-
});
64+
let validator = TransactionValidationTaskExecutor::eth_builder(ctx.provider().clone())
65+
.no_eip4844()
66+
.with_head_timestamp(ctx.head().timestamp)
67+
.kzg_settings(ctx.kzg_settings()?)
68+
.with_local_transactions_config(
69+
pool_config_overrides.clone().apply(ctx.pool_config()).local_transactions_config,
70+
)
71+
.with_additional_tasks(
72+
pool_config_overrides
73+
.additional_validation_tasks
74+
.unwrap_or_else(|| ctx.config().txpool.additional_validation_tasks),
75+
)
76+
.build_with_tasks(ctx.task_executor().clone(), blob_store.clone())
77+
.map(|validator| {
78+
ScrollTransactionValidator::new(validator)
79+
// In --dev mode we can't require gas fees because we're unable to decode
80+
// the L1 block info
81+
.require_l1_data_gas_fee(!ctx.config().dev.dev)
82+
});
8383

8484
let transaction_pool = reth_transaction_pool::Pool::new(
8585
validator,

crates/scroll/txpool/src/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ mod tests {
226226
#[test]
227227
fn validate_scroll_transaction() {
228228
let client = MockEthProvider::default().with_chain_spec(SCROLL_MAINNET.clone());
229-
let validator = EthTransactionValidatorBuilder::new(client, None)
229+
let validator = EthTransactionValidatorBuilder::new(client)
230230
.no_shanghai()
231231
.no_cancun()
232232
.build(InMemoryBlobStore::default());

crates/transaction-pool/src/maintain.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,7 @@ mod tests {
776776
let sender = hex!("1f9090aaE28b8a3dCeaDf281B0F12828e676c326").into();
777777
provider.add_account(sender, ExtendedAccount::new(42, U256::MAX));
778778
let blob_store = InMemoryBlobStore::default();
779-
let validator =
780-
EthTransactionValidatorBuilder::new(provider, None).build(blob_store.clone());
779+
let validator = EthTransactionValidatorBuilder::new(provider).build(blob_store.clone());
781780

782781
let txpool = Pool::new(
783782
validator.clone(),

crates/transaction-pool/src/test_utils/mock.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -799,21 +799,24 @@ impl alloy_consensus::Transaction for MockTransaction {
799799
}
800800

801801
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128 {
802-
base_fee.map_or(self.max_fee_per_gas(), |base_fee| {
803-
// if the tip is greater than the max priority fee per gas, set it to the max
804-
// priority fee per gas + base fee
805-
let tip = self.max_fee_per_gas().saturating_sub(base_fee as u128);
806-
if let Some(max_tip) = self.max_priority_fee_per_gas() {
807-
if tip > max_tip {
808-
max_tip + base_fee as u128
802+
base_fee.map_or_else(
803+
|| self.max_fee_per_gas(),
804+
|base_fee| {
805+
// if the tip is greater than the max priority fee per gas, set it to the max
806+
// priority fee per gas + base fee
807+
let tip = self.max_fee_per_gas().saturating_sub(base_fee as u128);
808+
if let Some(max_tip) = self.max_priority_fee_per_gas() {
809+
if tip > max_tip {
810+
max_tip + base_fee as u128
811+
} else {
812+
// otherwise return the max fee per gas
813+
self.max_fee_per_gas()
814+
}
809815
} else {
810-
// otherwise return the max fee per gas
811816
self.max_fee_per_gas()
812817
}
813-
} else {
814-
self.max_fee_per_gas()
815-
}
816-
})
818+
},
819+
)
817820
}
818821

819822
fn is_dynamic_fee(&self) -> bool {

crates/transaction-pool/src/validate/eth.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -785,14 +785,14 @@ impl<Client> EthTransactionValidatorBuilder<Client> {
785785
/// - EIP-1559
786786
/// - EIP-4844
787787
/// - EIP-7702
788-
pub fn new(client: Client, local_transactions_config: Option<LocalTransactionConfig>) -> Self {
788+
pub fn new(client: Client) -> Self {
789789
Self {
790790
block_gas_limit: ETHEREUM_BLOCK_GAS_LIMIT_30M.into(),
791791
client,
792792
minimum_priority_fee: None,
793793
additional_tasks: 1,
794794
kzg_settings: EnvKzgSettings::Default,
795-
local_transactions_config: local_transactions_config.unwrap_or_default(),
795+
local_transactions_config: Default::default(),
796796
max_tx_input_bytes: DEFAULT_MAX_TX_INPUT_BYTES,
797797
tx_fee_cap: Some(1e18 as u128),
798798
// by default all transaction types are allowed
@@ -1201,8 +1201,7 @@ mod tests {
12011201
ExtendedAccount::new(transaction.nonce(), U256::MAX),
12021202
);
12031203
let blob_store = InMemoryBlobStore::default();
1204-
let validator =
1205-
EthTransactionValidatorBuilder::new(provider, None).build(blob_store.clone());
1204+
let validator = EthTransactionValidatorBuilder::new(provider).build(blob_store.clone());
12061205

12071206
let outcome = validator.validate_one(TransactionOrigin::External, transaction.clone());
12081207

@@ -1229,7 +1228,7 @@ mod tests {
12291228
);
12301229

12311230
let blob_store = InMemoryBlobStore::default();
1232-
let validator = EthTransactionValidatorBuilder::new(provider, None)
1231+
let validator = EthTransactionValidatorBuilder::new(provider)
12331232
.set_block_gas_limit(1_000_000) // tx gas limit is 1_015_288
12341233
.build(blob_store.clone());
12351234

@@ -1262,7 +1261,7 @@ mod tests {
12621261
);
12631262

12641263
let blob_store = InMemoryBlobStore::default();
1265-
let validator = EthTransactionValidatorBuilder::new(provider, None)
1264+
let validator = EthTransactionValidatorBuilder::new(provider)
12661265
.set_tx_fee_cap(100) // 100 wei cap
12671266
.build(blob_store.clone());
12681267

@@ -1299,7 +1298,7 @@ mod tests {
12991298
);
13001299

13011300
let blob_store = InMemoryBlobStore::default();
1302-
let validator = EthTransactionValidatorBuilder::new(provider, None)
1301+
let validator = EthTransactionValidatorBuilder::new(provider)
13031302
.set_tx_fee_cap(0) // no cap
13041303
.build(blob_store);
13051304

@@ -1317,7 +1316,7 @@ mod tests {
13171316
);
13181317

13191318
let blob_store = InMemoryBlobStore::default();
1320-
let validator = EthTransactionValidatorBuilder::new(provider, None)
1319+
let validator = EthTransactionValidatorBuilder::new(provider)
13211320
.set_tx_fee_cap(2e18 as u128) // 2 ETH cap
13221321
.build(blob_store);
13231322

0 commit comments

Comments
 (0)