gitlab.com/flarenetwork/coreth@v0.1.1/eth/ethconfig/config.go (about)

     1  // (c) 2019-2020, Ava Labs, Inc.
     2  //
     3  // This file is a derived work, based on the go-ethereum library whose original
     4  // notices appear below.
     5  //
     6  // It is distributed under a license compatible with the licensing terms of the
     7  // original code from which it is derived.
     8  //
     9  // Much love to the original authors for their work.
    10  // **********
    11  // Copyright 2017 The go-ethereum Authors
    12  // This file is part of the go-ethereum library.
    13  //
    14  // The go-ethereum library is free software: you can redistribute it and/or modify
    15  // it under the terms of the GNU Lesser General Public License as published by
    16  // the Free Software Foundation, either version 3 of the License, or
    17  // (at your option) any later version.
    18  //
    19  // The go-ethereum library is distributed in the hope that it will be useful,
    20  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    21  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    22  // GNU Lesser General Public License for more details.
    23  //
    24  // You should have received a copy of the GNU Lesser General Public License
    25  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    26  
    27  package ethconfig
    28  
    29  import (
    30  	"time"
    31  
    32  	"github.com/ethereum/go-ethereum/common"
    33  	"gitlab.com/flarenetwork/coreth/core"
    34  	"gitlab.com/flarenetwork/coreth/eth/gasprice"
    35  	"gitlab.com/flarenetwork/coreth/miner"
    36  )
    37  
    38  // DefaultFullGPOConfig contains default gasprice oracle settings for full node.
    39  var DefaultFullGPOConfig = gasprice.Config{
    40  	Blocks:      20,
    41  	Percentile:  60,
    42  	MaxPrice:    gasprice.DefaultMaxPrice,
    43  	IgnorePrice: gasprice.DefaultIgnorePrice,
    44  }
    45  
    46  // DefaultConfig contains default settings for use on the Avalanche main net.
    47  var DefaultConfig = NewDefaultConfig()
    48  
    49  func NewDefaultConfig() Config {
    50  	return Config{
    51  		NetworkId:               1,
    52  		LightPeers:              100,
    53  		UltraLightFraction:      75,
    54  		DatabaseCache:           512,
    55  		TrieCleanCache:          75,
    56  		TrieCleanCacheJournal:   "triecache",
    57  		TrieCleanCacheRejournal: 60 * time.Minute,
    58  		TrieDirtyCache:          256,
    59  		TrieTimeout:             60 * time.Minute,
    60  		SnapshotCache:           128,
    61  		Miner:                   miner.Config{},
    62  		TxPool:                  core.DefaultTxPoolConfig,
    63  		RPCGasCap:               25000000,
    64  		GPO:                     DefaultFullGPOConfig,
    65  		RPCTxFeeCap:             1, // 1 AVAX
    66  	}
    67  }
    68  
    69  //go:generate gencodec -type Config -formats toml -out gen_config.go
    70  
    71  type Config struct {
    72  	// The genesis block, which is inserted if the database is empty.
    73  	// If nil, the Ethereum main net block is used.
    74  	Genesis *core.Genesis `toml:",omitempty"`
    75  
    76  	// Protocol options
    77  	NetworkId uint64 // Network ID to use for selecting peers to connect to
    78  
    79  	// This can be set to list of enrtree:// URLs which will be queried for
    80  	// for nodes to connect to.
    81  	DiscoveryURLs []string
    82  
    83  	Pruning        bool // Whether to disable pruning and flush everything to disk
    84  	SnapshotAsync  bool // Whether to generate the initial snapshot in async mode
    85  	SnapshotVerify bool // Whether to verify generated snapshots
    86  
    87  	// Whitelist of required block number -> hash values to accept
    88  	Whitelist map[uint64]common.Hash `toml:"-"`
    89  
    90  	// Light client options
    91  	LightServ    int  `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests
    92  	LightIngress int  `toml:",omitempty"` // Incoming bandwidth limit for light servers
    93  	LightEgress  int  `toml:",omitempty"` // Outgoing bandwidth limit for light servers
    94  	LightPeers   int  `toml:",omitempty"` // Maximum number of LES client peers
    95  	LightNoPrune bool `toml:",omitempty"` // Whether to disable light chain pruning
    96  
    97  	// Ultra Light client options
    98  	UltraLightServers      []string `toml:",omitempty"` // List of trusted ultra light servers
    99  	UltraLightFraction     int      `toml:",omitempty"` // Percentage of trusted servers to accept an announcement
   100  	UltraLightOnlyAnnounce bool     `toml:",omitempty"` // Whether to only announce headers, or also serve them
   101  
   102  	// Database options
   103  	SkipBcVersionCheck bool `toml:"-"`
   104  	DatabaseHandles    int  `toml:"-"`
   105  	DatabaseCache      int
   106  	// DatabaseFreezer    string
   107  
   108  	TrieCleanCache          int
   109  	TrieCleanCacheJournal   string        `toml:",omitempty"` // Disk journal directory for trie cache to survive node restarts
   110  	TrieCleanCacheRejournal time.Duration `toml:",omitempty"` // Time interval to regenerate the journal for clean cache
   111  	TrieDirtyCache          int
   112  	TrieTimeout             time.Duration
   113  	SnapshotCache           int
   114  	Preimages               bool
   115  
   116  	// Mining options
   117  	Miner miner.Config
   118  
   119  	// Transaction pool options
   120  	TxPool core.TxPoolConfig
   121  
   122  	// Gas Price Oracle options
   123  	GPO gasprice.Config
   124  
   125  	// Enables tracking of SHA3 preimages in the VM
   126  	EnablePreimageRecording bool
   127  
   128  	// Miscellaneous options
   129  	DocRoot string `toml:"-"`
   130  
   131  	// RPCGasCap is the global gas cap for eth-call variants.
   132  	RPCGasCap uint64 `toml:",omitempty"`
   133  
   134  	// RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for
   135  	// send-transction variants. The unit is ether.
   136  	RPCTxFeeCap float64 `toml:",omitempty"`
   137  
   138  	// AllowUnfinalizedQueries allow unfinalized queries
   139  	AllowUnfinalizedQueries bool
   140  }