core/vm: support for multiple interpreters (#17093)

- Define an Interpreter interface
- One contract can call contracts from other interpreter types.
- Pass the interpreter to the operands instead of the evm.
  This is meant to prevent type assertions in operands.
This commit is contained in:
Guillaume Ballet
2018-07-25 08:56:39 -04:00
committed by GitHub
parent 27a278e6e3
commit 7abedf9bbb
6 changed files with 315 additions and 240 deletions

View File

@@ -24,7 +24,7 @@ import (
)
type (
executionFunc func(pc *uint64, env *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error)
executionFunc func(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error)
gasFunc func(params.GasTable, *EVM, *Contract, *Stack, *Memory, uint64) (uint64, error) // last parameter is the requested memory size as a uint64
stackValidationFunc func(*Stack) error
memorySizeFunc func(*Stack) *big.Int