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

package ethconfig

import (
	"time"

	"github.com/ava-labs/libevm/common"
	"github.com/ava-labs/subnet-evm/core"
	"github.com/ava-labs/subnet-evm/core/txpool/blobpool"
	"github.com/ava-labs/subnet-evm/core/txpool/legacypool"
	"github.com/ava-labs/subnet-evm/eth/gasprice"
	"github.com/ava-labs/subnet-evm/miner"
)

// MarshalTOML marshals as TOML.
func (c Config) MarshalTOML() (interface{}, error) {
	type Config struct {
		Genesis                         *core.Genesis `toml:",omitempty"`
		NetworkId                       uint64
		Pruning                         bool
		AcceptorQueueLimit              int
		CommitInterval                  uint64
		PopulateMissingTries            *uint64
		PopulateMissingTriesParallelism int
		AllowMissingTries               bool
		SnapshotDelayInit               bool
		SnapshotWait                    bool
		SnapshotVerify                  bool
		SkipSnapshotRebuild             bool
		SkipBcVersionCheck              bool `toml:"-"`
		TrieCleanCache                  int
		TrieDirtyCache                  int
		TrieDirtyCommitTarget           int
		TriePrefetcherParallelism       int
		SnapshotCache                   int
		Preimages                       bool
		AcceptedCacheSize               int
		Miner                           miner.Config
		TxPool                          legacypool.Config
		BlobPool                        blobpool.Config
		GPO                             gasprice.Config
		EnablePreimageRecording         bool
		RPCGasCap                       uint64 `toml:",omitempty"`
		RPCEVMTimeout                   time.Duration
		RPCTxFeeCap                     float64 `toml:",omitempty"`
		AllowUnfinalizedQueries         bool
		HistoricalProofQueryWindow      uint64
		AllowUnprotectedTxs             bool
		AllowUnprotectedTxHashes        []common.Hash
		OfflinePruning                  bool
		OfflinePruningBloomFilterSize   uint64
		OfflinePruningDataDirectory     string
		SkipUpgradeCheck                bool
		TransactionHistory              uint64 `toml:",omitempty"`
		StateHistory                    uint64 `toml:",omitempty"`
		StateScheme                     string `toml:",omitempty"`
		SkipTxIndexing                  bool
	}
	var enc Config
	enc.Genesis = c.Genesis
	enc.NetworkId = c.NetworkId
	enc.Pruning = c.Pruning
	enc.AcceptorQueueLimit = c.AcceptorQueueLimit
	enc.CommitInterval = c.CommitInterval
	enc.PopulateMissingTries = c.PopulateMissingTries
	enc.PopulateMissingTriesParallelism = c.PopulateMissingTriesParallelism
	enc.AllowMissingTries = c.AllowMissingTries
	enc.SnapshotDelayInit = c.SnapshotDelayInit
	enc.SnapshotWait = c.SnapshotWait
	enc.SnapshotVerify = c.SnapshotVerify
	enc.SkipSnapshotRebuild = c.SkipSnapshotRebuild
	enc.SkipBcVersionCheck = c.SkipBcVersionCheck
	enc.TrieCleanCache = c.TrieCleanCache
	enc.TrieDirtyCache = c.TrieDirtyCache
	enc.TrieDirtyCommitTarget = c.TrieDirtyCommitTarget
	enc.TriePrefetcherParallelism = c.TriePrefetcherParallelism
	enc.SnapshotCache = c.SnapshotCache
	enc.Preimages = c.Preimages
	enc.AcceptedCacheSize = c.AcceptedCacheSize
	enc.Miner = c.Miner
	enc.TxPool = c.TxPool
	enc.BlobPool = c.BlobPool
	enc.GPO = c.GPO
	enc.EnablePreimageRecording = c.EnablePreimageRecording
	enc.RPCGasCap = c.RPCGasCap
	enc.RPCEVMTimeout = c.RPCEVMTimeout
	enc.RPCTxFeeCap = c.RPCTxFeeCap
	enc.AllowUnfinalizedQueries = c.AllowUnfinalizedQueries
	enc.HistoricalProofQueryWindow = c.HistoricalProofQueryWindow
	enc.AllowUnprotectedTxs = c.AllowUnprotectedTxs
	enc.AllowUnprotectedTxHashes = c.AllowUnprotectedTxHashes
	enc.OfflinePruning = c.OfflinePruning
	enc.OfflinePruningBloomFilterSize = c.OfflinePruningBloomFilterSize
	enc.OfflinePruningDataDirectory = c.OfflinePruningDataDirectory
	enc.SkipUpgradeCheck = c.SkipUpgradeCheck
	enc.TransactionHistory = c.TransactionHistory
	enc.StateHistory = c.StateHistory
	enc.StateScheme = c.StateScheme
	enc.SkipTxIndexing = c.SkipTxIndexing
	return &enc, nil
}

