rippled
Loading...
Searching...
No Matches
Config.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_CORE_CONFIG_H_INCLUDED
21#define RIPPLE_CORE_CONFIG_H_INCLUDED
22
23#include <xrpl/basics/BasicConfig.h>
24#include <xrpl/basics/base_uint.h>
25#include <xrpl/beast/net/IPEndpoint.h>
26#include <xrpl/beast/utility/Journal.h>
27#include <xrpl/protocol/SystemParameters.h> // VFALCO Breaks levelization
28
29#include <boost/filesystem.hpp> // VFALCO FIX: This include should not be here
30
31#include <cstdint>
32#include <optional>
33#include <string>
34#include <unordered_set>
35#include <utility>
36#include <vector>
37
38namespace ripple {
39
40class Rules;
41
42//------------------------------------------------------------------------------
43
59
66{
69
72
75
76 /* (Remember to update the example cfg files when changing any of these
77 * values.) */
78};
79
80// This entire derived class is deprecated.
81// For new config information use the style implied
82// in the base class. For existing config information
83// try to refactor code to use the new style.
84//
85class Config : public BasicConfig
86{
87public:
88 // Settings related to the configuration file location and directories
89 static char const* const configFileName;
90 static char const* const databaseDirName;
91 static char const* const validatorsFileName;
92
94 boost::filesystem::path
95 getDebugLogFile() const;
96
97private:
98 boost::filesystem::path CONFIG_FILE;
99
100public:
101 boost::filesystem::path CONFIG_DIR;
102
103private:
104 boost::filesystem::path DEBUG_LOGFILE;
105
106 void
107 load();
109
110 bool QUIET = false; // Minimize logging verbosity.
111 bool SILENT = false; // No output to console after startup.
121 bool RUN_STANDALONE = false;
122
123 bool USE_TX_TABLES = true;
124
131 bool signingEnabled_ = false;
132
133 // The amount of RAM, in bytes, that we detected on this system.
135
136public:
137 bool doImport = false;
138 bool ELB_SUPPORT = false;
139
140 // Entries from [ips] config stanza
142
143 // Entries from [ips_fixed] config stanza
145
148
149 bool START_VALID = false;
150
152
154
155 // Network parameters
156 uint32_t NETWORK_ID = 0;
157
158 // DEPRECATED - Fee units for a reference transction.
159 // Only provided for backwards compatibility in a couple of places
160 static constexpr std::uint32_t FEE_UNITS_DEPRECATED = 10;
161
162 // Note: The following parameters do not relate to the UNL or trust at all
163 // Minimum number of nodes to consider the network present
165
166 // Peer networking parameters
167 // 1 = relay, 0 = do not relay (but process), -1 = drop completely (do NOT
168 // process)
171
172 // True to ask peers not to relay current IP.
173 bool PEER_PRIVATE = false;
174 // peers_max is a legacy configuration, which is going to be replaced
175 // with individual inbound peers peers_in_max and outbound peers
176 // peers_out_max configuration. for now we support both the legacy and
177 // the new configuration. if peers_max is configured then peers_in_max and
178 // peers_out_max are ignored.
182
183 // Path searching: these were reasonable default values at some point but
184 // further research is needed to decide if they still are
185 // and whether all of them are needed.
186 //
187 // The performance and resource consumption of a server can
188 // be dramatically impacted by changing these configuration
189 // options; higher values result in exponentially higher
190 // resource usage.
191 //
192 // Servers operating as validators disable path finding by
193 // default by setting the `PATH_SEARCH_MAX` option to 0
194 // unless it is explicitly set in the configuration file.
196 int PATH_SEARCH = 2;
199
200 // Validation
202 VALIDATION_QUORUM; // validations to consider ledger authoritative
203
205
206 // Node storage configuration
209
210 // Tunable that adjusts various parameters, typically associated
211 // with hardware parameters (RAM size and CPU cores). The default
212 // is 'tiny'.
214
215 bool SSL_VERIFY = true;
218
219 // Compression
220 bool COMPRESSION = false;
221
222 // Enable the experimental Ledger Replay functionality
223 bool LEDGER_REPLAY = false;
224
225 // Work queue limits
227 static constexpr int MAX_JOB_QUEUE_TX = 1000;
228 static constexpr int MIN_JOB_QUEUE_TX = 100;
229
230 // Amendment majority time
232
233 // Thread pool configuration (0 = choose for me)
234 int WORKERS = 0; // jobqueue thread count. default: upto 6
235 int IO_WORKERS = 0; // io svc thread count. default: 2
236 int PREFETCH_WORKERS = 0; // prefetch thread count. default: 4
237
238 // Can only be set in code, specifically unit tests
239 bool FORCE_MULTI_THREAD = false;
240
241 // Normally the sweep timer is automatically deduced based on the node
242 // size, but we allow admins to explicitly set it in the config.
244
245 // Reduce-relay - Experimental parameters to control p2p routing algorithms
246
247 // Enable base squelching of duplicate validation/proposal messages
249
251 // Temporary squelching config for the peers selected as a source of //
252 // validator messages. The config must be removed once squelching is //
253 // made the default routing algorithm //
256
257 // Transaction reduce-relay feature
259 // If tx reduce-relay feature is disabled
260 // and this flag is enabled then some
261 // tx-related metrics is collected. It
262 // is ignored if tx reduce-relay feature is
263 // enabled. It is used in debugging to compare
264 // metrics with the feature disabled/enabled.
266 // Minimum peers a server should have before
267 // selecting random peers
269 // Percentage of peers with the tx reduce-relay feature enabled
270 // to relay to out of total active peers
272
273 // These override the command line client settings
275
277
279
280 // How long can a peer remain in the "unknown" state
282
283 // How long can a peer remain in the "diverged" state
285
286 // Enable the beta API version
287 bool BETA_RPC_API = false;
288
289 // First, attempt to load the latest ledger directly from disk.
290 bool FAST_LOAD = false;
291 // When starting rippled with existing database it do not know it has those
292 // ledgers locally until the server naturally tries to backfill. This makes
293 // is difficult to test some functionality (in particular performance
294 // testing sidechains). With this variable the user is able to force rippled
295 // to consider the ledger range to be present. It should be used for testing
296 // only.
299
301
302public:
303 Config();
304
305 /* Be very careful to make sure these bool params
306 are in the right order. */
307 void
308 setup(
309 std::string const& strConf,
310 bool bQuiet,
311 bool bSilent,
312 bool bStandalone);
313
314 void
315 setupControl(bool bQuiet, bool bSilent, bool bStandalone);
316
322 void
323 loadFromString(std::string const& fileContents);
324
325 bool
326 quiet() const
327 {
328 return QUIET;
329 }
330 bool
331 silent() const
332 {
333 return SILENT;
334 }
335 bool
337 {
338 return RUN_STANDALONE;
339 }
340
341 bool
343 {
344 return USE_TX_TABLES;
345 }
346
347 bool
348 canSign() const
349 {
350 return signingEnabled_;
351 }
352
370 int
372 const;
373
375 journal() const
376 {
377 return j_;
378 }
379};
380
381FeeSetup
382setup_FeeVote(Section const& section);
383
384} // namespace ripple
385
386#endif
A generic endpoint for log messages.
Definition Journal.h:60
Holds unparsed configuration information.
bool silent() const
Definition Config.h:331
uint32_t NETWORK_ID
Definition Config.h:156
int PATH_SEARCH
Definition Config.h:196
bool ELB_SUPPORT
Definition Config.h:138
static char const *const databaseDirName
Definition Config.h:90
bool START_VALID
Definition Config.h:149
std::optional< int > SWEEP_INTERVAL
Definition Config.h:243
std::uint32_t LEDGER_HISTORY
Definition Config.h:207
std::optional< std::size_t > VALIDATION_QUORUM
Definition Config.h:202
int PATH_SEARCH_OLD
Definition Config.h:195
std::uint32_t FETCH_DEPTH
Definition Config.h:208
std::string START_LEDGER
Definition Config.h:151
std::optional< std::pair< std::uint32_t, std::uint32_t > > FORCED_LEDGER_RANGE_PRESENT
Definition Config.h:298
std::size_t NETWORK_QUORUM
Definition Config.h:164
std::vector< std::string > IPS_FIXED
Definition Config.h:144
boost::filesystem::path CONFIG_DIR
Definition Config.h:101
void setup(std::string const &strConf, bool bQuiet, bool bSilent, bool bStandalone)
Definition Config.cpp:311
int PREFETCH_WORKERS
Definition Config.h:236
static char const *const configFileName
Definition Config.h:89
bool FORCE_MULTI_THREAD
Definition Config.h:239
bool canSign() const
Definition Config.h:348
std::vector< std::string > IPS
Definition Config.h:141
std::size_t PEERS_IN_MAX
Definition Config.h:181
bool PEER_PRIVATE
Definition Config.h:173
bool standalone() const
Definition Config.h:336
std::optional< beast::IP::Endpoint > rpc_ip
Definition Config.h:274
std::size_t TX_REDUCE_RELAY_MIN_PEERS
Definition Config.h:268
bool VP_REDUCE_RELAY_BASE_SQUELCH_ENABLE
Definition Config.h:248
bool BETA_RPC_API
Definition Config.h:287
beast::Journal const j_
Definition Config.h:108
bool LEDGER_REPLAY
Definition Config.h:223
std::optional< std::size_t > VALIDATOR_LIST_THRESHOLD
Definition Config.h:300
int PATH_SEARCH_MAX
Definition Config.h:198
int PATH_SEARCH_FAST
Definition Config.h:197
int RELAY_UNTRUSTED_PROPOSALS
Definition Config.h:170
beast::Journal journal() const
Definition Config.h:375
bool TX_REDUCE_RELAY_ENABLE
Definition Config.h:258
boost::filesystem::path getDebugLogFile() const
Returns the full path and filename of the debug log file.
Definition Config.cpp:1082
bool FAST_LOAD
Definition Config.h:290
bool quiet() const
Definition Config.h:326
bool TX_REDUCE_RELAY_METRICS
Definition Config.h:265
static constexpr int MIN_JOB_QUEUE_TX
Definition Config.h:228
bool RUN_STANDALONE
Operate in stand-alone mode.
Definition Config.h:121
std::size_t TX_RELAY_PERCENTAGE
Definition Config.h:271
bool useTxTables() const
Definition Config.h:342
std::string SERVER_DOMAIN
Definition Config.h:278
static constexpr int MAX_JOB_QUEUE_TX
Definition Config.h:227
int MAX_TRANSACTIONS
Definition Config.h:226
std::size_t NODE_SIZE
Definition Config.h:213
std::chrono::seconds MAX_DIVERGED_TIME
Definition Config.h:284
std::uint64_t const ramSize_
Definition Config.h:134
bool SSL_VERIFY
Definition Config.h:215
boost::filesystem::path CONFIG_FILE
Definition Config.h:98
bool USE_TX_TABLES
Definition Config.h:123
bool doImport
Definition Config.h:137
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:1116
FeeSetup FEES
Definition Config.h:204
bool signingEnabled_
Determines if the server will sign a tx, given an account's secret seed.
Definition Config.h:131
boost::filesystem::path DEBUG_LOGFILE
Definition Config.h:104
std::string SSL_VERIFY_FILE
Definition Config.h:216
void setupControl(bool bQuiet, bool bSilent, bool bStandalone)
Definition Config.cpp:269
void loadFromString(std::string const &fileContents)
Load the config from the contents of the string.
Definition Config.cpp:479
std::unordered_set< uint256, beast::uhash<> > features
Definition Config.h:276
std::chrono::seconds AMENDMENT_MAJORITY_TIME
Definition Config.h:231
bool COMPRESSION
Definition Config.h:220
static constexpr std::uint32_t FEE_UNITS_DEPRECATED
Definition Config.h:160
static char const *const validatorsFileName
Definition Config.h:91
std::chrono::seconds MAX_UNKNOWN_TIME
Definition Config.h:281
std::size_t VP_REDUCE_RELAY_SQUELCH_MAX_SELECTED_PEERS
Definition Config.h:254
std::size_t PEERS_OUT_MAX
Definition Config.h:180
int RELAY_UNTRUSTED_VALIDATIONS
Definition Config.h:169
std::string SSL_VERIFY_DIR
Definition Config.h:217
StartUpType START_UP
Definition Config.h:147
std::size_t PEERS_MAX
Definition Config.h:179
std::optional< uint256 > TRAP_TX_HASH
Definition Config.h:153
T is_same_v
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
SizedItem
Definition Config.h:44
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:1129
constexpr XRPAmount DROPS_PER_XRP
Number of drops per 1 XRP.
Definition XRPAmount.h:259
Fee schedule for startup / standalone, and to vote for.
Definition Config.h:66
XRPAmount reference_fee
The cost of a reference transaction in drops.
Definition Config.h:68
XRPAmount owner_reserve
The per-owned item reserve requirement in drops.
Definition Config.h:74
XRPAmount account_reserve
The account reserve requirement in drops.
Definition Config.h:71