diff options
author | Martin Holst Swende <martin@swende.se> | 2019-08-08 17:07:23 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-08-08 17:07:23 +0800 |
commit | 3e993ff64a9c2e9651fae11aaee55032cd6b0c3e (patch) | |
tree | a41e37be7f46f3fb2a3a7a0025587770d67f149e /core/vm/interpreter.go | |
parent | f3478f2899e80d59d15956ae408fab93cf26254d (diff) | |
download | go-tangerine-3e993ff64a9c2e9651fae11aaee55032cd6b0c3e.tar go-tangerine-3e993ff64a9c2e9651fae11aaee55032cd6b0c3e.tar.gz go-tangerine-3e993ff64a9c2e9651fae11aaee55032cd6b0c3e.tar.bz2 go-tangerine-3e993ff64a9c2e9651fae11aaee55032cd6b0c3e.tar.lz go-tangerine-3e993ff64a9c2e9651fae11aaee55032cd6b0c3e.tar.xz go-tangerine-3e993ff64a9c2e9651fae11aaee55032cd6b0c3e.tar.zst go-tangerine-3e993ff64a9c2e9651fae11aaee55032cd6b0c3e.zip |
Eip 1884 v3 (#19743)
* core/vm, tests: implement EIP 1884, add support for feature-tests
* core/vm: 1884-changes to extcodehash, move selfbalance opcode
* tests: fix statetests
* core/vm: move constants, address review concerns
* core/vm: word formatting
Co-Authored-By: Péter Szilágyi <peterke@gmail.com>
Diffstat (limited to 'core/vm/interpreter.go')
-rw-r--r-- | core/vm/interpreter.go | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 18081ec4c..be6e00a6e 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -23,6 +23,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereum/go-ethereum/log" ) // Config are the configuration options for the Interpreter @@ -36,6 +37,8 @@ type Config struct { EWASMInterpreter string // External EWASM interpreter options EVMInterpreter string // External EVM interpreter options + + ExtraEips []int // Additional EIPS that are to be enabled } // Interpreter is used to run Ethereum based contracts and will utilise the @@ -88,20 +91,29 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter { // the jump table was initialised. If it was not // we'll set the default jump table. if !cfg.JumpTable[STOP].valid { + var jt JumpTable switch { case evm.chainRules.IsConstantinople: - cfg.JumpTable = constantinopleInstructionSet + jt = constantinopleInstructionSet case evm.chainRules.IsByzantium: - cfg.JumpTable = byzantiumInstructionSet + jt = byzantiumInstructionSet case evm.chainRules.IsEIP158: - cfg.JumpTable = spuriousDragonInstructionSet + jt = spuriousDragonInstructionSet case evm.chainRules.IsEIP150: - cfg.JumpTable = tangerineWhistleInstructionSet + jt = tangerineWhistleInstructionSet case evm.chainRules.IsHomestead: - cfg.JumpTable = homesteadInstructionSet + jt = homesteadInstructionSet default: - cfg.JumpTable = frontierInstructionSet + jt = frontierInstructionSet + } + for i, eip := range cfg.ExtraEips { + if err := EnableEIP(eip, &jt); err != nil { + // Disable it, so caller can check if it's activated or not + cfg.ExtraEips = append(cfg.ExtraEips[:i], cfg.ExtraEips[i+1:]...) + log.Error("EIP activation failed", "eip", eip, "error", err) + } } + cfg.JumpTable = jt } return &EVMInterpreter{ |