all: remove noop vm config flags (#23111)
* all: rm external interpreter and ewasm config * core/vm: rm Interpreter interface * cmd/geth: deprecate interpreter config fields
This commit is contained in:
parent
e13d14e6a3
commit
5441a8fa47
@ -129,11 +129,6 @@ var (
|
|||||||
Name: "noreturndata",
|
Name: "noreturndata",
|
||||||
Usage: "disable return data output",
|
Usage: "disable return data output",
|
||||||
}
|
}
|
||||||
EVMInterpreterFlag = cli.StringFlag{
|
|
||||||
Name: "vm.evm",
|
|
||||||
Usage: "External EVM configuration (default = built-in interpreter)",
|
|
||||||
Value: "",
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var stateTransitionCommand = cli.Command{
|
var stateTransitionCommand = cli.Command{
|
||||||
@ -185,7 +180,6 @@ func init() {
|
|||||||
DisableStackFlag,
|
DisableStackFlag,
|
||||||
DisableStorageFlag,
|
DisableStorageFlag,
|
||||||
DisableReturnDataFlag,
|
DisableReturnDataFlag,
|
||||||
EVMInterpreterFlag,
|
|
||||||
}
|
}
|
||||||
app.Commands = []cli.Command{
|
app.Commands = []cli.Command{
|
||||||
compileCommand,
|
compileCommand,
|
||||||
|
@ -213,7 +213,6 @@ func runCmd(ctx *cli.Context) error {
|
|||||||
EVMConfig: vm.Config{
|
EVMConfig: vm.Config{
|
||||||
Tracer: tracer,
|
Tracer: tracer,
|
||||||
Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name),
|
Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name),
|
||||||
EVMInterpreter: ctx.GlobalString(EVMInterpreterFlag.Name),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,5 +236,12 @@ func applyMetricConfig(ctx *cli.Context, cfg *gethConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func deprecated(field string) bool {
|
func deprecated(field string) bool {
|
||||||
|
switch field {
|
||||||
|
case "ethconfig.Config.EVMInterpreter":
|
||||||
|
return true
|
||||||
|
case "ethconfig.Config.EWASMInterpreter":
|
||||||
|
return true
|
||||||
|
default:
|
||||||
return false
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,8 +148,6 @@ var (
|
|||||||
utils.GpoPercentileFlag,
|
utils.GpoPercentileFlag,
|
||||||
utils.GpoMaxGasPriceFlag,
|
utils.GpoMaxGasPriceFlag,
|
||||||
utils.GpoIgnoreGasPriceFlag,
|
utils.GpoIgnoreGasPriceFlag,
|
||||||
utils.EWASMInterpreterFlag,
|
|
||||||
utils.EVMInterpreterFlag,
|
|
||||||
utils.MinerNotifyFullFlag,
|
utils.MinerNotifyFullFlag,
|
||||||
configFileFlag,
|
configFileFlag,
|
||||||
utils.CatalystFlag,
|
utils.CatalystFlag,
|
||||||
|
@ -203,8 +203,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
|
|||||||
Name: "VIRTUAL MACHINE",
|
Name: "VIRTUAL MACHINE",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.VMEnableDebugFlag,
|
utils.VMEnableDebugFlag,
|
||||||
utils.EVMInterpreterFlag,
|
|
||||||
utils.EWASMInterpreterFlag,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -760,16 +760,6 @@ var (
|
|||||||
Usage: "Comma-separated InfluxDB tags (key/values) attached to all measurements",
|
Usage: "Comma-separated InfluxDB tags (key/values) attached to all measurements",
|
||||||
Value: metrics.DefaultConfig.InfluxDBTags,
|
Value: metrics.DefaultConfig.InfluxDBTags,
|
||||||
}
|
}
|
||||||
EWASMInterpreterFlag = cli.StringFlag{
|
|
||||||
Name: "vm.ewasm",
|
|
||||||
Usage: "External ewasm configuration (default = built-in interpreter)",
|
|
||||||
Value: "",
|
|
||||||
}
|
|
||||||
EVMInterpreterFlag = cli.StringFlag{
|
|
||||||
Name: "vm.evm",
|
|
||||||
Usage: "External EVM configuration (default = built-in interpreter)",
|
|
||||||
Value: "",
|
|
||||||
}
|
|
||||||
|
|
||||||
CatalystFlag = cli.BoolFlag{
|
CatalystFlag = cli.BoolFlag{
|
||||||
Name: "catalyst",
|
Name: "catalyst",
|
||||||
@ -1586,13 +1576,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||||||
cfg.EnablePreimageRecording = ctx.GlobalBool(VMEnableDebugFlag.Name)
|
cfg.EnablePreimageRecording = ctx.GlobalBool(VMEnableDebugFlag.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.GlobalIsSet(EWASMInterpreterFlag.Name) {
|
|
||||||
cfg.EWASMInterpreter = ctx.GlobalString(EWASMInterpreterFlag.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ctx.GlobalIsSet(EVMInterpreterFlag.Name) {
|
|
||||||
cfg.EVMInterpreter = ctx.GlobalString(EVMInterpreterFlag.Name)
|
|
||||||
}
|
|
||||||
if ctx.GlobalIsSet(RPCGlobalGasCapFlag.Name) {
|
if ctx.GlobalIsSet(RPCGlobalGasCapFlag.Name) {
|
||||||
cfg.RPCGasCap = ctx.GlobalUint64(RPCGlobalGasCapFlag.Name)
|
cfg.RPCGasCap = ctx.GlobalUint64(RPCGlobalGasCapFlag.Name)
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@ func copyConfig(original *params.ChainConfig) *params.ChainConfig {
|
|||||||
MuirGlacierBlock: original.MuirGlacierBlock,
|
MuirGlacierBlock: original.MuirGlacierBlock,
|
||||||
BerlinBlock: original.BerlinBlock,
|
BerlinBlock: original.BerlinBlock,
|
||||||
LondonBlock: original.LondonBlock,
|
LondonBlock: original.LondonBlock,
|
||||||
EWASMBlock: original.EWASMBlock,
|
|
||||||
CatalystBlock: original.CatalystBlock,
|
CatalystBlock: original.CatalystBlock,
|
||||||
Ethash: original.Ethash,
|
Ethash: original.Ethash,
|
||||||
Clique: original.Clique,
|
Clique: original.Clique,
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package vm
|
package vm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
@ -58,24 +57,6 @@ func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) {
|
|||||||
return p, ok
|
return p, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// run runs the given contract and takes care of running precompiles with a fallback to the byte code interpreter.
|
|
||||||
func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, error) {
|
|
||||||
for _, interpreter := range evm.interpreters {
|
|
||||||
if interpreter.CanRun(contract.Code) {
|
|
||||||
if evm.interpreter != interpreter {
|
|
||||||
// Ensure that the interpreter pointer is set back
|
|
||||||
// to its current value upon return.
|
|
||||||
defer func(i Interpreter) {
|
|
||||||
evm.interpreter = i
|
|
||||||
}(evm.interpreter)
|
|
||||||
evm.interpreter = interpreter
|
|
||||||
}
|
|
||||||
return interpreter.Run(contract, input, readOnly)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil, errors.New("no compatible interpreter")
|
|
||||||
}
|
|
||||||
|
|
||||||
// BlockContext provides the EVM with auxiliary information. Once provided
|
// BlockContext provides the EVM with auxiliary information. Once provided
|
||||||
// it shouldn't be modified.
|
// it shouldn't be modified.
|
||||||
type BlockContext struct {
|
type BlockContext struct {
|
||||||
@ -131,8 +112,7 @@ type EVM struct {
|
|||||||
Config Config
|
Config Config
|
||||||
// global (to this context) ethereum virtual machine
|
// global (to this context) ethereum virtual machine
|
||||||
// used throughout the execution of the tx.
|
// used throughout the execution of the tx.
|
||||||
interpreters []Interpreter
|
interpreter *EVMInterpreter
|
||||||
interpreter Interpreter
|
|
||||||
// abort is used to abort the EVM calling operations
|
// abort is used to abort the EVM calling operations
|
||||||
// NOTE: must be set atomically
|
// NOTE: must be set atomically
|
||||||
abort int32
|
abort int32
|
||||||
@ -152,30 +132,8 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig
|
|||||||
Config: config,
|
Config: config,
|
||||||
chainConfig: chainConfig,
|
chainConfig: chainConfig,
|
||||||
chainRules: chainConfig.Rules(blockCtx.BlockNumber),
|
chainRules: chainConfig.Rules(blockCtx.BlockNumber),
|
||||||
interpreters: make([]Interpreter, 0, 1),
|
|
||||||
}
|
}
|
||||||
|
evm.interpreter = NewEVMInterpreter(evm, config)
|
||||||
if chainConfig.IsEWASM(blockCtx.BlockNumber) {
|
|
||||||
// to be implemented by EVM-C and Wagon PRs.
|
|
||||||
// if vmConfig.EWASMInterpreter != "" {
|
|
||||||
// extIntOpts := strings.Split(vmConfig.EWASMInterpreter, ":")
|
|
||||||
// path := extIntOpts[0]
|
|
||||||
// options := []string{}
|
|
||||||
// if len(extIntOpts) > 1 {
|
|
||||||
// options = extIntOpts[1..]
|
|
||||||
// }
|
|
||||||
// evm.interpreters = append(evm.interpreters, NewEVMVCInterpreter(evm, vmConfig, options))
|
|
||||||
// } else {
|
|
||||||
// evm.interpreters = append(evm.interpreters, NewEWASMInterpreter(evm, vmConfig))
|
|
||||||
// }
|
|
||||||
panic("No supported ewasm interpreter yet.")
|
|
||||||
}
|
|
||||||
|
|
||||||
// vmConfig.EVMInterpreter will be used by EVM-C, it won't be checked here
|
|
||||||
// as we always want to have the built-in EVM as the failover option.
|
|
||||||
evm.interpreters = append(evm.interpreters, NewEVMInterpreter(evm, config))
|
|
||||||
evm.interpreter = evm.interpreters[0]
|
|
||||||
|
|
||||||
return evm
|
return evm
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +156,7 @@ func (evm *EVM) Cancelled() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Interpreter returns the current interpreter
|
// Interpreter returns the current interpreter
|
||||||
func (evm *EVM) Interpreter() Interpreter {
|
func (evm *EVM) Interpreter() *EVMInterpreter {
|
||||||
return evm.interpreter
|
return evm.interpreter
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +214,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
|
|||||||
// The depth-check is already done, and precompiles handled above
|
// The depth-check is already done, and precompiles handled above
|
||||||
contract := NewContract(caller, AccountRef(addrCopy), value, gas)
|
contract := NewContract(caller, AccountRef(addrCopy), value, gas)
|
||||||
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), code)
|
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), code)
|
||||||
ret, err = run(evm, contract, input, false)
|
ret, err = evm.interpreter.Run(contract, input, false)
|
||||||
gas = contract.Gas
|
gas = contract.Gas
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -308,7 +266,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
|
|||||||
// The contract is a scoped environment for this execution context only.
|
// The contract is a scoped environment for this execution context only.
|
||||||
contract := NewContract(caller, AccountRef(caller.Address()), value, gas)
|
contract := NewContract(caller, AccountRef(caller.Address()), value, gas)
|
||||||
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), evm.StateDB.GetCode(addrCopy))
|
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), evm.StateDB.GetCode(addrCopy))
|
||||||
ret, err = run(evm, contract, input, false)
|
ret, err = evm.interpreter.Run(contract, input, false)
|
||||||
gas = contract.Gas
|
gas = contract.Gas
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -343,7 +301,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
|
|||||||
// Initialise a new contract and make initialise the delegate values
|
// Initialise a new contract and make initialise the delegate values
|
||||||
contract := NewContract(caller, AccountRef(caller.Address()), nil, gas).AsDelegate()
|
contract := NewContract(caller, AccountRef(caller.Address()), nil, gas).AsDelegate()
|
||||||
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), evm.StateDB.GetCode(addrCopy))
|
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), evm.StateDB.GetCode(addrCopy))
|
||||||
ret, err = run(evm, contract, input, false)
|
ret, err = evm.interpreter.Run(contract, input, false)
|
||||||
gas = contract.Gas
|
gas = contract.Gas
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -394,7 +352,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
|
|||||||
// When an error was returned by the EVM or when setting the creation code
|
// When an error was returned by the EVM or when setting the creation code
|
||||||
// above we revert to the snapshot and consume any gas remaining. Additionally
|
// above we revert to the snapshot and consume any gas remaining. Additionally
|
||||||
// when we're in Homestead this also counts for code storage gas errors.
|
// when we're in Homestead this also counts for code storage gas errors.
|
||||||
ret, err = run(evm, contract, input, true)
|
ret, err = evm.interpreter.Run(contract, input, true)
|
||||||
gas = contract.Gas
|
gas = contract.Gas
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -462,7 +420,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
|
|||||||
}
|
}
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
ret, err := run(evm, contract, nil, false)
|
ret, err := evm.interpreter.Run(contract, nil, false)
|
||||||
|
|
||||||
// Check whether the max code size has been exceeded, assign err if the case.
|
// Check whether the max code size has been exceeded, assign err if the case.
|
||||||
if err == nil && evm.chainRules.IsEIP158 && len(ret) > params.MaxCodeSize {
|
if err == nil && evm.chainRules.IsEIP158 && len(ret) > params.MaxCodeSize {
|
||||||
|
@ -96,7 +96,7 @@ func testTwoOperandOp(t *testing.T, tests []TwoOperandTestcase, opFn executionFu
|
|||||||
env = NewEVM(BlockContext{}, TxContext{}, nil, params.TestChainConfig, Config{})
|
env = NewEVM(BlockContext{}, TxContext{}, nil, params.TestChainConfig, Config{})
|
||||||
stack = newstack()
|
stack = newstack()
|
||||||
pc = uint64(0)
|
pc = uint64(0)
|
||||||
evmInterpreter = env.interpreter.(*EVMInterpreter)
|
evmInterpreter = env.interpreter
|
||||||
)
|
)
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
@ -234,7 +234,7 @@ func getResult(args []*twoOperandParams, opFn executionFunc) []TwoOperandTestcas
|
|||||||
env = NewEVM(BlockContext{}, TxContext{}, nil, params.TestChainConfig, Config{})
|
env = NewEVM(BlockContext{}, TxContext{}, nil, params.TestChainConfig, Config{})
|
||||||
stack = newstack()
|
stack = newstack()
|
||||||
pc = uint64(0)
|
pc = uint64(0)
|
||||||
interpreter = env.interpreter.(*EVMInterpreter)
|
interpreter = env.interpreter
|
||||||
)
|
)
|
||||||
result := make([]TwoOperandTestcase, len(args))
|
result := make([]TwoOperandTestcase, len(args))
|
||||||
for i, param := range args {
|
for i, param := range args {
|
||||||
|
@ -35,34 +35,9 @@ type Config struct {
|
|||||||
|
|
||||||
JumpTable [256]*operation // EVM instruction table, automatically populated if unset
|
JumpTable [256]*operation // EVM instruction table, automatically populated if unset
|
||||||
|
|
||||||
EWASMInterpreter string // External EWASM interpreter options
|
|
||||||
EVMInterpreter string // External EVM interpreter options
|
|
||||||
|
|
||||||
ExtraEips []int // Additional EIPS that are to be enabled
|
ExtraEips []int // Additional EIPS that are to be enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interpreter is used to run Ethereum based contracts and will utilise the
|
|
||||||
// passed environment to query external sources for state information.
|
|
||||||
// The Interpreter will run the byte code VM based on the passed
|
|
||||||
// configuration.
|
|
||||||
type Interpreter interface {
|
|
||||||
// Run loops and evaluates the contract's code with the given input data and returns
|
|
||||||
// the return byte-slice and an error if one occurred.
|
|
||||||
Run(contract *Contract, input []byte, static bool) ([]byte, error)
|
|
||||||
// CanRun tells if the contract, passed as an argument, can be
|
|
||||||
// run by the current interpreter. This is meant so that the
|
|
||||||
// caller can do something like:
|
|
||||||
//
|
|
||||||
// ```golang
|
|
||||||
// for _, interpreter := range interpreters {
|
|
||||||
// if interpreter.CanRun(contract.code) {
|
|
||||||
// interpreter.Run(contract.code, input)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ```
|
|
||||||
CanRun([]byte) bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// ScopeContext contains the things that are per-call, such as stack and memory,
|
// ScopeContext contains the things that are per-call, such as stack and memory,
|
||||||
// but not transients like pc and gas
|
// but not transients like pc and gas
|
||||||
type ScopeContext struct {
|
type ScopeContext struct {
|
||||||
@ -303,9 +278,3 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
|
|||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanRun tells if the contract, passed as an argument, can be
|
|
||||||
// run by the current interpreter.
|
|
||||||
func (in *EVMInterpreter) CanRun(code []byte) bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
@ -175,8 +175,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||||||
var (
|
var (
|
||||||
vmConfig = vm.Config{
|
vmConfig = vm.Config{
|
||||||
EnablePreimageRecording: config.EnablePreimageRecording,
|
EnablePreimageRecording: config.EnablePreimageRecording,
|
||||||
EWASMInterpreter: config.EWASMInterpreter,
|
|
||||||
EVMInterpreter: config.EVMInterpreter,
|
|
||||||
}
|
}
|
||||||
cacheConfig = &core.CacheConfig{
|
cacheConfig = &core.CacheConfig{
|
||||||
TrieCleanLimit: config.TrieCleanCache,
|
TrieCleanLimit: config.TrieCleanCache,
|
||||||
|
@ -186,12 +186,6 @@ type Config struct {
|
|||||||
// Miscellaneous options
|
// Miscellaneous options
|
||||||
DocRoot string `toml:"-"`
|
DocRoot string `toml:"-"`
|
||||||
|
|
||||||
// Type of the EWASM interpreter ("" for default)
|
|
||||||
EWASMInterpreter string
|
|
||||||
|
|
||||||
// Type of the EVM interpreter ("" for default)
|
|
||||||
EVMInterpreter string
|
|
||||||
|
|
||||||
// RPCGasCap is the global gas cap for eth-call variants.
|
// RPCGasCap is the global gas cap for eth-call variants.
|
||||||
RPCGasCap uint64
|
RPCGasCap uint64
|
||||||
|
|
||||||
|
@ -54,8 +54,6 @@ func (c Config) MarshalTOML() (interface{}, error) {
|
|||||||
GPO gasprice.Config
|
GPO gasprice.Config
|
||||||
EnablePreimageRecording bool
|
EnablePreimageRecording bool
|
||||||
DocRoot string `toml:"-"`
|
DocRoot string `toml:"-"`
|
||||||
EWASMInterpreter string
|
|
||||||
EVMInterpreter string
|
|
||||||
RPCGasCap uint64
|
RPCGasCap uint64
|
||||||
RPCTxFeeCap float64
|
RPCTxFeeCap float64
|
||||||
Checkpoint *params.TrustedCheckpoint `toml:",omitempty"`
|
Checkpoint *params.TrustedCheckpoint `toml:",omitempty"`
|
||||||
@ -99,8 +97,6 @@ func (c Config) MarshalTOML() (interface{}, error) {
|
|||||||
enc.GPO = c.GPO
|
enc.GPO = c.GPO
|
||||||
enc.EnablePreimageRecording = c.EnablePreimageRecording
|
enc.EnablePreimageRecording = c.EnablePreimageRecording
|
||||||
enc.DocRoot = c.DocRoot
|
enc.DocRoot = c.DocRoot
|
||||||
enc.EWASMInterpreter = c.EWASMInterpreter
|
|
||||||
enc.EVMInterpreter = c.EVMInterpreter
|
|
||||||
enc.RPCGasCap = c.RPCGasCap
|
enc.RPCGasCap = c.RPCGasCap
|
||||||
enc.RPCTxFeeCap = c.RPCTxFeeCap
|
enc.RPCTxFeeCap = c.RPCTxFeeCap
|
||||||
enc.Checkpoint = c.Checkpoint
|
enc.Checkpoint = c.Checkpoint
|
||||||
@ -148,8 +144,6 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
|||||||
GPO *gasprice.Config
|
GPO *gasprice.Config
|
||||||
EnablePreimageRecording *bool
|
EnablePreimageRecording *bool
|
||||||
DocRoot *string `toml:"-"`
|
DocRoot *string `toml:"-"`
|
||||||
EWASMInterpreter *string
|
|
||||||
EVMInterpreter *string
|
|
||||||
RPCGasCap *uint64
|
RPCGasCap *uint64
|
||||||
RPCTxFeeCap *float64
|
RPCTxFeeCap *float64
|
||||||
Checkpoint *params.TrustedCheckpoint `toml:",omitempty"`
|
Checkpoint *params.TrustedCheckpoint `toml:",omitempty"`
|
||||||
@ -268,12 +262,6 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
|||||||
if dec.DocRoot != nil {
|
if dec.DocRoot != nil {
|
||||||
c.DocRoot = *dec.DocRoot
|
c.DocRoot = *dec.DocRoot
|
||||||
}
|
}
|
||||||
if dec.EWASMInterpreter != nil {
|
|
||||||
c.EWASMInterpreter = *dec.EWASMInterpreter
|
|
||||||
}
|
|
||||||
if dec.EVMInterpreter != nil {
|
|
||||||
c.EVMInterpreter = *dec.EVMInterpreter
|
|
||||||
}
|
|
||||||
if dec.RPCGasCap != nil {
|
if dec.RPCGasCap != nil {
|
||||||
c.RPCGasCap = *dec.RPCGasCap
|
c.RPCGasCap = *dec.RPCGasCap
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ func TestNoStepExec(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsPrecompile(t *testing.T) {
|
func TestIsPrecompile(t *testing.T) {
|
||||||
chaincfg := ¶ms.ChainConfig{ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: false, EIP150Block: big.NewInt(0), EIP150Hash: common.Hash{}, EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(100), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(200), MuirGlacierBlock: big.NewInt(0), BerlinBlock: big.NewInt(300), LondonBlock: big.NewInt(0), EWASMBlock: nil, CatalystBlock: nil, Ethash: new(params.EthashConfig), Clique: nil}
|
chaincfg := ¶ms.ChainConfig{ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), DAOForkBlock: nil, DAOForkSupport: false, EIP150Block: big.NewInt(0), EIP150Hash: common.Hash{}, EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(100), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(200), MuirGlacierBlock: big.NewInt(0), BerlinBlock: big.NewInt(300), LondonBlock: big.NewInt(0), CatalystBlock: nil, Ethash: new(params.EthashConfig), Clique: nil}
|
||||||
chaincfg.ByzantiumBlock = big.NewInt(100)
|
chaincfg.ByzantiumBlock = big.NewInt(100)
|
||||||
chaincfg.IstanbulBlock = big.NewInt(200)
|
chaincfg.IstanbulBlock = big.NewInt(200)
|
||||||
chaincfg.BerlinBlock = big.NewInt(300)
|
chaincfg.BerlinBlock = big.NewInt(300)
|
||||||
|
@ -246,16 +246,16 @@ var (
|
|||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil}
|
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil}
|
||||||
|
|
||||||
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
||||||
// and accepted by the Ethereum core developers into the Clique consensus.
|
// and accepted by the Ethereum core developers into the Clique consensus.
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}}
|
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}}
|
||||||
|
|
||||||
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil}
|
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil}
|
||||||
TestRules = TestChainConfig.Rules(new(big.Int))
|
TestRules = TestChainConfig.Rules(new(big.Int))
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -335,7 +335,6 @@ type ChainConfig struct {
|
|||||||
BerlinBlock *big.Int `json:"berlinBlock,omitempty"` // Berlin switch block (nil = no fork, 0 = already on berlin)
|
BerlinBlock *big.Int `json:"berlinBlock,omitempty"` // Berlin switch block (nil = no fork, 0 = already on berlin)
|
||||||
LondonBlock *big.Int `json:"londonBlock,omitempty"` // London switch block (nil = no fork, 0 = already on london)
|
LondonBlock *big.Int `json:"londonBlock,omitempty"` // London switch block (nil = no fork, 0 = already on london)
|
||||||
|
|
||||||
EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated)
|
|
||||||
CatalystBlock *big.Int `json:"catalystBlock,omitempty"` // Catalyst switch block (nil = no fork, 0 = already on catalyst)
|
CatalystBlock *big.Int `json:"catalystBlock,omitempty"` // Catalyst switch block (nil = no fork, 0 = already on catalyst)
|
||||||
|
|
||||||
// Various consensus engines
|
// Various consensus engines
|
||||||
@ -459,11 +458,6 @@ func (c *ChainConfig) IsCatalyst(num *big.Int) bool {
|
|||||||
return isForked(c.CatalystBlock, num)
|
return isForked(c.CatalystBlock, num)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsEWASM returns whether num represents a block number after the EWASM fork
|
|
||||||
func (c *ChainConfig) IsEWASM(num *big.Int) bool {
|
|
||||||
return isForked(c.EWASMBlock, num)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckCompatible checks whether scheduled fork transitions have been imported
|
// CheckCompatible checks whether scheduled fork transitions have been imported
|
||||||
// with a mismatching chain configuration.
|
// with a mismatching chain configuration.
|
||||||
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError {
|
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError {
|
||||||
@ -573,9 +567,6 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
|
|||||||
if isForkIncompatible(c.LondonBlock, newcfg.LondonBlock, head) {
|
if isForkIncompatible(c.LondonBlock, newcfg.LondonBlock, head) {
|
||||||
return newCompatError("London fork block", c.LondonBlock, newcfg.LondonBlock)
|
return newCompatError("London fork block", c.LondonBlock, newcfg.LondonBlock)
|
||||||
}
|
}
|
||||||
if isForkIncompatible(c.EWASMBlock, newcfg.EWASMBlock, head) {
|
|
||||||
return newCompatError("ewasm fork block", c.EWASMBlock, newcfg.EWASMBlock)
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ package tests
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -34,17 +33,6 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Command line flags to configure the interpreters.
|
|
||||||
var (
|
|
||||||
testEVM = flag.String("vm.evm", "", "EVM configuration")
|
|
||||||
testEWASM = flag.String("vm.ewasm", "", "EWASM configuration")
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
|
||||||
flag.Parse()
|
|
||||||
os.Exit(m.Run())
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
baseDir = filepath.Join(".", "testdata")
|
baseDir = filepath.Join(".", "testdata")
|
||||||
blockTestDir = filepath.Join(baseDir, "BlockchainTests")
|
blockTestDir = filepath.Join(baseDir, "BlockchainTests")
|
||||||
|
@ -92,7 +92,7 @@ const traceErrorLimit = 400000
|
|||||||
|
|
||||||
func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
|
func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
|
||||||
// Use config from command line arguments.
|
// Use config from command line arguments.
|
||||||
config := vm.Config{EVMInterpreter: *testEVM, EWASMInterpreter: *testEWASM}
|
config := vm.Config{}
|
||||||
err := test(config)
|
err := test(config)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user