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