More formatting

This commit is contained in:
Tomusdrw 2016-01-14 02:26:20 +01:00
parent de802b7b6e
commit e9cc821969

View File

@ -195,39 +195,39 @@ impl evm::Evm for Interpreter {
while reader.position < code.len() { while reader.position < code.len() {
let instruction = code[reader.position]; let instruction = code[reader.position];
reader.position += 1; reader.position += 1;
// Calculate gas cost // Calculate gas cost
let gas_cost = try!(self.get_gas_cost_and_expand_mem(ext, instruction, &mut mem, &stack)); let gas_cost = try!(self.get_gas_cost_and_expand_mem(ext, instruction, &mut mem, &stack));
try!(self.verify_gas(&current_gas, &gas_cost)); try!(self.verify_gas(&current_gas, &gas_cost));
current_gas = current_gas - gas_cost; current_gas = current_gas - gas_cost;
println!("Gas cost: {} (left: {})", gas_cost, current_gas); println!("Gas cost: {} (left: {})", gas_cost, current_gas);
println!("Executing: {} ", instructions::get_info(instruction).name); println!("Executing: {} ", instructions::get_info(instruction).name);
// Execute instruction // Execute instruction
let result = try!(self.exec_instruction( let result = try!(self.exec_instruction(
current_gas, params, ext, instruction, &mut reader, &mut mem, &mut stack current_gas, params, ext, instruction, &mut reader, &mut mem, &mut stack
)); ));
// Advance // Advance
match result { match result {
InstructionResult::JumpToPosition(position) => { InstructionResult::JumpToPosition(position) => {
let pos = try!(self.verify_jump(position, &valid_jump_destinations)); let pos = try!(self.verify_jump(position, &valid_jump_destinations));
reader.position = pos; reader.position = pos;
}, },
InstructionResult::AdditionalGasCost(gas_cost) => { InstructionResult::AdditionalGasCost(gas_cost) => {
current_gas = current_gas - gas_cost; current_gas = current_gas - gas_cost;
}, },
InstructionResult::StopExecutionWithGasCost(gas_cost) => { InstructionResult::StopExecutionWithGasCost(gas_cost) => {
current_gas = current_gas - gas_cost; current_gas = current_gas - gas_cost;
reader.position = code.len(); reader.position = code.len();
}, },
InstructionResult::StopExecution => { InstructionResult::StopExecution => {
reader.position = code.len(); reader.position = code.len();
}
} }
} }
}
Ok(current_gas) Ok(current_gas)
} }
} }