Fixing evmbin compilation (#2652)

This commit is contained in:
Tomasz Drwięga 2016-10-17 11:55:47 +02:00 committed by Gav Wood
parent b5c65e3df5
commit 238840d74e
3 changed files with 473 additions and 322 deletions

772
evmbin/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@
//! Externalities implementation.
use std::sync::Arc;
use std::collections::HashMap;
use util::{U256, H256, Address, Bytes, FixedHash};
use ethcore::client::EnvInfo;
@ -24,6 +25,7 @@ use ethcore::evm::{self, Ext, ContractCreateResult, MessageCallResult, Schedule,
pub struct FakeExt {
schedule: Schedule,
store: HashMap<H256, H256>,
depth: usize,
}
impl Default for FakeExt {
@ -31,6 +33,7 @@ impl Default for FakeExt {
FakeExt {
schedule: Schedule::new_homestead(),
store: HashMap::new(),
depth: 1,
}
}
}
@ -72,7 +75,11 @@ impl Ext for FakeExt {
unimplemented!();
}
fn extcode(&self, _address: &Address) -> Bytes {
fn extcode(&self, _address: &Address) -> Arc<Bytes> {
unimplemented!();
}
fn extcodesize(&self, _address: &Address) -> usize {
unimplemented!();
}
@ -97,8 +104,7 @@ impl Ext for FakeExt {
}
fn depth(&self) -> usize {
unimplemented!();
// self.depth
self.depth
}
fn inc_sstore_clears(&mut self) {

View File

@ -26,6 +26,7 @@ extern crate ethcore_util as util;
mod ext;
use std::sync::Arc;
use std::time::{Instant, Duration};
use std::str::FromStr;
use docopt::Docopt;
@ -42,9 +43,9 @@ Usage:
evmbin [-h | --help]
Transaction options:
--code CODE Contract code.
--input DATA Input data.
--gas GAS Supplied gas.
--code CODE Contract code as hex (without 0x)
--input DATA Input data as hex (without 0x)
--gas GAS Supplied gas as hex (without 0x)
General options:
-h, --help Display this message and exit.
@ -56,7 +57,7 @@ fn main() {
let mut params = ActionParams::default();
params.gas = args.gas();
params.code = Some(args.code());
params.code = Some(Arc::new(args.code()));
params.data = args.data();
let result = run_vm(params);
@ -68,7 +69,7 @@ fn main() {
/// Execute VM with given `ActionParams`
pub fn run_vm(params: ActionParams) -> ExecutionResults {
let initial_gas = params.gas;
let factory = Factory::new(VMType::Interpreter);
let factory = Factory::new(VMType::Interpreter, 1024);
let mut vm = factory.create(params.gas);
let mut ext = ext::FakeExt::default();