fix eth config

This commit is contained in:
Sina Mahmoodi 2024-03-06 18:42:18 +01:00 committed by Matthieu Vachon
parent 5c6fb316b7
commit ea02c9ebc2
4 changed files with 23 additions and 20 deletions

View file

@ -18,7 +18,6 @@ package main
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"os"
@ -38,7 +37,6 @@ import (
"github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/eth/tracers/directory/live"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/internal/flags"
"github.com/ethereum/go-ethereum/internal/version"
@ -181,21 +179,6 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
cfg.Eth.OverrideVerkle = &v
}
if ctx.IsSet(utils.VMTraceFlag.Name) {
if name := ctx.String(utils.VMTraceFlag.Name); name != "" {
var config string
if ctx.IsSet(utils.VMTraceConfigFlag.Name) {
config = ctx.String(utils.VMTraceConfigFlag.Name)
}
t, err := live.Directory.New(name, json.RawMessage(config))
if err != nil {
utils.Fatalf("Failed to create tracer %q: %v", name, err)
}
cfg.Eth.VMTracer = t
}
}
backend, eth := utils.RegisterEthService(stack, &cfg.Eth)
// Create gauge with geth system and build information

View file

@ -1900,6 +1900,18 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if err := kzg4844.UseCKZG(ctx.String(CryptoKZGFlag.Name) == "ckzg"); err != nil {
Fatalf("Failed to set KZG library implementation to %s: %v", ctx.String(CryptoKZGFlag.Name), err)
}
// VM tracing config.
if ctx.IsSet(VMTraceFlag.Name) {
if name := ctx.String(VMTraceFlag.Name); name != "" {
var config string
if ctx.IsSet(VMTraceConfigFlag.Name) {
config = ctx.String(VMTraceConfigFlag.Name)
}
cfg.VMTrace = name
cfg.VMTraceConfig = config
}
}
}
// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if

View file

@ -18,6 +18,7 @@
package eth
import (
"encoding/json"
"errors"
"fmt"
"math/big"
@ -44,6 +45,7 @@ import (
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/eth/protocols/eth"
"github.com/ethereum/go-ethereum/eth/protocols/snap"
"github.com/ethereum/go-ethereum/eth/tracers/directory/live"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/internal/ethapi"
@ -192,7 +194,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
var (
vmConfig = vm.Config{
EnablePreimageRecording: config.EnablePreimageRecording,
Tracer: config.VMTracer,
}
cacheConfig = &core.CacheConfig{
TrieCleanLimit: config.TrieCleanCache,
@ -206,6 +207,13 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
StateScheme: scheme,
}
)
if config.VMTrace != "" {
t, err := live.Directory.New(config.VMTrace, json.RawMessage(config.VMTraceConfig))
if err != nil {
return nil, fmt.Errorf("Failed to create tracer %s: %v", config.VMTrace, err)
}
vmConfig.Tracer = t
}
// Override the chain config with provided settings.
var overrides core.ChainOverrides
if config.OverrideCancun != nil {

View file

@ -27,7 +27,6 @@ import (
"github.com/ethereum/go-ethereum/consensus/clique"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/txpool/blobpool"
"github.com/ethereum/go-ethereum/core/txpool/legacypool"
"github.com/ethereum/go-ethereum/eth/downloader"
@ -153,7 +152,8 @@ type Config struct {
EnablePreimageRecording bool
// Enables VM tracing
VMTracer *tracing.Hooks
VMTrace string
VMTraceConfig string
// Miscellaneous options
DocRoot string `toml:"-"`