xrpld
Loading...
Searching...
No Matches
libxrpl/server/Manifest.cpp
1#include <xrpl/server/Manifest.h>
2
3#include <xrpl/basics/Blob.h>
4#include <xrpl/basics/Log.h>
5#include <xrpl/basics/Slice.h>
6#include <xrpl/basics/StringUtilities.h>
7#include <xrpl/basics/base64.h>
8#include <xrpl/basics/base_uint.h>
9#include <xrpl/basics/contract.h>
10#include <xrpl/beast/utility/Journal.h>
11#include <xrpl/beast/utility/instrumentation.h>
12#include <xrpl/json/json_reader.h>
13#include <xrpl/json/json_value.h>
14#include <xrpl/protocol/HashPrefix.h>
15#include <xrpl/protocol/PublicKey.h>
16#include <xrpl/protocol/SField.h>
17#include <xrpl/protocol/SOTemplate.h>
18#include <xrpl/protocol/STExchange.h>
19#include <xrpl/protocol/STObject.h>
20#include <xrpl/protocol/Serializer.h>
21#include <xrpl/protocol/Sign.h>
22#include <xrpl/protocol/tokens.h>
23#include <xrpl/rdb/DatabaseCon.h>
24#include <xrpl/server/Wallet.h>
25
26#include <cstddef>
27#include <cstdint>
28#include <exception>
29#include <format>
30#include <functional>
31#include <limits>
32#include <mutex>
33#include <numeric>
34#include <optional>
35#include <shared_mutex>
36#include <stdexcept>
37#include <string>
38#include <utility>
39#include <vector>
40
41namespace xrpl {
42
43std::string
45{
46 auto const mk = toBase58(TokenType::NodePublic, m.masterKey);
47
48 if (m.revoked())
49 return "Revocation Manifest " + mk;
50
51 if (!m.signingKey)
52 Throw<std::runtime_error>(std::format("No SigningKey in manifest {}", mk));
53
54 return "Manifest " + mk + " (" + std::to_string(m.sequence) + ": " +
56}
57
60{
61 if (s.empty())
62 return std::nullopt;
63
64 // A valid manifest has a fixed maximum size, so reject anything larger
65 // before parsing it.
66 if (s.size() > kMaxManifestBytes)
67 return std::nullopt;
68
69 static SOTemplate const kManifestFormat{
70 // A manifest must include:
71 // - the master public key
72 {sfPublicKey, SoeRequired},
73
74 // - a signature with that public key
75 {sfMasterSignature, SoeRequired},
76
77 // - a sequence number
78 {sfSequence, SoeRequired},
79
80 // It may, optionally, contain:
81 // - a version number which defaults to 0
82 {sfVersion, SoeDefault},
83
84 // - a domain name
85 {sfDomain, SoeOptional},
86
87 // - an ephemeral signing key that can be changed as necessary
88 {sfSigningPubKey, SoeOptional},
89
90 // - a signature using the ephemeral signing key, if it is present
91 {sfSignature, SoeOptional},
92 };
93
94 try
95 {
96 SerialIter sit{s};
97 STObject st{sit, sfGeneric};
98
99 st.applyTemplate(kManifestFormat);
100
101 // We only understand "version 0" manifests at this time:
102 if (st.isFieldPresent(sfVersion) && st.getFieldU16(sfVersion) != 0)
103 return std::nullopt;
104
105 auto const pk = st.getFieldVL(sfPublicKey);
106
107 if (!publicKeyType(makeSlice(pk)))
108 return std::nullopt;
109
110 PublicKey const masterKey = PublicKey(makeSlice(pk));
111 std::uint32_t const seq = st.getFieldU32(sfSequence);
112
113 std::string domain;
114
115 std::optional<PublicKey> signingKey;
116
117 if (st.isFieldPresent(sfDomain))
118 {
119 auto const d = st.getFieldVL(sfDomain);
120
121 domain.assign(reinterpret_cast<char const*>(d.data()), d.size());
122
123 if (!isProperlyFormedTomlDomain(domain))
124 return std::nullopt;
125 }
126
127 bool const hasEphemeralKey = st.isFieldPresent(sfSigningPubKey);
128 bool const hasEphemeralSig = st.isFieldPresent(sfSignature);
129
130 if (Manifest::revoked(seq))
131 {
132 // Revocation manifests should not specify a new signing key
133 // or a signing key signature.
134 if (hasEphemeralKey)
135 return std::nullopt;
136
137 if (hasEphemeralSig)
138 return std::nullopt;
139 }
140 else
141 {
142 // Regular manifests should contain a signing key and an
143 // associated signature.
144 if (!hasEphemeralKey)
145 return std::nullopt;
146
147 if (!hasEphemeralSig)
148 return std::nullopt;
149
150 auto const spk = st.getFieldVL(sfSigningPubKey);
151
152 if (!publicKeyType(makeSlice(spk)))
153 return std::nullopt;
154
155 signingKey.emplace(makeSlice(spk));
156
157 // The signing and master keys can't be the same
158 if (*signingKey == masterKey)
159 return std::nullopt;
160 }
161
162 std::string const serialized(reinterpret_cast<char const*>(s.data()), s.size());
163
164 // If the manifest is revoked, then the signingKey will be unseated
165 return Manifest(serialized, masterKey, signingKey, seq, domain);
166 }
167 catch (std::exception const& ex)
168 {
169 JLOG(journal.error()) << "Exception in " << __func__ << ": " << ex.what();
170 return std::nullopt;
171 }
172}
173
174template <class Stream>
175Stream&
176logMftAct(Stream& s, std::string const& action, PublicKey const& pk, std::uint32_t seq)
177{
178 s << "Manifest: " << action << ";Pk: " << toBase58(TokenType::NodePublic, pk) << ";Seq: " << seq
179 << ";";
180 return s;
181}
182
183template <class Stream>
184Stream&
186 Stream& s,
187 std::string const& action,
188 PublicKey const& pk,
189 std::uint32_t seq,
190 std::uint32_t oldSeq)
191{
192 s << "Manifest: " << action << ";Pk: " << toBase58(TokenType::NodePublic, pk) << ";Seq: " << seq
193 << ";OldSeq: " << oldSeq << ";";
194 return s;
195}
196
197bool
199{
201 SerialIter sit(serialized.data(), serialized.size());
202 st.set(sit);
203
204 // The manifest must either have a signing key or be revoked. This check
205 // prevents us from accessing an unseated signingKey in the next check.
206 if (!revoked() && !signingKey)
207 return false;
208
209 // Signing key and signature are not required for
210 // master key revocations
212 return false;
213
214 return xrpl::verify(st, HashPrefix::Manifest, masterKey, sfMasterSignature);
215}
216
219{
221 SerialIter sit(serialized.data(), serialized.size());
222 st.set(sit);
223 return st.getHash(HashPrefix::Manifest);
224}
225
226bool
228{
229 /*
230 The maximum possible sequence number means that the master key
231 has been revoked.
232 */
233 return revoked(sequence);
234}
235
236bool
238{
239 // The maximum possible sequence number means that the master key has
240 // been revoked.
242}
243
246{
248 SerialIter sit(serialized.data(), serialized.size());
249 st.set(sit);
250 if (!get(st, sfSignature))
251 return std::nullopt;
252 return st.getFieldVL(sfSignature);
253}
254
255Blob
257{
259 SerialIter sit(serialized.data(), serialized.size());
260 st.set(sit);
261 return st.getFieldVL(sfMasterSignature);
262}
263
266{
267 try
268 {
269 std::string tokenStr;
270
271 tokenStr.reserve(
273 blob.cbegin(),
274 blob.cend(),
275 std::size_t(0),
276 [](std::size_t init, std::string const& s) { return init + s.size(); }));
277
278 for (auto const& line : blob)
279 tokenStr += trimWhitespace(line);
280
281 tokenStr = base64Decode(tokenStr);
282
283 json::Reader r;
284 json::Value token;
285
286 if (r.parse(tokenStr, token))
287 {
288 auto const m = token.get("manifest", json::Value{});
289 auto const k = token.get("validation_secret_key", json::Value{});
290
291 if (m.isString() && k.isString())
292 {
293 auto const key = strUnHex(k.asString());
294
295 if (key && key->size() == 32)
296 {
297 return ValidatorToken{
298 .manifest = m.asString(),
299 .validationSecret = makeSlice(*key),
300 };
301 }
302 }
303 }
304
305 return std::nullopt;
306 }
307 catch (std::exception const& ex)
308 {
309 JLOG(journal.error()) << "Exception in " << __func__ << ": " << ex.what();
310 return std::nullopt;
311 }
312}
313
316{
317 std::shared_lock const lock{mutex_};
318 auto const iter = map_.find(pk);
319
320 if (iter != map_.end() && !iter->second.revoked())
321 return iter->second.signingKey;
322
323 return pk;
324}
325
328{
329 std::shared_lock const lock{mutex_};
330
331 if (auto const iter = signingToMasterKeys_.find(pk); iter != signingToMasterKeys_.end())
332 return iter->second;
333
334 return pk;
335}
336
339{
340 std::shared_lock const lock{mutex_};
341 auto const iter = map_.find(pk);
342
343 if (iter != map_.end() && !iter->second.revoked())
344 return iter->second.sequence;
345
346 return std::nullopt;
347}
348
351{
352 std::shared_lock const lock{mutex_};
353 auto const iter = map_.find(pk);
354
355 if (iter != map_.end() && !iter->second.revoked())
356 return iter->second.domain;
357
358 return std::nullopt;
359}
360
363{
364 std::shared_lock const lock{mutex_};
365 auto const iter = map_.find(pk);
366
367 if (iter != map_.end() && !iter->second.revoked())
368 return iter->second.serialized;
369
370 return std::nullopt;
371}
372
373bool
375{
376 std::shared_lock const lock{mutex_};
377 auto const iter = map_.find(pk);
378
379 if (iter != map_.end())
380 return iter->second.revoked();
381
382 return false;
383}
384
387{
388 bool const uncapped = cap == ManifestRateLimitCapPolicy::Uncapped;
389
390 // The signature is checked only on the first `prewriteCheck` run (under the
391 // read lock). It is expensive, so `checkSignature` is cleared the first
392 // time it is read; the second run (under the write lock) skips it.
393 bool checkSignature = true;
394
395 // Check the manifest against the conditions that do not require a
396 // `unique_lock` (write lock) on the `mutex_`.
397 auto const prewriteCheck = [this, &m, &checkSignature](
398 auto const& iter,
399 auto const& lock) -> std::optional<ManifestDisposition> {
400 XRPL_ASSERT(lock.owns_lock(), "xrpl::ManifestCache::applyManifest::prewriteCheck : locked");
401 (void)lock; // not used. parameter is present to ensure the mutex is
402 // locked when the lambda is called.
403 if (iter != map_.end() && m.sequence <= iter->second.sequence)
404 {
405 // We received a manifest whose sequence number is not strictly
406 // greater than the one we already know about. This can happen in
407 // several cases including when we receive manifests from a peer who
408 // doesn't have the latest data.
409 if (auto stream = j_.debug())
410 logMftAct(stream, "Stale", m.masterKey, m.sequence, iter->second.sequence);
412 }
413
414 if (checkSignature)
415 {
416 checkSignature = false;
417 if (!m.verify())
418 {
419 if (auto stream = j_.warn())
420 logMftAct(stream, "Invalid", m.masterKey, m.sequence);
422 }
423 }
424
425 // If the master key associated with a manifest is or might be
426 // compromised and is, therefore, no longer trustworthy.
427 //
428 // A manifest revocation essentially marks a manifest as compromised. By
429 // setting the sequence number to the highest value possible, the
430 // manifest is effectively neutered and cannot be superseded by a forged
431 // one.
432 bool const revoked = m.revoked();
433
434 if (auto stream = j_.warn(); stream && revoked)
435 logMftAct(stream, "Revoked", m.masterKey, m.sequence);
436
437 // Sanity check: the master key of this manifest should not be used as
438 // the ephemeral key of another manifest:
439 if (auto const x = signingToMasterKeys_.find(m.masterKey); x != signingToMasterKeys_.end())
440 {
441 JLOG(j_.warn()) << to_string(m) << ": Master key already used as ephemeral key for "
442 << toBase58(TokenType::NodePublic, x->second);
443
445 }
446
447 if (!revoked)
448 {
449 if (!m.signingKey)
450 {
451 JLOG(j_.warn()) << to_string(m)
452 << ": is not revoked and the manifest has no "
453 "signing key. Hence, the manifest is "
454 "invalid";
456 }
457
458 // Sanity check: the ephemeral key of this manifest should not be
459 // used as the master or ephemeral key of another manifest:
460 if (auto const x = signingToMasterKeys_.find(*m.signingKey);
461 x != signingToMasterKeys_.end())
462 {
463 JLOG(j_.warn()) << to_string(m)
464 << ": Ephemeral key already used as ephemeral key for "
465 << toBase58(TokenType::NodePublic, x->second);
466
468 }
469
470 if (auto const x = map_.find(*m.signingKey); x != map_.end())
471 {
472 JLOG(j_.warn()) << to_string(m) << ": Ephemeral key used as master key for "
473 << to_string(x->second);
474
476 }
477 }
478
479 return std::nullopt;
480 };
481
482 // Reject a brand-new manifest for an unlisted key once the untrusted cap
483 // is full. Updates to a cached key and uncapped manifests always pass.
484 // Called under both the read and write lock, since the cap can be reached
485 // between the two. The lock param enforces that.
486 auto const atUntrustedCap = [this, &m, uncapped](auto const& iter, auto const& lock) {
487 XRPL_ASSERT(
488 lock.owns_lock(), "xrpl::ManifestCache::applyManifest::atUntrustedCap : locked");
489 (void)lock; // not used. parameter is present to ensure the mutex is
490 // locked when the lambda is called.
491 if (iter == map_.end() && !uncapped && untrustedKeys_.size() >= maxUntrustedCount_)
492 {
493 // Log each rejection at debug, but warn only once per interval so a
494 // flood does not fill the log.
495 if (auto stream = j_.debug())
496 logMftAct(stream, "UntrustedCapacity", m.masterKey, m.sequence);
497 if (auto const n = untrustedRejectCount_.fetch_add(1) + 1;
498 n % kUntrustedRejectCount == 0)
499 {
500 JLOG(j_.warn()) << "Untrusted manifest cap reached; " << n
501 << " manifests rejected so far";
502 }
503 return true;
504 }
505 return false;
506 };
507
508 {
509 std::shared_lock const sl{mutex_};
510 auto const iter = map_.find(m.masterKey);
511
512 if (atUntrustedCap(iter, sl))
514
515 if (auto d = prewriteCheck(iter, sl); d.has_value())
516 return *d;
517 }
518
519 std::unique_lock const sl{mutex_};
520 auto const iter = map_.find(m.masterKey);
521
522 // Re-check the cap under the write lock: the cache may have grown while the
523 // read lock above was released.
524 if (atUntrustedCap(iter, sl))
526
527 // Since we released the previously held read lock, it's possible that the
528 // collections have been written to. This means we need to run
529 // `prewriteCheck` again. This re-does work, but `prewriteCheck` is
530 // relatively inexpensive to run, and doing it this way allows us to run
531 // `prewriteCheck` under a `shared_lock` above.
532 // Note, the signature has already been checked above, so it
533 // doesn't need to happen again (signature checks are somewhat expensive).
534 // Note: It's a mistake to use an upgradable lock. This is a recipe for
535 // deadlock.
536 if (auto d = prewriteCheck(iter, sl); d.has_value())
537 return *d;
538
539 bool const revoked = m.revoked();
540 // This is the first manifest we are seeing for a master key. This should
541 // only ever happen once per validator run.
542 if (iter == map_.end())
543 {
544 if (auto stream = j_.info())
545 logMftAct(stream, "AcceptedNew", m.masterKey, m.sequence);
546
547 if (!revoked)
548 {
549 signingToMasterKeys_.emplace(
550 *m.signingKey, m.masterKey); // NOLINT(bugprone-unchecked-optional-access)
551 // non-revoked manifest always has signingKey
552 }
553
554 auto const masterKey = m.masterKey;
555
556 // Count this key against the untrusted cap. Uncapped keys (listed,
557 // configured, or DB-loaded) are not tracked.
558 if (!uncapped)
559 untrustedKeys_.insert(masterKey);
560
561 map_.emplace(masterKey, std::move(m));
562
563 // Something has changed. Keep track of it.
564 seq_++;
565
567 }
568
569 // An ephemeral key was revoked and superseded by a new key. This is
570 // expected, but should happen infrequently.
571 if (auto stream = j_.info())
572 logMftAct(stream, "AcceptedUpdate", m.masterKey, m.sequence, iter->second.sequence);
573
574 // If this key was counted against the cap but now arrives uncapped, free
575 // its slot without waiting for promoteToTrusted.
576 if (uncapped)
577 untrustedKeys_.erase(m.masterKey);
578
580 *iter->second.signingKey); // NOLINT(bugprone-unchecked-optional-access) prewriteCheck
581 // ensures old manifest is not revoked
582
583 if (!revoked)
584 {
585 signingToMasterKeys_.emplace(
586 *m.signingKey, m.masterKey); // NOLINT(bugprone-unchecked-optional-access)
587 // non-revoked manifest always has signingKey
588 }
589
590 iter->second = std::move(m);
591
592 // Something has changed. Keep track of it.
593 seq_++;
594
596}
597
598void
600{
601 // Frees the key's untrusted slot; a no-op (and idempotent) if the key was
602 // never counted. Not re-added on de-listing, so list/de-list cannot grow
603 // the count.
604 std::unique_lock const sl{mutex_};
605 untrustedKeys_.erase(pk);
606}
607
608void
610{
611 auto db = dbCon.checkoutDb();
612 xrpl::getManifests(*db, dbTable, *this, j_);
613}
614
615bool
617 DatabaseCon& dbCon,
618 std::string const& dbTable,
619 std::string const& configManifest,
620 std::vector<std::string> const& configRevocation)
621{
622 load(dbCon, dbTable);
623
624 if (!configManifest.empty())
625 {
626 auto mo = deserializeManifest(base64Decode(configManifest));
627 if (!mo)
628 {
629 JLOG(j_.error()) << "Malformed validator_token in config";
630 return false;
631 }
632
633 if (mo->revoked())
634 {
635 JLOG(j_.warn()) << "Configured manifest revokes public key";
636 }
637
640 {
641 JLOG(j_.error()) << "Manifest in config was rejected";
642 return false;
643 }
644 }
645
646 if (!configRevocation.empty())
647 {
648 std::string revocationStr;
649 revocationStr.reserve(
651 configRevocation.cbegin(),
652 configRevocation.cend(),
653 std::size_t(0),
654 [](std::size_t init, std::string const& s) { return init + s.size(); }));
655
656 for (auto const& line : configRevocation)
657 revocationStr += trimWhitespace(line);
658
659 auto mo = deserializeManifest(base64Decode(revocationStr));
660
661 if (!mo || !mo->revoked() ||
664 {
665 JLOG(j_.error()) << "Invalid validator key revocation in config";
666 return false;
667 }
668 }
669
670 return true;
671}
672
673void
675 DatabaseCon& dbCon,
676 std::string const& dbTable,
677 std::function<bool(PublicKey const&)> const& isTrusted)
678{
679 std::shared_lock const lock{mutex_};
680 auto db = dbCon.checkoutDb();
681
682 saveManifests(*db, dbTable, isTrusted, map_, j_);
683}
684} // namespace xrpl
T accumulate(T... args)
T assign(T... args)
T cbegin(T... args)
A generic endpoint for log messages.
Definition Journal.h:44
Stream error() const
Definition Journal.h:362
Unserialize a JSON document into a Value.
Definition json_reader.h:20
bool parse(std::string const &document, Value &root)
Read a Value from a JSON document.
Represents a JSON value.
Definition json_value.h:121
Value get(UInt index, Value const &defaultValue) const
If the array contains at least index+1 elements, returns the element value, otherwise returns default...
LockedSociSession checkoutDb()
HashMap< PublicKey, Manifest > map_
Active manifests stored by master public key.
Definition Manifest.h:382
std::size_t const maxUntrustedCount_
Maximum number of untrusted master keys kept in the cache.
Definition Manifest.h:407
std::atomic< std::uint32_t > seq_
Definition Manifest.h:389
std::shared_mutex mutex_
Definition Manifest.h:377
bool load(DatabaseCon &dbCon, std::string const &dbTable, std::string const &configManifest, std::vector< std::string > const &configRevocation)
Populate manifest cache with manifests in database and config.
HashMap< PublicKey, PublicKey > signingToMasterKeys_
Master public keys stored by current ephemeral public key.
Definition Manifest.h:387
std::optional< PublicKey > getSigningKey(PublicKey const &pk) const
Returns master key's current signing key.
HashSet< PublicKey > untrustedKeys_
Master keys of cached manifests for validators this node does not list.
Definition Manifest.h:399
ManifestDisposition applyManifest(Manifest m, ManifestRateLimitCapPolicy cap)
Add manifest to cache.
static constexpr std::uint64_t kUntrustedRejectCount
Number of cap rejections between summary warnings.
Definition Manifest.h:422
std::optional< std::string > getDomain(PublicKey const &pk) const
Returns domain claimed by a given public key.
PublicKey getMasterKey(PublicKey const &pk) const
Returns ephemeral signing key's master public key.
std::optional< std::string > getManifest(PublicKey const &pk) const
Returns manifest corresponding to a given public key.
std::optional< std::uint32_t > getSequence(PublicKey const &pk) const
Returns master key's current manifest sequence.
void save(DatabaseCon &dbCon, std::string const &dbTable, std::function< bool(PublicKey const &)> const &isTrusted)
Save cached manifests to database.
std::atomic< std::uint64_t > untrustedRejectCount_
Running count of manifests rejected because the untrusted cap was full.
Definition Manifest.h:415
beast::Journal j_
Definition Manifest.h:376
void promoteToTrusted(PublicKey const &pk)
Stop counting a master key against the untrusted cap.
bool revoked(PublicKey const &pk) const
Returns true if master key has been revoked in a manifest.
A public key.
Definition PublicKey.h:53
Defines the fields and their attributes within a STObject.
Definition SOTemplate.h:105
Blob getFieldVL(SField const &field) const
Definition STObject.cpp:649
std::uint32_t getFieldU32(SField const &field) const
Definition STObject.cpp:601
void applyTemplate(SOTemplate const &type)
Definition STObject.cpp:158
bool isFieldPresent(SField const &field) const
Definition STObject.cpp:464
void set(SOTemplate const &)
Definition STObject.cpp:138
UInt256 getHash(HashPrefix prefix) const
Definition STObject.cpp:375
std::uint16_t getFieldU16(SField const &field) const
Definition STObject.cpp:595
An immutable linear range of bytes.
Definition Slice.h:28
bool empty() const noexcept
Return true if the byte range is empty.
Definition Slice.h:58
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
Definition Slice.h:88
std::size_t size() const noexcept
Returns the number of bytes in the storage.
Definition Slice.h:70
T emplace(T... args)
T empty(T... args)
T cend(T... args)
T format(T... args)
T max(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
Stream & logMftAct(Stream &s, std::string const &action, PublicKey const &pk, std::uint32_t seq)
std::string base64Decode(std::string_view data)
void saveManifests(soci::session &session, std::string const &dbTable, std::function< bool(PublicKey const &)> const &isTrusted, HashMap< PublicKey, Manifest > const &map, beast::Journal j)
saveManifests Saves all given manifests to the database.
Definition Wallet.cpp:104
bool isProperlyFormedTomlDomain(std::string_view domain)
Determines if the given string looks like a TOML-file hosting domain.
T get(Section const &section, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
@ SoeDefault
Definition SOTemplate.h:24
@ SoeOptional
Definition SOTemplate.h:23
@ SoeRequired
Definition SOTemplate.h:22
bool verify(PublicKey const &publicKey, Slice const &m, Slice const &sig) noexcept
Verify a signature on a message.
SField const sfGeneric
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition AccountID.cpp:95
constexpr std::size_t kMaxManifestBytes
Largest a valid manifest can be, in decoded bytes.
Definition Manifest.h:191
std::string trimWhitespace(std::string str)
Remove leading and trailing ASCII whitespace.
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition base_uint.h:658
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
std::optional< Manifest > deserializeManifest(Slice s, beast::Journal journal)
Constructs Manifest from serialized string.
ManifestRateLimitCapPolicy
Whether a manifest counts against the 'untrusted' cache cap.
Definition Manifest.h:363
@ Uncapped
Bypasses the cap (listed/trusted or config manifests).
Definition Manifest.h:365
Slice makeSlice(std::array< T, N > const &a)
Definition Slice.h:228
BaseUInt< 256 > UInt256
Definition base_uint.h:581
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
@ Manifest
Manifest.
Definition HashPrefix.h:84
void getManifests(soci::session &session, std::string const &dbTable, ManifestCache &cache, beast::Journal j)
getManifests Loads a manifest from the wallet database and stores it in the cache.
Definition Wallet.cpp:58
std::vector< unsigned char > Blob
Storage for linear binary data.
Definition Blob.h:11
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
Definition contract.h:52
std::optional< ValidatorToken > loadValidatorToken(std::vector< std::string > const &blob, beast::Journal journal=beast::Journal(beast::Journal::getNullSink()))
ManifestDisposition
Definition Manifest.h:320
@ BadMasterKey
The master key is not acceptable to us.
Definition Manifest.h:325
@ Accepted
Manifest is valid.
Definition Manifest.h:321
@ Invalid
Timely, but invalid signature.
Definition Manifest.h:329
@ BadEphemeralKey
The ephemeral key is not acceptable to us.
Definition Manifest.h:327
@ Stale
Sequence is too old.
Definition Manifest.h:323
@ UntrustedCapacity
Unlisted and limit reached.
Definition Manifest.h:331
T reserve(T... args)
static bool revoked(std::uint32_t sequence)
Returns true if manifest revokes master key.
PublicKey masterKey
The master key associated with this manifest.
Definition Manifest.h:84
std::string serialized
The manifest in serialized form.
Definition Manifest.h:79
Blob getMasterSignature() const
Returns manifest master key signature.
std::optional< Blob > getSignature() const
Returns manifest signature.
UInt256 hash() const
Returns hash of serialized manifest data.
std::optional< PublicKey > signingKey
The ephemeral key associated with this manifest.
Definition Manifest.h:92
std::uint32_t sequence
The sequence number of this manifest.
Definition Manifest.h:97
bool revoked() const
Returns true if manifest revokes master key.
bool verify() const
Returns true if manifest signature is valid.
T to_string(T... args)
T what(T... args)