Changing state tests to support transition
This commit is contained in:
@@ -23,6 +23,9 @@ pub fn new_frontier_test() -> Spec { Spec::from_json_utf8(include_bytes!("../../
|
||||
/// Create a new Homestead chain spec as though it never changed from Frontier.
|
||||
pub fn new_homestead_test() -> Spec { Spec::from_json_utf8(include_bytes!("../../res/ethereum/homestead_test.json")) }
|
||||
|
||||
/// Create a new Frontier main net chain spec without genesis accounts.
|
||||
pub fn new_frontier_like_test() -> Spec { Spec::from_json_utf8(include_bytes!("../../res/ethereum/frontier_like_test.json")) }
|
||||
|
||||
/// Create a new Morden chain spec.
|
||||
pub fn new_morden() -> Spec { Spec::from_json_utf8(include_bytes!("../../res/ethereum/morden.json")) }
|
||||
|
||||
|
||||
@@ -4,26 +4,14 @@ use pod_state::*;
|
||||
use state_diff::*;
|
||||
use ethereum;
|
||||
|
||||
const HOMESTEAD_BLOCK : u64 = 0x0dbba0;
|
||||
|
||||
fn do_json_test(json_data: &[u8]) -> Vec<String> {
|
||||
let json = Json::from_str(::std::str::from_utf8(json_data).unwrap()).expect("Json is invalid");
|
||||
let mut failed = Vec::new();
|
||||
|
||||
let engine = |block_number: u64| {
|
||||
if block_number >= HOMESTEAD_BLOCK {
|
||||
ethereum::new_homestead_test().to_engine().unwrap()
|
||||
} else {
|
||||
ethereum::new_frontier_test().to_engine().unwrap()
|
||||
}
|
||||
};
|
||||
|
||||
let engine = ethereum::new_frontier_like_test().to_engine().unwrap();
|
||||
flush(format!("\n"));
|
||||
|
||||
for (name, test) in json.as_object().unwrap() {
|
||||
if name != "createNameRegistratorPerTxsAt" {
|
||||
continue;
|
||||
}
|
||||
let mut fail = false;
|
||||
{
|
||||
let mut fail_unless = |cond: bool| if !cond && !fail {
|
||||
@@ -35,9 +23,8 @@ fn do_json_test(json_data: &[u8]) -> Vec<String> {
|
||||
|
||||
flush(format!(" - {}...", name));
|
||||
|
||||
let env = EnvInfo::from_json(&test["env"]);
|
||||
let engine = engine(env.number);
|
||||
let t = Transaction::from_json(&test["transaction"]);
|
||||
let env = EnvInfo::from_json(&test["env"]);
|
||||
let _out = Bytes::from_json(&test["out"]);
|
||||
let post_state_root = xjson!(&test["postStateRoot"]);
|
||||
let pre = PodState::from_json(&test["pre"]);
|
||||
|
||||
Reference in New Issue
Block a user