rippled
STTx.cpp
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 #include <ripple/basics/Log.h>
21 #include <ripple/basics/StringUtilities.h>
22 #include <ripple/basics/contract.h>
23 #include <ripple/basics/safe_cast.h>
24 #include <ripple/json/to_string.h>
25 #include <ripple/protocol/Feature.h>
26 #include <ripple/protocol/HashPrefix.h>
27 #include <ripple/protocol/Protocol.h>
28 #include <ripple/protocol/PublicKey.h>
29 #include <ripple/protocol/STAccount.h>
30 #include <ripple/protocol/STArray.h>
31 #include <ripple/protocol/STTx.h>
32 #include <ripple/protocol/Sign.h>
33 #include <ripple/protocol/TxFlags.h>
34 #include <ripple/protocol/UintTypes.h>
35 #include <ripple/protocol/jss.h>
36 #include <boost/format.hpp>
37 #include <array>
38 #include <memory>
39 #include <type_traits>
40 #include <utility>
41 
42 namespace ripple {
43 
44 static auto
46 {
47  auto format = TxFormats::getInstance().findByType(type);
48 
49  if (format == nullptr)
50  {
51  Throw<std::runtime_error>(
52  "Invalid transaction type " +
54  }
55 
56  return format;
57 }
58 
59 STTx::STTx(STObject&& object) : STObject(std::move(object))
60 {
61  tx_type_ = safe_cast<TxType>(getFieldU16(sfTransactionType));
62  applyTemplate(getTxFormat(tx_type_)->getSOTemplate()); // may throw
64 }
65 
67 {
68  int length = sit.getBytesLeft();
69 
70  if ((length < txMinSizeBytes) || (length > txMaxSizeBytes))
71  Throw<std::runtime_error>("Transaction length invalid");
72 
73  if (set(sit))
74  Throw<std::runtime_error>("Transaction contains an object terminator");
75 
76  tx_type_ = safe_cast<TxType>(getFieldU16(sfTransactionType));
77 
78  applyTemplate(getTxFormat(tx_type_)->getSOTemplate()); // May throw
80 }
81 
82 STTx::STTx(TxType type, std::function<void(STObject&)> assembler)
84 {
85  auto format = getTxFormat(type);
86 
87  set(format->getSOTemplate());
88  setFieldU16(sfTransactionType, format->getType());
89 
90  assembler(*this);
91 
92  tx_type_ = safe_cast<TxType>(getFieldU16(sfTransactionType));
93 
94  if (tx_type_ != type)
95  LogicError("Transaction type was mutated during assembly");
96 
98 }
99 
100 STBase*
101 STTx::copy(std::size_t n, void* buf) const
102 {
103  return emplace(n, buf, *this);
104 }
105 
106 STBase*
107 STTx::move(std::size_t n, void* buf)
108 {
109  return emplace(n, buf, std::move(*this));
110 }
111 
112 // STObject functions.
115 {
116  return STI_TRANSACTION;
117 }
118 
121 {
122  std::string ret = "\"";
123  ret += to_string(getTransactionID());
124  ret += "\" = {";
125  ret += STObject::getFullText();
126  ret += "}";
127  return ret;
128 }
129 
130 boost::container::flat_set<AccountID>
132 {
133  boost::container::flat_set<AccountID> list;
134 
135  for (auto const& it : *this)
136  {
137  if (auto sacc = dynamic_cast<STAccount const*>(&it))
138  {
139  assert(!sacc->isDefault());
140  if (!sacc->isDefault())
141  list.insert(sacc->value());
142  }
143  else if (auto samt = dynamic_cast<STAmount const*>(&it))
144  {
145  auto const& issuer = samt->getIssuer();
146  if (!isXRP(issuer))
147  list.insert(issuer);
148  }
149  }
150 
151  return list;
152 }
153 
154 static Blob
155 getSigningData(STTx const& that)
156 {
157  Serializer s;
159  that.addWithoutSigningFields(s);
160  return s.getData();
161 }
162 
163 uint256
165 {
167 }
168 
169 Blob
171 {
172  try
173  {
174  return getFieldVL(sfTxnSignature);
175  }
176  catch (std::exception const&)
177  {
178  return Blob();
179  }
180 }
181 
182 SeqProxy
184 {
186  if (seq != 0)
187  return SeqProxy::sequence(seq);
188 
190  if (!ticketSeq)
191  // No TicketSequence specified. Return the Sequence, whatever it is.
192  return SeqProxy::sequence(seq);
193 
194  return SeqProxy{SeqProxy::ticket, *ticketSeq};
195 }
196 
197 void
198 STTx::sign(PublicKey const& publicKey, SecretKey const& secretKey)
199 {
200  auto const data = getSigningData(*this);
201 
202  auto const sig = ripple::sign(publicKey, secretKey, makeSlice(data));
203 
206 }
207 
210  RequireFullyCanonicalSig requireCanonicalSig,
211  Rules const& rules) const
212 {
213  try
214  {
215  // Determine whether we're single- or multi-signing by looking
216  // at the SigningPubKey. If it's empty we must be
217  // multi-signing. Otherwise we're single-signing.
218  Blob const& signingPubKey = getFieldVL(sfSigningPubKey);
219  return signingPubKey.empty()
220  ? checkMultiSign(requireCanonicalSig, rules)
221  : checkSingleSign(requireCanonicalSig);
222  }
223  catch (std::exception const&)
224  {
225  }
226  return Unexpected("Internal signature check failure.");
227 }
228 
230 {
232  ret[jss::hash] = to_string(getTransactionID());
233  return ret;
234 }
235 
237 STTx::getJson(JsonOptions options, bool binary) const
238 {
239  if (binary)
240  {
241  Json::Value ret;
243  ret[jss::tx] = strHex(s.peekData());
244  ret[jss::hash] = to_string(getTransactionID());
245  return ret;
246  }
247  return getJson(options);
248 }
249 
250 std::string const&
252 {
253  static std::string const sql =
254  "INSERT OR REPLACE INTO Transactions "
255  "(TransID, TransType, FromAcct, FromSeq, LedgerSeq, Status, RawTxn, "
256  "TxnMeta)"
257  " VALUES ";
258 
259  return sql;
260 }
261 
263 STTx::getMetaSQL(std::uint32_t inLedger, std::string const& escapedMetaData)
264  const
265 {
266  Serializer s;
267  add(s);
268  return getMetaSQL(s, inLedger, txnSqlValidated, escapedMetaData);
269 }
270 
271 // VFALCO This could be a free function elsewhere
274  Serializer rawTxn,
275  std::uint32_t inLedger,
276  char status,
277  std::string const& escapedMetaData) const
278 {
279  static boost::format bfTrans(
280  "('%s', '%s', '%s', '%d', '%d', '%c', %s, %s)");
281  std::string rTxn = sqlBlobLiteral(rawTxn.peekData());
282 
283  auto format = TxFormats::getInstance().findByType(tx_type_);
284  assert(format != nullptr);
285 
286  return str(
287  boost::format(bfTrans) % to_string(getTransactionID()) %
288  format->getName() % toBase58(getAccountID(sfAccount)) %
289  getFieldU32(sfSequence) % inLedger % status % rTxn % escapedMetaData);
290 }
291 
294 {
295  // We don't allow both a non-empty sfSigningPubKey and an sfSigners.
296  // That would allow the transaction to be signed two ways. So if both
297  // fields are present the signature is invalid.
299  return Unexpected("Cannot both single- and multi-sign.");
300 
301  bool validSig = false;
302  try
303  {
304  bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
305  (requireCanonicalSig == RequireFullyCanonicalSig::yes);
306 
307  auto const spk = getFieldVL(sfSigningPubKey);
308 
309  if (publicKeyType(makeSlice(spk)))
310  {
311  Blob const signature = getFieldVL(sfTxnSignature);
312  Blob const data = getSigningData(*this);
313 
314  validSig = verify(
315  PublicKey(makeSlice(spk)),
316  makeSlice(data),
317  makeSlice(signature),
319  }
320  }
321  catch (std::exception const&)
322  {
323  // Assume it was a signature failure.
324  validSig = false;
325  }
326  if (validSig == false)
327  return Unexpected("Invalid signature.");
328  // Signature was verified.
329  return {};
330 }
331 
334  RequireFullyCanonicalSig requireCanonicalSig,
335  Rules const& rules) const
336 {
337  // Make sure the MultiSigners are present. Otherwise they are not
338  // attempting multi-signing and we just have a bad SigningPubKey.
340  return Unexpected("Empty SigningPubKey.");
341 
342  // We don't allow both an sfSigners and an sfTxnSignature. Both fields
343  // being present would indicate that the transaction is signed both ways.
345  return Unexpected("Cannot both single- and multi-sign.");
346 
347  STArray const& signers{getFieldArray(sfSigners)};
348 
349  // There are well known bounds that the number of signers must be within.
350  if (signers.size() < minMultiSigners ||
351  signers.size() > maxMultiSigners(&rules))
352  return Unexpected("Invalid Signers array size.");
353 
354  // We can ease the computational load inside the loop a bit by
355  // pre-constructing part of the data that we hash. Fill a Serializer
356  // with the stuff that stays constant from signature to signature.
357  Serializer const dataStart{startMultiSigningData(*this)};
358 
359  // We also use the sfAccount field inside the loop. Get it once.
360  auto const txnAccountID = getAccountID(sfAccount);
361 
362  // Determine whether signatures must be full canonical.
363  bool const fullyCanonical = (getFlags() & tfFullyCanonicalSig) ||
364  (requireCanonicalSig == RequireFullyCanonicalSig::yes);
365 
366  // Signers must be in sorted order by AccountID.
367  AccountID lastAccountID(beast::zero);
368 
369  for (auto const& signer : signers)
370  {
371  auto const accountID = signer.getAccountID(sfAccount);
372 
373  // The account owner may not multisign for themselves.
374  if (accountID == txnAccountID)
375  return Unexpected("Invalid multisigner.");
376 
377  // No duplicate signers allowed.
378  if (lastAccountID == accountID)
379  return Unexpected("Duplicate Signers not allowed.");
380 
381  // Accounts must be in order by account ID. No duplicates allowed.
382  if (lastAccountID > accountID)
383  return Unexpected("Unsorted Signers array.");
384 
385  // The next signature must be greater than this one.
386  lastAccountID = accountID;
387 
388  // Verify the signature.
389  bool validSig = false;
390  try
391  {
392  Serializer s = dataStart;
393  finishMultiSigningData(accountID, s);
394 
395  auto spk = signer.getFieldVL(sfSigningPubKey);
396 
397  if (publicKeyType(makeSlice(spk)))
398  {
399  Blob const signature = signer.getFieldVL(sfTxnSignature);
400 
401  validSig = verify(
402  PublicKey(makeSlice(spk)),
403  s.slice(),
404  makeSlice(signature),
406  }
407  }
408  catch (std::exception const&)
409  {
410  // We assume any problem lies with the signature.
411  validSig = false;
412  }
413  if (!validSig)
414  return Unexpected(
415  std::string("Invalid signature on account ") +
416  toBase58(accountID) + ".");
417  }
418  // All signatures verified.
419  return {};
420 }
421 
422 //------------------------------------------------------------------------------
423 
424 static bool
425 isMemoOkay(STObject const& st, std::string& reason)
426 {
427  if (!st.isFieldPresent(sfMemos))
428  return true;
429 
430  auto const& memos = st.getFieldArray(sfMemos);
431 
432  // The number 2048 is a preallocation hint, not a hard limit
433  // to avoid allocate/copy/free's
434  Serializer s(2048);
435  memos.add(s);
436 
437  // FIXME move the memo limit into a config tunable
438  if (s.getDataLength() > 1024)
439  {
440  reason = "The memo exceeds the maximum allowed size.";
441  return false;
442  }
443 
444  for (auto const& memo : memos)
445  {
446  auto memoObj = dynamic_cast<STObject const*>(&memo);
447 
448  if (!memoObj || (memoObj->getFName() != sfMemo))
449  {
450  reason = "A memo array may contain only Memo objects.";
451  return false;
452  }
453 
454  for (auto const& memoElement : *memoObj)
455  {
456  auto const& name = memoElement.getFName();
457 
458  if (name != sfMemoType && name != sfMemoData &&
459  name != sfMemoFormat)
460  {
461  reason =
462  "A memo may contain only MemoType, MemoData or "
463  "MemoFormat fields.";
464  return false;
465  }
466 
467  // The raw data is stored as hex-octets, which we want to decode.
468  auto optData = strUnHex(memoElement.getText());
469 
470  if (!optData)
471  {
472  reason =
473  "The MemoType, MemoData and MemoFormat fields may "
474  "only contain hex-encoded data.";
475  return false;
476  }
477 
478  if (name == sfMemoData)
479  continue;
480 
481  // The only allowed characters for MemoType and MemoFormat are the
482  // characters allowed in URLs per RFC 3986: alphanumerics and the
483  // following symbols: -._~:/?#[]@!$&'()*+,;=%
484  static constexpr std::array<char, 256> const allowedSymbols = []() {
486 
487  std::string_view symbols(
488  "0123456789"
489  "-._~:/?#[]@!$&'()*+,;=%"
490  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
491  "abcdefghijklmnopqrstuvwxyz");
492 
493  for (char c : symbols)
494  a[c] = 1;
495  return a;
496  }();
497 
498  for (auto c : *optData)
499  {
500  if (!allowedSymbols[c])
501  {
502  reason =
503  "The MemoType and MemoFormat fields may only "
504  "contain characters that are allowed in URLs "
505  "under RFC 3986.";
506  return false;
507  }
508  }
509  }
510  }
511 
512  return true;
513 }
514 
515 // Ensure all account fields are 160-bits
516 static bool
518 {
519  for (int i = 0; i < st.getCount(); ++i)
520  {
521  auto t = dynamic_cast<STAccount const*>(st.peekAtPIndex(i));
522  if (t && t->isDefault())
523  return false;
524  }
525 
526  return true;
527 }
528 
529 bool
531 {
532  if (!isMemoOkay(st, reason))
533  return false;
534 
535  if (!isAccountFieldOkay(st))
536  {
537  reason = "An account field is invalid.";
538  return false;
539  }
540 
541  if (isPseudoTx(st))
542  {
543  reason = "Cannot submit pseudo transactions.";
544  return false;
545  }
546  return true;
547 }
548 
550 sterilize(STTx const& stx)
551 {
552  Serializer s;
553  stx.add(s);
554  SerialIter sit(s.slice());
555  return std::make_shared<STTx const>(std::ref(sit));
556 }
557 
558 bool
560 {
561  auto t = tx[~sfTransactionType];
562  if (!t)
563  return false;
564  auto tt = safe_cast<TxType>(*t);
565  return tt == ttAMENDMENT || tt == ttFEE || tt == ttUNL_MODIFY;
566 }
567 
568 } // namespace ripple
ripple::getTxFormat
static auto getTxFormat(TxType type)
Definition: STTx.cpp:45
ripple::isAccountFieldOkay
static bool isAccountFieldOkay(STObject const &st)
Definition: STTx.cpp:517
ripple::STObject::getFieldArray
const STArray & getFieldArray(SField const &field) const
Definition: STObject.cpp:624
ripple::STObject::applyTemplate
void applyTemplate(const SOTemplate &type)
Definition: STObject.cpp:116
ripple::Blob
std::vector< unsigned char > Blob
Storage for linear binary data.
Definition: Blob.h:30
ripple::STTx::getMetaSQL
std::string getMetaSQL(std::uint32_t inLedger, std::string const &escapedMetaData) const
Definition: STTx.cpp:263
ripple::makeSlice
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Definition: Slice.h:241
std::string
STL class.
std::shared_ptr
STL class.
ripple::sfSigners
const SField sfSigners
utility
ripple::SeqProxy::ticket
@ ticket
Definition: SeqProxy.h:58
std::exception
STL class.
ripple::STObject::setFieldU16
void setFieldU16(SField const &field, std::uint16_t)
Definition: STObject.cpp:653
ripple::JsonOptions
JsonOptions
Definition: STBase.h:34
std::string_view
STL class.
ripple::STObject::peekAtPIndex
const STBase * peekAtPIndex(int offset) const
Definition: STObject.h:932
ripple::sfSequence
const SF_UINT32 sfSequence
ripple::txMinSizeBytes
constexpr std::size_t txMinSizeBytes
Protocol specific constants.
Definition: Protocol.h:40
ripple::verify
bool verify(PublicKey const &publicKey, Slice const &m, Slice const &sig, bool mustBeFullyCanonical) noexcept
Verify a signature on a message.
Definition: PublicKey.cpp:272
std::vector< unsigned char >
ripple::sfSigningPubKey
const SF_VL sfSigningPubKey
ripple::SerializedTypeID
SerializedTypeID
Definition: SField.h:52
ripple::Unexpected
Unexpected(E(&)[N]) -> Unexpected< E const * >
ripple::ttFEE
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
Definition: TxFormats.h:152
ripple::toBase58
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition: AccountID.cpp:104
ripple::tfFullyCanonicalSig
constexpr std::uint32_t tfFullyCanonicalSig
Transaction flags.
Definition: TxFlags.h:58
ripple::STObject::getSerializer
Serializer getSerializer() const
Definition: STObject.h:898
ripple::SeqProxy::sequence
static constexpr SeqProxy sequence(std::uint32_t v)
Factory function to return a sequence-based SeqProxy.
Definition: SeqProxy.h:76
ripple::TxType
TxType
Transaction type identifiers.
Definition: TxFormats.h:56
ripple::STTx::getSigningHash
uint256 getSigningHash() const
Definition: STTx.cpp:164
ripple::STTx::getSeqProxy
SeqProxy getSeqProxy() const
Definition: STTx.cpp:183
ripple::sfTicketSequence
const SF_UINT32 sfTicketSequence
ripple::STTx::getMetaSQLInsertReplaceHeader
static std::string const & getMetaSQLInsertReplaceHeader()
Definition: STTx.cpp:251
std::function
ripple::STObject::setFieldVL
void setFieldVL(SField const &field, Blob const &)
Definition: STObject.cpp:695
ripple::STObject::getFieldVL
Blob getFieldVL(SField const &field) const
Definition: STObject.cpp:595
ripple::ttAMENDMENT
@ ttAMENDMENT
This system-generated transaction type is used to update the status of the various amendments.
Definition: TxFormats.h:146
ripple::ECDSACanonicality::fullyCanonical
@ fullyCanonical
ripple::finishMultiSigningData
void finishMultiSigningData(AccountID const &signingID, Serializer &s)
Definition: Sign.h:85
ripple::STObject::getFullText
std::string getFullText() const override
Definition: STObject.cpp:254
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:550
std::underlying_type_t
ripple::publicKeyType
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
Definition: PublicKey.cpp:207
ripple::Serializer::getDataLength
int getDataLength() const
Definition: Serializer.h:184
ripple::base_uint< 160, detail::AccountIDTag >
ripple::sfTransactionType
const SF_UINT16 sfTransactionType
ripple::isPseudoTx
bool isPseudoTx(STObject const &tx)
Check whether a transaction is a pseudo-transaction.
Definition: STTx.cpp:559
ripple::getSigningData
static Blob getSigningData(STTx const &that)
Definition: STTx.cpp:155
ripple::ttUNL_MODIFY
@ ttUNL_MODIFY
This system-generated transaction type is used to update the network's negative UNL.
Definition: TxFormats.h:158
ripple::Expected
Definition: Expected.h:132
ripple::sfMemos
const SField sfMemos
ripple::passesLocalChecks
bool passesLocalChecks(STObject const &st, std::string &reason)
Definition: STTx.cpp:530
ripple::STBase::emplace
static STBase * emplace(std::size_t n, void *buf, T &&val)
Definition: STBase.h:165
ripple::TxFormats::getInstance
static TxFormats const & getInstance()
Definition: TxFormats.cpp:334
ripple::PublicKey
A public key.
Definition: PublicKey.h:59
ripple::STObject::getAccountID
AccountID getAccountID(SField const &field) const
Definition: STObject.cpp:589
ripple::JsonOptions::none
@ none
ripple::STTx::getFullText
std::string getFullText() const override
Definition: STTx.cpp:120
ripple::safe_cast
constexpr std::enable_if_t< std::is_same_v< typename Dest::unit_type, typename Src::unit_type > &&std::is_integral_v< typename Dest::value_type > &&std::is_integral_v< typename Src::value_type >, Dest > safe_cast(Src s) noexcept
Definition: FeeUnits.h:532
ripple::startMultiSigningData
Serializer startMultiSigningData(STObject const &obj)
Break the multi-signing hash computation into 2 parts for optimization.
Definition: Sign.cpp:95
ripple::STArray
Definition: STArray.h:28
std::to_string
T to_string(T... args)
ripple::isMemoOkay
static bool isMemoOkay(STObject const &st, std::string &reason)
Definition: STTx.cpp:425
array
ripple::STAmount
Definition: STAmount.h:45
ripple::Serializer::slice
Slice slice() const noexcept
Definition: Serializer.h:63
ripple::txnSqlValidated
@ txnSqlValidated
Definition: STTx.h:40
ripple::STObject::getFlags
std::uint32_t getFlags() const
Definition: STObject.cpp:481
ripple::STTx
Definition: STTx.h:45
ripple::isXRP
bool isXRP(AccountID const &c)
Definition: AccountID.h:89
ripple::SerialIter
Definition: Serializer.h:310
ripple::HashPrefix::transactionID
@ transactionID
transaction plus signature to give transaction ID
ripple::STTx::maxMultiSigners
static std::size_t maxMultiSigners(Rules const *rules=0)
Definition: STTx.h:55
std::uint32_t
ripple::SecretKey
A secret key.
Definition: SecretKey.h:36
ripple::STObject::addWithoutSigningFields
void addWithoutSigningFields(Serializer &s) const
Definition: STObject.h:889
ripple::txMaxSizeBytes
constexpr std::size_t txMaxSizeBytes
Largest legal byte size of a transaction.
Definition: Protocol.h:43
ripple::STTx::sign
void sign(PublicKey const &publicKey, SecretKey const &secretKey)
Definition: STTx.cpp:198
ripple::STObject::getFieldU16
std::uint16_t getFieldU16(SField const &field) const
Definition: STObject.cpp:553
ripple::STTx::getJson
Json::Value getJson(JsonOptions options) const override
Definition: STTx.cpp:229
memory
ripple::STTx::getTransactionID
uint256 getTransactionID() const
Definition: STTx.h:191
ripple::Serializer
Definition: Serializer.h:39
ripple::STAccount
Definition: STAccount.h:29
ripple::sfMemoData
const SF_VL sfMemoData
ripple::STObject::add
void add(Serializer &s) const override
Definition: STObject.cpp:85
ripple::sfTxnSignature
const SF_VL sfTxnSignature
ripple::STObject
Definition: STObject.h:51
ripple::STTx::checkSingleSign
Expected< void, std::string > checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const
Definition: STTx.cpp:293
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::sterilize
std::shared_ptr< STTx const > sterilize(STTx const &stx)
Sterilize a transaction.
Definition: STTx.cpp:550
ripple::STObject::getSigningHash
uint256 getSigningHash(HashPrefix prefix) const
Definition: STObject.cpp:348
ripple::STTx::RequireFullyCanonicalSig::yes
@ yes
ripple::SerialIter::getBytesLeft
int getBytesLeft() const noexcept
Definition: Serializer.h:341
ripple::STTx::STTx
STTx()=delete
ripple::STTx::checkSign
Expected< void, std::string > checkSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const &rules) const
Definition: STTx.cpp:209
ripple::sign
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &m)
Generate a signature for a message.
Definition: SecretKey.cpp:238
ripple::STBase
A type which can be exported to a well known binary format.
Definition: STBase.h:66
ripple::STTx::getSignature
Blob getSignature() const
Definition: STTx.cpp:170
std
STL namespace.
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:48
ripple::STObject::isFieldPresent
bool isFieldPresent(SField const &field) const
Definition: STObject.cpp:428
ripple::STTx::tid_
uint256 tid_
Definition: STTx.h:47
ripple::Serializer::peekData
Blob const & peekData() const
Definition: Serializer.h:168
ripple::STTx::getMentionedAccounts
boost::container::flat_set< AccountID > getMentionedAccounts() const
Definition: STTx.cpp:131
ripple::SeqProxy
A type that represents either a sequence value or a ticket value.
Definition: SeqProxy.h:55
std::vector::empty
T empty(T... args)
ripple::Rules
Rules controlling protocol behavior.
Definition: Rules.h:33
ripple::STTx::minMultiSigners
static const std::size_t minMultiSigners
Definition: STTx.h:51
std::optional< std::uint32_t >
ripple::STObject::getCount
int getCount() const
Definition: STObject.h:914
ripple::STTx::copy
STBase * copy(std::size_t n, void *buf) const override
Definition: STTx.cpp:101
std::size_t
ripple::to_string
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Definition: app/misc/impl/Manifest.cpp:41
ripple::sfMemo
const SField sfMemo
ripple::sfAccount
const SF_ACCOUNT sfAccount
ripple::Serializer::add32
int add32(std::uint32_t i)
Definition: Serializer.cpp:38
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
ripple::Serializer::getData
Blob getData() const
Definition: Serializer.h:173
ripple::HashPrefix::txSign
@ txSign
inner transaction to sign
ripple::STObject::operator[]
T::value_type operator[](TypedField< T > const &f) const
Get the value of a field.
Definition: STObject.h:945
ripple::STObject::getFieldU32
std::uint32_t getFieldU32(SField const &field) const
Definition: STObject.cpp:559
ripple::STObject::getJson
Json::Value getJson(JsonOptions options) const override
Definition: STObject.cpp:725
ripple::strUnHex
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
Definition: StringUtilities.h:50
ripple::STTx::checkMultiSign
Expected< void, std::string > checkMultiSign(RequireFullyCanonicalSig requireCanonicalSig, Rules const &rules) const
Definition: STTx.cpp:333
ripple::STObject::set
void set(const SOTemplate &)
Definition: STObject.cpp:100
ripple::STTx::move
STBase * move(std::size_t n, void *buf) override
Definition: STTx.cpp:107
ripple::STTx::RequireFullyCanonicalSig
RequireFullyCanonicalSig
Check the signature.
Definition: STTx.h:120
type_traits
ripple::KnownFormats::findByType
Item const * findByType(KeyType type) const
Retrieve a format based on its type.
Definition: KnownFormats.h:127
ripple::sfTransaction
const SField sfTransaction
ripple::sqlBlobLiteral
std::string sqlBlobLiteral(Blob const &blob)
Format arbitrary binary data as an SQLite "blob literal".
Definition: StringUtilities.cpp:33
ripple::STTx::getSType
SerializedTypeID getSType() const override
Definition: STTx.cpp:114
std::ref
T ref(T... args)
Json::Value
Represents a JSON value.
Definition: json_value.h:145
ripple::STI_TRANSACTION
@ STI_TRANSACTION
Definition: SField.h:82
ripple::STTx::tx_type_
TxType tx_type_
Definition: STTx.h:48
ripple::STObject::getHash
uint256 getHash(HashPrefix prefix) const
Definition: STObject.cpp:339
ripple::sfMemoFormat
const SF_VL sfMemoFormat
ripple::sfMemoType
const SF_VL sfMemoType