core/vm: rework reversion to work on a higher level

This commit is contained in:
Péter Szilágyi
2017-08-16 17:09:29 +03:00
parent b70a73cd3e
commit f9fb70d2ee
6 changed files with 58 additions and 50 deletions

View File

@ -41,20 +41,13 @@ type operation struct {
validateStack stackValidationFunc
// memorySize returns the memory size required for the operation
memorySize memorySizeFunc
// halts indicates whether the operation shoult halt further execution
// and return
halts bool
// jumps indicates whether operation made a jump. This prevents the program
// counter from further incrementing.
jumps bool
// writes determines whether this a state modifying operation
writes bool
// valid is used to check whether the retrieved operation is valid and known
valid bool
// reverts determined whether the operation reverts state
reverts bool
// returns determines whether the opertions sets the return data
returns bool
halts bool // indicates whether the operation shoult halt further execution
jumps bool // indicates whether the program counter should not increment
writes bool // determines whether this a state modifying operation
valid bool // indication whether the retrieved operation is valid and known
reverts bool // determines whether the operation reverts state (implicitly halts)
returns bool // determines whether the opertions sets the return data content
}
var (
@ -91,10 +84,12 @@ func NewMetropolisInstructionSet() [256]operation {
}
instructionSet[REVERT] = operation{
execute: opRevert,
gasCost: constGasFunc(GasFastestStep),
gasCost: gasRevert,
validateStack: makeStackFunc(2, 0),
memorySize: memoryRevert,
valid: true,
reverts: true,
returns: true,
}
return instructionSet
}