executive create
This commit is contained in:
@@ -71,24 +71,24 @@ impl<'a> Ext for TestExt<'a> {
|
||||
self.ext.blockhash(number)
|
||||
}
|
||||
|
||||
fn create(&mut self, gas: &U256, value: &U256, code: &[u8]) -> Result<(U256, Option<Address>), evm::Error> {
|
||||
fn create(&mut self, gas: &U256, value: &U256, code: &[u8]) -> (U256, Option<Address>) {
|
||||
// in call and create we need to check if we exited with insufficient balance or max limit reached.
|
||||
// in case of reaching max depth, we should store callcreates. Otherwise, ignore.
|
||||
let res = self.ext.create(gas, value, code);
|
||||
let ext = &self.ext;
|
||||
match res {
|
||||
// just record call create
|
||||
Ok((gas_left, Some(address))) => {
|
||||
(gas_left, Some(address)) => {
|
||||
self.callcreates.push(CallCreate {
|
||||
data: code.to_vec(),
|
||||
destination: address.clone(),
|
||||
_gas_limit: *gas,
|
||||
value: *value
|
||||
});
|
||||
Ok((gas_left, Some(address)))
|
||||
(gas_left, Some(address))
|
||||
},
|
||||
// creation failed only due to reaching max_depth
|
||||
Ok((gas_left, None)) if ext.state.balance(&ext.params.address) >= *value => {
|
||||
(gas_left, None) if ext.state.balance(&ext.params.address) >= *value => {
|
||||
let address = contract_address(&ext.params.address, &ext.state.nonce(&ext.params.address));
|
||||
self.callcreates.push(CallCreate {
|
||||
data: code.to_vec(),
|
||||
@@ -97,9 +97,10 @@ impl<'a> Ext for TestExt<'a> {
|
||||
_gas_limit: *gas,
|
||||
value: *value
|
||||
});
|
||||
Ok((gas_left, Some(address)))
|
||||
(gas_left, Some(address))
|
||||
},
|
||||
other => other
|
||||
// compiler is wrong...
|
||||
_other => { unreachable!() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +157,7 @@ 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();
|
||||
for (name, test) in json.as_object().unwrap() {
|
||||
println!("name: {:?}", name);
|
||||
// sync io is usefull when something crashes in jit
|
||||
//::std::io::stdout().write(&name.as_bytes());
|
||||
//::std::io::stdout().write(b"\n");
|
||||
|
||||
@@ -10,6 +10,7 @@ fn do_json_test(json_data: &[u8]) -> Vec<String> {
|
||||
let engine = ethereum::new_frontier_test().to_engine().unwrap();
|
||||
|
||||
for (name, test) in json.as_object().unwrap() {
|
||||
println!("name: {:?}", name);
|
||||
let mut fail = false;
|
||||
let mut fail_unless = |cond: bool| if !cond && !fail { failed.push(name.to_string()); fail = true; true } else {false};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user