From fb893a9334e9469e666272675d4c690ac9583dde Mon Sep 17 00:00:00 2001 From: dastansam Date: Mon, 10 Jun 2024 19:52:01 +0600 Subject: [PATCH] Fix evm gas estimate bug --- domains/runtime/evm/src/lib.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/domains/runtime/evm/src/lib.rs b/domains/runtime/evm/src/lib.rs index fe47c3e630..2e2705a11c 100644 --- a/domains/runtime/evm/src/lib.rs +++ b/domains/runtime/evm/src/lib.rs @@ -1311,9 +1311,25 @@ impl_runtime_apis! { let is_transactional = false; let validate = true; - let weight_limit = None; - let proof_size_base_cost = None; let evm_config = config.as_ref().unwrap_or(::config()); + + let gas_limit = gas_limit.min(u64::MAX.into()); + + let transaction_data = TransactionData::new( + pallet_ethereum::TransactionAction::Call(to), + data.clone(), + nonce.unwrap_or_default(), + gas_limit, + None, + max_fee_per_gas, + max_priority_fee_per_gas, + value, + Some(::ChainId::get()), + access_list.clone().unwrap_or_default(), + ); + + let (weight_limit, proof_size_base_cost) = pallet_ethereum::Pallet::::transaction_weight(&transaction_data); + ::Runner::call( from, to,