cmd, eth: rename config and flag to VMTraceJsonConfig #29573 (#1490)

This commit is contained in:
Daniel Liu 2025-09-13 10:52:31 +08:00 committed by GitHub
parent 88086e820e
commit c9f2b73861
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 30 additions and 12 deletions

View file

@ -80,7 +80,7 @@ It expects the genesis file or the network name [ mainnet | testnet | devnet ] a
utils.MetricsInfluxDBBucketFlag, utils.MetricsInfluxDBBucketFlag,
utils.MetricsInfluxDBOrganizationFlag, utils.MetricsInfluxDBOrganizationFlag,
utils.VMTraceFlag, utils.VMTraceFlag,
utils.VMTraceConfigFlag, utils.VMTraceJsonConfigFlag,
}, utils.DatabaseFlags), }, utils.DatabaseFlags),
Description: ` Description: `
The import command imports blocks from an RLP-encoded form. The form can be one file The import command imports blocks from an RLP-encoded form. The form can be one file

View file

@ -123,7 +123,7 @@ var (
utils.Enable0xPrefixFlag, utils.Enable0xPrefixFlag,
utils.EnableXDCPrefixFlag, utils.EnableXDCPrefixFlag,
utils.VMTraceFlag, utils.VMTraceFlag,
utils.VMTraceConfigFlag, utils.VMTraceJsonConfigFlag,
utils.NetworkIdFlag, utils.NetworkIdFlag,
utils.HTTPCORSDomainFlag, utils.HTTPCORSDomainFlag,
utils.AuthListenFlag, utils.AuthListenFlag,

View file

@ -381,7 +381,7 @@ var (
Usage: "Name of tracer which should record internal VM operations (costly)", Usage: "Name of tracer which should record internal VM operations (costly)",
Category: flags.VMCategory, Category: flags.VMCategory,
} }
VMTraceConfigFlag = &cli.StringFlag{ VMTraceJsonConfigFlag = &cli.StringFlag{
Name: "vmtrace-config", Name: "vmtrace-config",
Usage: "Tracer configuration (JSON)", Usage: "Tracer configuration (JSON)",
Category: flags.VMCategory, Category: flags.VMCategory,
@ -1674,12 +1674,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if ctx.IsSet(VMTraceFlag.Name) { if ctx.IsSet(VMTraceFlag.Name) {
if name := ctx.String(VMTraceFlag.Name); name != "" { if name := ctx.String(VMTraceFlag.Name); name != "" {
var config string var config string
if ctx.IsSet(VMTraceConfigFlag.Name) { if ctx.IsSet(VMTraceJsonConfigFlag.Name) {
config = ctx.String(VMTraceConfigFlag.Name) config = ctx.String(VMTraceJsonConfigFlag.Name)
} }
cfg.VMTrace = name cfg.VMTrace = name
cfg.VMTraceConfig = config cfg.VMTraceJsonConfig = config
} }
} }
} }
@ -1863,8 +1863,8 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (chain *core.B
if ctx.IsSet(VMTraceFlag.Name) { if ctx.IsSet(VMTraceFlag.Name) {
if name := ctx.String(VMTraceFlag.Name); name != "" { if name := ctx.String(VMTraceFlag.Name); name != "" {
var config json.RawMessage var config json.RawMessage
if ctx.IsSet(VMTraceConfigFlag.Name) { if ctx.IsSet(VMTraceJsonConfigFlag.Name) {
config = json.RawMessage(ctx.String(VMTraceConfigFlag.Name)) config = json.RawMessage(ctx.String(VMTraceJsonConfigFlag.Name))
} }
t, err := tracers.LiveDirectory.New(name, config) t, err := tracers.LiveDirectory.New(name, config)
if err != nil { if err != nil {

View file

@ -188,8 +188,8 @@ func New(stack *node.Node, config *ethconfig.Config, XDCXServ *XDCx.XDCX, lendin
) )
if config.VMTrace != "" { if config.VMTrace != "" {
var traceConfig json.RawMessage var traceConfig json.RawMessage
if config.VMTraceConfig != "" { if config.VMTraceJsonConfig != "" {
traceConfig = json.RawMessage(config.VMTraceConfig) traceConfig = json.RawMessage(config.VMTraceJsonConfig)
} }
t, err := tracers.LiveDirectory.New(config.VMTrace, traceConfig) t, err := tracers.LiveDirectory.New(config.VMTrace, traceConfig)
if err != nil { if err != nil {

View file

@ -106,8 +106,8 @@ type Config struct {
EnablePreimageRecording bool EnablePreimageRecording bool
// Enables VM tracing // Enables VM tracing
VMTrace string VMTrace string
VMTraceConfig string VMTraceJsonConfig 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

View file

@ -23,6 +23,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
NetworkId uint64 NetworkId uint64
SyncMode downloader.SyncMode SyncMode downloader.SyncMode
NoPruning bool NoPruning bool
NoPrefetch bool
LightServ int `toml:",omitempty"` LightServ int `toml:",omitempty"`
LightPeers int `toml:",omitempty"` LightPeers int `toml:",omitempty"`
SkipBcVersionCheck bool `toml:"-"` SkipBcVersionCheck bool `toml:"-"`
@ -40,6 +41,8 @@ func (c Config) MarshalTOML() (interface{}, error) {
TxPool txpool.Config TxPool txpool.Config
GPO gasprice.Config GPO gasprice.Config
EnablePreimageRecording bool EnablePreimageRecording bool
VMTrace string
VMTraceJsonConfig string
RPCGasCap uint64 RPCGasCap uint64
RPCTxFeeCap float64 RPCTxFeeCap float64
} }
@ -48,6 +51,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc.NetworkId = c.NetworkId enc.NetworkId = c.NetworkId
enc.SyncMode = c.SyncMode enc.SyncMode = c.SyncMode
enc.NoPruning = c.NoPruning enc.NoPruning = c.NoPruning
enc.NoPrefetch = c.NoPrefetch
enc.LightServ = c.LightServ enc.LightServ = c.LightServ
enc.LightPeers = c.LightPeers enc.LightPeers = c.LightPeers
enc.SkipBcVersionCheck = c.SkipBcVersionCheck enc.SkipBcVersionCheck = c.SkipBcVersionCheck
@ -65,6 +69,8 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc.TxPool = c.TxPool enc.TxPool = c.TxPool
enc.GPO = c.GPO enc.GPO = c.GPO
enc.EnablePreimageRecording = c.EnablePreimageRecording enc.EnablePreimageRecording = c.EnablePreimageRecording
enc.VMTrace = c.VMTrace
enc.VMTraceJsonConfig = c.VMTraceJsonConfig
enc.RPCGasCap = c.RPCGasCap enc.RPCGasCap = c.RPCGasCap
enc.RPCTxFeeCap = c.RPCTxFeeCap enc.RPCTxFeeCap = c.RPCTxFeeCap
return &enc, nil return &enc, nil
@ -77,6 +83,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
NetworkId *uint64 NetworkId *uint64
SyncMode *downloader.SyncMode SyncMode *downloader.SyncMode
NoPruning *bool NoPruning *bool
NoPrefetch *bool
LightServ *int `toml:",omitempty"` LightServ *int `toml:",omitempty"`
LightPeers *int `toml:",omitempty"` LightPeers *int `toml:",omitempty"`
SkipBcVersionCheck *bool `toml:"-"` SkipBcVersionCheck *bool `toml:"-"`
@ -94,6 +101,8 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
TxPool *txpool.Config TxPool *txpool.Config
GPO *gasprice.Config GPO *gasprice.Config
EnablePreimageRecording *bool EnablePreimageRecording *bool
VMTrace *string
VMTraceJsonConfig *string
RPCGasCap *uint64 RPCGasCap *uint64
RPCTxFeeCap *float64 RPCTxFeeCap *float64
} }
@ -113,6 +122,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
if dec.NoPruning != nil { if dec.NoPruning != nil {
c.NoPruning = *dec.NoPruning c.NoPruning = *dec.NoPruning
} }
if dec.NoPrefetch != nil {
c.NoPrefetch = *dec.NoPrefetch
}
if dec.LightServ != nil { if dec.LightServ != nil {
c.LightServ = *dec.LightServ c.LightServ = *dec.LightServ
} }
@ -164,6 +176,12 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
if dec.EnablePreimageRecording != nil { if dec.EnablePreimageRecording != nil {
c.EnablePreimageRecording = *dec.EnablePreimageRecording c.EnablePreimageRecording = *dec.EnablePreimageRecording
} }
if dec.VMTrace != nil {
c.VMTrace = *dec.VMTrace
}
if dec.VMTraceJsonConfig != nil {
c.VMTraceJsonConfig = *dec.VMTraceJsonConfig
}
if dec.RPCGasCap != nil { if dec.RPCGasCap != nil {
c.RPCGasCap = *dec.RPCGasCap c.RPCGasCap = *dec.RPCGasCap
} }