// UnmarshalTOML unmarshals from TOML.
func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
	type Config struct {
		Genesis                         *core.Genesis `toml:",omitempty"`
		NetworkId                       *uint64
		Pruning                         *bool
		AcceptorQueueLimit              *int
		CommitInterval                  *uint64
		PopulateMissingTries            *uint64
		PopulateMissingTriesParallelism *int
		AllowMissingTries               *bool
		SnapshotDelayInit               *bool
		SnapshotWait                    *bool
		SnapshotVerify                  *bool
		SkipSnapshotRebuild             *bool
		SkipBcVersionCheck              *bool `toml:"-"`
		TrieCleanCache                  *int
		TrieDirtyCache                  *int
		TrieDirtyCommitTarget           *int
		TriePrefetcherParallelism       *int
		SnapshotCache                   *int
		Preimages                       *bool
		AcceptedCacheSize               *int
		Miner                           *miner.Config
		TxPool                          *legacypool.Config
		BlobPool                        *blobpool.Config
		GPO                             *gasprice.Config
		EnablePreimageRecording         *bool
		RPCGasCap                       *uint64 `toml:",omitempty"`
		RPCEVMTimeout                   *time.Duration
		RPCTxFeeCap                     *float64 `toml:",omitempty"`
		AllowUnfinalizedQueries         *bool
		HistoricalProofQueryWindow      *uint64
		AllowUnprotectedTxs             *bool
		AllowUnprotectedTxHashes        []common.Hash
		OfflinePruning                  *bool
		OfflinePruningBloomFilterSize   *uint64
		OfflinePruningDataDirectory     *string
		SkipUpgradeCheck                *bool
		TransactionHistory              *uint64 `toml:",omitempty"`
		StateHistory                    *uint64 `toml:",omitempty"`
		StateScheme                     *string `toml:",omitempty"`
		SkipTxIndexing                  *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.Pruning != nil {
		c.Pruning = *dec.Pruning
	}
	if dec.AcceptorQueueLimit != nil {
		c.AcceptorQueueLimit = *dec.AcceptorQueueLimit
	}
	if dec.CommitInterval != nil {
		c.CommitInterval = *dec.CommitInterval
	}
	if dec.PopulateMissingTries != nil {
		c.PopulateMissingTries = dec.PopulateMissingTries
	}
	if dec.PopulateMissingTriesParallelism != nil {
		c.PopulateMissingTriesParallelism = *dec.PopulateMissingTriesParallelism
	}
	if dec.AllowMissingTries != nil {
		c.AllowMissingTries = *dec.AllowMissingTries
	}
	if dec.SnapshotDelayInit != nil {
		c.SnapshotDelayInit = *dec.SnapshotDelayInit
	}
	if dec.SnapshotWait != nil {
		c.SnapshotWait = *dec.SnapshotWait
	}
	if dec.SnapshotVerify != nil {
		c.SnapshotVerify = *dec.SnapshotVerify
	}
	if dec.SkipSnapshotRebuild != nil {
		c.SkipSnapshotRebuild = *dec.SkipSnapshotRebuild
	}
	if dec.SkipBcVersionCheck != nil {
		c.SkipBcVersionCheck = *dec.SkipBcVersionCheck
	}
	if dec.TrieCleanCache != nil {
		c.TrieCleanCache = *dec.TrieCleanCache
	}
	if dec.TrieDirtyCache != nil {
		c.TrieDirtyCache = *dec.TrieDirtyCache
	}
	if dec.TrieDirtyCommitTarget != nil {
		c.TrieDirtyCommitTarget = *dec.TrieDirtyCommitTarget
	}
	if dec.TriePrefetcherParallelism != nil {
		c.TriePrefetcherParallelism = *dec.TriePrefetcherParallelism
	}
	if dec.SnapshotCache != nil {
		c.SnapshotCache = *dec.SnapshotCache
	}
	if dec.Preimages != nil {
		c.Preimages = *dec.Preimages
	}
	if dec.AcceptedCacheSize != nil {
		c.AcceptedCacheSize = *dec.AcceptedCacheSize
	}
	if dec.Miner != nil {
		c.Miner = *dec.Miner
	}
	if dec.TxPool != nil {
		c.TxPool = *dec.TxPool
	}
	if dec.BlobPool != nil {
		c.BlobPool = *dec.BlobPool
	}
	if dec.GPO != nil {
		c.GPO = *dec.GPO
	}
	if dec.EnablePreimageRecording != nil {
		c.EnablePreimageRecording = *dec.EnablePreimageRecording
	}
	if dec.RPCGasCap != nil {
		c.RPCGasCap = *dec.RPCGasCap
	}
	if dec.RPCEVMTimeout != nil {
		c.RPCEVMTimeout = *dec.RPCEVMTimeout
	}
	if dec.RPCTxFeeCap != nil {
		c.RPCTxFeeCap = *dec.RPCTxFeeCap
	}
	if dec.AllowUnfinalizedQueries != nil {
		c.AllowUnfinalizedQueries = *dec.AllowUnfinalizedQueries
	}
	if dec.HistoricalProofQueryWindow != nil {
		c.HistoricalProofQueryWindow = *dec.HistoricalProofQueryWindow
	}
	if dec.AllowUnprotectedTxs != nil {
		c.AllowUnprotectedTxs = *dec.AllowUnprotectedTxs
	}
	if dec.AllowUnprotectedTxHashes != nil {
		c.AllowUnprotectedTxHashes = dec.AllowUnprotectedTxHashes
	}
	if dec.OfflinePruning != nil {
		c.OfflinePruning = *dec.OfflinePruning
	}
	if dec.OfflinePruningBloomFilterSize != nil {
		c.OfflinePruningBloomFilterSize = *dec.OfflinePruningBloomFilterSize
	}
	if dec.OfflinePruningDataDirectory != nil {
		c.OfflinePruningDataDirectory = *dec.OfflinePruningDataDirectory
	}
	if dec.SkipUpgradeCheck != nil {
		c.SkipUpgradeCheck = *dec.SkipUpgradeCheck
	}
	if dec.TransactionHistory != nil {
		c.TransactionHistory = *dec.TransactionHistory
	}
	if dec.StateHistory != nil {
		c.StateHistory = *dec.StateHistory
	}
	if dec.StateScheme != nil {
		c.StateScheme = *dec.StateScheme
	}
	if dec.SkipTxIndexing != nil {
		c.SkipTxIndexing = *dec.SkipTxIndexing
	}
	return nil
}
