Fixing CALL cost and PC instruction

This commit is contained in:
Tomusdrw 2016-01-14 16:32:28 +01:00
parent 6ab0ec1097
commit 4520f69ed7

View File

@ -311,7 +311,8 @@ impl Interpreter {
InstructionCost::GasMem(gas, self.mem_needed(stack.peek(0), stack.peek(1))) InstructionCost::GasMem(gas, self.mem_needed(stack.peek(0), stack.peek(1)))
}, },
instructions::CALL | instructions::CALLCODE => { 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( let mem = cmp::max(
self.mem_needed(stack.peek(5), stack.peek(6)), self.mem_needed(stack.peek(5), stack.peek(6)),
self.mem_needed(stack.peek(3), stack.peek(4)) self.mem_needed(stack.peek(3), stack.peek(4))
@ -534,7 +535,7 @@ impl Interpreter {
ext.sstore(key, word); ext.sstore(key, word);
}, },
instructions::PC => { instructions::PC => {
stack.push(U256::from(code.position)); stack.push(U256::from(code.position - 1));
}, },
instructions::GAS => { instructions::GAS => {
stack.push(gas.clone()); stack.push(gas.clone());