github.com/okex/exchain@v1.8.0/libs/tendermint/config/dynamic_config_okchain.go (about) 1 package config 2 3 import "time" 4 5 type IDynamicConfig interface { 6 GetMempoolRecheck() bool 7 GetMempoolForceRecheckGap() int64 8 GetMempoolSize() int 9 GetMempoolCacheSize() int 10 GetMaxTxNumPerBlock() int64 11 GetEnableDeleteMinGPTx() bool 12 GetMaxGasUsedPerBlock() int64 13 GetEnablePGU() bool 14 GetPGUPercentageThreshold() int64 15 GetPGUConcurrency() int 16 GetPGUAdjustment() float64 17 GetPGUPersist() bool 18 GetMempoolFlush() bool 19 GetNodeKeyWhitelist() []string 20 GetMempoolCheckTxCost() bool 21 GetSentryAddrs() []string 22 GetCsTimeoutPropose() time.Duration 23 GetCsTimeoutProposeDelta() time.Duration 24 GetCsTimeoutPrevote() time.Duration 25 GetCsTimeoutPrevoteDelta() time.Duration 26 GetCsTimeoutPrecommit() time.Duration 27 GetCsTimeoutPrecommitDelta() time.Duration 28 GetCsTimeoutCommit() time.Duration 29 GetEnableWtx() bool 30 GetDeliverTxsExecuteMode() int 31 GetEnableHasBlockPartMsg() bool 32 GetCommitGapOffset() int64 33 GetIavlAcNoBatch() bool 34 GetDynamicGpWeight() int 35 GetDynamicGpCheckBlocks() int 36 GetDynamicGpMode() int 37 GetDynamicGpMaxTxNum() int64 38 GetDynamicGpMaxGasUsed() int64 39 GetGasLimitBuffer() uint64 40 GetEnableMempoolSimGuFactor() bool 41 GetMaxSubscriptionClients() int 42 GetPendingPoolBlacklist() string 43 } 44 45 var DynamicConfig IDynamicConfig = MockDynamicConfig{} 46 47 func SetDynamicConfig(c IDynamicConfig) { 48 DynamicConfig = c 49 } 50 51 type MockDynamicConfig struct { 52 enableDeleteMinGPTx bool 53 dynamicGpMode int 54 dynamicGpMaxTxNum int64 55 dynamicGpMaxGasUsed int64 56 maxSubscriptionClients int 57 } 58 59 func (d MockDynamicConfig) GetMempoolRecheck() bool { 60 return DefaultMempoolConfig().Recheck 61 } 62 63 func (d MockDynamicConfig) GetMempoolForceRecheckGap() int64 { 64 return DefaultMempoolConfig().ForceRecheckGap 65 } 66 67 func (d MockDynamicConfig) GetMempoolSize() int { 68 return DefaultMempoolConfig().Size 69 } 70 71 func (d MockDynamicConfig) GetMempoolCacheSize() int { 72 return DefaultMempoolConfig().CacheSize 73 } 74 75 func (d MockDynamicConfig) GetMaxTxNumPerBlock() int64 { 76 return DefaultMempoolConfig().MaxTxNumPerBlock 77 } 78 79 func (d MockDynamicConfig) GetMaxGasUsedPerBlock() int64 { 80 return DefaultMempoolConfig().MaxGasUsedPerBlock 81 } 82 83 func (d MockDynamicConfig) GetEnablePGU() bool { 84 return false 85 } 86 87 func (d MockDynamicConfig) GetPGUPercentageThreshold() int64 { 88 return 10 89 } 90 91 func (d MockDynamicConfig) GetPGUConcurrency() int { 92 return 1 93 } 94 95 func (d MockDynamicConfig) GetPGUAdjustment() float64 { 96 return 1 97 } 98 99 func (d MockDynamicConfig) GetPGUPersist() bool { 100 return false 101 } 102 103 func (d MockDynamicConfig) GetMempoolFlush() bool { 104 return false 105 } 106 107 func (d MockDynamicConfig) GetNodeKeyWhitelist() []string { 108 return []string{} 109 } 110 111 func (d MockDynamicConfig) GetMempoolCheckTxCost() bool { 112 return false 113 } 114 115 func (d MockDynamicConfig) GetSentryAddrs() []string { 116 return []string{} 117 } 118 119 func (d MockDynamicConfig) GetCsTimeoutPropose() time.Duration { 120 return DefaultConsensusConfig().TimeoutPropose 121 } 122 func (d MockDynamicConfig) GetCsTimeoutProposeDelta() time.Duration { 123 return DefaultConsensusConfig().TimeoutProposeDelta 124 } 125 func (d MockDynamicConfig) GetCsTimeoutPrevote() time.Duration { 126 return DefaultConsensusConfig().TimeoutPrevote 127 } 128 func (d MockDynamicConfig) GetCsTimeoutPrevoteDelta() time.Duration { 129 return DefaultConsensusConfig().TimeoutPrecommitDelta 130 } 131 func (d MockDynamicConfig) GetCsTimeoutPrecommit() time.Duration { 132 return DefaultConsensusConfig().TimeoutPrecommit 133 } 134 func (d MockDynamicConfig) GetCsTimeoutPrecommitDelta() time.Duration { 135 return DefaultConsensusConfig().TimeoutPrecommitDelta 136 } 137 func (d MockDynamicConfig) GetCsTimeoutCommit() time.Duration { 138 return DefaultConsensusConfig().TimeoutCommit 139 } 140 141 func (d MockDynamicConfig) GetEnableWtx() bool { 142 return false 143 } 144 func (d MockDynamicConfig) GetDeliverTxsExecuteMode() int { 145 return 0 146 } 147 148 func (d MockDynamicConfig) GetEnableHasBlockPartMsg() bool { 149 return false 150 } 151 152 func (d MockDynamicConfig) GetEnableDeleteMinGPTx() bool { 153 return d.enableDeleteMinGPTx 154 } 155 156 func (d *MockDynamicConfig) SetEnableDeleteMinGPTx(enable bool) { 157 d.enableDeleteMinGPTx = enable 158 } 159 160 func (d MockDynamicConfig) GetCommitGapOffset() int64 { 161 return 0 162 } 163 164 func (d MockDynamicConfig) GetIavlAcNoBatch() bool { 165 return false 166 } 167 168 func (d *MockDynamicConfig) SetDynamicGpMode(value int) { 169 if value < 0 || value > 2 { 170 return 171 } 172 d.dynamicGpMode = value 173 } 174 175 func (d MockDynamicConfig) GetDynamicGpMode() int { 176 return d.dynamicGpMode 177 } 178 179 func (d MockDynamicConfig) GetDynamicGpCheckBlocks() int { 180 return 5 181 } 182 183 func (d MockDynamicConfig) GetDynamicGpWeight() int { 184 return 80 185 } 186 187 func (d *MockDynamicConfig) SetDynamicGpMaxTxNum(value int64) { 188 if value < 0 { 189 return 190 } 191 d.dynamicGpMaxTxNum = value 192 } 193 194 func (d MockDynamicConfig) GetDynamicGpMaxTxNum() int64 { 195 return d.dynamicGpMaxTxNum 196 } 197 198 func (d *MockDynamicConfig) SetDynamicGpMaxGasUsed(value int64) { 199 if value < -1 { 200 return 201 } 202 d.dynamicGpMaxGasUsed = value 203 } 204 205 func (d MockDynamicConfig) GetDynamicGpMaxGasUsed() int64 { 206 return d.dynamicGpMaxGasUsed 207 } 208 209 func (d MockDynamicConfig) GetGasLimitBuffer() uint64 { 210 return 0 211 } 212 213 func (d MockDynamicConfig) GetEnableMempoolSimGuFactor() bool { 214 return false 215 } 216 217 func (d MockDynamicConfig) GetMaxSubscriptionClients() int { 218 return d.maxSubscriptionClients 219 } 220 221 func (d *MockDynamicConfig) SetMaxSubscriptionClients(value int) { 222 if value < 0 { 223 return 224 } 225 d.maxSubscriptionClients = value 226 } 227 228 func (d MockDynamicConfig) GetPendingPoolBlacklist() string { 229 return "" 230 }