mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
core/vm: tweak the --vm.ewasm= option format
This commit is contained in:
parent
f951e23fb5
commit
92f20ec18a
2 changed files with 15 additions and 2 deletions
|
|
@ -43,7 +43,7 @@ type Config struct {
|
|||
JumpTable [256]operation
|
||||
|
||||
// Type of the EWASM interpreter
|
||||
EWASMInterpreter string
|
||||
EWASMInterpreter map[string]string
|
||||
// Type of the EVM interpreter
|
||||
EVMInterpreter string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"fmt"
|
||||
"math/big"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
|
|
@ -148,10 +149,22 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
|
|||
}
|
||||
rawdb.WriteDatabaseVersion(chainDb, core.BlockChainVersion)
|
||||
}
|
||||
|
||||
ewasmOptions := make(map[string]string)
|
||||
if len(config.EWASMInterpreter) > 0 {
|
||||
for _, option := range strings.Split(config.EWASMInterpreter, ",") {
|
||||
opt := strings.Split(option, ":")
|
||||
if len(opt) != 2 || len(opt[0]) == 0 {
|
||||
panic(fmt.Sprintf("Invalid ewasm option: expected a format of name:value, got: %s", option))
|
||||
}
|
||||
ewasmOptions[opt[0]] = opt[1]
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
vmConfig = vm.Config{
|
||||
EnablePreimageRecording: config.EnablePreimageRecording,
|
||||
EWASMInterpreter: config.EWASMInterpreter,
|
||||
EWASMInterpreter: ewasmOptions,
|
||||
EVMInterpreter: config.EVMInterpreter,
|
||||
}
|
||||
cacheConfig = &core.CacheConfig{Disabled: config.NoPruning, TrieNodeLimit: config.TrieCache, TrieTimeLimit: config.TrieTimeout}
|
||||
|
|
|
|||
Loading…
Reference in a new issue