Merge pull request #108 from gavofyork/executive_fixes
executive gas calculation fixes
This commit is contained in:
commit
1d524260e9
@ -418,7 +418,7 @@ impl<'a> Ext for Externalities<'a> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut ex = Executive::from_parent(self.state, self.info, self.engine, self.depth);
|
let mut ex = Executive::from_parent(self.state, self.info, self.engine, self.depth);
|
||||||
ex.call(¶ms, self.substate, BytesRef::Fixed(output))
|
ex.call(¶ms, self.substate, BytesRef::Fixed(output)).map(|gas_left| gas + gas_left)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extcode(&self, address: &Address) -> Vec<u8> {
|
fn extcode(&self, address: &Address) -> Vec<u8> {
|
||||||
|
@ -9,14 +9,14 @@ use ethereum;
|
|||||||
|
|
||||||
struct TestEngine {
|
struct TestEngine {
|
||||||
spec: Spec,
|
spec: Spec,
|
||||||
stack_limit: usize
|
max_depth: usize
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TestEngine {
|
impl TestEngine {
|
||||||
fn new(stack_limit: usize) -> TestEngine {
|
fn new(max_depth: usize) -> TestEngine {
|
||||||
TestEngine {
|
TestEngine {
|
||||||
spec: ethereum::new_frontier_test(),
|
spec: ethereum::new_frontier_test(),
|
||||||
stack_limit: stack_limit
|
max_depth: max_depth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ impl Engine for TestEngine {
|
|||||||
fn spec(&self) -> &Spec { &self.spec }
|
fn spec(&self) -> &Spec { &self.spec }
|
||||||
fn schedule(&self, _env_info: &EnvInfo) -> Schedule {
|
fn schedule(&self, _env_info: &EnvInfo) -> Schedule {
|
||||||
let mut schedule = Schedule::new_frontier();
|
let mut schedule = Schedule::new_frontier();
|
||||||
schedule.stack_limit = self.stack_limit;
|
schedule.max_depth = self.max_depth;
|
||||||
schedule
|
schedule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ impl<'a> Ext for TestExt<'a> {
|
|||||||
});
|
});
|
||||||
Ok((gas_left, Some(address)))
|
Ok((gas_left, Some(address)))
|
||||||
},
|
},
|
||||||
// creation failed only due to reaching stack_limit
|
// creation failed only due to reaching max_depth
|
||||||
Ok((gas_left, None)) if ext.state.balance(&ext.params.address) >= *value => {
|
Ok((gas_left, None)) if ext.state.balance(&ext.params.address) >= *value => {
|
||||||
let address = contract_address(&ext.params.address, &ext.state.nonce(&ext.params.address));
|
let address = contract_address(&ext.params.address, &ext.state.nonce(&ext.params.address));
|
||||||
self.callcreates.push(CallCreate {
|
self.callcreates.push(CallCreate {
|
||||||
|
Loading…
Reference in New Issue
Block a user