diff --git a/src/evm/executive.rs b/src/evm/executive.rs index bb6feb174..20f1fdd75 100644 --- a/src/evm/executive.rs +++ b/src/evm/executive.rs @@ -109,7 +109,6 @@ impl<'a> Executive<'a> { fn create(&mut self) -> ExecutiveResult { let address = self.params.address.clone(); - //let new_address = contract_address(&address, &self.state.nonce(&address)); let new_address = self.params.address.clone(); self.state.inc_nonce(&address); diff --git a/src/evm/jit.rs b/src/evm/jit.rs index bf0488cad..b88b853e5 100644 --- a/src/evm/jit.rs +++ b/src/evm/jit.rs @@ -8,6 +8,43 @@ use util::bytes::*; use util::sha3::*; use evm; +/// Ethcore representation of evmjit runtime data. +pub struct RuntimeData { + pub gas: U256, + pub gas_price: U256, + pub call_data: Vec, + pub address: Address, + pub caller: Address, + pub origin: Address, + pub call_value: U256, + pub coinbase: Address, + pub difficulty: U256, + pub gas_limit: U256, + pub number: u64, + pub timestamp: u64, + pub code: Vec +} + +impl RuntimeData { + pub fn new() -> RuntimeData { + RuntimeData { + gas: U256::zero(), + gas_price: U256::zero(), + call_data: vec![], + address: Address::new(), + caller: Address::new(), + origin: Address::new(), + call_value: U256::zero(), + coinbase: Address::new(), + difficulty: U256::zero(), + gas_limit: U256::zero(), + number: 0, + timestamp: 0, + code: vec![] + } + } +} + /// Should be used to convert jit types to ethcore trait FromJit: Sized { fn from_jit(input: T) -> Self; @@ -94,7 +131,7 @@ impl IntoJit for Address { } } -impl IntoJit for evm::RuntimeData { +impl IntoJit for RuntimeData { fn into_jit(self) -> evmjit::RuntimeDataHandle { let mut data = evmjit::RuntimeDataHandle::new(); assert!(self.gas <= U256::from(u64::max_value()), "evmjit gas must be lower than 2 ^ 64"); @@ -268,7 +305,7 @@ impl evm::Evm for JitEvm { // Dirty hack. This is unsafe, but we interact with ffi, so it's justified. let ext_adapter: ExtAdapter<'static> = unsafe { ::std::mem::transmute(ExtAdapter::new(ext)) }; let mut ext_handle = evmjit::ExtHandle::new(ext_adapter); - let mut data = evm::RuntimeData::new(); + let mut data = RuntimeData::new(); let params = ext.params(); data.gas = params.gas; data.gas_price = params.gas_price; diff --git a/src/evm/mod.rs b/src/evm/mod.rs index 2d18b33eb..08ad56ef2 100644 --- a/src/evm/mod.rs +++ b/src/evm/mod.rs @@ -1,7 +1,6 @@ //! Ethereum virtual machine. pub mod ext; -pub mod runtime_data; pub mod evm; pub mod vmfactory; pub mod logentry; @@ -12,7 +11,6 @@ mod jit; pub use self::evm::{Evm, ReturnCode}; pub use self::ext::{Ext}; -pub use self::runtime_data::RuntimeData; pub use self::logentry::LogEntry; pub use self::vmfactory::VmFactory; pub use self::executive::Executive; diff --git a/src/evm/runtime_data.rs b/src/evm/runtime_data.rs deleted file mode 100644 index fff49ab47..000000000 --- a/src/evm/runtime_data.rs +++ /dev/null @@ -1,41 +0,0 @@ -//! Immutable runtime data. - -use util::hash::*; -use util::uint::*; - -// call_data -pub struct RuntimeData { - pub gas: U256, - pub gas_price: U256, - pub call_data: Vec, - pub address: Address, - pub caller: Address, - pub origin: Address, - pub call_value: U256, - pub coinbase: Address, - pub difficulty: U256, - pub gas_limit: U256, - pub number: u64, - pub timestamp: u64, - pub code: Vec -} - -impl RuntimeData { - pub fn new() -> RuntimeData { - RuntimeData { - gas: U256::zero(), - gas_price: U256::zero(), - call_data: vec![], - address: Address::new(), - caller: Address::new(), - origin: Address::new(), - call_value: U256::zero(), - coinbase: Address::new(), - difficulty: U256::zero(), - gas_limit: U256::zero(), - number: 0, - timestamp: 0, - code: vec![] - } - } -}