This commit is contained in:
debris 2016-01-13 17:45:06 +01:00
parent 1f4d5fb860
commit cb16bdb350
3 changed files with 8 additions and 22 deletions

View File

@ -279,11 +279,17 @@ pub enum OutputPolicy<'a> {
/// Implementation of evm Externalities.
pub struct Externalities<'a> {
#[cfg(test)]
pub state: &'a mut State,
#[cfg(not(test))]
state: &'a mut State,
info: &'a EnvInfo,
engine: &'a Engine,
depth: usize,
#[cfg(test)]
pub params: &'a ActionParams,
#[cfg(not(test))]
params: &'a ActionParams,
substate: &'a mut Substate,
schedule: Schedule,
output: OutputPolicy<'a>
@ -482,7 +488,6 @@ mod tests {
use engine::*;
use spec::*;
use evm::Schedule;
//use super::Substate;
struct TestEngine {
spec: Spec,

View File

@ -4,14 +4,14 @@ use ethereum;
pub fn hashmap_h256_h256_from_json(json: &Json) -> HashMap<H256, H256> {
json.as_object().unwrap().iter().fold(HashMap::new(), |mut m, (key, value)| {
m.insert(H256::from(&u256_from_hex(key)), H256::from(&u256_from_json(value)));
m.insert(H256::from(&u256_from_str(key)), H256::from(&u256_from_json(value)));
m
})
}
pub fn map_h256_h256_from_json(json: &Json) -> BTreeMap<H256, H256> {
json.as_object().unwrap().iter().fold(BTreeMap::new(), |mut m, (key, value)| {
m.insert(H256::from(&u256_from_hex(key)), H256::from(&u256_from_json(value)));
m.insert(H256::from(&u256_from_str(key)), H256::from(&u256_from_json(value)));
m
})
}

View File

@ -1,24 +1,5 @@
pub use common::*;
pub fn address_from_str<'a>(s: &'a str) -> Address {
if s.len() % 2 == 1 {
address_from_hex(&("0".to_string() + &(clean(s).to_string()))[..])
} else {
address_from_hex(clean(s))
}
}
pub fn u256_from_str<'a>(s: &'a str) -> U256 {
if s.len() >= 2 && &s[0..2] == "0x" {
// hex
U256::from_str(&s[2..]).unwrap()
}
else {
// dec
U256::from_dec_str(s).unwrap()
}
}
#[macro_export]
macro_rules! declare_test {
($id: ident, $name: expr) => {