github.com/dim4egster/coreth@v0.10.2/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/dim4egster/coreth/core" 33 "github.com/dim4egster/coreth/eth/gasprice" 34 "github.com/dim4egster/coreth/miner" 35 ) 36 37 // DefaultFullGPOConfig contains default gasprice oracle settings for full node. 38 var DefaultFullGPOConfig = gasprice.Config{ 39 Blocks: 40, 40 Percentile: 60, 41 MaxLookbackSeconds: gasprice.DefaultMaxLookbackSeconds, 42 MaxCallBlockHistory: gasprice.DefaultMaxCallBlockHistory, 43 MaxBlockHistory: gasprice.DefaultMaxBlockHistory, 44 MinPrice: gasprice.DefaultMinPrice, 45 MaxPrice: gasprice.DefaultMaxPrice, 46 MinGasUsed: gasprice.DefaultMinGasUsed, 47 } 48 49 // DefaultConfig contains default settings for use on the Avalanche main net. 50 var DefaultConfig = NewDefaultConfig() 51 52 func NewDefaultConfig() Config { 53 return Config{ 54 NetworkId: 1, 55 LightPeers: 100, 56 UltraLightFraction: 75, 57 DatabaseCache: 512, 58 TrieCleanCache: 256, 59 TrieDirtyCache: 256, 60 TrieDirtyCommitTarget: 20, 61 SnapshotCache: 128, 62 FilterLogCacheSize: 32, 63 Miner: miner.Config{}, 64 TxPool: core.DefaultTxPoolConfig, 65 RPCGasCap: 25000000, 66 RPCEVMTimeout: 5 * time.Second, 67 GPO: DefaultFullGPOConfig, 68 RPCTxFeeCap: 1, // 1 AVAX 69 } 70 } 71 72 //go:generate go run github.com/fjl/gencodec -type Config -formats toml -out gen_config.go 73 74 // Config contains configuration options for of the ETH and LES protocols. 75 type Config struct { 76 // The genesis block, which is inserted if the database is empty. 77 // If nil, the Ethereum main net block is used. 78 Genesis *core.Genesis `toml:",omitempty"` 79 80 // Protocol options 81 NetworkId uint64 // Network ID to use for selecting peers to connect to 82 83 // This can be set to list of enrtree:// URLs which will be queried for 84 // for nodes to connect to. 85 DiscoveryURLs []string 86 87 Pruning bool // Whether to disable pruning and flush everything to disk 88 AcceptorQueueLimit int // Maximum blocks to queue before blocking during acceptance 89 CommitInterval uint64 // If pruning is enabled, specified the interval at which to commit an entire trie to disk. 90 PopulateMissingTries *uint64 // Height at which to start re-populating missing tries on startup. 91 PopulateMissingTriesParallelism int // Number of concurrent readers to use when re-populating missing tries on startup. 92 AllowMissingTries bool // Whether to allow an archival node to run with pruning enabled and corrupt a complete index. 93 SnapshotDelayInit bool // Whether snapshot tree should be initialized on startup or delayed until explicit call 94 SnapshotAsync bool // Whether to generate the initial snapshot in async mode 95 SnapshotVerify bool // Whether to verify generated snapshots 96 SkipSnapshotRebuild bool // Whether to skip rebuilding the snapshot in favor of returning an error (only set to true for tests) 97 98 // Light client options 99 LightServ int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests 100 LightIngress int `toml:",omitempty"` // Incoming bandwidth limit for light servers 101 LightEgress int `toml:",omitempty"` // Outgoing bandwidth limit for light servers 102 LightPeers int `toml:",omitempty"` // Maximum number of LES client peers 103 LightNoPrune bool `toml:",omitempty"` // Whether to disable light chain pruning 104 105 // Ultra Light client options 106 UltraLightServers []string `toml:",omitempty"` // List of trusted ultra light servers 107 UltraLightFraction int `toml:",omitempty"` // Percentage of trusted servers to accept an announcement 108 UltraLightOnlyAnnounce bool `toml:",omitempty"` // Whether to only announce headers, or also serve them 109 110 // Database options 111 SkipBcVersionCheck bool `toml:"-"` 112 DatabaseHandles int `toml:"-"` 113 DatabaseCache int 114 // DatabaseFreezer string 115 116 TrieCleanCache int 117 TrieDirtyCache int 118 TrieDirtyCommitTarget int 119 SnapshotCache int 120 Preimages bool 121 122 // This is the number of blocks for which logs will be cached in the filter system. 123 FilterLogCacheSize int 124 125 // Mining options 126 Miner miner.Config 127 128 // Transaction pool options 129 TxPool core.TxPoolConfig 130 131 // Gas Price Oracle options 132 GPO gasprice.Config 133 134 // Enables tracking of SHA3 preimages in the VM 135 EnablePreimageRecording bool 136 137 // Miscellaneous options 138 DocRoot string `toml:"-"` 139 140 // RPCGasCap is the global gas cap for eth-call variants. 141 RPCGasCap uint64 `toml:",omitempty"` 142 143 // RPCEVMTimeout is the global timeout for eth-call. 144 RPCEVMTimeout time.Duration 145 146 // RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for 147 // send-transaction variants. The unit is ether. 148 RPCTxFeeCap float64 `toml:",omitempty"` 149 150 // AllowUnfinalizedQueries allow unfinalized queries 151 AllowUnfinalizedQueries bool 152 153 // AllowUnprotectedTxs allow unprotected transactions to be locally issued. 154 // Unprotected transactions are transactions that are signed without EIP-155 155 // replay protection. 156 AllowUnprotectedTxs bool 157 158 // OfflinePruning enables offline pruning on startup of the node. If a node is started 159 // with this configuration option, it must finish pruning before resuming normal operation. 160 OfflinePruning bool 161 OfflinePruningBloomFilterSize uint64 162 OfflinePruningDataDirectory string 163 }