Skip to content

Commit

Permalink
chain-evm makes configuration types public
Browse files Browse the repository at this point in the history
  • Loading branch information
saibatizoku committed Oct 26, 2021
1 parent e7a614b commit 548727a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions chain-evm/src/lib.rs
@@ -1,2 +1,4 @@
pub mod machine;
pub mod state;

pub use machine::{Configuration, Environment, GasLimit};
12 changes: 9 additions & 3 deletions chain-evm/src/machine.rs
Expand Up @@ -20,6 +20,12 @@ use primitive_types::{H160, H256, U256};

use crate::state::AccountTrie;

/// EVM Configuration.
pub type Configuration = Config;

/// Gas limit for EVM operations.
pub type GasLimit = u64;

/// Environment values for the machine backend.
pub type Environment = MemoryVicinity;

Expand Down Expand Up @@ -49,7 +55,7 @@ impl VirtualMachine {
fn executor<'backend, 'config>(
&'backend self,
gas_limit: u64,
config: &'config Config,
config: &'config Configuration,
) -> StackExecutor<'config, MemoryStackState<'backend, 'config, VirtualMachine>> {
let metadata = StackSubstateMetadata::new(gas_limit, config);
let memory_stack_state = MemoryStackState::new(metadata, self);
Expand All @@ -63,7 +69,7 @@ impl VirtualMachine {
code: Rc<Vec<u8>>,
data: Rc<Vec<u8>>,
context: RuntimeContext,
config: &'config Config,
config: &'config Configuration,
) -> Runtime<'config> {
Runtime::new(code, data, context, config)
}
Expand Down Expand Up @@ -214,7 +220,7 @@ mod tests {
let vm = VirtualMachine::new(environment, state);

let gas_limit = u64::max_value();
let config = Config::istanbul();
let config = Configuration::istanbul();
let mut executor = vm.executor(gas_limit, &config);

// Byte-encoded smart contract code
Expand Down

0 comments on commit 548727a

Please sign in to comment.