aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/jump_table.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-01-20 06:50:00 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2016-02-18 17:11:48 +0800
commitb6d88a0e9f9aaeb47d585d79c768d457b545af90 (patch)
tree49e667cd929ce6b561961ac741d9ff0f82e61261 /core/vm/jump_table.go
parent4f4d2b647488eaa056613fa6f026229ac91f066a (diff)
downloadgo-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.tar.gz
go-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.tar.zst
go-tangerine-b6d88a0e9f9aaeb47d585d79c768d457b545af90.zip
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
Diffstat (limited to 'core/vm/jump_table.go')
-rw-r--r--core/vm/jump_table.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go
index 222c93854..37d7bb160 100644
--- a/core/vm/jump_table.go
+++ b/core/vm/jump_table.go
@@ -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}