Skip to content

Commit

Permalink
clean need to update frame evm runner next to use new evm Stack API
Browse files Browse the repository at this point in the history
  • Loading branch information
4meta5 committed Jan 12, 2025
1 parent b6df361 commit 10f5426
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions frame/evm/src/runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub trait Runner<T: Config> {
is_transactional: bool,
weight_limit: Option<Weight>,
proof_size_base_cost: Option<u64>,
evm_config: &evm::Config,
evm_config: &evm::standard::Config,
) -> Result<(), RunnerError<Self::Error>>;

fn call(
Expand All @@ -62,7 +62,7 @@ pub trait Runner<T: Config> {
validate: bool,
weight_limit: Option<Weight>,
proof_size_base_cost: Option<u64>,
config: &evm::Config,
config: &evm::standard::Config,
) -> Result<CallInfo, RunnerError<Self::Error>>;

fn create(
Expand All @@ -78,7 +78,7 @@ pub trait Runner<T: Config> {
validate: bool,
weight_limit: Option<Weight>,
proof_size_base_cost: Option<u64>,
config: &evm::Config,
config: &evm::standard::Config,
) -> Result<CreateInfo, RunnerError<Self::Error>>;

fn create2(
Expand All @@ -95,6 +95,6 @@ pub trait Runner<T: Config> {
validate: bool,
weight_limit: Option<Weight>,
proof_size_base_cost: Option<u64>,
config: &evm::Config,
config: &evm::standard::Config,
) -> Result<CreateInfo, RunnerError<Self::Error>>;
}
10 changes: 7 additions & 3 deletions precompiles/src/evm/costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ pub fn log_costs(topics: usize, data_len: usize) -> EvmResult<u64> {

// Compute the cost of doing a subcall.
// Some parameters cannot be known in advance, so we estimate the worst possible cost.
pub fn call_cost(value: U256, config: &evm::Config) -> u64 {
pub fn call_cost(value: U256, config: &evm::standard::Config) -> u64 {
// Copied from EVM code since not public.
pub const G_CALLVALUE: u64 = 9000;
pub const G_NEWACCOUNT: u64 = 25000;

fn address_access_cost(is_cold: bool, regular_value: u64, config: &evm::Config) -> u64 {
fn address_access_cost(
is_cold: bool,
regular_value: u64,
config: &evm::standard::Config,
) -> u64 {
if config.increase_state_access_gas {
if is_cold {
config.gas_account_access_cold
Expand All @@ -85,7 +89,7 @@ pub fn call_cost(value: U256, config: &evm::Config) -> u64 {
is_call_or_staticcall: bool,
new_account: bool,
transfers_value: bool,
config: &evm::Config,
config: &evm::standard::Config,
) -> u64 {
let eip161 = !config.empty_considered_exists;
if is_call_or_staticcall {
Expand Down
2 changes: 1 addition & 1 deletion precompiles/src/testing/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl PrecompileHandle for MockHandle {
if self
.record_cost(crate::evm::costs::call_cost(
context.apparent_value,
&evm::Config::london(),
&evm::standard::Config::london(),
))
.is_err()
{
Expand Down
2 changes: 1 addition & 1 deletion primitives/evm/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
use alloc::vec::Vec;
use evm::standard::GasometerState;
use frame_support::weights::Weight;
use sp_core::{H160, H256, U256};
use scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_core::{H160, H256, U256};

#[derive(Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
pub struct Account {
Expand Down

0 comments on commit 10f5426

Please sign in to comment.