From 4520f69ed74c1cbff71fa34944f1f416aaa00a10 Mon Sep 17 00:00:00 2001 From: Tomusdrw Date: Thu, 14 Jan 2016 16:32:28 +0100 Subject: [PATCH] Fixing CALL cost and PC instruction --- src/evm/interpreter.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/evm/interpreter.rs b/src/evm/interpreter.rs index eac749f3f..d0bf051ac 100644 --- a/src/evm/interpreter.rs +++ b/src/evm/interpreter.rs @@ -311,7 +311,8 @@ impl Interpreter { InstructionCost::GasMem(gas, self.mem_needed(stack.peek(0), stack.peek(1))) }, instructions::CALL | instructions::CALLCODE => { - let gas = add_u256_usize(stack.peek(0), schedule.call_gas); + // [todr] we actuall call gas_cost is calculated in ext + let gas = U256::from(schedule.call_gas); let mem = cmp::max( self.mem_needed(stack.peek(5), stack.peek(6)), self.mem_needed(stack.peek(3), stack.peek(4)) @@ -534,7 +535,7 @@ impl Interpreter { ext.sstore(key, word); }, instructions::PC => { - stack.push(U256::from(code.position)); + stack.push(U256::from(code.position - 1)); }, instructions::GAS => { stack.push(gas.clone());