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

package ethconfig

import (
	"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"
	"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
		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                   *uint64 `toml:",omitempty"`
		OverrideAmsterdamTime               *uint64 `toml:",omitempty"`
		KeepStoredChainConfig               bool
		PolygonPosSingleSlotFinality        bool
		PolygonPosSingleSlotFinalityBlockAt uint64
		AllowAA                             bool
		FcuTimeout                          time.Duration
		FcuBackgroundPrune                  bool
		FcuBackgroundCommit                 bool
		MCPAddress                          string
		ErigondbDomainStepsInFrozenFile     *uint64 `toml:",omitempty"`
		WarmupKzgCtxOnInit                  bool
	}
	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.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.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
	enc.WarmupKzgCtxOnInit = c.WarmupKzgCtxOnInit
	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
		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                   *uint64 `toml:",omitempty"`
		OverrideAmsterdamTime               *uint64 `toml:",omitempty"`
		KeepStoredChainConfig               *bool
		PolygonPosSingleSlotFinality        *bool
		PolygonPosSingleSlotFinalityBlockAt *uint64
		AllowAA                             *bool
		FcuTimeout                          *time.Duration
		FcuBackgroundPrune                  *bool
		FcuBackgroundCommit                 *bool
		MCPAddress                          *string
		ErigondbDomainStepsInFrozenFile     *uint64 `toml:",omitempty"`
		WarmupKzgCtxOnInit                  *bool
	}
	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.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.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
	}
	if dec.WarmupKzgCtxOnInit != nil {
		c.WarmupKzgCtxOnInit = *dec.WarmupKzgCtxOnInit
	}
	return nil
}
