Merge pull request #105 from gavofyork/executive_max_depth

Fixing MaxDepth param for executive
This commit is contained in:
Gav Wood 2016-01-14 02:30:30 +01:00
commit 4b6d853593
2 changed files with 10 additions and 8 deletions

View File

@ -5,6 +5,7 @@ pub struct Schedule {
pub exceptional_failed_code_deposit: bool,
pub have_delegate_call: bool,
pub stack_limit: usize,
pub max_depth: usize,
pub tier_step_gas: [usize; 8],
pub exp_gas: usize,
pub exp_byte_gas: usize,
@ -50,6 +51,7 @@ impl Schedule {
exceptional_failed_code_deposit: efcd,
have_delegate_call: hdc,
stack_limit: 1024,
max_depth: 1024,
tier_step_gas: [0, 2, 3, 5, 8, 10, 20, 0],
exp_gas: 10,
exp_byte_gas: 10,

View File

@ -303,7 +303,7 @@ impl<'a> Externalities<'a> {
pub fn new(state: &'a mut State,
info: &'a EnvInfo,
engine: &'a Engine,
depth: usize,
depth: usize,
params: &'a ActionParams,
substate: &'a mut Substate,
output: OutputPolicy<'a>) -> Self {
@ -354,7 +354,7 @@ impl<'a> Ext for Externalities<'a> {
fn create(&mut self, gas: &U256, value: &U256, code: &[u8]) -> Result<(U256, Option<Address>), evm::Error> {
// if balance is insufficient or we are to deep, return
if self.state.balance(&self.params.address) < *value || self.depth >= self.schedule.stack_limit {
if self.state.balance(&self.params.address) < *value || self.depth >= self.schedule.max_depth {
return Ok((*gas, None));
}
@ -400,7 +400,7 @@ impl<'a> Ext for Externalities<'a> {
let gas = *gas - gas_cost;
// if balance is insufficient or we are to deep, return
if self.state.balance(&self.params.address) < *value || self.depth >= self.schedule.stack_limit {
if self.state.balance(&self.params.address) < *value || self.depth >= self.schedule.max_depth {
return Ok(gas + call_gas)
}
@ -492,14 +492,14 @@ mod tests {
struct TestEngine {
spec: Spec,
stack_limit: usize
max_depth: usize
}
impl TestEngine {
fn new(stack_limit: usize) -> TestEngine {
fn new(max_depth: usize) -> TestEngine {
TestEngine {
spec: ethereum::new_frontier_test(),
stack_limit: stack_limit
max_depth: max_depth
}
}
}
@ -509,7 +509,7 @@ mod tests {
fn spec(&self) -> &Spec { &self.spec }
fn schedule(&self, _env_info: &EnvInfo) -> Schedule {
let mut schedule = Schedule::new_frontier();
schedule.stack_limit = self.stack_limit;
schedule.max_depth = self.max_depth;
schedule
}
}
@ -659,7 +659,7 @@ mod tests {
}
#[test]
fn test_create_contract_without_stack_limit() {
fn test_create_contract_without_max_depth() {
// code:
//
// 7c 601080600c6000396000f3006000355415600957005b60203560003555 - push 29 bytes?