executive in progress
This commit is contained in:
parent
ec720aefa9
commit
d27a16c945
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -339,4 +339,4 @@ fn create_empty() {
|
||||
assert_eq!(s.root().hex(), "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ pub struct Transaction {
|
||||
pub gas: U256,
|
||||
pub to: Option<Address>,
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user