github.com/ava-labs/subnet-evm@v0.6.4/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/ava-labs/subnet-evm/core" 33 "github.com/ava-labs/subnet-evm/core/rawdb" 34 "github.com/ava-labs/subnet-evm/core/txpool/blobpool" 35 "github.com/ava-labs/subnet-evm/core/txpool/legacypool" 36 "github.com/ava-labs/subnet-evm/eth/gasprice" 37 "github.com/ava-labs/subnet-evm/miner" 38 "github.com/ava-labs/subnet-evm/params" 39 "github.com/ethereum/go-ethereum/common" 40 ) 41 42 // DefaultFullGPOConfig contains default gasprice oracle settings for full node. 43 var DefaultFullGPOConfig = gasprice.Config{ 44 Blocks: 40, 45 Percentile: 60, 46 MaxLookbackSeconds: gasprice.DefaultMaxLookbackSeconds, 47 MaxCallBlockHistory: gasprice.DefaultMaxCallBlockHistory, 48 MaxBlockHistory: gasprice.DefaultMaxBlockHistory, 49 MinPrice: gasprice.DefaultMinPrice, 50 MaxPrice: gasprice.DefaultMaxPrice, 51 MinGasUsed: gasprice.DefaultMinGasUsed, 52 } 53 54 // DefaultConfig contains default settings for use on the Avalanche main net. 55 var DefaultConfig = NewDefaultConfig() 56 57 func NewDefaultConfig() Config { 58 return Config{ 59 NetworkId: 1, 60 StateHistory: params.FullImmutabilityThreshold, 61 StateScheme: rawdb.HashScheme, 62 TrieCleanCache: 512, 63 TrieDirtyCache: 256, 64 TrieDirtyCommitTarget: 20, 65 TriePrefetcherParallelism: 16, 66 SnapshotCache: 256, 67 AcceptedCacheSize: 32, 68 Miner: miner.Config{}, 69 TxPool: legacypool.DefaultConfig, 70 BlobPool: blobpool.DefaultConfig, 71 RPCGasCap: 25000000, 72 RPCEVMTimeout: 5 * time.Second, 73 GPO: DefaultFullGPOConfig, 74 RPCTxFeeCap: 1, // 1 AVAX 75 } 76 } 77 78 //go:generate go run github.com/fjl/gencodec -type Config -formats toml -out gen_config.go 79 80 // Config contains configuration options for of the ETH and LES protocols. 81 type Config struct { 82 // The genesis block, which is inserted if the database is empty. 83 // If nil, the Ethereum main net block is used. 84 Genesis *core.Genesis `toml:",omitempty"` 85 86 // Protocol options 87 NetworkId uint64 // Network ID to use for selecting peers to connect to 88 89 Pruning bool // Whether to disable pruning and flush everything to disk 90 AcceptorQueueLimit int // Maximum blocks to queue before blocking during acceptance 91 CommitInterval uint64 // If pruning is enabled, specified the interval at which to commit an entire trie to disk. 92 PopulateMissingTries *uint64 // Height at which to start re-populating missing tries on startup. 93 PopulateMissingTriesParallelism int // Number of concurrent readers to use when re-populating missing tries on startup. 94 AllowMissingTries bool // Whether to allow an archival node to run with pruning enabled and corrupt a complete index. 95 SnapshotDelayInit bool // Whether snapshot tree should be initialized on startup or delayed until explicit call (= StateSyncEnabled) 96 SnapshotWait bool // Whether to wait for the initial snapshot generation 97 SnapshotVerify bool // Whether to verify generated snapshots 98 SkipSnapshotRebuild bool // Whether to skip rebuilding the snapshot in favor of returning an error (only set to true for tests) 99 100 // Database options 101 SkipBcVersionCheck bool `toml:"-"` 102 103 // TrieDB and snapshot options 104 TrieCleanCache int 105 TrieDirtyCache int 106 TrieDirtyCommitTarget int 107 TriePrefetcherParallelism int 108 SnapshotCache int 109 Preimages bool 110 111 // AcceptedCacheSize is the depth of accepted headers cache and accepted 112 // logs cache at the accepted tip. 113 AcceptedCacheSize int 114 115 // Mining options 116 Miner miner.Config 117 118 // Transaction pool options 119 TxPool legacypool.Config 120 BlobPool blobpool.Config 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 // RPCGasCap is the global gas cap for eth-call variants. 129 RPCGasCap uint64 `toml:",omitempty"` 130 131 // RPCEVMTimeout is the global timeout for eth-call. 132 RPCEVMTimeout time.Duration 133 134 // RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for 135 // send-transaction variants. The unit is ether. 136 RPCTxFeeCap float64 `toml:",omitempty"` 137 138 // AllowUnfinalizedQueries allow unfinalized queries 139 AllowUnfinalizedQueries bool 140 141 // AllowUnprotectedTxs allow unprotected transactions to be locally issued. 142 // Unprotected transactions are transactions that are signed without EIP-155 143 // replay protection. 144 AllowUnprotectedTxs bool 145 // AllowUnprotectedTxHashes provides a list of transaction hashes, which will be allowed 146 // to be issued without replay protection over the API even if AllowUnprotectedTxs is false. 147 AllowUnprotectedTxHashes []common.Hash 148 149 // OfflinePruning enables offline pruning on startup of the node. If a node is started 150 // with this configuration option, it must finish pruning before resuming normal operation. 151 OfflinePruning bool 152 OfflinePruningBloomFilterSize uint64 153 OfflinePruningDataDirectory string 154 155 // SkipUpgradeCheck disables checking that upgrades must take place before the last 156 // accepted block. Skipping this check is useful when a node operator does not update 157 // their node before the network upgrade and their node accepts blocks that have 158 // identical state with the pre-upgrade ruleset. 159 SkipUpgradeCheck bool 160 161 // TxLookupLimit is the maximum number of blocks from head whose tx indices 162 // are reserved: 163 // * 0: means no limit 164 // * N: means N block limit [HEAD-N+1, HEAD] and delete extra indexes 165 // Deprecated, use 'TransactionHistory' instead. 166 TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved. 167 TransactionHistory uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved. 168 StateHistory uint64 `toml:",omitempty"` // The maximum number of blocks from head whose state histories are reserved. 169 StateScheme string `toml:",omitempty"` // State scheme used to store ethereum state and merkle trie nodes on top 170 171 // SkipTxIndexing skips indexing transactions. 172 // This is useful for validators that don't need to index transactions. 173 // TxLookupLimit can be still used to control unindexing old transactions. 174 SkipTxIndexing bool 175 }