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