core, core/vm, crypto: fixes for homestead
* Removed some strange code that didn't apply state reverting properly * Refactored code setting from vm & state transition to the executioner * Updated tests
This commit is contained in:
@ -1,13 +1,29 @@
|
||||
package vm
|
||||
|
||||
import "math/big"
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
)
|
||||
|
||||
type jumpPtr struct {
|
||||
fn instrFn
|
||||
valid bool
|
||||
}
|
||||
|
||||
var jumpTable [256]jumpPtr
|
||||
type vmJumpTable [256]jumpPtr
|
||||
|
||||
func (jt vmJumpTable) init(blockNumber *big.Int) {
|
||||
// when initialising a new VM execution we must first check the homestead
|
||||
// changes.
|
||||
if params.IsHomestead(blockNumber) {
|
||||
jumpTable[DELEGATECALL] = jumpPtr{opDelegateCall, true}
|
||||
} else {
|
||||
jumpTable[DELEGATECALL] = jumpPtr{nil, false}
|
||||
}
|
||||
}
|
||||
|
||||
var jumpTable vmJumpTable
|
||||
|
||||
func init() {
|
||||
jumpTable[ADD] = jumpPtr{opAdd, true}
|
||||
@ -62,10 +78,9 @@ func init() {
|
||||
jumpTable[PC] = jumpPtr{nil, true}
|
||||
jumpTable[MSIZE] = jumpPtr{opMsize, true}
|
||||
jumpTable[GAS] = jumpPtr{opGas, true}
|
||||
jumpTable[CREATE] = jumpPtr{nil, true}
|
||||
jumpTable[CREATE] = jumpPtr{opCreate, true}
|
||||
jumpTable[CALL] = jumpPtr{opCall, true}
|
||||
jumpTable[CALLCODE] = jumpPtr{opCallCode, true}
|
||||
jumpTable[DELEGATECALL] = jumpPtr{opDelegateCall, true}
|
||||
jumpTable[LOG0] = jumpPtr{makeLog(0), true}
|
||||
jumpTable[LOG1] = jumpPtr{makeLog(1), true}
|
||||
jumpTable[LOG2] = jumpPtr{makeLog(2), true}
|
||||
|
Reference in New Issue
Block a user