diff --git a/src/evm/executive.rs b/src/evm/executive.rs index 8547af1a2..1ab7a580d 100644 --- a/src/evm/executive.rs +++ b/src/evm/executive.rs @@ -1,3 +1,5 @@ +use util::hash::*; +use util::uint::*; use state::*; use env_info::*; use engine::*; @@ -27,9 +29,11 @@ impl<'a> Executive<'a> { pub fn exec(&mut self, transaction: &Transaction) -> ExecutiveResult { // TODO: validate that we have enough funds + self.state.inc_nonce(&transaction.sender()); + match transaction.kind() { TransactionKind::MessageCall => self.call(transaction), - TransactionKind::ContractCreation => self.create(transaction) + TransactionKind::ContractCreation => { unimplemented!(); }// self.create(&self.sender(), ) } } @@ -37,7 +41,7 @@ impl<'a> Executive<'a> { ExecutiveResult::Ok } - fn create(&mut self, transaction: &Transaction) -> ExecutiveResult { + fn create(&mut self, address: &Address, endowment: &U256, gas_price: &U256, gas: &U256, init: &[u8], origin: &Address) -> ExecutiveResult { ExecutiveResult::Ok } } diff --git a/src/evm/ext.rs b/src/evm/ext.rs index d46378d66..27fdc1028 100644 --- a/src/evm/ext.rs +++ b/src/evm/ext.rs @@ -27,8 +27,8 @@ impl SubState { } } -/// This structure represents contract execution environment. -/// It should be initalized with `State` and contract address. +/// Externality interface for the Virtual Machine providing access to +/// world state. /// /// ```markdown /// extern crate ethcore_util as util; @@ -41,7 +41,7 @@ impl SubState { /// fn main() { /// let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap(); /// let mut data = RuntimeData::new(); -/// let mut env = Env::new(EnvInfo::new(), State::new_temp(), address); +/// let mut ext = Ext::new(EnvInfo::new(), State::new_temp(), address); /// } /// ``` pub struct Ext { diff --git a/src/state.rs b/src/state.rs index dbe349d77..cc8aad7fd 100644 --- a/src/state.rs +++ b/src/state.rs @@ -339,4 +339,4 @@ fn create_empty() { assert_eq!(s.root().hex(), "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"); } -} \ No newline at end of file +} diff --git a/src/transaction.rs b/src/transaction.rs index 21282229e..517926b40 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -18,7 +18,7 @@ pub struct Transaction { pub gas: U256, pub to: Option
, pub value: U256, - pub data: Bytes, + pub data: Bytes } impl Transaction { @@ -33,6 +33,12 @@ impl Transaction { } } + /// Returns sender of the transaction. + /// TODO: implement + pub fn sender(&self) -> Address { + Address::new() + } + /// Is this transaction meant to create a contract? pub fn is_contract_creation(&self) -> bool { self.kind() == TransactionKind::ContractCreation