github.com/ebakus/go-ebakus@v1.0.5-0.20200520105415-dbccef9ec421/eth/config.go (about) 1 // Copyright 2019 The ebakus/go-ebakus Authors 2 // This file is part of the ebakus/go-ebakus library. 3 // 4 // The ebakus/go-ebakus library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The ebakus/go-ebakus library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the ebakus/go-ebakus library. If not, see <http://www.gnu.org/licenses/>. 16 17 package eth 18 19 import ( 20 "math/big" 21 "os" 22 "os/user" 23 "time" 24 25 "github.com/ebakus/go-ebakus/common" 26 "github.com/ebakus/go-ebakus/core" 27 "github.com/ebakus/go-ebakus/core/types" 28 "github.com/ebakus/go-ebakus/eth/downloader" 29 "github.com/ebakus/go-ebakus/eth/gasprice" 30 "github.com/ebakus/go-ebakus/miner" 31 "github.com/ebakus/go-ebakus/params" 32 ) 33 34 // DefaultConfig contains default settings for use on the Ebakus main net. 35 var DefaultConfig = Config{ 36 SyncMode: downloader.FullSync, 37 DPOS: *params.MainnetDPOSConfig, 38 NetworkId: params.MainnetChainConfig.ChainID.Uint64(), 39 LightPeers: 100, 40 UltraLightFraction: 75, 41 DatabaseCache: 768, 42 TrieCleanCache: 256, 43 TrieDirtyCache: 256, 44 TrieTimeout: 60 * time.Minute, 45 EbakusdbMaxActiveIterators: 1000, 46 Miner: miner.Config{ 47 GasFloor: 80000000, 48 GasCeil: 160000000, 49 GasPrice: types.MinimumTargetDifficulty, 50 Recommit: 3 * time.Second, 51 }, 52 TxPool: core.DefaultTxPoolConfig, 53 GPO: gasprice.Config{ 54 Blocks: 20, 55 Percentile: 60, 56 }, 57 } 58 59 func init() { 60 home := os.Getenv("HOME") 61 if home == "" { 62 if user, err := user.Current(); err == nil { 63 home = user.HomeDir 64 } 65 } 66 } 67 68 //go:generate gencodec -type Config -formats toml -out gen_config.go 69 70 type Config struct { 71 // The genesis block, which is inserted if the database is empty. 72 // If nil, the Ebakus main net block is used. 73 Genesis *core.Genesis `toml:",omitempty"` 74 75 // Protocol options 76 NetworkId uint64 // Network ID to use for selecting peers to connect to 77 SyncMode downloader.SyncMode 78 79 NoPruning bool // Whether to disable pruning and flush everything to disk 80 NoPrefetch bool // Whether to disable prefetching and only load state on demand 81 82 // Whitelist of required block number -> hash values to accept 83 Whitelist map[uint64]common.Hash `toml:"-"` 84 85 // Light client options 86 LightServ int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests 87 LightIngress int `toml:",omitempty"` // Incoming bandwidth limit for light servers 88 LightEgress int `toml:",omitempty"` // Outgoing bandwidth limit for light servers 89 LightPeers int `toml:",omitempty"` // Maximum number of LES client peers 90 91 // Ultra Light client options 92 UltraLightServers []string `toml:",omitempty"` // List of trusted ultra light servers 93 UltraLightFraction int `toml:",omitempty"` // Percentage of trusted servers to accept an announcement 94 UltraLightOnlyAnnounce bool `toml:",omitempty"` // Whether to only announce headers, or also serve them 95 96 // Database options 97 SkipBcVersionCheck bool `toml:"-"` 98 DatabaseHandles int `toml:"-"` 99 DatabaseCache int 100 DatabaseFreezer string 101 102 TrieCleanCache int 103 TrieDirtyCache int 104 TrieTimeout time.Duration 105 106 EbakusdbMaxActiveIterators uint64 // Maximum number of ebakusDb iterators to retain in memory for RPC APIs 107 108 // Mining options 109 Miner miner.Config 110 111 // DPOS options 112 DPOS params.DPOSConfig 113 114 // Transaction pool options 115 TxPool core.TxPoolConfig 116 117 // Gas Price Oracle options 118 GPO gasprice.Config 119 120 // Enables tracking of SHA3 preimages in the VM 121 EnablePreimageRecording bool 122 123 // Miscellaneous options 124 DocRoot string `toml:"-"` 125 126 // Type of the EWASM interpreter ("" for default) 127 EWASMInterpreter string 128 129 // Type of the EVM interpreter ("" for default) 130 EVMInterpreter string 131 132 // RPCGasCap is the global gas cap for eth-call variants. 133 RPCGasCap *big.Int `toml:",omitempty"` 134 135 // Checkpoint is a hardcoded checkpoint which can be nil. 136 Checkpoint *params.TrustedCheckpoint `toml:",omitempty"` 137 138 // CheckpointOracle is the configuration for checkpoint oracle. 139 CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` 140 141 // Istanbul block override (TODO: remove after the fork) 142 OverrideIstanbul *big.Int 143 }