From 3118baee9b1703d66b7457420eecb7a9e7a5a259 Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 14 Jan 2016 12:10:26 +0100 Subject: [PATCH] executive gas calculation fixes --- src/executive.rs | 2 +- src/tests/executive.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/executive.rs b/src/executive.rs index 6ae8a0a0e..36ed48a6a 100644 --- a/src/executive.rs +++ b/src/executive.rs @@ -418,7 +418,7 @@ impl<'a> Ext for Externalities<'a> { }; 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 { diff --git a/src/tests/executive.rs b/src/tests/executive.rs index cfe80dfc1..25166dc04 100644 --- a/src/tests/executive.rs +++ b/src/tests/executive.rs @@ -9,14 +9,14 @@ use ethereum; 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 } } } @@ -26,7 +26,7 @@ impl Engine for TestEngine { 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 } } @@ -87,7 +87,7 @@ impl<'a> Ext for TestExt<'a> { }); 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 => { let address = contract_address(&ext.params.address, &ext.state.nonce(&ext.params.address)); self.callcreates.push(CallCreate {