This repository has been archived by the owner on Nov 30, 2021. It is now read-only.
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.
When evm is initialized, one of the parameters vm.Config is not initialized #627
Closed
Description
System info: [Include Ethermint commit, operating system name, and other relevant details]
- in branch development
Expected behavior: [What you expected to happen]
- Expect to initialize vm.Config{} when vm.NewEVM is executed
Actual behavior: [What actually happened]
- The evm initialization procedure is as follows:
func (st StateTransition) newEVM(ctx sdk.Context, csdb *CommitStateDB, gasLimit uint64, gasPrice *big.Int, config ChainConfig) *vm.EVM {
// Create context for evm
context := vm.Context{
CanTransfer: core.CanTransfer,
Transfer: core.Transfer,
Origin: st.Sender,
Coinbase: common.Address{}, // there's no benefitiary since we're not mining
BlockNumber: big.NewInt(ctx.BlockHeight()),
Time: big.NewInt(ctx.BlockHeader().Time.Unix()),
Difficulty: big.NewInt(0), // unused. Only required in PoW context
GasLimit: gasLimit,
GasPrice: gasPrice,
}
return vm.NewEVM(context, csdb, config.EthereumConfig(st.ChainID), vm.Config{})
}
- As follows, the vm.Config here directly uses a default value as a parameter to initialize evm
return vm.NewEVM(context, csdb, config.EthereumConfig(st.ChainID), vm.Config{})
risk
- One consequence found so far is caused by the incomplete setting of the ExtraEips parameter in vm.Config, which has been described by issue626
advice
- It is recommended to set the variables in vm.Config through proposal parameters
Additional info: [Include gist of relevant config, logs, etc.]
type vm.Config struct {
Debug bool // Enables debugging
Tracer Tracer // Opcode logger
NoRecursion bool // Disables call, callcode, delegate call and create
EnablePreimageRecording bool // Enables recording of SHA3/keccak preimages
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
}