rippled
Loading...
Searching...
No Matches
Config.h
1#pragma once
2
3#include <xrpl/basics/BasicConfig.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/beast/net/IPEndpoint.h>
6#include <xrpl/beast/utility/Journal.h>
7#include <xrpl/core/StartUpType.h>
8#include <xrpl/protocol/SystemParameters.h> // VFALCO Breaks levelization
9#include <xrpl/rdb/DatabaseCon.h>
10
11#include <boost/filesystem.hpp> // VFALCO FIX: This include should not be here
12
13#include <cstdint>
14#include <optional>
15#include <string>
16#include <unordered_set>
17#include <utility>
18#include <vector>
19
20namespace xrpl {
21
22class Rules;
23
24//------------------------------------------------------------------------------
25
41
48{
51
54
57
58 /* (Remember to update the example cfg files when changing any of these
59 * values.) */
60};
61
62// This entire derived class is deprecated.
63// For new config information use the style implied
64// in the base class. For existing config information
65// try to refactor code to use the new style.
66//
67class Config : public BasicConfig
68{
69public:
70 // Settings related to the configuration file location and directories
71 static char const* const configFileName;
72 static char const* const configLegacyName;
73 static char const* const databaseDirName;
74 static char const* const validatorsFileName;
75
77 boost::filesystem::path
78 getDebugLogFile() const;
79
80private:
81 boost::filesystem::path CONFIG_FILE;
82
83public:
84 boost::filesystem::path CONFIG_DIR;
85
86private:
87 boost::filesystem::path DEBUG_LOGFILE;
88
89 void
90 load();
92
93 bool QUIET = false; // Minimize logging verbosity.
94 bool SILENT = false; // No output to console after startup.
104 bool RUN_STANDALONE = false;
105
106 bool USE_TX_TABLES = true;
107
114 bool signingEnabled_ = false;
115
116 // The amount of RAM, in bytes, that we detected on this system.
118
119public:
120 bool doImport = false;
121 bool ELB_SUPPORT = false;
122
123 // Entries from [ips] config stanza
125
126 // Entries from [ips_fixed] config stanza
128
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
183 std::optional<std::size_t> 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.
279
281
282public:
283 Config();
284
285 /* Be very careful to make sure these bool params
286 are in the right order. */
287 void
288 setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStandalone);
289
290 void
291 setupControl(bool bQuiet, bool bSilent, bool bStandalone);
292
298 void
299 loadFromString(std::string const& fileContents);
300
301 bool
302 quiet() const
303 {
304 return QUIET;
305 }
306 bool
307 silent() const
308 {
309 return SILENT;
310 }
311 bool
313 {
314 return RUN_STANDALONE;
315 }
316
317 bool
319 {
320 return USE_TX_TABLES;
321 }
322
323 bool
324 canSign() const
325 {
326 return signingEnabled_;
327 }
328
346 int
348
350 journal() const
351 {
352 return j_;
353 }
354};
355
356FeeSetup
357setup_FeeVote(Section const& section);
358
359DatabaseCon::Setup
361
362} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:40
Holds unparsed configuration information.
uint32_t NETWORK_ID
Definition Config.h:138
std::unordered_set< uint256, beast::uhash<> > features
Definition Config.h:257
bool ELB_SUPPORT
Definition Config.h:121
bool COMPRESSION
Definition Config.h:201
static char const *const configLegacyName
Definition Config.h:72
boost::filesystem::path DEBUG_LOGFILE
Definition Config.h:87
void load()
Definition Config.cpp:418
bool doImport
Definition Config.h:120
StartUpType START_UP
Definition Config.h:129
std::optional< std::size_t > VALIDATOR_LIST_THRESHOLD
Definition Config.h:280
boost::filesystem::path CONFIG_FILE
Definition Config.h:81
bool silent() const
Definition Config.h:307
bool TX_REDUCE_RELAY_ENABLE
Definition Config.h:239
static char const *const configFileName
Definition Config.h:71
int MAX_TRANSACTIONS
Definition Config.h:207
bool quiet() const
Definition Config.h:302
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:255
bool BETA_RPC_API
Definition Config.h:268
std::chrono::seconds MAX_DIVERGED_TIME
Definition Config.h:265
beast::Journal const j_
Definition Config.h:91
std::vector< std::string > IPS
Definition Config.h:124
bool standalone() const
Definition Config.h:312
bool RUN_STANDALONE
Operate in stand-alone mode.
Definition Config.h:104
int PATH_SEARCH_FAST
Definition Config.h:179
std::string SSL_VERIFY_FILE
Definition Config.h:197
std::size_t PEERS_OUT_MAX
Definition Config.h:162
std::string SERVER_DOMAIN
Definition Config.h:259
int RELAY_UNTRUSTED_VALIDATIONS
Definition Config.h:151
bool SILENT
Definition Config.h:94
std::string SSL_VERIFY_DIR
Definition Config.h:198
void setup(std::string const &strConf, bool bQuiet, bool bSilent, bool bStandalone)
Definition Config.cpp:278
std::string START_LEDGER
Definition Config.h:133
bool USE_TX_TABLES
Definition Config.h:106
beast::Journal journal() const
Definition Config.h:350
std::optional< std::size_t > VALIDATION_QUORUM
Definition Config.h:183
static constexpr int MAX_JOB_QUEUE_TX
Definition Config.h:208
std::uint64_t const ramSize_
Definition Config.h:117
int PREFETCH_WORKERS
Definition Config.h:217
std::size_t TX_RELAY_PERCENTAGE
Definition Config.h:252
void loadFromString(std::string const &fileContents)
Load the config from the contents of the string.
Definition Config.cpp:440
std::optional< std::pair< std::uint32_t, std::uint32_t > > FORCED_LEDGER_RANGE_PRESENT
Definition Config.h:278
static constexpr std::uint32_t FEE_UNITS_DEPRECATED
Definition Config.h:142
bool FORCE_MULTI_THREAD
Definition Config.h:220
bool SSL_VERIFY
Definition Config.h:196
boost::filesystem::path getDebugLogFile() const
Returns the full path and filename of the debug log file.
Definition Config.cpp:982
bool QUIET
Definition Config.h:93
bool TX_REDUCE_RELAY_METRICS
Definition Config.h:246
std::chrono::seconds MAX_UNKNOWN_TIME
Definition Config.h:262
static constexpr int MIN_JOB_QUEUE_TX
Definition Config.h:209
bool PEER_PRIVATE
Definition Config.h:155
static char const *const validatorsFileName
Definition Config.h:74
std::uint32_t LEDGER_HISTORY
Definition Config.h:188
std::size_t NODE_SIZE
Definition Config.h:194
bool useTxTables() const
Definition Config.h:318
bool FAST_LOAD
Definition Config.h:271
std::size_t PEERS_MAX
Definition Config.h:161
std::uint32_t FETCH_DEPTH
Definition Config.h:189
bool signingEnabled_
Determines if the server will sign a tx, given an account's secret seed.
Definition Config.h:114
int PATH_SEARCH
Definition Config.h:178
std::optional< int > SWEEP_INTERVAL
Definition Config.h:224
void setupControl(bool bQuiet, bool bSilent, bool bStandalone)
Definition Config.cpp:244
std::size_t NETWORK_QUORUM
Definition Config.h:146
FeeSetup FEES
Definition Config.h:185
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:1015
bool VP_REDUCE_RELAY_BASE_SQUELCH_ENABLE
Definition Config.h:229
int IO_WORKERS
Definition Config.h:216
std::vector< std::string > IPS_FIXED
Definition Config.h:127
std::chrono::seconds AMENDMENT_MAJORITY_TIME
Definition Config.h:212
int RELAY_UNTRUSTED_PROPOSALS
Definition Config.h:152
bool canSign() const
Definition Config.h:324
bool START_VALID
Definition Config.h:131
std::size_t VP_REDUCE_RELAY_SQUELCH_MAX_SELECTED_PEERS
Definition Config.h:235
int WORKERS
Definition Config.h:215
std::size_t TX_REDUCE_RELAY_MIN_PEERS
Definition Config.h:249
boost::filesystem::path CONFIG_DIR
Definition Config.h:84
bool LEDGER_REPLAY
Definition Config.h:204
static char const *const databaseDirName
Definition Config.h:73
T is_same_v
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
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:1024
SizedItem
Definition Config.h:26
DatabaseCon::Setup setup_DatabaseCon(Config const &c, std::optional< beast::Journal > j=std::nullopt)
Definition Config.cpp:1043
constexpr XRPAmount DROPS_PER_XRP
Number of drops per 1 XRP.
Definition XRPAmount.h:237
StartUpType
Definition StartUpType.h:8
Fee schedule for startup / standalone, and to vote for.
Definition Config.h:48
XRPAmount reference_fee
The cost of a reference transaction in drops.
Definition Config.h:50
XRPAmount account_reserve
The account reserve requirement in drops.
Definition Config.h:53
XRPAmount owner_reserve
The per-owned item reserve requirement in drops.
Definition Config.h:56