From f1b6df96e9a4deeda98c21551fd469361ffb6725 Mon Sep 17 00:00:00 2001 From: Joseph Zhao Date: Tue, 7 Jan 2025 11:19:37 +0800 Subject: [PATCH 1/3] init --- crates/anvil/src/eth/api.rs | 6 +++--- crates/anvil/tests/it/anvil_api.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/anvil/src/eth/api.rs b/crates/anvil/src/eth/api.rs index 23aac7452913..3a8dd630ce00 100644 --- a/crates/anvil/src/eth/api.rs +++ b/crates/anvil/src/eth/api.rs @@ -1902,10 +1902,10 @@ impl EthApi { TransactionOrder::Fees => "fees".to_string(), }, environment: NodeEnvironment { - base_fee: U256::from(self.backend.base_fee()), + base_fee: self.backend.base_fee().to::(), chain_id: self.backend.chain_id().to::(), - gas_limit: U256::from(self.backend.gas_limit()), - gas_price: U256::from(self.gas_price()), + gas_limit: self.backend.gas_limit().to::(), + gas_price: self.gas_price().to::(), }, fork_config: fork_config .map(|fork| { diff --git a/crates/anvil/tests/it/anvil_api.rs b/crates/anvil/tests/it/anvil_api.rs index 9eb44c69b529..495229fdfda6 100644 --- a/crates/anvil/tests/it/anvil_api.rs +++ b/crates/anvil/tests/it/anvil_api.rs @@ -460,10 +460,10 @@ async fn can_get_node_info() { hard_fork: hard_fork.to_string(), transaction_order: "fees".to_owned(), environment: NodeEnvironment { - base_fee: U256::from_str("0x3b9aca00").unwrap().to(), + base_fee: u128::from_str("0x3b9aca00").unwrap(), chain_id: 0x7a69, - gas_limit: U256::from_str("0x1c9c380").unwrap().to(), - gas_price: U256::from_str("0x77359400").unwrap().to(), + gas_limit: u64::from_str("0x1c9c380").unwrap(), + gas_price: u128::from_str("0x77359400").unwrap(), }, fork_config: NodeForkConfig { fork_url: None, From c13e7b915b72c153f6bfb500fb4ca40685e4e860 Mon Sep 17 00:00:00 2001 From: Joseph Zhao Date: Tue, 7 Jan 2025 12:14:40 +0800 Subject: [PATCH 2/3] fix to --- crates/anvil/src/eth/api.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/anvil/src/eth/api.rs b/crates/anvil/src/eth/api.rs index 3a8dd630ce00..d31e3e9bf92d 100644 --- a/crates/anvil/src/eth/api.rs +++ b/crates/anvil/src/eth/api.rs @@ -1902,10 +1902,10 @@ impl EthApi { TransactionOrder::Fees => "fees".to_string(), }, environment: NodeEnvironment { - base_fee: self.backend.base_fee().to::(), + base_fee: self.backend.base_fee() as u128, chain_id: self.backend.chain_id().to::(), - gas_limit: self.backend.gas_limit().to::(), - gas_price: self.gas_price().to::(), + gas_limit: self.backend.gas_limit() as u64, + gas_price: self.gas_price(), }, fork_config: fork_config .map(|fork| { From cc0a696ebcc7249d9688a8a2ce86c643dd546269 Mon Sep 17 00:00:00 2001 From: zerosnacks <95942363+zerosnacks@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:49:16 +0100 Subject: [PATCH 3/3] Apply suggestions from code review --- crates/anvil/src/eth/api.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/anvil/src/eth/api.rs b/crates/anvil/src/eth/api.rs index d31e3e9bf92d..2efef464a4ee 100644 --- a/crates/anvil/src/eth/api.rs +++ b/crates/anvil/src/eth/api.rs @@ -1902,9 +1902,9 @@ impl EthApi { TransactionOrder::Fees => "fees".to_string(), }, environment: NodeEnvironment { - base_fee: self.backend.base_fee() as u128, + base_fee: self.backend.base_fee().to::(), chain_id: self.backend.chain_id().to::(), - gas_limit: self.backend.gas_limit() as u64, + gas_limit: self.backend.gas_limit().to::(), gas_price: self.gas_price(), }, fork_config: fork_config