rippled
Loading...
Searching...
No Matches
Config.h
1#ifndef XRPL_CORE_CONFIG_H_INCLUDED
2#define XRPL_CORE_CONFIG_H_INCLUDED
3
4#include <xrpl/basics/BasicConfig.h>
5#include <xrpl/basics/base_uint.h>
6#include <xrpl/beast/net/IPEndpoint.h>
7#include <xrpl/beast/utility/Journal.h>
8#include <xrpl/protocol/SystemParameters.h> // VFALCO Breaks levelization
9
10#include <boost/filesystem.hpp> // VFALCO FIX: This include should not be here
11
12#include <cstdint>
13#include <optional>
14#include <string>
15#include <unordered_set>
16#include <utility>
17#include <vector>
18
19namespace ripple {
20
21class Rules;
22
23//------------------------------------------------------------------------------
24
40
47{
50
53
56
57 /* (Remember to update the example cfg files when changing any of these
58 * values.) */
59};
60
61// This entire derived class is deprecated.
62// For new config information use the style implied
63// in the base class. For existing config information
64// try to refactor code to use the new style.
65//
66class Config : public BasicConfig
67{
68public:
69 // Settings related to the configuration file location and directories
70 static char const* const configFileName;
71 static char const* const databaseDirName;
72 static char const* const validatorsFileName;
73
75 boost::filesystem::path
76 getDebugLogFile() const;
77
78private:
79 boost::filesystem::path CONFIG_FILE;
80
81public:
82 boost::filesystem::path CONFIG_DIR;
83
84private:
85 boost::filesystem::path DEBUG_LOGFILE;
86
87 void
88 load();
90
91 bool QUIET = false; // Minimize logging verbosity.
92 bool SILENT = false; // No output to console after startup.
102 bool RUN_STANDALONE = false;
103
104 bool USE_TX_TABLES = true;
105
112 bool signingEnabled_ = false;
113
114 // The amount of RAM, in bytes, that we detected on this system.
116
117public:
118 bool doImport = false;
119 bool ELB_SUPPORT = false;
120
121 // Entries from [ips] config stanza
123
124 // Entries from [ips_fixed] config stanza
126
129
130 bool START_VALID = false;
131
133
135
136 // Network parameters
137 uint32_t NETWORK_ID = 0;
138
139 // DEPRECATED - Fee units for a reference transction.
140 // Only provided for backwards compatibility in a couple of places
141 static constexpr std::uint32_t FEE_UNITS_DEPRECATED = 10;
142
143 // Note: The following parameters do not relate to the UNL or trust at all
144 // Minimum number of nodes to consider the network present
146
147 // Peer networking parameters
148 // 1 = relay, 0 = do not relay (but process), -1 = drop completely (do NOT
149 // process)
152
153 // True to ask peers not to relay current IP.
154 bool PEER_PRIVATE = false;
155 // peers_max is a legacy configuration, which is going to be replaced
156 // with individual inbound peers peers_in_max and outbound peers
157 // peers_out_max configuration. for now we support both the legacy and
158 // the new configuration. if peers_max is configured then peers_in_max and
159 // peers_out_max are ignored.
163
164 // Path searching: these were reasonable default values at some point but
165 // further research is needed to decide if they still are
166 // and whether all of them are needed.
167 //
168 // The performance and resource consumption of a server can
169 // be dramatically impacted by changing these configuration
170 // options; higher values result in exponentially higher
171 // resource usage.
172 //
173 // Servers operating as validators disable path finding by
174 // default by setting the `PATH_SEARCH_MAX` option to 0
175 // unless it is explicitly set in the configuration file.
177 int PATH_SEARCH = 2;
180
181 // Validation
183 VALIDATION_QUORUM; // validations to consider ledger authoritative
184
186
187 // Node storage configuration
190
191 // Tunable that adjusts various parameters, typically associated
192 // with hardware parameters (RAM size and CPU cores). The default
193 // is 'tiny'.
195
196 bool SSL_VERIFY = true;
199
200 // Compression
201 bool COMPRESSION = false;
202
203 // Enable the experimental Ledger Replay functionality
204 bool LEDGER_REPLAY = false;
205
206 // Work queue limits
208 static constexpr int MAX_JOB_QUEUE_TX = 1000;
209 static constexpr int MIN_JOB_QUEUE_TX = 100;
210
211 // Amendment majority time
213
214 // Thread pool configuration (0 = choose for me)
215 int WORKERS = 0; // jobqueue thread count. default: upto 6
216 int IO_WORKERS = 0; // io svc thread count. default: 2
217 int PREFETCH_WORKERS = 0; // prefetch thread count. default: 4
218
219 // Can only be set in code, specifically unit tests
220 bool FORCE_MULTI_THREAD = false;
221
222 // Normally the sweep timer is automatically deduced based on the node
223 // size, but we allow admins to explicitly set it in the config.
225
226 // Reduce-relay - Experimental parameters to control p2p routing algorithms
227
228 // Enable base squelching of duplicate validation/proposal messages
230
232 // Temporary squelching config for the peers selected as a source of //
233 // validator messages. The config must be removed once squelching is //
234 // made the default routing algorithm //
237
238 // Transaction reduce-relay feature
240 // If tx reduce-relay feature is disabled
241 // and this flag is enabled then some
242 // tx-related metrics is collected. It
243 // is ignored if tx reduce-relay feature is
244 // enabled. It is used in debugging to compare
245 // metrics with the feature disabled/enabled.
247 // Minimum peers a server should have before
248 // selecting random peers
250 // Percentage of peers with the tx reduce-relay feature enabled
251 // to relay to out of total active peers
253
254 // These override the command line client settings
256
258
260
261 // How long can a peer remain in the "unknown" state
263
264 // How long can a peer remain in the "diverged" state
266
267 // Enable the beta API version
268 bool BETA_RPC_API = false;
269
270 // First, attempt to load the latest ledger directly from disk.
271 bool FAST_LOAD = false;
272 // When starting rippled with existing database it do not know it has those
273 // ledgers locally until the server naturally tries to backfill. This makes
274 // is difficult to test some functionality (in particular performance
275 // testing sidechains). With this variable the user is able to force rippled
276 // to consider the ledger range to be present. It should be used for testing
277 // only.
280
282
283public:
284 Config();
285
286 /* Be very careful to make sure these bool params
287 are in the right order. */
288 void
289 setup(
290 std::string const& strConf,
291 bool bQuiet,
292 bool bSilent,
293 bool bStandalone);
294
295 void
296 setupControl(bool bQuiet, bool bSilent, bool bStandalone);
297
303 void
304 loadFromString(std::string const& fileContents);
305
306 bool
307 quiet() const
308 {
309 return QUIET;
310 }
311 bool
312 silent() const
313 {
314 return SILENT;
315 }
316 bool
318 {
319 return RUN_STANDALONE;
320 }
321
322 bool
324 {
325 return USE_TX_TABLES;
326 }
327
328 bool
329 canSign() const
330 {
331 return signingEnabled_;
332 }
333
351 int
353 const;
354
356 journal() const
357 {
358 return j_;
359 }
360};
361
362FeeSetup
363setup_FeeVote(Section const& section);
364
365} // namespace ripple
366
367#endif
A generic endpoint for log messages.
Definition Journal.h:41
Holds unparsed configuration information.
bool silent() const
Definition Config.h:312
uint32_t NETWORK_ID
Definition Config.h:137
int PATH_SEARCH
Definition Config.h:177
bool ELB_SUPPORT
Definition Config.h:119
static char const *const databaseDirName
Definition Config.h:71
bool START_VALID
Definition Config.h:130
std::optional< int > SWEEP_INTERVAL
Definition Config.h:224
std::uint32_t LEDGER_HISTORY
Definition Config.h:188
std::optional< std::size_t > VALIDATION_QUORUM
Definition Config.h:183
int PATH_SEARCH_OLD
Definition Config.h:176
std::uint32_t FETCH_DEPTH
Definition Config.h:189
std::string START_LEDGER
Definition Config.h:132
std::optional< std::pair< std::uint32_t, std::uint32_t > > FORCED_LEDGER_RANGE_PRESENT
Definition Config.h:279
std::size_t NETWORK_QUORUM
Definition Config.h:145
std::vector< std::string > IPS_FIXED
Definition Config.h:125
boost::filesystem::path CONFIG_DIR
Definition Config.h:82
void setup(std::string const &strConf, bool bQuiet, bool bSilent, bool bStandalone)
Definition Config.cpp:292
int PREFETCH_WORKERS
Definition Config.h:217
static char const *const configFileName
Definition Config.h:70
bool FORCE_MULTI_THREAD
Definition Config.h:220
bool SILENT
Definition Config.h:92
bool canSign() const
Definition Config.h:329
std::vector< std::string > IPS
Definition Config.h:122
std::size_t PEERS_IN_MAX
Definition Config.h:162
bool PEER_PRIVATE
Definition Config.h:154
bool standalone() const
Definition Config.h:317
std::optional< beast::IP::Endpoint > rpc_ip
Definition Config.h:255
std::size_t TX_REDUCE_RELAY_MIN_PEERS
Definition Config.h:249
bool VP_REDUCE_RELAY_BASE_SQUELCH_ENABLE
Definition Config.h:229
bool BETA_RPC_API
Definition Config.h:268
beast::Journal const j_
Definition Config.h:89
bool LEDGER_REPLAY
Definition Config.h:204
std::optional< std::size_t > VALIDATOR_LIST_THRESHOLD
Definition Config.h:281
int PATH_SEARCH_MAX
Definition Config.h:179
int PATH_SEARCH_FAST
Definition Config.h:178
int RELAY_UNTRUSTED_PROPOSALS
Definition Config.h:151
beast::Journal journal() const
Definition Config.h:356
bool TX_REDUCE_RELAY_ENABLE
Definition Config.h:239
boost::filesystem::path getDebugLogFile() const
Returns the full path and filename of the debug log file.
Definition Config.cpp:1063
bool FAST_LOAD
Definition Config.h:271
bool quiet() const
Definition Config.h:307
bool TX_REDUCE_RELAY_METRICS
Definition Config.h:246
static constexpr int MIN_JOB_QUEUE_TX
Definition Config.h:209
bool RUN_STANDALONE
Operate in stand-alone mode.
Definition Config.h:102
std::size_t TX_RELAY_PERCENTAGE
Definition Config.h:252
bool useTxTables() const
Definition Config.h:323
std::string SERVER_DOMAIN
Definition Config.h:259
static constexpr int MAX_JOB_QUEUE_TX
Definition Config.h:208
int MAX_TRANSACTIONS
Definition Config.h:207
std::size_t NODE_SIZE
Definition Config.h:194
std::chrono::seconds MAX_DIVERGED_TIME
Definition Config.h:265
std::uint64_t const ramSize_
Definition Config.h:115
bool SSL_VERIFY
Definition Config.h:196
boost::filesystem::path CONFIG_FILE
Definition Config.h:79
bool USE_TX_TABLES
Definition Config.h:104
bool doImport
Definition Config.h:118
int getValueFor(SizedItem item, std::optional< std::size_t > node=std::nullopt) const
Retrieve the default value for the item at the specified node size.
Definition Config.cpp:1097
FeeSetup FEES
Definition Config.h:185
bool signingEnabled_
Determines if the server will sign a tx, given an account's secret seed.
Definition Config.h:112
boost::filesystem::path DEBUG_LOGFILE
Definition Config.h:85
std::string SSL_VERIFY_FILE
Definition Config.h:197
void setupControl(bool bQuiet, bool bSilent, bool bStandalone)
Definition Config.cpp:250
void loadFromString(std::string const &fileContents)
Load the config from the contents of the string.
Definition Config.cpp:460
std::unordered_set< uint256, beast::uhash<> > features
Definition Config.h:257
std::chrono::seconds AMENDMENT_MAJORITY_TIME
Definition Config.h:212
bool COMPRESSION
Definition Config.h:201
static constexpr std::uint32_t FEE_UNITS_DEPRECATED
Definition Config.h:141
static char const *const validatorsFileName
Definition Config.h:72
std::chrono::seconds MAX_UNKNOWN_TIME
Definition Config.h:262
std::size_t VP_REDUCE_RELAY_SQUELCH_MAX_SELECTED_PEERS
Definition Config.h:235
std::size_t PEERS_OUT_MAX
Definition Config.h:161
int RELAY_UNTRUSTED_VALIDATIONS
Definition Config.h:150
std::string SSL_VERIFY_DIR
Definition Config.h:198
StartUpType START_UP
Definition Config.h:128
std::size_t PEERS_MAX
Definition Config.h:160
std::optional< uint256 > TRAP_TX_HASH
Definition Config.h:134
T is_same_v
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
SizedItem
Definition Config.h:25
constexpr std::chrono::seconds const defaultAmendmentMajorityTime
The minimum amount of time an amendment must hold a majority.
FeeSetup setup_FeeVote(Section const &section)
Definition Config.cpp:1110
constexpr XRPAmount DROPS_PER_XRP
Number of drops per 1 XRP.
Definition XRPAmount.h:240
Fee schedule for startup / standalone, and to vote for.
Definition Config.h:47
XRPAmount reference_fee
The cost of a reference transaction in drops.
Definition Config.h:49
XRPAmount owner_reserve
The per-owned item reserve requirement in drops.
Definition Config.h:55
XRPAmount account_reserve
The account reserve requirement in drops.
Definition Config.h:52