diff options
author | Aaron Buchwald <[email protected]> | 2020-11-23 20:46:35 -0500 |
---|---|---|
committer | Aaron Buchwald <[email protected]> | 2020-12-15 10:46:26 -0500 |
commit | 368844ad2a28ec07848e3c0169cf2b83b579a2e8 (patch) | |
tree | 0b3956351add28aed944824eb45ffb2723809dba /core/vm/interpreter.go | |
parent | 2d0a37c6490dc9a4ec36ee4ebbed01c790f0426a (diff) |
Add native asset precompiled contracts for apricot release
Diffstat (limited to 'core/vm/interpreter.go')
-rw-r--r-- | core/vm/interpreter.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index a114a8d..1292650 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -26,6 +26,7 @@ import ( ) var ( + // BuiltinAddr ... BuiltinAddr = common.Address{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -106,6 +107,8 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter { if cfg.JumpTable[STOP] == nil { var jt JumpTable switch { + case evm.chainRules.IsApricot: + jt = apricotInstructionSet case evm.chainRules.IsYoloV1: jt = yoloV1InstructionSet case evm.chainRules.IsIstanbul: @@ -146,6 +149,15 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter { // considered a revert-and-consume-all-gas operation except for // ErrExecutionReverted which means revert-and-keep-gas-left. func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (ret []byte, err error) { + // TODO remove after Apricot network upgrade. + // [BuiltinAddr] is overridden by a precompile in Apricot. + // This makes any call to [BuiltinAddr] a no-op once the network + // upgrade occurs. Then in the upgrade after the hard fork, this + // code can be safely removed. + // This can't occur before the hard fork because it would change + // the behavior of upgraded nodes before the hard fork occurs + // since there is no mechanism to change this code based on the + // block height. if contract.Address() == BuiltinAddr { self := AccountRef(contract.Caller()) if _, ok := contract.caller.(*Contract); ok { |