// Code generated by github.com/fjl/gencodec. DO NOT EDIT.

package ethconfig

import (
	"math/big"
	"time"

	"github.com/c2h5oh/datasize"
	"github.com/erigontech/erigon/cl/clparams"
	"github.com/erigontech/erigon/common"
	"github.com/erigontech/erigon/db/datadir"
	"github.com/erigontech/erigon/db/downloader/downloadercfg"
	"github.com/erigontech/erigon/db/kv/prune"
	"github.com/erigontech/erigon/execution/builder/buildercfg"
	"github.com/erigontech/erigon/execution/chain"
	chainspec "github.com/erigontech/erigon/execution/chain/spec"
	"github.com/erigontech/erigon/execution/protocol/rules/ethash/ethashcfg"
	"github.com/erigontech/erigon/execution/types"
	"github.com/erigontech/erigon/rpc/gasprice/gaspricecfg"
	"github.com/erigontech/erigon/txnprovider/shutter/shuttercfg"
	"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

// MarshalTOML marshals as TOML.
func (c Config) MarshalTOML() (interface{}, error) {
	type Config struct {
		Genesis                             *types.Genesis `toml:",omitempty"`
		NetworkID                           uint64
		EthDiscoveryURLs                    []string
		Prune                               prune.Mode
		BatchSize                           datasize.ByteSize
		BadBlockHash                        common.Hash
		Snapshot                            BlocksFreezing
		Downloader                          *downloadercfg.Cfg
		CaplinConfig                        clparams.CaplinConfig
		Dirs                                datadir.Dirs
		ExternalSnapshotDownloaderAddr      string
		Whitelist                           map[uint64]common.Hash `toml:"-"`
		Builder                             buildercfg.BuilderConfig
		Ethash                              ethashcfg.Config
		Clique                              chainspec.ConsensusSnapshotConfig
		Aura                                chain.AuRaConfig
		TxPool                              txpoolcfg.Config
		Shutter                             shuttercfg.Config
		GPO                                 gaspricecfg.Config
		RPCGasCap                           uint64  `toml:",omitempty"`
		RPCTxFeeCap                         float64 `toml:",omitempty"`
		StateStream                         bool
		ExperimentalBAL                     bool
		HeimdallURL                         string
		WithoutHeimdall                     bool
		Ethstats                            string
		InternalCL                          bool
		OverrideOsakaTime                   *big.Int `toml:",omitempty"`
		OverrideAmsterdamTime               *big.Int `toml:",omitempty"`
		KeepStoredChainConfig               bool
		SilkwormExecution                   bool
		SilkwormRpcDaemon                   bool
		SilkwormSentry                      bool
		SilkwormVerbosity                   string
		SilkwormNumContexts                 uint32
		SilkwormRpcLogEnabled               bool
		SilkwormRpcLogDirPath               string
		SilkwormRpcLogMaxFileSize           uint16
		SilkwormRpcLogMaxFiles              uint16
		SilkwormRpcLogDumpResponse          bool
		SilkwormRpcNumWorkers               uint32
		SilkwormRpcJsonCompatibility        bool
		PolygonPosSingleSlotFinality        bool
		PolygonPosSingleSlotFinalityBlockAt uint64
		AllowAA                             bool
		FcuTimeout                          time.Duration
		FcuBackgroundPrune                  bool
		FcuBackgroundCommit                 bool
		MCPAddress                          string
		ErigondbDomainStepsInFrozenFile     *uint64 `toml:",omitempty"`
	}
	var enc Config
	enc.Genesis = c.Genesis
	enc.NetworkID = c.NetworkID
	enc.EthDiscoveryURLs = c.EthDiscoveryURLs
	enc.Prune = c.Prune
	enc.BatchSize = c.BatchSize
	enc.BadBlockHash = c.BadBlockHash
	enc.Snapshot = c.Snapshot
	enc.Downloader = c.Downloader
	enc.CaplinConfig = c.CaplinConfig
	enc.Dirs = c.Dirs
	enc.ExternalSnapshotDownloaderAddr = c.ExternalSnapshotDownloaderAddr
	enc.Whitelist = c.Whitelist
	enc.Builder = c.Builder
	enc.Ethash = c.Ethash
	enc.Clique = c.Clique
	enc.Aura = c.Aura
	enc.TxPool = c.TxPool
	enc.Shutter = c.Shutter
	enc.GPO = c.GPO
	enc.RPCGasCap = c.RPCGasCap
	enc.RPCTxFeeCap = c.RPCTxFeeCap
	enc.StateStream = c.StateStream
	enc.ExperimentalBAL = c.ExperimentalBAL
	enc.HeimdallURL = c.HeimdallURL
	enc.WithoutHeimdall = c.WithoutHeimdall
	enc.Ethstats = c.Ethstats
	enc.InternalCL = c.InternalCL
	enc.OverrideOsakaTime = c.OverrideOsakaTime
	enc.OverrideAmsterdamTime = c.OverrideAmsterdamTime
	enc.KeepStoredChainConfig = c.KeepStoredChainConfig
	enc.SilkwormExecution = c.SilkwormExecution
	enc.SilkwormRpcDaemon = c.SilkwormRpcDaemon
	enc.SilkwormSentry = c.SilkwormSentry
	enc.SilkwormVerbosity = c.SilkwormVerbosity
	enc.SilkwormNumContexts = c.SilkwormNumContexts
	enc.SilkwormRpcLogEnabled = c.SilkwormRpcLogEnabled
	enc.SilkwormRpcLogDirPath = c.SilkwormRpcLogDirPath
	enc.SilkwormRpcLogMaxFileSize = c.SilkwormRpcLogMaxFileSize
	enc.SilkwormRpcLogMaxFiles = c.SilkwormRpcLogMaxFiles
	enc.SilkwormRpcLogDumpResponse = c.SilkwormRpcLogDumpResponse
	enc.SilkwormRpcNumWorkers = c.SilkwormRpcNumWorkers
	enc.SilkwormRpcJsonCompatibility = c.SilkwormRpcJsonCompatibility
	enc.PolygonPosSingleSlotFinality = c.PolygonPosSingleSlotFinality
	enc.PolygonPosSingleSlotFinalityBlockAt = c.PolygonPosSingleSlotFinalityBlockAt
	enc.AllowAA = c.AllowAA
	enc.FcuTimeout = c.FcuTimeout
	enc.FcuBackgroundPrune = c.FcuBackgroundPrune
	enc.FcuBackgroundCommit = c.FcuBackgroundCommit
	enc.MCPAddress = c.MCPAddress
	enc.ErigondbDomainStepsInFrozenFile = c.ErigondbDomainStepsInFrozenFile
	return &enc, nil
}

// UnmarshalTOML unmarshals from TOML.
func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
	type Config struct {
		Genesis                             *types.Genesis `toml:",omitempty"`
		NetworkID                           *uint64
		EthDiscoveryURLs                    []string
		Prune                               *prune.Mode
		BatchSize                           *datasize.ByteSize
		BadBlockHash                        *common.Hash
		Snapshot                            *BlocksFreezing
		Downloader                          *downloadercfg.Cfg
		CaplinConfig                        *clparams.CaplinConfig
		Dirs                                *datadir.Dirs
		ExternalSnapshotDownloaderAddr      *string
		Whitelist                           map[uint64]common.Hash `toml:"-"`
		Builder                             *buildercfg.BuilderConfig
		Ethash                              *ethashcfg.Config
		Clique                              *chainspec.ConsensusSnapshotConfig
		Aura                                *chain.AuRaConfig
		TxPool                              *txpoolcfg.Config
		Shutter                             *shuttercfg.Config
		GPO                                 *gaspricecfg.Config
		RPCGasCap                           *uint64  `toml:",omitempty"`
		RPCTxFeeCap                         *float64 `toml:",omitempty"`
		StateStream                         *bool
		ExperimentalBAL                     *bool
		HeimdallURL                         *string
		WithoutHeimdall                     *bool
		Ethstats                            *string
		InternalCL                          *bool
		OverrideOsakaTime                   *big.Int `toml:",omitempty"`
		OverrideAmsterdamTime               *big.Int `toml:",omitempty"`
		KeepStoredChainConfig               *bool
		SilkwormExecution                   *bool
		SilkwormRpcDaemon                   *bool
		SilkwormSentry                      *bool
		SilkwormVerbosity                   *string
		SilkwormNumContexts                 *uint32
		SilkwormRpcLogEnabled               *bool
		SilkwormRpcLogDirPath               *string
		SilkwormRpcLogMaxFileSize           *uint16
		SilkwormRpcLogMaxFiles              *uint16
		SilkwormRpcLogDumpResponse          *bool
		SilkwormRpcNumWorkers               *uint32
		SilkwormRpcJsonCompatibility        *bool
		PolygonPosSingleSlotFinality        *bool
		PolygonPosSingleSlotFinalityBlockAt *uint64
		AllowAA                             *bool
		FcuTimeout                          *time.Duration
		FcuBackgroundPrune                  *bool
		FcuBackgroundCommit                 *bool
		MCPAddress                          *string
		ErigondbDomainStepsInFrozenFile     *uint64 `toml:",omitempty"`
	}
	var dec Config
	if err := unmarshal(&dec); err != nil {
		return err
	}
	if dec.Genesis != nil {
		c.Genesis = dec.Genesis
	}
	if dec.NetworkID != nil {
		c.NetworkID = *dec.NetworkID
	}
	if dec.EthDiscoveryURLs != nil {
		c.EthDiscoveryURLs = dec.EthDiscoveryURLs
	}
	if dec.Prune != nil {
		c.Prune = *dec.Prune
	}
	if dec.BatchSize != nil {
		c.BatchSize = *dec.BatchSize
	}
	if dec.BadBlockHash != nil {
		c.BadBlockHash = *dec.BadBlockHash
	}
	if dec.Snapshot != nil {
		c.Snapshot = *dec.Snapshot
	}
	if dec.Downloader != nil {
		c.Downloader = dec.Downloader
	}
	if dec.CaplinConfig != nil {
		c.CaplinConfig = *dec.CaplinConfig
	}
	if dec.Dirs != nil {
		c.Dirs = *dec.Dirs
	}
	if dec.ExternalSnapshotDownloaderAddr != nil {
		c.ExternalSnapshotDownloaderAddr = *dec.ExternalSnapshotDownloaderAddr
	}
	if dec.Whitelist != nil {
		c.Whitelist = dec.Whitelist
	}
	if dec.Builder != nil {
		c.Builder = *dec.Builder
	}
	if dec.Ethash != nil {
		c.Ethash = *dec.Ethash
	}
	if dec.Clique != nil {
		c.Clique = *dec.Clique
	}
	if dec.Aura != nil {
		c.Aura = *dec.Aura
	}
	if dec.TxPool != nil {
		c.TxPool = *dec.TxPool
	}
	if dec.Shutter != nil {
		c.Shutter = *dec.Shutter
	}
	if dec.GPO != nil {
		c.GPO = *dec.GPO
	}
	if dec.RPCGasCap != nil {
		c.RPCGasCap = *dec.RPCGasCap
	}
	if dec.RPCTxFeeCap != nil {
		c.RPCTxFeeCap = *dec.RPCTxFeeCap
	}
	if dec.StateStream != nil {
		c.StateStream = *dec.StateStream
	}
	if dec.ExperimentalBAL != nil {
		c.ExperimentalBAL = *dec.ExperimentalBAL
	}
	if dec.HeimdallURL != nil {
		c.HeimdallURL = *dec.HeimdallURL
	}
	if dec.WithoutHeimdall != nil {
		c.WithoutHeimdall = *dec.WithoutHeimdall
	}
	if dec.Ethstats != nil {
		c.Ethstats = *dec.Ethstats
	}
	if dec.InternalCL != nil {
		c.InternalCL = *dec.InternalCL
	}
	if dec.OverrideOsakaTime != nil {
		c.OverrideOsakaTime = dec.OverrideOsakaTime
	}
	if dec.OverrideAmsterdamTime != nil {
		c.OverrideAmsterdamTime = dec.OverrideAmsterdamTime
	}
	if dec.KeepStoredChainConfig != nil {
		c.KeepStoredChainConfig = *dec.KeepStoredChainConfig
	}
	if dec.SilkwormExecution != nil {
		c.SilkwormExecution = *dec.SilkwormExecution
	}
	if dec.SilkwormRpcDaemon != nil {
		c.SilkwormRpcDaemon = *dec.SilkwormRpcDaemon
	}
	if dec.SilkwormSentry != nil {
		c.SilkwormSentry = *dec.SilkwormSentry
	}
	if dec.SilkwormVerbosity != nil {
		c.SilkwormVerbosity = *dec.SilkwormVerbosity
	}
	if dec.SilkwormNumContexts != nil {
		c.SilkwormNumContexts = *dec.SilkwormNumContexts
	}
	if dec.SilkwormRpcLogEnabled != nil {
		c.SilkwormRpcLogEnabled = *dec.SilkwormRpcLogEnabled
	}
	if dec.SilkwormRpcLogDirPath != nil {
		c.SilkwormRpcLogDirPath = *dec.SilkwormRpcLogDirPath
	}
	if dec.SilkwormRpcLogMaxFileSize != nil {
		c.SilkwormRpcLogMaxFileSize = *dec.SilkwormRpcLogMaxFileSize
	}
	if dec.SilkwormRpcLogMaxFiles != nil {
		c.SilkwormRpcLogMaxFiles = *dec.SilkwormRpcLogMaxFiles
	}
	if dec.SilkwormRpcLogDumpResponse != nil {
		c.SilkwormRpcLogDumpResponse = *dec.SilkwormRpcLogDumpResponse
	}
	if dec.SilkwormRpcNumWorkers != nil {
		c.SilkwormRpcNumWorkers = *dec.SilkwormRpcNumWorkers
	}
	if dec.SilkwormRpcJsonCompatibility != nil {
		c.SilkwormRpcJsonCompatibility = *dec.SilkwormRpcJsonCompatibility
	}
	if dec.PolygonPosSingleSlotFinality != nil {
		c.PolygonPosSingleSlotFinality = *dec.PolygonPosSingleSlotFinality
	}
	if dec.PolygonPosSingleSlotFinalityBlockAt != nil {
		c.PolygonPosSingleSlotFinalityBlockAt = *dec.PolygonPosSingleSlotFinalityBlockAt
	}
	if dec.AllowAA != nil {
		c.AllowAA = *dec.AllowAA
	}
	if dec.FcuTimeout != nil {
		c.FcuTimeout = *dec.FcuTimeout
	}
	if dec.FcuBackgroundPrune != nil {
		c.FcuBackgroundPrune = *dec.FcuBackgroundPrune
	}
	if dec.FcuBackgroundCommit != nil {
		c.FcuBackgroundCommit = *dec.FcuBackgroundCommit
	}
	if dec.MCPAddress != nil {
		c.MCPAddress = *dec.MCPAddress
	}
	if dec.ErigondbDomainStepsInFrozenFile != nil {
		c.ErigondbDomainStepsInFrozenFile = dec.ErigondbDomainStepsInFrozenFile
	}
	return nil
}
