mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: clippy
This commit is contained in:
@ -579,9 +579,8 @@ async fn adjust_transaction_receipt<Eth: EthWrapper>(
|
|||||||
fn system_tx_count_for_block<Eth: EthWrapper>(eth_api: &Eth, block_id: BlockId) -> usize {
|
fn system_tx_count_for_block<Eth: EthWrapper>(eth_api: &Eth, block_id: BlockId) -> usize {
|
||||||
let provider = eth_api.provider();
|
let provider = eth_api.provider();
|
||||||
let block = provider.block_by_id(block_id).unwrap().unwrap();
|
let block = provider.block_by_id(block_id).unwrap().unwrap();
|
||||||
let system_tx_count =
|
|
||||||
block.body.transactions().iter().filter(|tx| tx.is_system_transaction()).count();
|
block.body.transactions().iter().filter(|tx| tx.is_system_transaction()).count()
|
||||||
system_tx_count
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
|
|||||||
@ -82,13 +82,11 @@ where
|
|||||||
let mut tx_env = self.create_txn_env(&evm_env, request, &mut db)?;
|
let mut tx_env = self.create_txn_env(&evm_env, request, &mut db)?;
|
||||||
|
|
||||||
let mut is_basic_transfer = false;
|
let mut is_basic_transfer = false;
|
||||||
if tx_env.input().is_empty() {
|
if tx_env.input().is_empty()
|
||||||
if let TxKind::Call(to) = tx_env.kind() {
|
&& let TxKind::Call(to) = tx_env.kind()
|
||||||
if let Ok(code) = db.db.account_code(&to) {
|
&& let Ok(code) = db.db.account_code(&to) {
|
||||||
is_basic_transfer = code.map(|code| code.is_empty()).unwrap_or(true);
|
is_basic_transfer = code.map(|code| code.is_empty()).unwrap_or(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if tx_env.gas_price() > 0 {
|
if tx_env.gas_price() > 0 {
|
||||||
highest_gas_limit =
|
highest_gas_limit =
|
||||||
@ -107,12 +105,11 @@ where
|
|||||||
let mut min_tx_env = tx_env.clone();
|
let mut min_tx_env = tx_env.clone();
|
||||||
min_tx_env.set_gas_limit(MIN_TRANSACTION_GAS);
|
min_tx_env.set_gas_limit(MIN_TRANSACTION_GAS);
|
||||||
|
|
||||||
if let Ok(res) = evm.transact(min_tx_env).map_err(Self::Error::from_evm_err) {
|
if let Ok(res) = evm.transact(min_tx_env).map_err(Self::Error::from_evm_err)
|
||||||
if res.result.is_success() {
|
&& res.result.is_success() {
|
||||||
return Ok(U256::from(MIN_TRANSACTION_GAS));
|
return Ok(U256::from(MIN_TRANSACTION_GAS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
trace!(target: "rpc::eth::estimate", ?tx_env, gas_limit = tx_env.gas_limit(), is_basic_transfer, "Starting gas estimation");
|
trace!(target: "rpc::eth::estimate", ?tx_env, gas_limit = tx_env.gas_limit(), is_basic_transfer, "Starting gas estimation");
|
||||||
|
|
||||||
|
|||||||
@ -81,11 +81,10 @@ impl BlockPoller {
|
|||||||
.await
|
.await
|
||||||
.ok_or(eyre::eyre!("Failed to find latest block number"))?;
|
.ok_or(eyre::eyre!("Failed to find latest block number"))?;
|
||||||
|
|
||||||
if let Some(debug_cutoff_height) = debug_cutoff_height {
|
if let Some(debug_cutoff_height) = debug_cutoff_height
|
||||||
if next_block_number > debug_cutoff_height {
|
&& next_block_number > debug_cutoff_height {
|
||||||
next_block_number = debug_cutoff_height;
|
next_block_number = debug_cutoff_height;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match block_source.collect_block(next_block_number).await {
|
match block_source.collect_block(next_block_number).await {
|
||||||
|
|||||||
Reference in New Issue
Block a user