diff --git a/AccountCurrencies__test_8cpp_source.html b/AccountCurrencies__test_8cpp_source.html index 681fff3d6b..2f9e996006 100644 --- a/AccountCurrencies__test_8cpp_source.html +++ b/AccountCurrencies__test_8cpp_source.html @@ -281,10 +281,10 @@ $(function() {
Json::Value::isMember
bool isMember(const char *key) const
Return true if the object has a member named key.
Definition: json_value.cpp:932
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::AccountCurrencies_test::run
void run() override
Definition: AccountCurrencies_test.cpp:194
-
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:111
+
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:112
std::vector::begin
T begin(T... args)
Json::StaticString
Lightweight wrapper to tag static string.
Definition: json_value.h:60
-
ripple::tfClearFreeze
constexpr std::uint32_t tfClearFreeze
Definition: TxFlags.h:112
+
ripple::tfClearFreeze
constexpr std::uint32_t tfClearFreeze
Definition: TxFlags.h:113
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
std::vector::end
T end(T... args)
ripple::AccountCurrencies_test::testBasic
void testBasic()
Definition: AccountCurrencies_test.cpp:96
diff --git a/AccountDelete__test_8cpp_source.html b/AccountDelete__test_8cpp_source.html index 6ce35478b0..b170d1fb78 100644 --- a/AccountDelete__test_8cpp_source.html +++ b/AccountDelete__test_8cpp_source.html @@ -1029,7 +1029,7 @@ $(function() {
ripple::tecDST_TAG_NEEDED
@ tecDST_TAG_NEEDED
Definition: TER.h:276
ripple::test::AccountDelete_test::testAmendmentEnable
void testAmendmentEnable()
Definition: AccountDelete_test.cpp:551
ripple::keylet::offer
Keylet offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
Definition: Indexes.cpp:222
-
ripple::tfClose
constexpr std::uint32_t tfClose
Definition: TxFlags.h:123
+
ripple::tfClose
constexpr std::uint32_t tfClose
Definition: TxFlags.h:124
ripple::test::jtx::Account::human
std::string const & human() const
Returns the human readable public key.
Definition: Account.h:113
ripple::test::AccountDelete_test::testDirectories
void testDirectories()
Definition: AccountDelete_test.cpp:262
ripple::test::AccountDelete_test::verifyDeliveredAmount
void verifyDeliveredAmount(jtx::Env &env, STAmount const &amount)
Definition: AccountDelete_test.cpp:41
@@ -1105,7 +1105,7 @@ $(function() {
ripple::keylet::depositPreauth
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
Definition: Indexes.cpp:287
ripple::sfPublicKey
const SF_VL sfPublicKey
ripple::test::jtx::Account::pk
PublicKey const & pk() const
Return the public key.
Definition: Account.h:89
-
ripple::tfImmediateOrCancel
constexpr std::uint32_t tfImmediateOrCancel
Definition: TxFlags.h:94
+
ripple::tfImmediateOrCancel
constexpr std::uint32_t tfImmediateOrCancel
Definition: TxFlags.h:95
ripple::test::jtx::Env::current
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition: Env.h:300
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:116
ripple::tecNO_DST
@ tecNO_DST
Definition: TER.h:257
diff --git a/AccountLinesRPC__test_8cpp_source.html b/AccountLinesRPC__test_8cpp_source.html index a726021796..a50cb63527 100644 --- a/AccountLinesRPC__test_8cpp_source.html +++ b/AccountLinesRPC__test_8cpp_source.html @@ -1551,7 +1551,7 @@ $(function() {
1480 } // namespace ripple
ripple::RPC::BEAST_DEFINE_TESTSUITE
BEAST_DEFINE_TESTSUITE(AccountLinesRPC, app, ripple)
-
ripple::tfTransferable
constexpr const std::uint32_t tfTransferable
Definition: TxFlags.h:130
+
ripple::tfTransferable
constexpr const std::uint32_t tfTransferable
Definition: TxFlags.h:131
ripple::test::jtx::XRP
const XRP_t XRP
Converts to XRP Issue or STAmount.
Definition: amount.cpp:105
ripple::RPC::AccountLinesRPC_test::testAccountLineDelete2
void testAccountLineDelete2()
Definition: AccountLinesRPC_test.cpp:1365
std::string
STL class.
@@ -1564,7 +1564,7 @@ $(function() {
std::string::find
T find(T... args)
std::size
T size(T... args)
ripple::test::jtx::trust
Json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
Definition: trust.cpp:30
-
ripple::tfSetNoRipple
constexpr std::uint32_t tfSetNoRipple
Definition: TxFlags.h:109
+
ripple::tfSetNoRipple
constexpr std::uint32_t tfSetNoRipple
Definition: TxFlags.h:110
ripple::keylet::offer
Keylet offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
Definition: Indexes.cpp:222
ripple::RPC::AccountLinesRPC_test::ledger3Info
const LedgerInfo ledger3Info
Definition: AccountLinesRPC_test.cpp:851
ripple::RPC::AccountLinesRPC_test::gw1Currencies
std::vector< IOU > gw1Currencies
Definition: AccountLinesRPC_test.cpp:923
@@ -1589,7 +1589,7 @@ $(function() {
std::to_string
T to_string(T... args)
ripple::RPC::AccountLinesRPC_test::linesD
const auto linesD
Definition: AccountLinesRPC_test.cpp:1230
ripple::RPC::AccountLinesRPC_test::ledger4Info
const LedgerInfo ledger4Info
Definition: AccountLinesRPC_test.cpp:937
-
ripple::tfSellNFToken
constexpr const std::uint32_t tfSellNFToken
Definition: TxFlags.h:152
+
ripple::tfSellNFToken
constexpr const std::uint32_t tfSellNFToken
Definition: TxFlags.h:153
Json::Value::isMember
bool isMember(const char *key) const
Return true if the object has a member named key.
Definition: json_value.cpp:932
ripple::RPC::AccountLinesRPC_test::gw2Currencies
std::vector< IOU > gw2Currencies
Definition: AccountLinesRPC_test.cpp:948
ripple::RPC::AccountLinesRPC_test::linesB
const auto linesB
Definition: AccountLinesRPC_test.cpp:1182
@@ -1599,10 +1599,10 @@ $(function() {
ripple::RPC::AccountLinesRPC_test::gw2
const Account gw2
Definition: AccountLinesRPC_test.cpp:942
ripple::rpcACT_MALFORMED
@ rpcACT_MALFORMED
Definition: ErrorCodes.h:90
ripple::sfLedgerEntryType
const SF_UINT16 sfLedgerEntryType
-
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:111
+
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:112
ripple::test::jtx::pay
Json::Value pay(Account const &account, Account const &to, AnyAmount amount)
Create a payment.
Definition: pay.cpp:29
ripple::keylet::payChan
Keylet payChan(AccountID const &src, AccountID const &dst, std::uint32_t seq) noexcept
A PaymentChannel.
Definition: Indexes.cpp:324
-
ripple::tfSetfAuth
constexpr std::uint32_t tfSetfAuth
Definition: TxFlags.h:108
+
ripple::tfSetfAuth
constexpr std::uint32_t tfSetfAuth
Definition: TxFlags.h:109
ripple::asfRequireAuth
constexpr std::uint32_t asfRequireAuth
Definition: TxFlags.h:75
ripple::RPC::AccountLinesRPC_test::lineA
auto const & lineA
Definition: AccountLinesRPC_test.cpp:1320
std::optional< std::string >
diff --git a/AccountLines_8cpp_source.html b/AccountLines_8cpp_source.html index 951ed9de05..844d42c4df 100644 --- a/AccountLines_8cpp_source.html +++ b/AccountLines_8cpp_source.html @@ -334,7 +334,7 @@ $(function() {
ripple::ltANY
@ ltANY
A special type, matching any ledger entry type.
Definition: LedgerFormats.h:176
ripple::forEachItemAfter
bool forEachItemAfter(ReadView const &view, Keylet const &root, uint256 const &after, std::uint64_t const hint, unsigned int limit, std::function< bool(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items after an item in the given directory.
Definition: View.cpp:394
ripple::STAmount::issue
Issue const & issue() const
Definition: STAmount.h:347
-
ripple::lsfLowReserve
@ lsfLowReserve
Definition: LedgerFormats.h:252
+
ripple::lsfLowReserve
@ lsfLowReserve
Definition: LedgerFormats.h:255
ripple::Resource::feeMediumBurdenRPC
const Charge feeMediumBurdenRPC
Json::arrayValue
@ arrayValue
array value (ordered list)
Definition: json_value.h:42
ripple::RPC::Context::loadType
Resource::Charge & loadType
Definition: Context.h:43
@@ -374,7 +374,7 @@ $(function() {
ripple::STObject::getFieldU32
std::uint32_t getFieldU32(SField const &field) const
Definition: STObject.cpp:559
ripple::base_uint::parseHex
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition: base_uint.h:496
ripple::RPC::JsonContext::params
Json::Value params
Definition: Context.h:64
-
ripple::lsfHighReserve
@ lsfHighReserve
Definition: LedgerFormats.h:253
+
ripple::lsfHighReserve
@ lsfHighReserve
Definition: LedgerFormats.h:256
ripple::RPC::inject_error
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
Definition: ErrorCodes.h:212
ripple::STObject::getFieldAmount
STAmount const & getFieldAmount(SField const &field) const
Definition: STObject.cpp:603
ripple::RPC::isRelatedToAccount
bool isRelatedToAccount(ReadView const &ledger, std::shared_ptr< SLE const > const &sle, AccountID const &accountID)
Tests if a SLE is owned by accountID.
Definition: RPCHelpers.cpp:113
diff --git a/AccountObjects__test_8cpp_source.html b/AccountObjects__test_8cpp_source.html index 567305dd97..34d74aa827 100644 --- a/AccountObjects__test_8cpp_source.html +++ b/AccountObjects__test_8cpp_source.html @@ -887,7 +887,7 @@ $(function() {
ripple::sfSignerWeight
const SF_UINT16 sfSignerWeight
ripple::test::AccountObjects_test::testObjectTypes
void testObjectTypes()
Definition: AccountObjects_test.cpp:540
-
ripple::tfTransferable
constexpr const std::uint32_t tfTransferable
Definition: TxFlags.h:130
+
ripple::tfTransferable
constexpr const std::uint32_t tfTransferable
Definition: TxFlags.h:131
ripple::test::jtx::XRP
const XRP_t XRP
Converts to XRP Issue or STAmount.
Definition: amount.cpp:105
ripple::sfSendMax
const SF_AMOUNT sfSendMax
std::string
STL class.
@@ -901,7 +901,7 @@ $(function() {
std::size
T size(T... args)
ripple::test::jtx::Account::human
std::string const & human() const
Returns the human readable public key.
Definition: Account.h:113
ripple::sfTicketSequence
const SF_UINT32 sfTicketSequence
-
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:93
+
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:94
Json::Reader
Unserialize a JSON document into a Value.
Definition: json_reader.h:36
ripple::SField::jsonName
const Json::StaticString jsonName
Definition: SField.h:136
std::sort
T sort(T... args)
diff --git a/AccountSet__test_8cpp_source.html b/AccountSet__test_8cpp_source.html index dfe7d8befa..8be58fb068 100644 --- a/AccountSet__test_8cpp_source.html +++ b/AccountSet__test_8cpp_source.html @@ -164,508 +164,514 @@ $(function() {
93  // and are tested elsewhere
94  continue;
95  }
-
96 
-
97  if (std::find(goodFlags.begin(), goodFlags.end(), flag) !=
-
98  goodFlags.end())
-
99  {
-
100  // Good flag
-
101  env.require(nflags(alice, flag));
-
102  env(fset(alice, flag), sig(alice));
-
103  env.close();
-
104  env.require(flags(alice, flag));
-
105  env(fclear(alice, flag), sig(alie));
-
106  env.close();
+
96  if (flag == asfAllowClawback)
+
97  {
+
98  // The asfAllowClawback flag can't be cleared. It is tested
+
99  // elsewhere.
+
100  continue;
+
101  }
+
102 
+
103  if (std::find(goodFlags.begin(), goodFlags.end(), flag) !=
+
104  goodFlags.end())
+
105  {
+
106  // Good flag
107  env.require(nflags(alice, flag));
-
108  std::uint32_t const now_flags = (*env.le(alice))[sfFlags];
-
109  BEAST_EXPECT(now_flags == orig_flags);
-
110  }
-
111  else
-
112  {
-
113  // Bad flag
-
114  BEAST_EXPECT((*env.le(alice))[sfFlags] == orig_flags);
-
115  env(fset(alice, flag), sig(alice));
-
116  env.close();
-
117  BEAST_EXPECT((*env.le(alice))[sfFlags] == orig_flags);
-
118  env(fclear(alice, flag), sig(alie));
-
119  env.close();
+
108  env(fset(alice, flag), sig(alice));
+
109  env.close();
+
110  env.require(flags(alice, flag));
+
111  env(fclear(alice, flag), sig(alie));
+
112  env.close();
+
113  env.require(nflags(alice, flag));
+
114  std::uint32_t const now_flags = (*env.le(alice))[sfFlags];
+
115  BEAST_EXPECT(now_flags == orig_flags);
+
116  }
+
117  else
+
118  {
+
119  // Bad flag
120  BEAST_EXPECT((*env.le(alice))[sfFlags] == orig_flags);
-
121  }
-
122  }
-
123  };
-
124 
-
125  // Test with featureDepositAuth disabled.
-
126  testFlags(
-
127  {asfRequireDest,
-
128  asfRequireAuth,
-
129  asfDisallowXRP,
-
130  asfGlobalFreeze,
-
131  asfDisableMaster,
-
132  asfDefaultRipple});
-
133 
-
134  // Enable featureDepositAuth and retest.
-
135  env.enableFeature(featureDepositAuth);
-
136  env.close();
-
137  testFlags(
-
138  {asfRequireDest,
-
139  asfRequireAuth,
-
140  asfDisallowXRP,
-
141  asfGlobalFreeze,
-
142  asfDisableMaster,
-
143  asfDefaultRipple,
-
144  asfDepositAuth});
-
145  }
-
146 
-
147  void
-
148  testSetAndResetAccountTxnID()
-
149  {
-
150  testcase("Set and reset AccountTxnID");
-
151 
-
152  using namespace test::jtx;
-
153  Env env(*this);
-
154  Account const alice("alice");
-
155  env.fund(XRP(10000), noripple(alice));
-
156 
-
157  std::uint32_t const orig_flags = (*env.le(alice))[sfFlags];
-
158 
-
159  // asfAccountTxnID is special and not actually set as a flag,
-
160  // so we check the field presence instead
-
161  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfAccountTxnID));
-
162  env(fset(alice, asfAccountTxnID), sig(alice));
-
163  BEAST_EXPECT(env.le(alice)->isFieldPresent(sfAccountTxnID));
-
164  env(fclear(alice, asfAccountTxnID));
-
165  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfAccountTxnID));
-
166  std::uint32_t const now_flags = (*env.le(alice))[sfFlags];
-
167  BEAST_EXPECT(now_flags == orig_flags);
-
168  }
-
169 
-
170  void
-
171  testSetNoFreeze()
-
172  {
-
173  testcase("Set NoFreeze");
-
174 
-
175  using namespace test::jtx;
-
176  Env env(*this);
-
177  Account const alice("alice");
-
178  env.fund(XRP(10000), noripple(alice));
-
179  env.memoize("eric");
-
180  env(regkey(alice, "eric"));
-
181 
-
182  env.require(nflags(alice, asfNoFreeze));
-
183  env(fset(alice, asfNoFreeze), sig("eric"), ter(tecNEED_MASTER_KEY));
-
184  env(fset(alice, asfNoFreeze), sig(alice));
-
185  env.require(flags(alice, asfNoFreeze));
-
186  env(fclear(alice, asfNoFreeze), sig(alice));
-
187  // verify flag is still set (clear does not clear in this case)
-
188  env.require(flags(alice, asfNoFreeze));
-
189  }
-
190 
-
191  void
-
192  testDomain()
-
193  {
-
194  testcase("Domain");
-
195 
-
196  using namespace test::jtx;
-
197  Env env(*this);
-
198  Account const alice("alice");
-
199  env.fund(XRP(10000), alice);
-
200  auto jt = noop(alice);
-
201  // The Domain field is represented as the hex string of the lowercase
-
202  // ASCII of the domain. For example, the domain example.com would be
-
203  // represented as "6578616d706c652e636f6d".
-
204  //
-
205  // To remove the Domain field from an account, send an AccountSet with
-
206  // the Domain set to an empty string.
-
207  std::string const domain = "example.com";
-
208  jt[sfDomain.fieldName] = strHex(domain);
-
209  env(jt);
-
210  BEAST_EXPECT((*env.le(alice))[sfDomain] == makeSlice(domain));
-
211 
-
212  jt[sfDomain.fieldName] = "";
-
213  env(jt);
-
214  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfDomain));
-
215 
-
216  // The upper limit on the length is 256 bytes
-
217  // (defined as DOMAIN_BYTES_MAX in SetAccount)
-
218  // test the edge cases: 255, 256, 257.
-
219  std::size_t const maxLength = 256;
-
220  for (std::size_t len = maxLength - 1; len <= maxLength + 1; ++len)
-
221  {
-
222  std::string domain2 =
-
223  std::string(len - domain.length() - 1, 'a') + "." + domain;
-
224 
-
225  BEAST_EXPECT(domain2.length() == len);
-
226 
-
227  jt[sfDomain.fieldName] = strHex(domain2);
-
228 
-
229  if (len <= maxLength)
-
230  {
-
231  env(jt);
-
232  BEAST_EXPECT((*env.le(alice))[sfDomain] == makeSlice(domain2));
-
233  }
-
234  else
-
235  {
-
236  env(jt, ter(telBAD_DOMAIN));
-
237  }
-
238  }
-
239  }
-
240 
-
241  void
-
242  testMessageKey()
-
243  {
-
244  testcase("MessageKey");
-
245 
-
246  using namespace test::jtx;
-
247  Env env(*this);
-
248  Account const alice("alice");
-
249  env.fund(XRP(10000), alice);
-
250  auto jt = noop(alice);
+
121  env(fset(alice, flag), sig(alice));
+
122  env.close();
+
123  BEAST_EXPECT((*env.le(alice))[sfFlags] == orig_flags);
+
124  env(fclear(alice, flag), sig(alie));
+
125  env.close();
+
126  BEAST_EXPECT((*env.le(alice))[sfFlags] == orig_flags);
+
127  }
+
128  }
+
129  };
+
130 
+
131  // Test with featureDepositAuth disabled.
+
132  testFlags(
+
133  {asfRequireDest,
+
134  asfRequireAuth,
+
135  asfDisallowXRP,
+
136  asfGlobalFreeze,
+
137  asfDisableMaster,
+
138  asfDefaultRipple});
+
139 
+
140  // Enable featureDepositAuth and retest.
+
141  env.enableFeature(featureDepositAuth);
+
142  env.close();
+
143  testFlags(
+
144  {asfRequireDest,
+
145  asfRequireAuth,
+
146  asfDisallowXRP,
+
147  asfGlobalFreeze,
+
148  asfDisableMaster,
+
149  asfDefaultRipple,
+
150  asfDepositAuth});
+
151  }
+
152 
+
153  void
+
154  testSetAndResetAccountTxnID()
+
155  {
+
156  testcase("Set and reset AccountTxnID");
+
157 
+
158  using namespace test::jtx;
+
159  Env env(*this);
+
160  Account const alice("alice");
+
161  env.fund(XRP(10000), noripple(alice));
+
162 
+
163  std::uint32_t const orig_flags = (*env.le(alice))[sfFlags];
+
164 
+
165  // asfAccountTxnID is special and not actually set as a flag,
+
166  // so we check the field presence instead
+
167  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfAccountTxnID));
+
168  env(fset(alice, asfAccountTxnID), sig(alice));
+
169  BEAST_EXPECT(env.le(alice)->isFieldPresent(sfAccountTxnID));
+
170  env(fclear(alice, asfAccountTxnID));
+
171  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfAccountTxnID));
+
172  std::uint32_t const now_flags = (*env.le(alice))[sfFlags];
+
173  BEAST_EXPECT(now_flags == orig_flags);
+
174  }
+
175 
+
176  void
+
177  testSetNoFreeze()
+
178  {
+
179  testcase("Set NoFreeze");
+
180 
+
181  using namespace test::jtx;
+
182  Env env(*this);
+
183  Account const alice("alice");
+
184  env.fund(XRP(10000), noripple(alice));
+
185  env.memoize("eric");
+
186  env(regkey(alice, "eric"));
+
187 
+
188  env.require(nflags(alice, asfNoFreeze));
+
189  env(fset(alice, asfNoFreeze), sig("eric"), ter(tecNEED_MASTER_KEY));
+
190  env(fset(alice, asfNoFreeze), sig(alice));
+
191  env.require(flags(alice, asfNoFreeze));
+
192  env(fclear(alice, asfNoFreeze), sig(alice));
+
193  // verify flag is still set (clear does not clear in this case)
+
194  env.require(flags(alice, asfNoFreeze));
+
195  }
+
196 
+
197  void
+
198  testDomain()
+
199  {
+
200  testcase("Domain");
+
201 
+
202  using namespace test::jtx;
+
203  Env env(*this);
+
204  Account const alice("alice");
+
205  env.fund(XRP(10000), alice);
+
206  auto jt = noop(alice);
+
207  // The Domain field is represented as the hex string of the lowercase
+
208  // ASCII of the domain. For example, the domain example.com would be
+
209  // represented as "6578616d706c652e636f6d".
+
210  //
+
211  // To remove the Domain field from an account, send an AccountSet with
+
212  // the Domain set to an empty string.
+
213  std::string const domain = "example.com";
+
214  jt[sfDomain.fieldName] = strHex(domain);
+
215  env(jt);
+
216  BEAST_EXPECT((*env.le(alice))[sfDomain] == makeSlice(domain));
+
217 
+
218  jt[sfDomain.fieldName] = "";
+
219  env(jt);
+
220  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfDomain));
+
221 
+
222  // The upper limit on the length is 256 bytes
+
223  // (defined as DOMAIN_BYTES_MAX in SetAccount)
+
224  // test the edge cases: 255, 256, 257.
+
225  std::size_t const maxLength = 256;
+
226  for (std::size_t len = maxLength - 1; len <= maxLength + 1; ++len)
+
227  {
+
228  std::string domain2 =
+
229  std::string(len - domain.length() - 1, 'a') + "." + domain;
+
230 
+
231  BEAST_EXPECT(domain2.length() == len);
+
232 
+
233  jt[sfDomain.fieldName] = strHex(domain2);
+
234 
+
235  if (len <= maxLength)
+
236  {
+
237  env(jt);
+
238  BEAST_EXPECT((*env.le(alice))[sfDomain] == makeSlice(domain2));
+
239  }
+
240  else
+
241  {
+
242  env(jt, ter(telBAD_DOMAIN));
+
243  }
+
244  }
+
245  }
+
246 
+
247  void
+
248  testMessageKey()
+
249  {
+
250  testcase("MessageKey");
251 
-
252  auto const rkp = randomKeyPair(KeyType::ed25519);
-
253  jt[sfMessageKey.fieldName] = strHex(rkp.first.slice());
-
254  env(jt);
-
255  BEAST_EXPECT(
-
256  strHex((*env.le(alice))[sfMessageKey]) ==
-
257  strHex(rkp.first.slice()));
-
258 
-
259  jt[sfMessageKey.fieldName] = "";
+
252  using namespace test::jtx;
+
253  Env env(*this);
+
254  Account const alice("alice");
+
255  env.fund(XRP(10000), alice);
+
256  auto jt = noop(alice);
+
257 
+
258  auto const rkp = randomKeyPair(KeyType::ed25519);
+
259  jt[sfMessageKey.fieldName] = strHex(rkp.first.slice());
260  env(jt);
-
261  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfMessageKey));
-
262 
-
263  using namespace std::string_literals;
-
264  jt[sfMessageKey.fieldName] = strHex("NOT_REALLY_A_PUBKEY"s);
-
265  env(jt, ter(telBAD_PUBLIC_KEY));
-
266  }
-
267 
-
268  void
-
269  testWalletID()
-
270  {
-
271  testcase("WalletID");
-
272 
-
273  using namespace test::jtx;
-
274  Env env(*this);
-
275  Account const alice("alice");
-
276  env.fund(XRP(10000), alice);
-
277  auto jt = noop(alice);
+
261  BEAST_EXPECT(
+
262  strHex((*env.le(alice))[sfMessageKey]) ==
+
263  strHex(rkp.first.slice()));
+
264 
+
265  jt[sfMessageKey.fieldName] = "";
+
266  env(jt);
+
267  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfMessageKey));
+
268 
+
269  using namespace std::string_literals;
+
270  jt[sfMessageKey.fieldName] = strHex("NOT_REALLY_A_PUBKEY"s);
+
271  env(jt, ter(telBAD_PUBLIC_KEY));
+
272  }
+
273 
+
274  void
+
275  testWalletID()
+
276  {
+
277  testcase("WalletID");
278 
-
279  std::string const locator =
-
280  "9633EC8AF54F16B5286DB1D7B519EF49EEFC050C0C8AC4384F1D88ACD1BFDF05";
-
281  jt[sfWalletLocator.fieldName] = locator;
-
282  env(jt);
-
283  BEAST_EXPECT(to_string((*env.le(alice))[sfWalletLocator]) == locator);
+
279  using namespace test::jtx;
+
280  Env env(*this);
+
281  Account const alice("alice");
+
282  env.fund(XRP(10000), alice);
+
283  auto jt = noop(alice);
284 
-
285  jt[sfWalletLocator.fieldName] = "";
-
286  env(jt);
-
287  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfWalletLocator));
-
288  }
-
289 
-
290  void
-
291  testEmailHash()
-
292  {
-
293  testcase("EmailHash");
-
294 
-
295  using namespace test::jtx;
-
296  Env env(*this);
-
297  Account const alice("alice");
-
298  env.fund(XRP(10000), alice);
-
299  auto jt = noop(alice);
+
285  std::string const locator =
+
286  "9633EC8AF54F16B5286DB1D7B519EF49EEFC050C0C8AC4384F1D88ACD1BFDF05";
+
287  jt[sfWalletLocator.fieldName] = locator;
+
288  env(jt);
+
289  BEAST_EXPECT(to_string((*env.le(alice))[sfWalletLocator]) == locator);
+
290 
+
291  jt[sfWalletLocator.fieldName] = "";
+
292  env(jt);
+
293  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfWalletLocator));
+
294  }
+
295 
+
296  void
+
297  testEmailHash()
+
298  {
+
299  testcase("EmailHash");
300 
-
301  std::string const mh("5F31A79367DC3137FADA860C05742EE6");
-
302  jt[sfEmailHash.fieldName] = mh;
-
303  env(jt);
-
304  BEAST_EXPECT(to_string((*env.le(alice))[sfEmailHash]) == mh);
-
305 
-
306  jt[sfEmailHash.fieldName] = "";
-
307  env(jt);
-
308  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfEmailHash));
-
309  }
-
310 
-
311  void
-
312  testTransferRate()
-
313  {
-
314  struct test_results
-
315  {
-
316  double set;
-
317  TER code;
-
318  double get;
-
319  };
-
320 
-
321  testcase("TransferRate");
-
322 
-
323  using namespace test::jtx;
-
324  auto doTests = [this](
-
325  FeatureBitset const& features,
-
326  std::initializer_list<test_results> testData) {
-
327  Env env(*this, features);
+
301  using namespace test::jtx;
+
302  Env env(*this);
+
303  Account const alice("alice");
+
304  env.fund(XRP(10000), alice);
+
305  auto jt = noop(alice);
+
306 
+
307  std::string const mh("5F31A79367DC3137FADA860C05742EE6");
+
308  jt[sfEmailHash.fieldName] = mh;
+
309  env(jt);
+
310  BEAST_EXPECT(to_string((*env.le(alice))[sfEmailHash]) == mh);
+
311 
+
312  jt[sfEmailHash.fieldName] = "";
+
313  env(jt);
+
314  BEAST_EXPECT(!env.le(alice)->isFieldPresent(sfEmailHash));
+
315  }
+
316 
+
317  void
+
318  testTransferRate()
+
319  {
+
320  struct test_results
+
321  {
+
322  double set;
+
323  TER code;
+
324  double get;
+
325  };
+
326 
+
327  testcase("TransferRate");
328 
-
329  Account const alice("alice");
-
330  env.fund(XRP(10000), alice);
-
331 
-
332  for (auto const& r : testData)
-
333  {
-
334  env(rate(alice, r.set), ter(r.code));
-
335  env.close();
-
336 
-
337  // If the field is not present expect the default value
-
338  if (!(*env.le(alice))[~sfTransferRate])
-
339  BEAST_EXPECT(r.get == 1.0);
-
340  else
-
341  BEAST_EXPECT(
-
342  *(*env.le(alice))[~sfTransferRate] ==
-
343  r.get * QUALITY_ONE);
-
344  }
-
345  };
-
346 
-
347  doTests(
-
348  supported_amendments(),
-
349  {{1.0, tesSUCCESS, 1.0},
-
350  {1.1, tesSUCCESS, 1.1},
-
351  {2.0, tesSUCCESS, 2.0},
-
352  {2.1, temBAD_TRANSFER_RATE, 2.0},
-
353  {0.0, tesSUCCESS, 1.0},
-
354  {2.0, tesSUCCESS, 2.0},
-
355  {0.9, temBAD_TRANSFER_RATE, 2.0}});
-
356  }
-
357 
-
358  void
-
359  testGateway()
-
360  {
-
361  testcase("Gateway");
-
362 
-
363  using namespace test::jtx;
-
364 
-
365  Account const alice("alice");
-
366  Account const bob("bob");
-
367  Account const gw("gateway");
-
368  auto const USD = gw["USD"];
-
369 
-
370  // Test gateway with a variety of allowed transfer rates
-
371  for (double transferRate = 1.0; transferRate <= 2.0;
-
372  transferRate += 0.03125)
-
373  {
-
374  Env env(*this);
-
375  env.fund(XRP(10000), gw, alice, bob);
-
376  env.close();
-
377  env.trust(USD(10), alice, bob);
-
378  env.close();
-
379  env(rate(gw, transferRate));
-
380  env.close();
-
381 
-
382  auto const amount = USD(1);
-
383  Rate const rate(transferRate * QUALITY_ONE);
-
384  auto const amountWithRate =
-
385  toAmount<STAmount>(multiply(amount.value(), rate));
-
386 
-
387  env(pay(gw, alice, USD(10)));
-
388  env.close();
-
389  env(pay(alice, bob, USD(1)), sendmax(USD(10)));
-
390  env.close();
-
391 
-
392  env.require(balance(alice, USD(10) - amountWithRate));
-
393  env.require(balance(bob, USD(1)));
-
394  }
-
395 
-
396  // Since fix1201 was enabled on Nov 14 2017 a rate in excess of
-
397  // 2.0 has been blocked by the transactor. But there are a few
-
398  // accounts on the MainNet that have larger-than-currently-allowed
-
399  // TransferRates. We'll bypass the transactor so we can check
-
400  // operation of these legacy TransferRates.
-
401  //
-
402  // Two out-of-bound values are currently in the ledger (March 2020)
-
403  // They are 4.0 and 4.294967295. So those are the values we test.
-
404  for (double transferRate : {4.0, 4.294967295})
-
405  {
-
406  Env env(*this);
-
407  env.fund(XRP(10000), gw, alice, bob);
-
408  env.close();
-
409  env.trust(USD(10), alice, bob);
-
410  env.close();
-
411 
-
412  // We'd like to use transferRate here, but the transactor
-
413  // blocks transfer rates that large. So we use an acceptable
-
414  // transfer rate here and later hack the ledger to replace
-
415  // the acceptable value with an out-of-bounds value.
-
416  env(rate(gw, 2.0));
-
417  env.close();
-
418 
-
419  // Because we're hacking the ledger we need the account to have
-
420  // non-zero sfMintedNFTokens and sfBurnedNFTokens fields. This
-
421  // prevents an exception when the AccountRoot template is applied.
-
422  {
-
423  uint256 const nftId0{token::getNextID(env, gw, 0u)};
-
424  env(token::mint(gw, 0u));
-
425  env.close();
-
426 
-
427  env(token::burn(gw, nftId0));
-
428  env.close();
-
429  }
-
430 
-
431  // Note that we're bypassing almost all of the ledger's safety
-
432  // checks with this modify() call. If you call close() between
-
433  // here and the end of the test all the effort will be lost.
-
434  env.app().openLedger().modify(
-
435  [&gw, transferRate](OpenView& view, beast::Journal j) {
-
436  // Get the account root we want to hijack.
-
437  auto const sle = view.read(keylet::account(gw.id()));
-
438  if (!sle)
-
439  return false; // This would be really surprising!
-
440 
-
441  // We'll insert a replacement for the account root
-
442  // with the higher (currently invalid) transfer rate.
-
443  auto replacement = std::make_shared<SLE>(*sle, sle->key());
-
444  (*replacement)[sfTransferRate] =
-
445  static_cast<std::uint32_t>(transferRate * QUALITY_ONE);
-
446  view.rawReplace(replacement);
-
447  return true;
-
448  });
-
449 
-
450  auto const amount = USD(1);
-
451  auto const amountWithRate = toAmount<STAmount>(
-
452  multiply(amount.value(), Rate(transferRate * QUALITY_ONE)));
-
453 
-
454  env(pay(gw, alice, USD(10)));
-
455  env(pay(alice, bob, amount), sendmax(USD(10)));
-
456 
-
457  env.require(balance(alice, USD(10) - amountWithRate));
-
458  env.require(balance(bob, amount));
-
459  }
-
460  }
-
461 
-
462  void
-
463  testBadInputs()
-
464  {
-
465  testcase("Bad inputs");
-
466 
-
467  using namespace test::jtx;
-
468  Env env(*this);
-
469  Account const alice("alice");
-
470  env.fund(XRP(10000), alice);
-
471 
-
472  auto jt = fset(alice, asfDisallowXRP);
-
473  jt[jss::ClearFlag] = asfDisallowXRP;
-
474  env(jt, ter(temINVALID_FLAG));
-
475 
-
476  jt = fset(alice, asfRequireAuth);
-
477  jt[jss::ClearFlag] = asfRequireAuth;
-
478  env(jt, ter(temINVALID_FLAG));
-
479 
-
480  jt = fset(alice, asfRequireDest);
-
481  jt[jss::ClearFlag] = asfRequireDest;
-
482  env(jt, ter(temINVALID_FLAG));
-
483 
-
484  jt = fset(alice, asfDisallowXRP);
-
485  jt[sfFlags.fieldName] = tfAllowXRP;
-
486  env(jt, ter(temINVALID_FLAG));
-
487 
-
488  jt = fset(alice, asfRequireAuth);
-
489  jt[sfFlags.fieldName] = tfOptionalAuth;
-
490  env(jt, ter(temINVALID_FLAG));
-
491 
-
492  jt = fset(alice, asfRequireDest);
-
493  jt[sfFlags.fieldName] = tfOptionalDestTag;
-
494  env(jt, ter(temINVALID_FLAG));
-
495 
-
496  jt = fset(alice, asfRequireDest);
-
497  jt[sfFlags.fieldName] = tfAccountSetMask;
-
498  env(jt, ter(temINVALID_FLAG));
-
499 
-
500  env(fset(alice, asfDisableMaster),
-
501  sig(alice),
-
502  ter(tecNO_ALTERNATIVE_KEY));
-
503  }
-
504 
-
505  void
-
506  testRequireAuthWithDir()
-
507  {
-
508  testcase("Require auth");
-
509 
-
510  using namespace test::jtx;
-
511  Env env(*this);
-
512  Account const alice("alice");
-
513  Account const bob("bob");
-
514 
-
515  env.fund(XRP(10000), alice);
-
516  env.close();
-
517 
-
518  // alice should have an empty directory.
-
519  BEAST_EXPECT(dirIsEmpty(*env.closed(), keylet::ownerDir(alice)));
+
329  using namespace test::jtx;
+
330  auto doTests = [this](
+
331  FeatureBitset const& features,
+
332  std::initializer_list<test_results> testData) {
+
333  Env env(*this, features);
+
334 
+
335  Account const alice("alice");
+
336  env.fund(XRP(10000), alice);
+
337 
+
338  for (auto const& r : testData)
+
339  {
+
340  env(rate(alice, r.set), ter(r.code));
+
341  env.close();
+
342 
+
343  // If the field is not present expect the default value
+
344  if (!(*env.le(alice))[~sfTransferRate])
+
345  BEAST_EXPECT(r.get == 1.0);
+
346  else
+
347  BEAST_EXPECT(
+
348  *(*env.le(alice))[~sfTransferRate] ==
+
349  r.get * QUALITY_ONE);
+
350  }
+
351  };
+
352 
+
353  doTests(
+
354  supported_amendments(),
+
355  {{1.0, tesSUCCESS, 1.0},
+
356  {1.1, tesSUCCESS, 1.1},
+
357  {2.0, tesSUCCESS, 2.0},
+
358  {2.1, temBAD_TRANSFER_RATE, 2.0},
+
359  {0.0, tesSUCCESS, 1.0},
+
360  {2.0, tesSUCCESS, 2.0},
+
361  {0.9, temBAD_TRANSFER_RATE, 2.0}});
+
362  }
+
363 
+
364  void
+
365  testGateway()
+
366  {
+
367  testcase("Gateway");
+
368 
+
369  using namespace test::jtx;
+
370 
+
371  Account const alice("alice");
+
372  Account const bob("bob");
+
373  Account const gw("gateway");
+
374  auto const USD = gw["USD"];
+
375 
+
376  // Test gateway with a variety of allowed transfer rates
+
377  for (double transferRate = 1.0; transferRate <= 2.0;
+
378  transferRate += 0.03125)
+
379  {
+
380  Env env(*this);
+
381  env.fund(XRP(10000), gw, alice, bob);
+
382  env.close();
+
383  env.trust(USD(10), alice, bob);
+
384  env.close();
+
385  env(rate(gw, transferRate));
+
386  env.close();
+
387 
+
388  auto const amount = USD(1);
+
389  Rate const rate(transferRate * QUALITY_ONE);
+
390  auto const amountWithRate =
+
391  toAmount<STAmount>(multiply(amount.value(), rate));
+
392 
+
393  env(pay(gw, alice, USD(10)));
+
394  env.close();
+
395  env(pay(alice, bob, USD(1)), sendmax(USD(10)));
+
396  env.close();
+
397 
+
398  env.require(balance(alice, USD(10) - amountWithRate));
+
399  env.require(balance(bob, USD(1)));
+
400  }
+
401 
+
402  // Since fix1201 was enabled on Nov 14 2017 a rate in excess of
+
403  // 2.0 has been blocked by the transactor. But there are a few
+
404  // accounts on the MainNet that have larger-than-currently-allowed
+
405  // TransferRates. We'll bypass the transactor so we can check
+
406  // operation of these legacy TransferRates.
+
407  //
+
408  // Two out-of-bound values are currently in the ledger (March 2020)
+
409  // They are 4.0 and 4.294967295. So those are the values we test.
+
410  for (double transferRate : {4.0, 4.294967295})
+
411  {
+
412  Env env(*this);
+
413  env.fund(XRP(10000), gw, alice, bob);
+
414  env.close();
+
415  env.trust(USD(10), alice, bob);
+
416  env.close();
+
417 
+
418  // We'd like to use transferRate here, but the transactor
+
419  // blocks transfer rates that large. So we use an acceptable
+
420  // transfer rate here and later hack the ledger to replace
+
421  // the acceptable value with an out-of-bounds value.
+
422  env(rate(gw, 2.0));
+
423  env.close();
+
424 
+
425  // Because we're hacking the ledger we need the account to have
+
426  // non-zero sfMintedNFTokens and sfBurnedNFTokens fields. This
+
427  // prevents an exception when the AccountRoot template is applied.
+
428  {
+
429  uint256 const nftId0{token::getNextID(env, gw, 0u)};
+
430  env(token::mint(gw, 0u));
+
431  env.close();
+
432 
+
433  env(token::burn(gw, nftId0));
+
434  env.close();
+
435  }
+
436 
+
437  // Note that we're bypassing almost all of the ledger's safety
+
438  // checks with this modify() call. If you call close() between
+
439  // here and the end of the test all the effort will be lost.
+
440  env.app().openLedger().modify(
+
441  [&gw, transferRate](OpenView& view, beast::Journal j) {
+
442  // Get the account root we want to hijack.
+
443  auto const sle = view.read(keylet::account(gw.id()));
+
444  if (!sle)
+
445  return false; // This would be really surprising!
+
446 
+
447  // We'll insert a replacement for the account root
+
448  // with the higher (currently invalid) transfer rate.
+
449  auto replacement = std::make_shared<SLE>(*sle, sle->key());
+
450  (*replacement)[sfTransferRate] =
+
451  static_cast<std::uint32_t>(transferRate * QUALITY_ONE);
+
452  view.rawReplace(replacement);
+
453  return true;
+
454  });
+
455 
+
456  auto const amount = USD(1);
+
457  auto const amountWithRate = toAmount<STAmount>(
+
458  multiply(amount.value(), Rate(transferRate * QUALITY_ONE)));
+
459 
+
460  env(pay(gw, alice, USD(10)));
+
461  env(pay(alice, bob, amount), sendmax(USD(10)));
+
462 
+
463  env.require(balance(alice, USD(10) - amountWithRate));
+
464  env.require(balance(bob, amount));
+
465  }
+
466  }
+
467 
+
468  void
+
469  testBadInputs()
+
470  {
+
471  testcase("Bad inputs");
+
472 
+
473  using namespace test::jtx;
+
474  Env env(*this);
+
475  Account const alice("alice");
+
476  env.fund(XRP(10000), alice);
+
477 
+
478  auto jt = fset(alice, asfDisallowXRP);
+
479  jt[jss::ClearFlag] = asfDisallowXRP;
+
480  env(jt, ter(temINVALID_FLAG));
+
481 
+
482  jt = fset(alice, asfRequireAuth);
+
483  jt[jss::ClearFlag] = asfRequireAuth;
+
484  env(jt, ter(temINVALID_FLAG));
+
485 
+
486  jt = fset(alice, asfRequireDest);
+
487  jt[jss::ClearFlag] = asfRequireDest;
+
488  env(jt, ter(temINVALID_FLAG));
+
489 
+
490  jt = fset(alice, asfDisallowXRP);
+
491  jt[sfFlags.fieldName] = tfAllowXRP;
+
492  env(jt, ter(temINVALID_FLAG));
+
493 
+
494  jt = fset(alice, asfRequireAuth);
+
495  jt[sfFlags.fieldName] = tfOptionalAuth;
+
496  env(jt, ter(temINVALID_FLAG));
+
497 
+
498  jt = fset(alice, asfRequireDest);
+
499  jt[sfFlags.fieldName] = tfOptionalDestTag;
+
500  env(jt, ter(temINVALID_FLAG));
+
501 
+
502  jt = fset(alice, asfRequireDest);
+
503  jt[sfFlags.fieldName] = tfAccountSetMask;
+
504  env(jt, ter(temINVALID_FLAG));
+
505 
+
506  env(fset(alice, asfDisableMaster),
+
507  sig(alice),
+
508  ter(tecNO_ALTERNATIVE_KEY));
+
509  }
+
510 
+
511  void
+
512  testRequireAuthWithDir()
+
513  {
+
514  testcase("Require auth");
+
515 
+
516  using namespace test::jtx;
+
517  Env env(*this);
+
518  Account const alice("alice");
+
519  Account const bob("bob");
520 
-
521  // Give alice a signer list, then there will be stuff in the directory.
-
522  env(signers(alice, 1, {{bob, 1}}));
-
523  env.close();
-
524  BEAST_EXPECT(!dirIsEmpty(*env.closed(), keylet::ownerDir(alice)));
-
525 
-
526  env(fset(alice, asfRequireAuth), ter(tecOWNERS));
-
527 
-
528  // Remove the signer list. After that asfRequireAuth should succeed.
-
529  env(signers(alice, test::jtx::none));
-
530  env.close();
-
531  BEAST_EXPECT(dirIsEmpty(*env.closed(), keylet::ownerDir(alice)));
-
532 
-
533  env(fset(alice, asfRequireAuth));
-
534  }
-
535 
-
536  void
-
537  testTicket()
-
538  {
-
539  using namespace test::jtx;
-
540  Env env(*this);
-
541  Account const alice("alice");
-
542 
-
543  env.fund(XRP(10000), alice);
-
544  env.close();
-
545 
-
546  std::uint32_t const ticketSeq{env.seq(alice) + 1};
-
547  env(ticket::create(alice, 1));
-
548  env.close();
-
549  env.require(owners(alice, 1), tickets(alice, 1));
-
550 
-
551  // Try using a ticket that alice doesn't have.
-
552  env(noop(alice), ticket::use(ticketSeq + 1), ter(terPRE_TICKET));
-
553  env.close();
-
554  env.require(owners(alice, 1), tickets(alice, 1));
-
555 
-
556  // Actually use alice's ticket. Note that if a transaction consumes
-
557  // a ticket then the account's sequence number does not advance.
-
558  std::uint32_t const aliceSeq{env.seq(alice)};
-
559  env(noop(alice), ticket::use(ticketSeq));
-
560  env.close();
-
561  env.require(owners(alice, 0), tickets(alice, 0));
-
562  BEAST_EXPECT(aliceSeq == env.seq(alice));
-
563 
-
564  // Try re-using a ticket that alice already used.
-
565  env(noop(alice), ticket::use(ticketSeq), ter(tefNO_TICKET));
+
521  env.fund(XRP(10000), alice);
+
522  env.close();
+
523 
+
524  // alice should have an empty directory.
+
525  BEAST_EXPECT(dirIsEmpty(*env.closed(), keylet::ownerDir(alice)));
+
526 
+
527  // Give alice a signer list, then there will be stuff in the directory.
+
528  env(signers(alice, 1, {{bob, 1}}));
+
529  env.close();
+
530  BEAST_EXPECT(!dirIsEmpty(*env.closed(), keylet::ownerDir(alice)));
+
531 
+
532  env(fset(alice, asfRequireAuth), ter(tecOWNERS));
+
533 
+
534  // Remove the signer list. After that asfRequireAuth should succeed.
+
535  env(signers(alice, test::jtx::none));
+
536  env.close();
+
537  BEAST_EXPECT(dirIsEmpty(*env.closed(), keylet::ownerDir(alice)));
+
538 
+
539  env(fset(alice, asfRequireAuth));
+
540  }
+
541 
+
542  void
+
543  testTicket()
+
544  {
+
545  using namespace test::jtx;
+
546  Env env(*this);
+
547  Account const alice("alice");
+
548 
+
549  env.fund(XRP(10000), alice);
+
550  env.close();
+
551 
+
552  std::uint32_t const ticketSeq{env.seq(alice) + 1};
+
553  env(ticket::create(alice, 1));
+
554  env.close();
+
555  env.require(owners(alice, 1), tickets(alice, 1));
+
556 
+
557  // Try using a ticket that alice doesn't have.
+
558  env(noop(alice), ticket::use(ticketSeq + 1), ter(terPRE_TICKET));
+
559  env.close();
+
560  env.require(owners(alice, 1), tickets(alice, 1));
+
561 
+
562  // Actually use alice's ticket. Note that if a transaction consumes
+
563  // a ticket then the account's sequence number does not advance.
+
564  std::uint32_t const aliceSeq{env.seq(alice)};
+
565  env(noop(alice), ticket::use(ticketSeq));
566  env.close();
-
567  }
-
568 
-
569  void
-
570  run() override
-
571  {
-
572  testNullAccountSet();
-
573  testMostFlags();
-
574  testSetAndResetAccountTxnID();
-
575  testSetNoFreeze();
-
576  testDomain();
-
577  testGateway();
-
578  testMessageKey();
-
579  testWalletID();
-
580  testEmailHash();
-
581  testBadInputs();
-
582  testRequireAuthWithDir();
-
583  testTransferRate();
-
584  testTicket();
-
585  }
-
586 };
-
587 
-
588 BEAST_DEFINE_TESTSUITE_PRIO(AccountSet, app, ripple, 1);
-
589 
-
590 } // namespace ripple
+
567  env.require(owners(alice, 0), tickets(alice, 0));
+
568  BEAST_EXPECT(aliceSeq == env.seq(alice));
+
569 
+
570  // Try re-using a ticket that alice already used.
+
571  env(noop(alice), ticket::use(ticketSeq), ter(tefNO_TICKET));
+
572  env.close();
+
573  }
+
574 
+
575  void
+
576  run() override
+
577  {
+
578  testNullAccountSet();
+
579  testMostFlags();
+
580  testSetAndResetAccountTxnID();
+
581  testSetNoFreeze();
+
582  testDomain();
+
583  testGateway();
+
584  testMessageKey();
+
585  testWalletID();
+
586  testEmailHash();
+
587  testBadInputs();
+
588  testRequireAuthWithDir();
+
589  testTransferRate();
+
590  testTicket();
+
591  }
+
592 };
+
593 
+
594 BEAST_DEFINE_TESTSUITE_PRIO(AccountSet, app, ripple, 1);
+
595 
+
596 } // namespace ripple
ripple::keylet::ownerDir
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition: Indexes.cpp:303
ripple::tefNO_TICKET
@ tefNO_TICKET
Definition: TER.h:167
ripple::transferRate
Rate transferRate(ReadView const &view, AccountID const &issuer)
Definition: View.cpp:471
ripple::terPRE_TICKET
@ terPRE_TICKET
Definition: TER.h:207
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
-
ripple::AccountSet_test::testTicket
void testTicket()
Definition: AccountSet_test.cpp:537
+
ripple::AccountSet_test::testTicket
void testTicket()
Definition: AccountSet_test.cpp:543
ripple::asfDisallowXRP
constexpr std::uint32_t asfDisallowXRP
Definition: TxFlags.h:76
ripple::asfDepositAuth
constexpr std::uint32_t asfDepositAuth
Definition: TxFlags.h:82
std::string
STL class.
@@ -678,34 +684,35 @@ $(function() {
std::find
T find(T... args)
std::string::length
T length(T... args)
ripple::SField::fieldName
const std::string fieldName
Definition: SField.h:132
+
ripple::asfAllowClawback
constexpr std::uint32_t asfAllowClawback
Definition: TxFlags.h:91
ripple::telBAD_DOMAIN
@ telBAD_DOMAIN
Definition: TER.h:52
ripple::featureDepositAuth
const uint256 featureDepositAuth
ripple::tfAllowXRP
constexpr std::uint32_t tfAllowXRP
Definition: TxFlags.h:68
ripple::asfDisallowIncomingPayChan
constexpr std::uint32_t asfDisallowIncomingPayChan
Definition: TxFlags.h:89
ripple::BEAST_DEFINE_TESTSUITE_PRIO
BEAST_DEFINE_TESTSUITE_PRIO(NFToken, tx, ripple, 2)
ripple::temBAD_TRANSFER_RATE
@ temBAD_TRANSFER_RATE
Definition: TER.h:105
-
ripple::AccountSet_test::testGateway
void testGateway()
Definition: AccountSet_test.cpp:359
+
ripple::AccountSet_test::testGateway
void testGateway()
Definition: AccountSet_test.cpp:365
ripple::asfDisallowIncomingTrustline
constexpr std::uint32_t asfDisallowIncomingTrustline
Definition: TxFlags.h:90
ripple::tfAccountSetMask
constexpr std::uint32_t tfAccountSetMask
Definition: TxFlags.h:69
ripple::asfDisallowIncomingCheck
constexpr std::uint32_t asfDisallowIncomingCheck
Definition: TxFlags.h:88
ripple::KeyType::ed25519
@ ed25519
ripple::base_uint< 256 >
ripple::temINVALID_FLAG
@ temINVALID_FLAG
Definition: TER.h:109
-
ripple::AccountSet_test::testRequireAuthWithDir
void testRequireAuthWithDir()
Definition: AccountSet_test.cpp:506
+
ripple::AccountSet_test::testRequireAuthWithDir
void testRequireAuthWithDir()
Definition: AccountSet_test.cpp:512
ripple::asfDisableMaster
constexpr std::uint32_t asfDisableMaster
Definition: TxFlags.h:77
ripple::tecNO_ALTERNATIVE_KEY
@ tecNO_ALTERNATIVE_KEY
Definition: TER.h:263
-
ripple::AccountSet_test::testEmailHash
void testEmailHash()
Definition: AccountSet_test.cpp:291
+
ripple::AccountSet_test::testEmailHash
void testEmailHash()
Definition: AccountSet_test.cpp:297
ripple::keylet::account
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition: Indexes.cpp:133
-
ripple::AccountSet_test::run
void run() override
Definition: AccountSet_test.cpp:570
+
ripple::AccountSet_test::run
void run() override
Definition: AccountSet_test.cpp:576
ripple::OpenView::rawReplace
void rawReplace(std::shared_ptr< SLE > const &sle) override
Unconditionally replace a state item.
Definition: OpenView.cpp:245
ripple::TERSubset< CanCvtToTER >
-
ripple::AccountSet_test::testTransferRate
void testTransferRate()
Definition: AccountSet_test.cpp:312
+
ripple::AccountSet_test::testTransferRate
void testTransferRate()
Definition: AccountSet_test.cpp:318
ripple::set
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:313
ripple::sfAccountTxnID
const SF_UINT256 sfAccountTxnID
ripple::sfTransferRate
const SF_UINT32 sfTransferRate
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
-
ripple::AccountSet_test::testDomain
void testDomain()
Definition: AccountSet_test.cpp:192
+
ripple::AccountSet_test::testDomain
void testDomain()
Definition: AccountSet_test.cpp:198
ripple::tecNEED_MASTER_KEY
@ tecNEED_MASTER_KEY
Definition: TER.h:275
ripple::tfOptionalAuth
constexpr std::uint32_t tfOptionalAuth
Definition: TxFlags.h:66
ripple::AccountSet_test::testMostFlags
void testMostFlags()
Definition: AccountSet_test.cpp:48
@@ -715,9 +722,9 @@ $(function() {
ripple::randomKeyPair
std::pair< PublicKey, SecretKey > randomKeyPair(KeyType type)
Create a key pair using secure random numbers.
Definition: SecretKey.cpp:368
ripple::dirIsEmpty
bool dirIsEmpty(ReadView const &view, Keylet const &k)
Returns true if the directory is empty.
Definition: View.cpp:590
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
-
ripple::AccountSet_test::testBadInputs
void testBadInputs()
Definition: AccountSet_test.cpp:463
+
ripple::AccountSet_test::testBadInputs
void testBadInputs()
Definition: AccountSet_test.cpp:469
ripple::sfWalletLocator
const SF_UINT256 sfWalletLocator
-
ripple::AccountSet_test::testSetNoFreeze
void testSetNoFreeze()
Definition: AccountSet_test.cpp:171
+
ripple::AccountSet_test::testSetNoFreeze
void testSetNoFreeze()
Definition: AccountSet_test.cpp:177
ripple::sfFlags
const SF_UINT32 sfFlags
ripple::asfRequireAuth
constexpr std::uint32_t asfRequireAuth
Definition: TxFlags.h:75
ripple::asfDefaultRipple
constexpr std::uint32_t asfDefaultRipple
Definition: TxFlags.h:81
@@ -730,11 +737,11 @@ $(function() {
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::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
-
ripple::AccountSet_test::testMessageKey
void testMessageKey()
Definition: AccountSet_test.cpp:242
+
ripple::AccountSet_test::testMessageKey
void testMessageKey()
Definition: AccountSet_test.cpp:248
ripple::tfOptionalDestTag
constexpr std::uint32_t tfOptionalDestTag
Definition: TxFlags.h:64
ripple::sfDomain
const SF_VL sfDomain
-
ripple::AccountSet_test::testSetAndResetAccountTxnID
void testSetAndResetAccountTxnID()
Definition: AccountSet_test.cpp:148
-
ripple::AccountSet_test::testWalletID
void testWalletID()
Definition: AccountSet_test.cpp:269
+
ripple::AccountSet_test::testSetAndResetAccountTxnID
void testSetAndResetAccountTxnID()
Definition: AccountSet_test.cpp:154
+
ripple::AccountSet_test::testWalletID
void testWalletID()
Definition: AccountSet_test.cpp:275
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:222
ripple::asfAccountTxnID
constexpr std::uint32_t asfAccountTxnID
Definition: TxFlags.h:78
ripple::asfDisallowIncomingNFTokenOffer
constexpr std::uint32_t asfDisallowIncomingNFTokenOffer
Definition: TxFlags.h:87
diff --git a/AccountTx__test_8cpp_source.html b/AccountTx__test_8cpp_source.html index bc04363eb8..834cb97d8d 100644 --- a/AccountTx__test_8cpp_source.html +++ b/AccountTx__test_8cpp_source.html @@ -694,7 +694,7 @@ $(function() {
ripple::test::jtx::trust
Json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
Definition: trust.cpp:30
std::chrono::duration
ripple::test::jtx::offer_cancel
Json::Value offer_cancel(Account const &account, std::uint32_t offerSeq)
Cancel an offer.
Definition: offer.cpp:45
-
ripple::tfClose
constexpr std::uint32_t tfClose
Definition: TxFlags.h:123
+
ripple::tfClose
constexpr std::uint32_t tfClose
Definition: TxFlags.h:124
ripple::test::AccountTx_test::NodeSanity::index
const int index
Definition: AccountTx_test.cpp:38
ripple::test::AccountTx_test::NodeSanity
Definition: AccountTx_test.cpp:36
ripple::test::jtx::Env::balance
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
Definition: Env.cpp:183
diff --git a/AmendmentTable_8cpp_source.html b/AmendmentTable_8cpp_source.html index f025b3c9e4..54f356aa6b 100644 --- a/AmendmentTable_8cpp_source.html +++ b/AmendmentTable_8cpp_source.html @@ -875,12 +875,12 @@ $(function() {
823 
824 } // namespace ripple
-
ripple::tfGotMajority
constexpr std::uint32_t tfGotMajority
Definition: TxFlags.h:118
+
ripple::tfGotMajority
constexpr std::uint32_t tfGotMajority
Definition: TxFlags.h:119
ripple::Section
Holds a collection of configuration values.
Definition: BasicConfig.h:42
ripple::Application
Definition: Application.h:116
ripple::AmendmentTableImpl::db_
DatabaseCon & db_
Definition: AmendmentTable.cpp:224
ripple::AmendmentState::supported
bool supported
Indicates an amendment that this server has code support for.
Definition: AmendmentTable.cpp:87
-
ripple::tfLostMajority
constexpr std::uint32_t tfLostMajority
Definition: TxFlags.h:119
+
ripple::tfLostMajority
constexpr std::uint32_t tfLostMajority
Definition: TxFlags.h:120
ripple::AmendmentTableImpl::lastUpdateSeq_
std::uint32_t lastUpdateSeq_
Definition: AmendmentTable.cpp:204
std::for_each
T for_each(T... args)
ripple::AmendmentVote::up
@ up
diff --git a/AmendmentTable_8h_source.html b/AmendmentTable_8h_source.html index 56a197481e..6839f1e3eb 100644 --- a/AmendmentTable_8h_source.html +++ b/AmendmentTable_8h_source.html @@ -262,7 +262,7 @@ $(function() {
std::chrono::seconds
ripple::AmendmentTable::doValidatedLedger
void doValidatedLedger(std::shared_ptr< ReadView const > const &lastValidatedLedger)
Called when a new fully-validated ledger is accepted.
Definition: AmendmentTable.h:92
ripple::AmendmentTable::getJson
virtual Json::Value getJson() const =0
-
ripple::ttAMENDMENT
@ ttAMENDMENT
This system-generated transaction type is used to update the status of the various amendments.
Definition: TxFormats.h:146
+
ripple::ttAMENDMENT
@ ttAMENDMENT
This system-generated transaction type is used to update the status of the various amendments.
Definition: TxFormats.h:149
ripple::SHAMapNodeType::tnTRANSACTION_NM
@ tnTRANSACTION_NM
ripple::base_uint< 256 >
ripple::AmendmentTable::doValidation
virtual std::vector< uint256 > doValidation(std::set< uint256 > const &enabled) const =0
diff --git a/AmendmentTable__test_8cpp_source.html b/AmendmentTable__test_8cpp_source.html index fdd2a16966..119e372a66 100644 --- a/AmendmentTable__test_8cpp_source.html +++ b/AmendmentTable__test_8cpp_source.html @@ -1090,11 +1090,11 @@ $(function() {
1019 
1020 } // namespace ripple
-
ripple::tfGotMajority
constexpr std::uint32_t tfGotMajority
Definition: TxFlags.h:118
+
ripple::tfGotMajority
constexpr std::uint32_t tfGotMajority
Definition: TxFlags.h:119
ripple::Section
Holds a collection of configuration values.
Definition: BasicConfig.h:42
ripple::Application
Definition: Application.h:116
ripple::AmendmentTable_test::allSupported_
const std::vector< std::string > allSupported_
Definition: AmendmentTable_test.cpp:177
-
ripple::tfLostMajority
constexpr std::uint32_t tfLostMajority
Definition: TxFlags.h:119
+
ripple::tfLostMajority
constexpr std::uint32_t tfLostMajority
Definition: TxFlags.h:120
std::for_each
T for_each(T... args)
ripple::AmendmentTable_test::makeDefaultNo
static std::vector< AmendmentTable::FeatureInfo > makeDefaultNo(std::vector< std::string > const &amendments)
Definition: AmendmentTable_test.cpp:118
ripple::AmendmentTable_test::testVoteEnable
void testVoteEnable(uint256 const &feat)
Definition: AmendmentTable_test.cpp:730
diff --git a/ApplyContext_8cpp_source.html b/ApplyContext_8cpp_source.html index 62320f3140..2f50d39bc5 100644 --- a/ApplyContext_8cpp_source.html +++ b/ApplyContext_8cpp_source.html @@ -262,7 +262,7 @@ $(function() {
ripple::after
static bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: Escrow.cpp:88
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::getInvariantChecks
InvariantChecks getInvariantChecks()
get a tuple of all invariant checks
Definition: InvariantCheck.h:416
+
ripple::getInvariantChecks
InvariantChecks getInvariantChecks()
get a tuple of all invariant checks
Definition: InvariantCheck.h:445
ripple::ApplyContext::size
std::size_t size()
Get the number of unapplied changes.
Definition: ApplyContext.cpp:63
ripple::ApplyContext::tx
STTx const & tx
Definition: ApplyContext.h:48
std::exception::what
T what(T... args)
diff --git a/BookStep_8cpp_source.html b/BookStep_8cpp_source.html index bee99a53f2..3c60ed8385 100644 --- a/BookStep_8cpp_source.html +++ b/BookStep_8cpp_source.html @@ -1309,8 +1309,8 @@ $(function() {
ripple::test::equalHelper
static bool equalHelper(Step const &step, ripple::Book const &book)
Definition: BookStep.cpp:1135
ripple::BookPaymentStep::getOfrInRate
std::uint32_t getOfrInRate(Step const *, TOffer< TIn, TOut > const &, std::uint32_t trIn) const
Definition: BookStep.cpp:257
ripple::fix1515
const uint256 fix1515
-
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:254
-
ripple::lsfLowNoRipple
@ lsfLowNoRipple
Definition: LedgerFormats.h:256
+
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:257
+
ripple::lsfLowNoRipple
@ lsfLowNoRipple
Definition: LedgerFormats.h:259
ripple::BookPaymentStep::BookPaymentStep
BookPaymentStep()=default
ripple::fixReducedOffersV1
const uint256 fixReducedOffersV1
ripple::BookOfferCrossingStep
Definition: BookStep.cpp:311
@@ -1342,7 +1342,7 @@ $(function() {
ripple::BookStep::j_
const beast::Journal j_
Definition: BookStep.cpp:62
ripple::ApplyView
Writeable view to a ledger, for applying a transaction.
Definition: ApplyView.h:134
ripple::BookOfferCrossingStep::defaultPath_
const bool defaultPath_
Definition: BookStep.cpp:459
-
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:255
+
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:258
ripple::StrandDirection
StrandDirection
Definition: Steps.h:39
ripple::BookOfferCrossingStep::getOfrOutRate
std::uint32_t getOfrOutRate(Step const *prevStep, TOffer< TIn, TOut > const &offer, AccountID const &strandDst, std::uint32_t trOut) const
Definition: BookStep.cpp:424
ripple::BookStep::debtDirection
DebtDirection debtDirection(ReadView const &sb, StrandDirection dir) const override
Definition: BookStep.cpp:119
@@ -1386,7 +1386,7 @@ $(function() {
std::uint32_t
ripple::keylet::line
Keylet line(AccountID const &id0, AccountID const &id1, Currency const &currency) noexcept
The index of a trust line for a given currency.
Definition: Indexes.cpp:193
ripple::ReadView::read
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
-
ripple::lsfHighNoRipple
@ lsfHighNoRipple
Definition: LedgerFormats.h:257
+
ripple::lsfHighNoRipple
@ lsfHighNoRipple
Definition: LedgerFormats.h:260
ripple::BookStep::operator==
friend bool operator==(BookStep const &lhs, BookStep const &rhs)
Definition: BookStep.cpp:181
ripple::BookStep::cachedOut
std::optional< EitherAmount > cachedOut() const override
Definition: BookStep.cpp:111
std::decay_t
diff --git a/CashCheck_8cpp_source.html b/CashCheck_8cpp_source.html index 14d7150616..b638825da3 100644 --- a/CashCheck_8cpp_source.html +++ b/CashCheck_8cpp_source.html @@ -612,7 +612,7 @@ $(function() {
ripple::isTesSuccess
bool isTesSuccess(TER x)
Definition: TER.h:597
ripple::sfCheckID
const SF_UINT256 sfCheckID
ripple::CashCheck::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition: CashCheck.cpp:36
-
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:254
+
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:257
ripple::detail::ApplyViewBase::exists
bool exists(Keylet const &k) const override
Determine if a state item exists.
Definition: ApplyViewBase.cpp:58
ripple::ReadView::fees
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
ripple::tecDST_TAG_NEEDED
@ tecDST_TAG_NEEDED
Definition: TER.h:276
@@ -628,7 +628,7 @@ $(function() {
ripple::STPathSet
Definition: STPathSet.h:176
algorithm
ripple::preflight1
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
Definition: Transactor.cpp:78
-
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:255
+
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:258
ripple::ApplyContext::app
Application & app
Definition: ApplyContext.h:47
ripple::STAmount::getIssuer
AccountID const & getIssuer() const
Definition: STAmount.h:359
ripple::sfExpiration
const SF_UINT32 sfExpiration
diff --git a/Change_8cpp_source.html b/Change_8cpp_source.html index f89e295b7c..1666b65293 100644 --- a/Change_8cpp_source.html +++ b/Change_8cpp_source.html @@ -583,11 +583,11 @@ $(function() {
ripple::STArray::empty
bool empty() const
Definition: STArray.h:254
ripple::STTx::getTxnType
TxType getTxnType() const
Definition: STTx.h:179
-
ripple::tfGotMajority
constexpr std::uint32_t tfGotMajority
Definition: TxFlags.h:118
+
ripple::tfGotMajority
constexpr std::uint32_t tfGotMajority
Definition: TxFlags.h:119
ripple::keylet::ownerDir
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition: Indexes.cpp:303
ripple::isFlagLedger
bool isFlagLedger(LedgerIndex seq)
Returns true if the given ledgerIndex is a flag ledgerIndex.
Definition: Ledger.cpp:969
ripple::sfUNLModifyValidator
const SF_VL sfUNLModifyValidator
-
ripple::tfLostMajority
constexpr std::uint32_t tfLostMajority
Definition: TxFlags.h:119
+
ripple::tfLostMajority
constexpr std::uint32_t tfLostMajority
Definition: TxFlags.h:120
ripple::sfBaseFeeDrops
const SF_AMOUNT sfBaseFeeDrops
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
ripple::sfReserveBase
const SF_UINT32 sfReserveBase
@@ -601,7 +601,7 @@ $(function() {
ripple::PreclaimContext::j
const beast::Journal j
Definition: Transactor.h:60
ripple::ApplyView::peek
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
ripple::sfLedgerSequence
const SF_UINT32 sfLedgerSequence
-
ripple::lsfLowReserve
@ lsfLowReserve
Definition: LedgerFormats.h:252
+
ripple::lsfLowReserve
@ lsfLowReserve
Definition: LedgerFormats.h:255
ripple::Transactor::j_
const beast::Journal j_
Definition: Transactor.h:89
ripple::isTesSuccess
bool isTesSuccess(TER x)
Definition: TER.h:597
ripple::Sandbox::apply
void apply(RawView &to)
Definition: Sandbox.h:55
@@ -611,7 +611,7 @@ $(function() {
std::find
T find(T... args)
ripple::STUInt32
STInteger< std::uint32_t > STUInt32
Definition: STInteger.h:80
ripple::STObject::getFieldU8
unsigned char getFieldU8(SField const &field) const
Definition: STObject.cpp:547
-
ripple::ttFEE
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
Definition: TxFormats.h:152
+
ripple::ttFEE
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
Definition: TxFormats.h:155
ripple::toBase58
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition: AccountID.cpp:104
beast::Journal::warn
Stream warn() const
Definition: Journal.h:327
ripple::keylet::child
Keylet child(uint256 const &key) noexcept
Any item that can be in an owner dir.
Definition: Indexes.cpp:139
@@ -622,7 +622,7 @@ $(function() {
ripple::sfCloseTime
const SF_UINT32 sfCloseTime
ripple::ApplyContext::rawView
RawView & rawView()
Definition: ApplyContext.h:67
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::ttAMENDMENT
@ ttAMENDMENT
This system-generated transaction type is used to update the status of the various amendments.
Definition: TxFormats.h:149
ripple::PreflightContext::j
const beast::Journal j
Definition: Transactor.h:38
ripple::Application::getOPs
virtual NetworkOPs & getOPs()=0
ripple::ApplyContext::app
Application & app
Definition: ApplyContext.h:47
@@ -636,7 +636,7 @@ $(function() {
ripple::sfLowLimit
const SF_AMOUNT sfLowLimit
ripple::preflight0
NotTEC preflight0(PreflightContext const &ctx)
Performs early sanity checks on the txid.
Definition: Transactor.cpp:41
ripple::adjustOwnerCount
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
Definition: View.cpp:713
-
ripple::ttUNL_MODIFY
@ ttUNL_MODIFY
This system-generated transaction type is used to update the network's negative UNL.
Definition: TxFormats.h:158
+
ripple::ttUNL_MODIFY
@ ttUNL_MODIFY
This system-generated transaction type is used to update the network's negative UNL.
Definition: TxFormats.h:161
ripple::keylet::account
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition: Indexes.cpp:133
ripple::STObject::getAccountID
AccountID getAccountID(SField const &field) const
Definition: STObject.cpp:589
ripple::sfReserveIncrement
const SF_UINT32 sfReserveIncrement
@@ -708,7 +708,7 @@ $(function() {
ripple::Change::applyFee
TER applyFee()
Definition: Change.cpp:345
ripple::sfMajorities
const SField sfMajorities
ripple::ReadView::open
virtual bool open() const =0
Returns true if this reflects an open ledger.
-
ripple::lsfHighReserve
@ lsfHighReserve
Definition: LedgerFormats.h:253
+
ripple::lsfHighReserve
@ lsfHighReserve
Definition: LedgerFormats.h:256
ripple::sfDisabledValidators
const SField sfDisabledValidators
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:222
string_view
diff --git a/Check__test_8cpp_source.html b/Check__test_8cpp_source.html index 6799ba92d7..f3ace073bb 100644 --- a/Check__test_8cpp_source.html +++ b/Check__test_8cpp_source.html @@ -2879,12 +2879,12 @@ $(function() {
ripple::Check_test::testCancelInvalid
void testCancelInvalid(FeatureBitset features)
Definition: Check_test.cpp:1831
Json::Value::removeMember
Value removeMember(const char *key)
Remove and return the named member.
Definition: json_value.cpp:907
ripple::tecNO_LINE_INSUF_RESERVE
@ tecNO_LINE_INSUF_RESERVE
Definition: TER.h:259
-
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:111
+
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:112
ripple::tecNO_LINE
@ tecNO_LINE
Definition: TER.h:268
ripple::tecEXPIRED
@ tecEXPIRED
Definition: TER.h:281
ripple::Check_test::testCashQuality
void testCashQuality(FeatureBitset features)
Definition: Check_test.cpp:1156
ripple::temDISABLED
@ temDISABLED
Definition: TER.h:112
-
ripple::tfSetfAuth
constexpr std::uint32_t tfSetfAuth
Definition: TxFlags.h:108
+
ripple::tfSetfAuth
constexpr std::uint32_t tfSetfAuth
Definition: TxFlags.h:109
ripple::Check_test
Definition: Check_test.cpp:86
ripple::sfFlags
const SF_UINT32 sfFlags
ripple::asfRequireAuth
constexpr std::uint32_t asfRequireAuth
Definition: TxFlags.h:75
@@ -2907,7 +2907,7 @@ $(function() {
ripple::Check_test::testCreateDisallowIncoming
void testCreateDisallowIncoming(FeatureBitset features)
Definition: Check_test.cpp:299
ripple::forEachItem
void forEachItem(ReadView const &view, Keylet const &root, std::function< void(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items in the given directory.
Definition: View.cpp:367
std::size_t
-
ripple::tfClearFreeze
constexpr std::uint32_t tfClearFreeze
Definition: TxFlags.h:112
+
ripple::tfClearFreeze
constexpr std::uint32_t tfClearFreeze
Definition: TxFlags.h:113
ripple::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
ripple::test::jtx::source_tag::source_tag
source_tag(std::uint32_t tag)
Definition: Check_test.cpp:54
ripple::tecNO_ENTRY
@ tecNO_ENTRY
Definition: TER.h:273
@@ -2920,7 +2920,7 @@ $(function() {
ripple::Check_test::testWithTickets
void testWithTickets(FeatureBitset features)
Definition: Check_test.cpp:1910
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:222
ripple::test::jtx::dest_tag::tag_
const std::uint32_t tag_
Definition: Check_test.cpp:69
-
ripple::tfImmediateOrCancel
constexpr std::uint32_t tfImmediateOrCancel
Definition: TxFlags.h:94
+
ripple::tfImmediateOrCancel
constexpr std::uint32_t tfImmediateOrCancel
Definition: TxFlags.h:95
ripple::sfHighNode
const SF_UINT64 sfHighNode
ripple::test::jtx::Env::current
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition: Env.h:300
ripple::Check_test::verifyDeliveredAmount
void verifyDeliveredAmount(test::jtx::Env &env, STAmount const &amount)
Definition: Check_test.cpp:126
diff --git a/Clawback_8cpp_source.html b/Clawback_8cpp_source.html new file mode 100644 index 0000000000..4d005d24e1 --- /dev/null +++ b/Clawback_8cpp_source.html @@ -0,0 +1,272 @@ + + + + + + + +rippled: Clawback.cpp Source File + + + + + + + + + +
+
+ + + + + + +
+
rippled +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Clawback.cpp
+
+
+
1 //------------------------------------------------------------------------------
+
2 /*
+
3  This file is part of rippled: https://github.com/ripple/rippled
+
4  Copyright (c) 2023 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/app/tx/impl/Clawback.h>
+
21 #include <ripple/ledger/View.h>
+
22 #include <ripple/protocol/Feature.h>
+
23 #include <ripple/protocol/Indexes.h>
+
24 #include <ripple/protocol/Protocol.h>
+
25 #include <ripple/protocol/TxFlags.h>
+
26 #include <ripple/protocol/st.h>
+
27 
+
28 namespace ripple {
+
29 
+
30 NotTEC
+ +
32 {
+
33  if (!ctx.rules.enabled(featureClawback))
+
34  return temDISABLED;
+
35 
+
36  if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
+
37  return ret;
+
38 
+
39  if (ctx.tx.getFlags() & tfClawbackMask)
+
40  return temINVALID_FLAG;
+
41 
+
42  AccountID const issuer = ctx.tx[sfAccount];
+
43  STAmount const clawAmount = ctx.tx[sfAmount];
+
44 
+
45  // The issuer field is used for the token holder instead
+
46  AccountID const& holder = clawAmount.getIssuer();
+
47 
+
48  if (issuer == holder || isXRP(clawAmount) || clawAmount <= beast::zero)
+
49  return temBAD_AMOUNT;
+
50 
+
51  return preflight2(ctx);
+
52 }
+
53 
+
54 TER
+ +
56 {
+
57  AccountID const issuer = ctx.tx[sfAccount];
+
58  STAmount const clawAmount = ctx.tx[sfAmount];
+
59  AccountID const& holder = clawAmount.getIssuer();
+
60 
+
61  auto const sleIssuer = ctx.view.read(keylet::account(issuer));
+
62  auto const sleHolder = ctx.view.read(keylet::account(holder));
+
63  if (!sleIssuer || !sleHolder)
+
64  return terNO_ACCOUNT;
+
65 
+
66  std::uint32_t const issuerFlagsIn = sleIssuer->getFieldU32(sfFlags);
+
67 
+
68  // If AllowClawback is not set or NoFreeze is set, return no permission
+
69  if (!(issuerFlagsIn & lsfAllowClawback) || (issuerFlagsIn & lsfNoFreeze))
+
70  return tecNO_PERMISSION;
+
71 
+
72  auto const sleRippleState =
+
73  ctx.view.read(keylet::line(holder, issuer, clawAmount.getCurrency()));
+
74  if (!sleRippleState)
+
75  return tecNO_LINE;
+
76 
+
77  STAmount const balance = (*sleRippleState)[sfBalance];
+
78 
+
79  // If balance is positive, issuer must have higher address than holder
+
80  if (balance > beast::zero && issuer < holder)
+
81  return tecNO_PERMISSION;
+
82 
+
83  // If balance is negative, issuer must have lower address than holder
+
84  if (balance < beast::zero && issuer > holder)
+
85  return tecNO_PERMISSION;
+
86 
+
87  // At this point, we know that issuer and holder accounts
+
88  // are correct and a trustline exists between them.
+
89  //
+
90  // Must now explicitly check the balance to make sure
+
91  // available balance is non-zero.
+
92  //
+
93  // We can't directly check the balance of trustline because
+
94  // the available balance of a trustline is prone to new changes (eg.
+
95  // XLS-34). So we must use `accountHolds`.
+
96  if (accountHolds(
+
97  ctx.view,
+
98  holder,
+
99  clawAmount.getCurrency(),
+
100  issuer,
+ +
102  ctx.j) <= beast::zero)
+
103  return tecINSUFFICIENT_FUNDS;
+
104 
+
105  return tesSUCCESS;
+
106 }
+
107 
+
108 TER
+ +
110 {
+
111  AccountID const& issuer = account_;
+
112  STAmount clawAmount = ctx_.tx[sfAmount];
+
113  AccountID const holder = clawAmount.getIssuer(); // cannot be reference
+
114 
+
115  // Replace the `issuer` field with issuer's account
+
116  clawAmount.setIssuer(issuer);
+
117  if (holder == issuer)
+
118  return tecINTERNAL;
+
119 
+
120  // Get the spendable balance. Must use `accountHolds`.
+
121  STAmount const spendableAmount = accountHolds(
+
122  view(),
+
123  holder,
+
124  clawAmount.getCurrency(),
+
125  clawAmount.getIssuer(),
+ +
127  j_);
+
128 
+
129  return rippleCredit(
+
130  view(),
+
131  holder,
+
132  issuer,
+
133  std::min(spendableAmount, clawAmount),
+
134  true,
+
135  j_);
+
136 }
+
137 
+
138 } // namespace ripple
+
+
ripple::rippleCredit
TER rippleCredit(ApplyView &view, AccountID const &uSenderID, AccountID const &uReceiverID, STAmount const &saAmount, bool bCheckIssuer, beast::Journal j)
Definition: View.cpp:933
+
ripple::preflight2
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
Definition: Transactor.cpp:130
+
ripple::Rules::enabled
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
Definition: Rules.cpp:94
+
ripple::PreclaimContext::view
ReadView const & view
Definition: Transactor.h:56
+
ripple::PreclaimContext::j
const beast::Journal j
Definition: Transactor.h:60
+
ripple::featureClawback
const uint256 featureClawback
+
ripple::sfAmount
const SF_AMOUNT sfAmount
+
ripple::Transactor::j_
const beast::Journal j_
Definition: Transactor.h:89
+
ripple::isTesSuccess
bool isTesSuccess(TER x)
Definition: TER.h:597
+
ripple::tecINSUFFICIENT_FUNDS
@ tecINSUFFICIENT_FUNDS
Definition: TER.h:292
+
ripple::accountHolds
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
Definition: View.cpp:223
+
ripple::tfClawbackMask
constexpr const std::uint32_t tfClawbackMask
Definition: TxFlags.h:164
+
ripple::STAmount::setIssuer
void setIssuer(AccountID const &uIssuer)
Definition: STAmount.h:433
+
ripple::preflight1
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
Definition: Transactor.cpp:78
+
ripple::STAmount::getIssuer
AccountID const & getIssuer() const
Definition: STAmount.h:359
+
ripple::base_uint< 160, detail::AccountIDTag >
+
ripple::temINVALID_FLAG
@ temINVALID_FLAG
Definition: TER.h:109
+
ripple::Clawback::preclaim
static TER preclaim(PreclaimContext const &ctx)
Definition: Clawback.cpp:55
+
ripple::lsfAllowClawback
@ lsfAllowClawback
Definition: LedgerFormats.h:247
+
ripple::keylet::account
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition: Indexes.cpp:133
+
ripple::TERSubset< CanCvtToTER >
+
ripple::STAmount
Definition: STAmount.h:45
+
ripple::tecINTERNAL
@ tecINTERNAL
Definition: TER.h:277
+
ripple::STObject::getFlags
std::uint32_t getFlags() const
Definition: STObject.cpp:481
+
ripple::isXRP
bool isXRP(AccountID const &c)
Definition: AccountID.h:89
+
ripple::temBAD_AMOUNT
@ temBAD_AMOUNT
Definition: TER.h:87
+
std::uint32_t
+
ripple::keylet::line
Keylet line(AccountID const &id0, AccountID const &id1, Currency const &currency) noexcept
The index of a trust line for a given currency.
Definition: Indexes.cpp:193
+
ripple::ReadView::read
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
+
ripple::PreclaimContext::tx
STTx const & tx
Definition: Transactor.h:58
+
ripple::terNO_ACCOUNT
@ terNO_ACCOUNT
Definition: TER.h:198
+
std::min
T min(T... args)
+
ripple::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition: Transactor.h:52
+
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
+
ripple::Transactor::view
ApplyView & view()
Definition: Transactor.h:107
+
ripple::tecNO_LINE
@ tecNO_LINE
Definition: TER.h:268
+
ripple::temDISABLED
@ temDISABLED
Definition: TER.h:112
+
ripple::lsfNoFreeze
@ lsfNoFreeze
Definition: LedgerFormats.h:230
+
ripple::sfFlags
const SF_UINT32 sfFlags
+
ripple::tecNO_PERMISSION
@ tecNO_PERMISSION
Definition: TER.h:272
+
ripple::sfBalance
const SF_AMOUNT sfBalance
+
ripple::fhIGNORE_FREEZE
@ fhIGNORE_FREEZE
Definition: View.h:76
+
ripple::Transactor::ctx_
ApplyContext & ctx_
Definition: Transactor.h:88
+
ripple::sfAccount
const SF_ACCOUNT sfAccount
+
ripple::Clawback::doApply
TER doApply() override
Definition: Clawback.cpp:109
+
ripple::PreflightContext::tx
STTx const & tx
Definition: Transactor.h:35
+
ripple::PreflightContext
State information when preflighting a tx.
Definition: Transactor.h:31
+
ripple::PreflightContext::rules
const Rules rules
Definition: Transactor.h:36
+
ripple::STAmount::getCurrency
Currency const & getCurrency() const
Definition: STAmount.h:353
+
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:222
+
ripple::Clawback::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition: Clawback.cpp:31
+
ripple::Transactor::account_
const AccountID account_
Definition: Transactor.h:91
+
ripple::ApplyContext::tx
STTx const & tx
Definition: ApplyContext.h:48
+
ripple::NotTEC
TERSubset< CanCvtToNotTEC > NotTEC
Definition: TER.h:528
+ + + + diff --git a/Clawback_8h_source.html b/Clawback_8h_source.html new file mode 100644 index 0000000000..90c060a3cd --- /dev/null +++ b/Clawback_8h_source.html @@ -0,0 +1,142 @@ + + + + + + + +rippled: Clawback.h Source File + + + + + + + + + +
+
+ + + + + + +
+
rippled +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Clawback.h
+
+
+
1 //------------------------------------------------------------------------------
+
2 /*
+
3  This file is part of rippled: https://github.com/ripple/rippled
+
4  Copyright (c) 2023 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 #ifndef RIPPLE_TX_CLAWBACK_H_INCLUDED
+
21 #define RIPPLE_TX_CLAWBACK_H_INCLUDED
+
22 
+
23 #include <ripple/app/tx/impl/Transactor.h>
+
24 
+
25 namespace ripple {
+
26 
+
27 class Clawback : public Transactor
+
28 {
+
29 public:
+ +
31 
+
32  explicit Clawback(ApplyContext& ctx) : Transactor(ctx)
+
33  {
+
34  }
+
35 
+
36  static NotTEC
+
37  preflight(PreflightContext const& ctx);
+
38 
+
39  static TER
+
40  preclaim(PreclaimContext const& ctx);
+
41 
+
42  TER
+
43  doApply() override;
+
44 };
+
45 
+
46 } // namespace ripple
+
47 
+
48 #endif
+
+
ripple::Transactor
Definition: Transactor.h:85
+
ripple::Transactor::ConsequencesFactoryType
ConsequencesFactoryType
Definition: Transactor.h:101
+
ripple::Clawback::preclaim
static TER preclaim(PreclaimContext const &ctx)
Definition: Clawback.cpp:55
+
ripple::TERSubset
Definition: TER.h:340
+
ripple::Clawback::Clawback
Clawback(ApplyContext &ctx)
Definition: Clawback.h:32
+
ripple::ApplyContext
State information when applying a tx.
Definition: ApplyContext.h:35
+
ripple::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition: Transactor.h:52
+
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
+
ripple::Transactor::Normal
@ Normal
Definition: Transactor.h:101
+
ripple::Clawback
Definition: Clawback.h:27
+
ripple::Clawback::ConsequencesFactory
static constexpr ConsequencesFactoryType ConsequencesFactory
Definition: Clawback.h:30
+
ripple::Clawback::doApply
TER doApply() override
Definition: Clawback.cpp:109
+
ripple::PreflightContext
State information when preflighting a tx.
Definition: Transactor.h:31
+
ripple::Clawback::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition: Clawback.cpp:31
+ + + + diff --git a/Clawback__test_8cpp_source.html b/Clawback__test_8cpp_source.html new file mode 100644 index 0000000000..7f8d0c4a0b --- /dev/null +++ b/Clawback__test_8cpp_source.html @@ -0,0 +1,1097 @@ + + + + + + + +rippled: Clawback_test.cpp Source File + + + + + + + + + +
+
+ + + + + + +
+
rippled +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Clawback_test.cpp
+
+
+
1 //------------------------------------------------------------------------------
+
2 /*
+
3  This file is part of rippled: https://github.com/ripple/rippled
+
4  Copyright (c) 2023 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/random.h>
+
21 #include <ripple/json/to_string.h>
+
22 #include <ripple/ledger/ApplyViewImpl.h>
+
23 #include <ripple/protocol/Feature.h>
+
24 #include <ripple/protocol/jss.h>
+
25 #include <initializer_list>
+
26 #include <test/jtx.h>
+
27 #include <test/jtx/trust.h>
+
28 
+
29 namespace ripple {
+
30 
+
31 class Clawback_test : public beast::unit_test::suite
+
32 {
+
33  template <class T>
+
34  static std::string
+
35  to_string(T const& t)
+
36  {
+
37  return boost::lexical_cast<std::string>(t);
+
38  }
+
39 
+
40  // Helper function that returns the owner count of an account root.
+
41  static std::uint32_t
+
42  ownerCount(test::jtx::Env const& env, test::jtx::Account const& acct)
+
43  {
+
44  std::uint32_t ret{0};
+
45  if (auto const sleAcct = env.le(acct))
+
46  ret = sleAcct->at(sfOwnerCount);
+
47  return ret;
+
48  }
+
49 
+
50  // Helper function that returns the number of tickets held by an account.
+
51  static std::uint32_t
+ +
53  {
+
54  std::uint32_t ret{0};
+
55  if (auto const sleAcct = env.le(acct))
+
56  ret = sleAcct->at(~sfTicketCount).value_or(0);
+
57  return ret;
+
58  }
+
59 
+
60  // Helper function that returns the freeze status of a trustline
+
61  static bool
+ +
63  test::jtx::Env const& env,
+
64  test::jtx::Account const& src,
+
65  test::jtx::Account const& dst,
+
66  Currency const& cur)
+
67  {
+
68  if (auto sle = env.le(keylet::line(src, dst, cur)))
+
69  {
+
70  auto const useHigh = src.id() > dst.id();
+
71  return sle->isFlag(useHigh ? lsfHighFreeze : lsfLowFreeze);
+
72  }
+
73  Throw<std::runtime_error>("No line in getLineFreezeFlag");
+
74  return false; // silence warning
+
75  }
+
76 
+
77  void
+ +
79  {
+
80  testcase("Enable AllowClawback flag");
+
81  using namespace test::jtx;
+
82 
+
83  // Test that one can successfully set asfAllowClawback flag.
+
84  // If successful, asfNoFreeze can no longer be set.
+
85  // Also, asfAllowClawback cannot be cleared.
+
86  {
+
87  Env env(*this, features);
+
88  Account alice{"alice"};
+
89 
+
90  env.fund(XRP(1000), alice);
+
91  env.close();
+
92 
+
93  // set asfAllowClawback
+
94  env(fset(alice, asfAllowClawback));
+
95  env.close();
+
96  env.require(flags(alice, asfAllowClawback));
+
97 
+
98  // clear asfAllowClawback does nothing
+
99  env(fclear(alice, asfAllowClawback));
+
100  env.close();
+
101  env.require(flags(alice, asfAllowClawback));
+
102 
+
103  // asfNoFreeze cannot be set when asfAllowClawback is set
+
104  env.require(nflags(alice, asfNoFreeze));
+
105  env(fset(alice, asfNoFreeze), ter(tecNO_PERMISSION));
+
106  env.close();
+
107  }
+
108 
+
109  // Test that asfAllowClawback cannot be set when
+
110  // asfNoFreeze has been set
+
111  {
+
112  Env env(*this, features);
+
113  Account alice{"alice"};
+
114 
+
115  env.fund(XRP(1000), alice);
+
116  env.close();
+
117 
+
118  env.require(nflags(alice, asfNoFreeze));
+
119 
+
120  // set asfNoFreeze
+
121  env(fset(alice, asfNoFreeze));
+
122  env.close();
+
123 
+
124  // NoFreeze is set
+
125  env.require(flags(alice, asfNoFreeze));
+
126 
+
127  // asfAllowClawback cannot be set if asfNoFreeze is set
+
128  env(fset(alice, asfAllowClawback), ter(tecNO_PERMISSION));
+
129  env.close();
+
130 
+
131  env.require(nflags(alice, asfAllowClawback));
+
132  }
+
133 
+
134  // Test that asfAllowClawback is not allowed when owner dir is non-empty
+
135  {
+
136  Env env(*this, features);
+
137 
+
138  Account alice{"alice"};
+
139  Account bob{"bob"};
+
140 
+
141  env.fund(XRP(1000), alice, bob);
+
142  env.close();
+
143 
+
144  auto const USD = alice["USD"];
+
145  env.require(nflags(alice, asfAllowClawback));
+
146 
+
147  // alice issues 10 USD to bob
+
148  env.trust(USD(1000), bob);
+
149  env(pay(alice, bob, USD(10)));
+
150  env.close();
+
151 
+
152  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
153  BEAST_EXPECT(ownerCount(env, bob) == 1);
+
154 
+
155  // alice fails to enable clawback because she has trustline with bob
+
156  env(fset(alice, asfAllowClawback), ter(tecOWNERS));
+
157  env.close();
+
158 
+
159  // bob sets trustline to default limit and pays alice back to delete
+
160  // the trustline
+
161  env(trust(bob, USD(0), 0));
+
162  env(pay(bob, alice, USD(10)));
+
163 
+
164  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
165  BEAST_EXPECT(ownerCount(env, bob) == 0);
+
166 
+
167  // alice now is able to set asfAllowClawback
+
168  env(fset(alice, asfAllowClawback));
+
169  env.close();
+
170  env.require(flags(alice, asfAllowClawback));
+
171 
+
172  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
173  BEAST_EXPECT(ownerCount(env, bob) == 0);
+
174  }
+
175 
+
176  // Test that one cannot enable asfAllowClawback when
+
177  // featureClawback amendment is disabled
+
178  {
+
179  Env env(*this, features - featureClawback);
+
180 
+
181  Account alice{"alice"};
+
182 
+
183  env.fund(XRP(1000), alice);
+
184  env.close();
+
185 
+
186  env.require(nflags(alice, asfAllowClawback));
+
187 
+
188  // alice attempts to set asfAllowClawback flag while amendment is
+
189  // disabled. no error is returned, but the flag remains to be unset.
+
190  env(fset(alice, asfAllowClawback));
+
191  env.close();
+
192  env.require(nflags(alice, asfAllowClawback));
+
193 
+
194  // now enable clawback amendment
+
195  env.enableFeature(featureClawback);
+
196  env.close();
+
197 
+
198  // asfAllowClawback can be set
+
199  env(fset(alice, asfAllowClawback));
+
200  env.close();
+
201  env.require(flags(alice, asfAllowClawback));
+
202  }
+
203  }
+
204 
+
205  void
+ +
207  {
+
208  testcase("Validation");
+
209  using namespace test::jtx;
+
210 
+
211  // Test that Clawback tx fails for the following:
+
212  // 1. when amendment is disabled
+
213  // 2. when asfAllowClawback flag has not been set
+
214  {
+
215  Env env(*this, features - featureClawback);
+
216 
+
217  Account alice{"alice"};
+
218  Account bob{"bob"};
+
219 
+
220  env.fund(XRP(1000), alice, bob);
+
221  env.close();
+
222 
+
223  env.require(nflags(alice, asfAllowClawback));
+
224 
+
225  auto const USD = alice["USD"];
+
226 
+
227  // alice issues 10 USD to bob
+
228  env.trust(USD(1000), bob);
+
229  env(pay(alice, bob, USD(10)));
+
230  env.close();
+
231 
+
232  env.require(balance(bob, alice["USD"](10)));
+
233  env.require(balance(alice, bob["USD"](-10)));
+
234 
+
235  // clawback fails because amendment is disabled
+
236  env(claw(alice, bob["USD"](5)), ter(temDISABLED));
+
237  env.close();
+
238 
+
239  // now enable clawback amendment
+
240  env.enableFeature(featureClawback);
+
241  env.close();
+
242 
+
243  // clawback fails because asfAllowClawback has not been set
+
244  env(claw(alice, bob["USD"](5)), ter(tecNO_PERMISSION));
+
245  env.close();
+
246 
+
247  env.require(balance(bob, alice["USD"](10)));
+
248  env.require(balance(alice, bob["USD"](-10)));
+
249  }
+
250 
+
251  // Test that Clawback tx fails for the following:
+
252  // 1. invalid flag
+
253  // 2. negative STAmount
+
254  // 3. zero STAmount
+
255  // 4. XRP amount
+
256  // 5. `account` and `issuer` fields are same account
+
257  // 6. trustline has a balance of 0
+
258  // 7. trustline does not exist
+
259  {
+
260  Env env(*this, features);
+
261 
+
262  Account alice{"alice"};
+
263  Account bob{"bob"};
+
264 
+
265  env.fund(XRP(1000), alice, bob);
+
266  env.close();
+
267 
+
268  // alice sets asfAllowClawback
+
269  env(fset(alice, asfAllowClawback));
+
270  env.close();
+
271  env.require(flags(alice, asfAllowClawback));
+
272 
+
273  auto const USD = alice["USD"];
+
274 
+
275  // alice issues 10 USD to bob
+
276  env.trust(USD(1000), bob);
+
277  env(pay(alice, bob, USD(10)));
+
278  env.close();
+
279 
+
280  env.require(balance(bob, alice["USD"](10)));
+
281  env.require(balance(alice, bob["USD"](-10)));
+
282 
+
283  // fails due to invalid flag
+
284  env(claw(alice, bob["USD"](5)),
+
285  txflags(0x00008000),
+
286  ter(temINVALID_FLAG));
+
287  env.close();
+
288 
+
289  // fails due to negative amount
+
290  env(claw(alice, bob["USD"](-5)), ter(temBAD_AMOUNT));
+
291  env.close();
+
292 
+
293  // fails due to zero amount
+
294  env(claw(alice, bob["USD"](0)), ter(temBAD_AMOUNT));
+
295  env.close();
+
296 
+
297  // fails because amount is in XRP
+
298  env(claw(alice, XRP(10)), ter(temBAD_AMOUNT));
+
299  env.close();
+
300 
+
301  // fails when `issuer` field in `amount` is not token holder
+
302  // NOTE: we are using the `issuer` field for the token holder
+
303  env(claw(alice, alice["USD"](5)), ter(temBAD_AMOUNT));
+
304  env.close();
+
305 
+
306  // bob pays alice back, trustline has a balance of 0
+
307  env(pay(bob, alice, USD(10)));
+
308  env.close();
+
309 
+
310  // bob still owns the trustline that has 0 balance
+
311  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
312  BEAST_EXPECT(ownerCount(env, bob) == 1);
+
313  env.require(balance(bob, alice["USD"](0)));
+
314  env.require(balance(alice, bob["USD"](0)));
+
315 
+
316  // clawback fails because because balance is 0
+
317  env(claw(alice, bob["USD"](5)), ter(tecINSUFFICIENT_FUNDS));
+
318  env.close();
+
319 
+
320  // set the limit to default, which should delete the trustline
+
321  env(trust(bob, USD(0), 0));
+
322  env.close();
+
323 
+
324  // bob no longer owns the trustline
+
325  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
326  BEAST_EXPECT(ownerCount(env, bob) == 0);
+
327 
+
328  // clawback fails because trustline does not exist
+
329  env(claw(alice, bob["USD"](5)), ter(tecNO_LINE));
+
330  env.close();
+
331  }
+
332  }
+
333 
+
334  void
+ +
336  {
+
337  // Checks the tx submitter has the permission to clawback.
+
338  // Exercises preclaim code
+
339  testcase("Permission");
+
340  using namespace test::jtx;
+
341 
+
342  // Clawing back from an non-existent account returns error
+
343  {
+
344  Env env(*this, features);
+
345 
+
346  Account alice{"alice"};
+
347  Account bob{"bob"};
+
348 
+
349  // bob's account is not funded and does not exist
+
350  env.fund(XRP(1000), alice);
+
351  env.close();
+
352 
+
353  // alice sets asfAllowClawback
+
354  env(fset(alice, asfAllowClawback));
+
355  env.close();
+
356  env.require(flags(alice, asfAllowClawback));
+
357 
+
358  // bob, the token holder, does not exist
+
359  env(claw(alice, bob["USD"](5)), ter(terNO_ACCOUNT));
+
360  env.close();
+
361  }
+
362 
+
363  // Test that trustline cannot be clawed by someone who is
+
364  // not the issuer of the currency
+
365  {
+
366  Env env(*this, features);
+
367 
+
368  Account alice{"alice"};
+
369  Account bob{"bob"};
+
370  Account cindy{"cindy"};
+
371 
+
372  env.fund(XRP(1000), alice, bob, cindy);
+
373  env.close();
+
374 
+
375  auto const USD = alice["USD"];
+
376 
+
377  // alice sets asfAllowClawback
+
378  env(fset(alice, asfAllowClawback));
+
379  env.close();
+
380  env.require(flags(alice, asfAllowClawback));
+
381 
+
382  // cindy sets asfAllowClawback
+
383  env(fset(cindy, asfAllowClawback));
+
384  env.close();
+
385  env.require(flags(cindy, asfAllowClawback));
+
386 
+
387  // alice issues 1000 USD to bob
+
388  env.trust(USD(1000), bob);
+
389  env(pay(alice, bob, USD(1000)));
+
390  env.close();
+
391 
+
392  env.require(balance(bob, alice["USD"](1000)));
+
393  env.require(balance(alice, bob["USD"](-1000)));
+
394 
+
395  // cindy tries to claw from bob, and fails because trustline does
+
396  // not exist
+
397  env(claw(cindy, bob["USD"](200)), ter(tecNO_LINE));
+
398  env.close();
+
399  }
+
400 
+
401  // When a trustline is created between issuer and holder,
+
402  // we must make sure the holder is unable to claw back from
+
403  // the issuer by impersonating the issuer account.
+
404  //
+
405  // This must be tested bidirectionally for both accounts because the
+
406  // issuer could be either the low or high account in the trustline
+
407  // object
+
408  {
+
409  Env env(*this, features);
+
410 
+
411  Account alice{"alice"};
+
412  Account bob{"bob"};
+
413 
+
414  env.fund(XRP(1000), alice, bob);
+
415  env.close();
+
416 
+
417  auto const USD = alice["USD"];
+
418  auto const CAD = bob["CAD"];
+
419 
+
420  // alice sets asfAllowClawback
+
421  env(fset(alice, asfAllowClawback));
+
422  env.close();
+
423  env.require(flags(alice, asfAllowClawback));
+
424 
+
425  // bob sets asfAllowClawback
+
426  env(fset(bob, asfAllowClawback));
+
427  env.close();
+
428  env.require(flags(bob, asfAllowClawback));
+
429 
+
430  // alice issues 10 USD to bob.
+
431  // bob then attempts to submit a clawback tx to claw USD from alice.
+
432  // this must FAIL, because bob is not the issuer for this
+
433  // trustline!!!
+
434  {
+
435  // bob creates a trustline with alice, and alice sends 10 USD to
+
436  // bob
+
437  env.trust(USD(1000), bob);
+
438  env(pay(alice, bob, USD(10)));
+
439  env.close();
+
440 
+
441  env.require(balance(bob, alice["USD"](10)));
+
442  env.require(balance(alice, bob["USD"](-10)));
+
443 
+
444  // bob cannot claw back USD from alice because he's not the
+
445  // issuer
+
446  env(claw(bob, alice["USD"](5)), ter(tecNO_PERMISSION));
+
447  env.close();
+
448  }
+
449 
+
450  // bob issues 10 CAD to alice.
+
451  // alice then attempts to submit a clawback tx to claw CAD from bob.
+
452  // this must FAIL, because alice is not the issuer for this
+
453  // trustline!!!
+
454  {
+
455  // alice creates a trustline with bob, and bob sends 10 CAD to
+
456  // alice
+
457  env.trust(CAD(1000), alice);
+
458  env(pay(bob, alice, CAD(10)));
+
459  env.close();
+
460 
+
461  env.require(balance(bob, alice["CAD"](-10)));
+
462  env.require(balance(alice, bob["CAD"](10)));
+
463 
+
464  // alice cannot claw back CAD from bob because she's not the
+
465  // issuer
+
466  env(claw(alice, bob["CAD"](5)), ter(tecNO_PERMISSION));
+
467  env.close();
+
468  }
+
469  }
+
470  }
+
471 
+
472  void
+ +
474  {
+
475  testcase("Enable clawback");
+
476  using namespace test::jtx;
+
477 
+
478  // Test that alice is able to successfully clawback tokens from bob
+
479  Env env(*this, features);
+
480 
+
481  Account alice{"alice"};
+
482  Account bob{"bob"};
+
483 
+
484  env.fund(XRP(1000), alice, bob);
+
485  env.close();
+
486 
+
487  auto const USD = alice["USD"];
+
488 
+
489  // alice sets asfAllowClawback
+
490  env(fset(alice, asfAllowClawback));
+
491  env.close();
+
492  env.require(flags(alice, asfAllowClawback));
+
493 
+
494  // alice issues 1000 USD to bob
+
495  env.trust(USD(1000), bob);
+
496  env(pay(alice, bob, USD(1000)));
+
497  env.close();
+
498 
+
499  env.require(balance(bob, alice["USD"](1000)));
+
500  env.require(balance(alice, bob["USD"](-1000)));
+
501 
+
502  // alice claws back 200 USD from bob
+
503  env(claw(alice, bob["USD"](200)));
+
504  env.close();
+
505 
+
506  // bob should have 800 USD left
+
507  env.require(balance(bob, alice["USD"](800)));
+
508  env.require(balance(alice, bob["USD"](-800)));
+
509 
+
510  // alice claws back 800 USD from bob again
+
511  env(claw(alice, bob["USD"](800)));
+
512  env.close();
+
513 
+
514  // trustline has a balance of 0
+
515  env.require(balance(bob, alice["USD"](0)));
+
516  env.require(balance(alice, bob["USD"](0)));
+
517  }
+
518 
+
519  void
+ +
521  {
+
522  // Test scenarios where multiple trustlines are involved
+
523  testcase("Multi line");
+
524  using namespace test::jtx;
+
525 
+
526  // Both alice and bob issues their own "USD" to cindy.
+
527  // When alice and bob tries to claw back, they will only
+
528  // claw back from their respective trustline.
+
529  {
+
530  Env env(*this, features);
+
531 
+
532  Account alice{"alice"};
+
533  Account bob{"bob"};
+
534  Account cindy{"cindy"};
+
535 
+
536  env.fund(XRP(1000), alice, bob, cindy);
+
537  env.close();
+
538 
+
539  // alice sets asfAllowClawback
+
540  env(fset(alice, asfAllowClawback));
+
541  env.close();
+
542  env.require(flags(alice, asfAllowClawback));
+
543 
+
544  // bob sets asfAllowClawback
+
545  env(fset(bob, asfAllowClawback));
+
546  env.close();
+
547  env.require(flags(bob, asfAllowClawback));
+
548 
+
549  // alice sends 1000 USD to cindy
+
550  env.trust(alice["USD"](1000), cindy);
+
551  env(pay(alice, cindy, alice["USD"](1000)));
+
552  env.close();
+
553 
+
554  // bob sends 1000 USD to cindy
+
555  env.trust(bob["USD"](1000), cindy);
+
556  env(pay(bob, cindy, bob["USD"](1000)));
+
557  env.close();
+
558 
+
559  // alice claws back 200 USD from cindy
+
560  env(claw(alice, cindy["USD"](200)));
+
561  env.close();
+
562 
+
563  // cindy has 800 USD left in alice's trustline after clawed by alice
+
564  env.require(balance(cindy, alice["USD"](800)));
+
565  env.require(balance(alice, cindy["USD"](-800)));
+
566 
+
567  // cindy still has 1000 USD in bob's trustline
+
568  env.require(balance(cindy, bob["USD"](1000)));
+
569  env.require(balance(bob, cindy["USD"](-1000)));
+
570 
+
571  // bob claws back 600 USD from cindy
+
572  env(claw(bob, cindy["USD"](600)));
+
573  env.close();
+
574 
+
575  // cindy has 400 USD left in bob's trustline after clawed by bob
+
576  env.require(balance(cindy, bob["USD"](400)));
+
577  env.require(balance(bob, cindy["USD"](-400)));
+
578 
+
579  // cindy still has 800 USD in alice's trustline
+
580  env.require(balance(cindy, alice["USD"](800)));
+
581  env.require(balance(alice, cindy["USD"](-800)));
+
582  }
+
583 
+
584  // alice issues USD to both bob and cindy.
+
585  // when alice claws back from bob, only bob's USD balance is
+
586  // affected, and cindy's balance remains unchanged, and vice versa.
+
587  {
+
588  Env env(*this, features);
+
589 
+
590  Account alice{"alice"};
+
591  Account bob{"bob"};
+
592  Account cindy{"cindy"};
+
593 
+
594  env.fund(XRP(1000), alice, bob, cindy);
+
595  env.close();
+
596 
+
597  auto const USD = alice["USD"];
+
598 
+
599  // alice sets asfAllowClawback
+
600  env(fset(alice, asfAllowClawback));
+
601  env.close();
+
602  env.require(flags(alice, asfAllowClawback));
+
603 
+
604  // alice sends 600 USD to bob
+
605  env.trust(USD(1000), bob);
+
606  env(pay(alice, bob, USD(600)));
+
607  env.close();
+
608 
+
609  env.require(balance(alice, bob["USD"](-600)));
+
610  env.require(balance(bob, alice["USD"](600)));
+
611 
+
612  // alice sends 1000 USD to cindy
+
613  env.trust(USD(1000), cindy);
+
614  env(pay(alice, cindy, USD(1000)));
+
615  env.close();
+
616 
+
617  env.require(balance(alice, cindy["USD"](-1000)));
+
618  env.require(balance(cindy, alice["USD"](1000)));
+
619 
+
620  // alice claws back 500 USD from bob
+
621  env(claw(alice, bob["USD"](500)));
+
622  env.close();
+
623 
+
624  // bob's balance is reduced
+
625  env.require(balance(alice, bob["USD"](-100)));
+
626  env.require(balance(bob, alice["USD"](100)));
+
627 
+
628  // cindy's balance is unchanged
+
629  env.require(balance(alice, cindy["USD"](-1000)));
+
630  env.require(balance(cindy, alice["USD"](1000)));
+
631 
+
632  // alice claws back 300 USD from cindy
+
633  env(claw(alice, cindy["USD"](300)));
+
634  env.close();
+
635 
+
636  // bob's balance is unchanged
+
637  env.require(balance(alice, bob["USD"](-100)));
+
638  env.require(balance(bob, alice["USD"](100)));
+
639 
+
640  // cindy's balance is reduced
+
641  env.require(balance(alice, cindy["USD"](-700)));
+
642  env.require(balance(cindy, alice["USD"](700)));
+
643  }
+
644  }
+
645 
+
646  void
+ +
648  {
+
649  testcase("Bidirectional line");
+
650  using namespace test::jtx;
+
651 
+
652  // Test when both alice and bob issues USD to each other.
+
653  // This scenario creates only one trustline.
+
654  // In this case, both alice and bob can be seen as the "issuer"
+
655  // and they can send however many USDs to each other.
+
656  // We test that only the person who has a negative balance from their
+
657  // perspective is allowed to clawback
+
658  Env env(*this, features);
+
659 
+
660  Account alice{"alice"};
+
661  Account bob{"bob"};
+
662 
+
663  env.fund(XRP(1000), alice, bob);
+
664  env.close();
+
665 
+
666  // alice sets asfAllowClawback
+
667  env(fset(alice, asfAllowClawback));
+
668  env.close();
+
669  env.require(flags(alice, asfAllowClawback));
+
670 
+
671  // bob sets asfAllowClawback
+
672  env(fset(bob, asfAllowClawback));
+
673  env.close();
+
674  env.require(flags(bob, asfAllowClawback));
+
675 
+
676  // alice issues 1000 USD to bob
+
677  env.trust(alice["USD"](1000), bob);
+
678  env(pay(alice, bob, alice["USD"](1000)));
+
679  env.close();
+
680 
+
681  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
682  BEAST_EXPECT(ownerCount(env, bob) == 1);
+
683 
+
684  // bob is the holder, and alice is the issuer
+
685  env.require(balance(bob, alice["USD"](1000)));
+
686  env.require(balance(alice, bob["USD"](-1000)));
+
687 
+
688  // bob issues 1500 USD to alice
+
689  env.trust(bob["USD"](1500), alice);
+
690  env(pay(bob, alice, bob["USD"](1500)));
+
691  env.close();
+
692 
+
693  BEAST_EXPECT(ownerCount(env, alice) == 1);
+
694  BEAST_EXPECT(ownerCount(env, bob) == 1);
+
695 
+
696  // bob has negative 500 USD because bob issued 500 USD more than alice
+
697  // bob can now been seen as the issuer, while alice is the holder
+
698  env.require(balance(bob, alice["USD"](-500)));
+
699  env.require(balance(alice, bob["USD"](500)));
+
700 
+
701  // At this point, both alice and bob are the issuers of USD
+
702  // and can send USD to each other through one trustline
+
703 
+
704  // alice fails to clawback. Even though she is also an issuer,
+
705  // the trustline balance is positive from her perspective
+
706  env(claw(alice, bob["USD"](200)), ter(tecNO_PERMISSION));
+
707  env.close();
+
708 
+
709  // bob is able to successfully clawback from alice because
+
710  // the trustline balance is negative from his perspective
+
711  env(claw(bob, alice["USD"](200)));
+
712  env.close();
+
713 
+
714  env.require(balance(bob, alice["USD"](-300)));
+
715  env.require(balance(alice, bob["USD"](300)));
+
716 
+
717  // alice pays bob 1000 USD
+
718  env(pay(alice, bob, alice["USD"](1000)));
+
719  env.close();
+
720 
+
721  // bob's balance becomes positive from his perspective because
+
722  // alice issued more USD than the balance
+
723  env.require(balance(bob, alice["USD"](700)));
+
724  env.require(balance(alice, bob["USD"](-700)));
+
725 
+
726  // bob is now the holder and fails to clawback
+
727  env(claw(bob, alice["USD"](200)), ter(tecNO_PERMISSION));
+
728  env.close();
+
729 
+
730  // alice successfully claws back
+
731  env(claw(alice, bob["USD"](200)));
+
732  env.close();
+
733 
+
734  env.require(balance(bob, alice["USD"](500)));
+
735  env.require(balance(alice, bob["USD"](-500)));
+
736  }
+
737 
+
738  void
+ +
740  {
+
741  testcase("Delete default trustline");
+
742  using namespace test::jtx;
+
743 
+
744  // If clawback results the trustline to be default,
+
745  // trustline should be automatically deleted
+
746  Env env(*this, features);
+
747  Account alice{"alice"};
+
748  Account bob{"bob"};
+
749 
+
750  env.fund(XRP(1000), alice, bob);
+
751  env.close();
+
752 
+
753  auto const USD = alice["USD"];
+
754 
+
755  // alice sets asfAllowClawback
+
756  env(fset(alice, asfAllowClawback));
+
757  env.close();
+
758  env.require(flags(alice, asfAllowClawback));
+
759 
+
760  // alice issues 1000 USD to bob
+
761  env.trust(USD(1000), bob);
+
762  env(pay(alice, bob, USD(1000)));
+
763  env.close();
+
764 
+
765  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
766  BEAST_EXPECT(ownerCount(env, bob) == 1);
+
767 
+
768  env.require(balance(bob, alice["USD"](1000)));
+
769  env.require(balance(alice, bob["USD"](-1000)));
+
770 
+
771  // set limit to default,
+
772  env(trust(bob, USD(0), 0));
+
773  env.close();
+
774 
+
775  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
776  BEAST_EXPECT(ownerCount(env, bob) == 1);
+
777 
+
778  // alice claws back full amount from bob, and should also delete
+
779  // trustline
+
780  env(claw(alice, bob["USD"](1000)));
+
781  env.close();
+
782 
+
783  // bob no longer owns the trustline because it was deleted
+
784  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
785  BEAST_EXPECT(ownerCount(env, bob) == 0);
+
786  }
+
787 
+
788  void
+ +
790  {
+
791  testcase("Frozen trustline");
+
792  using namespace test::jtx;
+
793 
+
794  // Claws back from frozen trustline
+
795  // and the trustline should remain frozen
+
796  Env env(*this, features);
+
797  Account alice{"alice"};
+
798  Account bob{"bob"};
+
799 
+
800  env.fund(XRP(1000), alice, bob);
+
801  env.close();
+
802 
+
803  auto const USD = alice["USD"];
+
804 
+
805  // alice sets asfAllowClawback
+
806  env(fset(alice, asfAllowClawback));
+
807  env.close();
+
808  env.require(flags(alice, asfAllowClawback));
+
809 
+
810  // alice issues 1000 USD to bob
+
811  env.trust(USD(1000), bob);
+
812  env(pay(alice, bob, USD(1000)));
+
813  env.close();
+
814 
+
815  env.require(balance(bob, alice["USD"](1000)));
+
816  env.require(balance(alice, bob["USD"](-1000)));
+
817 
+
818  // freeze trustline
+
819  env(trust(alice, bob["USD"](0), tfSetFreeze));
+
820  env.close();
+
821 
+
822  // alice claws back 200 USD from bob
+
823  env(claw(alice, bob["USD"](200)));
+
824  env.close();
+
825 
+
826  // bob should have 800 USD left
+
827  env.require(balance(bob, alice["USD"](800)));
+
828  env.require(balance(alice, bob["USD"](-800)));
+
829 
+
830  // trustline remains frozen
+
831  BEAST_EXPECT(getLineFreezeFlag(env, alice, bob, USD.currency));
+
832  }
+
833 
+
834  void
+ +
836  {
+
837  testcase("Amount exceeds available");
+
838  using namespace test::jtx;
+
839 
+
840  // When alice tries to claw back an amount that is greater
+
841  // than what bob holds, only the max available balance is clawed
+
842  Env env(*this, features);
+
843  Account alice{"alice"};
+
844  Account bob{"bob"};
+
845 
+
846  env.fund(XRP(1000), alice, bob);
+
847  env.close();
+
848 
+
849  auto const USD = alice["USD"];
+
850 
+
851  // alice sets asfAllowClawback
+
852  env(fset(alice, asfAllowClawback));
+
853  env.close();
+
854  env.require(flags(alice, asfAllowClawback));
+
855 
+
856  // alice issues 1000 USD to bob
+
857  env.trust(USD(1000), bob);
+
858  env(pay(alice, bob, USD(1000)));
+
859  env.close();
+
860 
+
861  env.require(balance(bob, alice["USD"](1000)));
+
862  env.require(balance(alice, bob["USD"](-1000)));
+
863 
+
864  // alice tries to claw back 2000 USD
+
865  env(claw(alice, bob["USD"](2000)));
+
866  env.close();
+
867 
+
868  // check alice and bob's balance.
+
869  // alice was only able to claw back 1000 USD at maximum
+
870  env.require(balance(bob, alice["USD"](0)));
+
871  env.require(balance(alice, bob["USD"](0)));
+
872 
+
873  // bob still owns the trustline because trustline is not in default
+
874  // state
+
875  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
876  BEAST_EXPECT(ownerCount(env, bob) == 1);
+
877 
+
878  // set limit to default,
+
879  env(trust(bob, USD(0), 0));
+
880  env.close();
+
881 
+
882  // verify that bob's trustline was deleted
+
883  BEAST_EXPECT(ownerCount(env, alice) == 0);
+
884  BEAST_EXPECT(ownerCount(env, bob) == 0);
+
885  }
+
886 
+
887  void
+ +
889  {
+
890  testcase("Tickets");
+
891  using namespace test::jtx;
+
892 
+
893  // Tests clawback with tickets
+
894  Env env(*this, features);
+
895  Account alice{"alice"};
+
896  Account bob{"bob"};
+
897 
+
898  env.fund(XRP(1000), alice, bob);
+
899  env.close();
+
900 
+
901  auto const USD = alice["USD"];
+
902 
+
903  // alice sets asfAllowClawback
+
904  env(fset(alice, asfAllowClawback));
+
905  env.close();
+
906  env.require(flags(alice, asfAllowClawback));
+
907 
+
908  // alice issues 100 USD to bob
+
909  env.trust(USD(1000), bob);
+
910  env(pay(alice, bob, USD(100)));
+
911  env.close();
+
912 
+
913  env.require(balance(bob, alice["USD"](100)));
+
914  env.require(balance(alice, bob["USD"](-100)));
+
915 
+
916  // alice creates 10 tickets
+
917  std::uint32_t ticketCnt = 10;
+
918  std::uint32_t aliceTicketSeq{env.seq(alice) + 1};
+
919  env(ticket::create(alice, ticketCnt));
+
920  env.close();
+
921  std::uint32_t const aliceSeq{env.seq(alice)};
+
922  BEAST_EXPECT(ticketCount(env, alice) == ticketCnt);
+
923  BEAST_EXPECT(ownerCount(env, alice) == ticketCnt);
+
924 
+
925  while (ticketCnt > 0)
+
926  {
+
927  // alice claws back 5 USD using a ticket
+
928  env(claw(alice, bob["USD"](5)), ticket::use(aliceTicketSeq++));
+
929  env.close();
+
930 
+
931  ticketCnt--;
+
932  BEAST_EXPECT(ticketCount(env, alice) == ticketCnt);
+
933  BEAST_EXPECT(ownerCount(env, alice) == ticketCnt);
+
934  }
+
935 
+
936  // alice clawed back 50 USD total, trustline has 50 USD remaining
+
937  env.require(balance(bob, alice["USD"](50)));
+
938  env.require(balance(alice, bob["USD"](-50)));
+
939 
+
940  // Verify that the account sequence numbers did not advance.
+
941  BEAST_EXPECT(env.seq(alice) == aliceSeq);
+
942  }
+
943 
+
944  void
+ +
946  {
+
947  testAllowClawbackFlag(features);
+
948  testValidation(features);
+
949  testPermission(features);
+
950  testEnabled(features);
+
951  testMultiLine(features);
+
952  testBidirectionalLine(features);
+
953  testDeleteDefaultLine(features);
+
954  testFrozenLine(features);
+
955  testAmountExceedsAvailable(features);
+
956  testTickets(features);
+
957  }
+
958 
+
959 public:
+
960  void
+
961  run() override
+
962  {
+
963  using namespace test::jtx;
+
964  FeatureBitset const all{supported_amendments()};
+
965 
+ +
967  }
+
968 };
+
969 
+
970 BEAST_DEFINE_TESTSUITE(Clawback, app, ripple);
+
971 } // namespace ripple
+
+
ripple::sfOwnerCount
const SF_UINT32 sfOwnerCount
+
ripple::Clawback_test::testTickets
void testTickets(FeatureBitset features)
Definition: Clawback_test.cpp:888
+
ripple::Clawback_test::testEnabled
void testEnabled(FeatureBitset features)
Definition: Clawback_test.cpp:473
+
std::string
STL class.
+
ripple::BEAST_DEFINE_TESTSUITE
BEAST_DEFINE_TESTSUITE(AccountTxPaging, app, ripple)
+
ripple::featureClawback
const uint256 featureClawback
+
ripple::tecOWNERS
@ tecOWNERS
Definition: TER.h:265
+
ripple::tecINSUFFICIENT_FUNDS
@ tecINSUFFICIENT_FUNDS
Definition: TER.h:292
+
ripple::Clawback_test::getLineFreezeFlag
static bool getLineFreezeFlag(test::jtx::Env const &env, test::jtx::Account const &src, test::jtx::Account const &dst, Currency const &cur)
Definition: Clawback_test.cpp:62
+
ripple::TxSearched::all
@ all
+
ripple::asfNoFreeze
constexpr std::uint32_t asfNoFreeze
Definition: TxFlags.h:79
+
ripple::Clawback_test::testBidirectionalLine
void testBidirectionalLine(FeatureBitset features)
Definition: Clawback_test.cpp:647
+
ripple::asfAllowClawback
constexpr std::uint32_t asfAllowClawback
Definition: TxFlags.h:91
+
ripple::Clawback_test
Definition: Clawback_test.cpp:31
+
ripple::Clawback_test::testDeleteDefaultLine
void testDeleteDefaultLine(FeatureBitset features)
Definition: Clawback_test.cpp:739
+
ripple::test::jtx::Account::id
AccountID id() const
Returns the Account ID.
Definition: Account.h:106
+
ripple::base_uint< 160, detail::CurrencyTag >
+
ripple::temINVALID_FLAG
@ temINVALID_FLAG
Definition: TER.h:109
+
ripple::Clawback_test::testPermission
void testPermission(FeatureBitset features)
Definition: Clawback_test.cpp:335
+
ripple::Clawback_test::to_string
static std::string to_string(T const &t)
Definition: Clawback_test.cpp:35
+
ripple::Clawback_test::testFrozenLine
void testFrozenLine(FeatureBitset features)
Definition: Clawback_test.cpp:789
+
ripple::Clawback_test::testMultiLine
void testMultiLine(FeatureBitset features)
Definition: Clawback_test.cpp:520
+
ripple::sfTicketCount
const SF_UINT32 sfTicketCount
+
ripple::Clawback_test::ownerCount
static std::uint32_t ownerCount(test::jtx::Env const &env, test::jtx::Account const &acct)
Definition: Clawback_test.cpp:42
+
ripple::temBAD_AMOUNT
@ temBAD_AMOUNT
Definition: TER.h:87
+
std::uint32_t
+
ripple::keylet::line
Keylet line(AccountID const &id0, AccountID const &id1, Currency const &currency) noexcept
The index of a trust line for a given currency.
Definition: Indexes.cpp:193
+
ripple::Clawback_test::testAmountExceedsAvailable
void testAmountExceedsAvailable(FeatureBitset features)
Definition: Clawback_test.cpp:835
+
ripple::Clawback_test::run
void run() override
Definition: Clawback_test.cpp:961
+
ripple::terNO_ACCOUNT
@ terNO_ACCOUNT
Definition: TER.h:198
+
ripple::Clawback_test::testAllowClawbackFlag
void testAllowClawbackFlag(FeatureBitset features)
Definition: Clawback_test.cpp:78
+
ripple::lsfHighFreeze
@ lsfHighFreeze
Definition: LedgerFormats.h:262
+
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
+
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:112
+
ripple::Clawback_test::ticketCount
static std::uint32_t ticketCount(test::jtx::Env const &env, test::jtx::Account const &acct)
Definition: Clawback_test.cpp:52
+
ripple::tecNO_LINE
@ tecNO_LINE
Definition: TER.h:268
+
ripple::temDISABLED
@ temDISABLED
Definition: TER.h:112
+
ripple::test::jtx::Env::le
std::shared_ptr< SLE const > le(Account const &account) const
Return an account root.
Definition: Env.cpp:216
+
ripple::Clawback_test::testValidation
void testValidation(FeatureBitset features)
Definition: Clawback_test.cpp:206
+
ripple::tecNO_PERMISSION
@ tecNO_PERMISSION
Definition: TER.h:272
+
ripple::FeatureBitset
Definition: Feature.h:113
+
ripple::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
+
ripple::lsfLowFreeze
@ lsfLowFreeze
Definition: LedgerFormats.h:261
+
ripple::Clawback_test::testWithFeats
void testWithFeats(FeatureBitset features)
Definition: Clawback_test.cpp:945
+
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:116
+
initializer_list
+ + + + diff --git a/CreateCheck_8cpp_source.html b/CreateCheck_8cpp_source.html index 2f96e29796..41dde34758 100644 --- a/CreateCheck_8cpp_source.html +++ b/CreateCheck_8cpp_source.html @@ -368,7 +368,7 @@ $(function() {
ripple::lsfRequireDestTag
@ lsfRequireDestTag
Definition: LedgerFormats.h:224
ripple::tecDIR_FULL
@ tecDIR_FULL
Definition: TER.h:254
ripple::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition: Transactor.h:52
-
ripple::lsfHighFreeze
@ lsfHighFreeze
Definition: LedgerFormats.h:259
+
ripple::lsfHighFreeze
@ lsfHighFreeze
Definition: LedgerFormats.h:262
ripple::SeqProxy::value
constexpr std::uint32_t value() const
Definition: SeqProxy.h:82
ripple::ApplyView::insert
virtual void insert(std::shared_ptr< SLE > const &sle)=0
Insert a new state SLE.
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
@@ -389,7 +389,7 @@ $(function() {
ripple::Transactor::ctx_
ApplyContext & ctx_
Definition: Transactor.h:88
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::sfAccount
const SF_ACCOUNT sfAccount
-
ripple::lsfLowFreeze
@ lsfLowFreeze
Definition: LedgerFormats.h:258
+
ripple::lsfLowFreeze
@ lsfLowFreeze
Definition: LedgerFormats.h:261
ripple::PreflightContext::tx
STTx const & tx
Definition: Transactor.h:35
ripple::PreflightContext
State information when preflighting a tx.
Definition: Transactor.h:31
ripple::temBAD_EXPIRATION
@ temBAD_EXPIRATION
Definition: TER.h:89
diff --git a/CreateOffer_8cpp_source.html b/CreateOffer_8cpp_source.html index 34d4db7016..01a1bc2c2e 100644 --- a/CreateOffer_8cpp_source.html +++ b/CreateOffer_8cpp_source.html @@ -1352,7 +1352,7 @@ $(function() {
ripple::BasicTaker::unfunded
bool unfunded() const
Returns true if the taker has run out of funds.
Definition: Taker.cpp:102
ripple::Sandbox::apply
void apply(RawView &to)
Definition: Sandbox.h:55
std::pair
-
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:254
+
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:257
ripple::featureDepositPreauth
const uint256 featureDepositPreauth
ripple::sfSequence
const SF_UINT32 sfSequence
ripple::sfBookDirectory
const SF_UINT256 sfBookDirectory
@@ -1366,7 +1366,7 @@ $(function() {
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:29
ripple::keylet::offer
Keylet offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
Definition: Indexes.cpp:222
ripple::Issue::currency
Currency currency
Definition: Issue.h:37
-
ripple::tfOfferCreateMask
constexpr std::uint32_t tfOfferCreateMask
Definition: TxFlags.h:97
+
ripple::tfOfferCreateMask
constexpr std::uint32_t tfOfferCreateMask
Definition: TxFlags.h:98
ripple::CrossType::IouToXrp
@ IouToXrp
ripple::multiplyRound
STAmount multiplyRound(STAmount const &amount, Rate const &rate, bool roundUp)
Definition: Rate2.cpp:58
ripple::transToken
std::string transToken(TER code)
Definition: TER.cpp:210
@@ -1376,7 +1376,7 @@ $(function() {
ripple::STTx::getSeqProxy
SeqProxy getSeqProxy() const
Definition: STTx.cpp:183
ripple::divideRound
STAmount divideRound(STAmount const &amount, Rate const &rate, bool roundUp)
Definition: Rate2.cpp:97
ripple::isLegalNet
bool isLegalNet(STAmount const &value)
Definition: STAmount.h:446
-
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:93
+
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:94
ripple::OfferStream
Presents and consumes the offers in an order book.
Definition: OfferStream.h:147
ripple::ApplyContext::rawView
RawView & rawView()
Definition: ApplyContext.h:67
ripple::Taker::get_bridge_crossings
std::uint32_t get_bridge_crossings() const
Definition: Taker.h:274
@@ -1392,7 +1392,7 @@ $(function() {
ripple::STPathSet
Definition: STPathSet.h:176
ripple::preflight1
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
Definition: Transactor.cpp:78
ripple::ApplyView
Writeable view to a ledger, for applying a transaction.
Definition: ApplyView.h:134
-
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:255
+
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:258
ripple::tecKILLED
@ tecKILLED
Definition: TER.h:283
ripple::mulRound
STAmount mulRound(STAmount const &v1, STAmount const &v2, Issue const &issue, bool roundUp)
Definition: STAmount.cpp:1510
ripple::ApplyContext::app
Application & app
Definition: ApplyContext.h:47
@@ -1419,7 +1419,7 @@ $(function() {
ripple::CreateOffer::preclaim
static TER preclaim(PreclaimContext const &ctx)
Enforce constraints beyond those of the Transactor base class.
Definition: CreateOffer.cpp:129
ripple::CrossType::IouToIou
@ IouToIou
ripple::ApplyView::dirAppend
std::optional< std::uint64_t > dirAppend(Keylet const &directory, Keylet const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Append an entry to a directory.
Definition: ApplyView.h:272
-
ripple::lsfSell
@ lsfSell
Definition: LedgerFormats.h:249
+
ripple::lsfSell
@ lsfSell
Definition: LedgerFormats.h:252
ripple::keylet::account
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition: Indexes.cpp:133
ripple::CreateOffer::preCompute
void preCompute() override
Gather information beyond what the Transactor base class gathers.
Definition: CreateOffer.cpp:900
ripple::offerDelete
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
Definition: View.cpp:893
@@ -1454,11 +1454,11 @@ $(function() {
ripple::keylet::line
Keylet line(AccountID const &id0, AccountID const &id1, Currency const &currency) noexcept
The index of a trust line for a given currency.
Definition: Indexes.cpp:193
ripple::CreateOffer::cross_type_
CrossType cross_type_
Definition: CreateOffer.h:139
ripple::temREDUNDANT
@ temREDUNDANT
Definition: TER.h:110
-
ripple::lsfPassive
@ lsfPassive
Definition: LedgerFormats.h:248
+
ripple::lsfPassive
@ lsfPassive
Definition: LedgerFormats.h:251
ripple::ReadView::read
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
ripple::ApplyContext::view
ApplyView & view()
Definition: ApplyContext.h:54
ripple::PreclaimContext::tx
STTx const & tx
Definition: Transactor.h:58
-
ripple::tfFillOrKill
constexpr std::uint32_t tfFillOrKill
Definition: TxFlags.h:95
+
ripple::tfFillOrKill
constexpr std::uint32_t tfFillOrKill
Definition: TxFlags.h:96
ripple::accountFunds
STAmount accountFunds(ReadView const &view, AccountID const &id, STAmount const &saDefault, FreezeHandling freezeHandling, beast::Journal j)
Definition: View.cpp:267
ripple::tecDIR_FULL
@ tecDIR_FULL
Definition: TER.h:254
ripple::terNO_ACCOUNT
@ terNO_ACCOUNT
Definition: TER.h:198
@@ -1474,7 +1474,7 @@ $(function() {
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:125
ripple::BasicTaker::done
bool done() const
Returns true if order crossing should not continue.
Definition: Taker.cpp:112
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
-
ripple::tfSell
constexpr std::uint32_t tfSell
Definition: TxFlags.h:96
+
ripple::tfSell
constexpr std::uint32_t tfSell
Definition: TxFlags.h:97
ripple::Application::journal
virtual beast::Journal journal(std::string const &name)=0
ripple::featureImmediateOfferKilled
const uint256 featureImmediateOfferKilled
ripple::CreateOffer::cross
std::pair< TER, Amounts > cross(Sandbox &sb, Sandbox &sbCancel, Amounts const &takerAmount)
Definition: CreateOffer.cpp:870
@@ -1523,7 +1523,7 @@ $(function() {
ripple::CreateOffer::stepCounter_
OfferStream::StepCounter stepCounter_
Definition: CreateOffer.h:142
ripple::Transactor::account_
const AccountID account_
Definition: Transactor.h:91
ripple::TOffer
Definition: Offer.h:49
-
ripple::tfImmediateOrCancel
constexpr std::uint32_t tfImmediateOrCancel
Definition: TxFlags.h:94
+
ripple::tfImmediateOrCancel
constexpr std::uint32_t tfImmediateOrCancel
Definition: TxFlags.h:95
ripple::Transactor::preCompute
virtual void preCompute()
Definition: Transactor.cpp:437
ripple::STObject::getFieldAmount
STAmount const & getFieldAmount(SField const &field) const
Definition: STObject.cpp:603
ripple::xrpCurrency
Currency const & xrpCurrency()
XRP currency.
Definition: UintTypes.cpp:121
diff --git a/DeliverMin__test_8cpp_source.html b/DeliverMin__test_8cpp_source.html index 8053a5dd2c..b8730a3f48 100644 --- a/DeliverMin__test_8cpp_source.html +++ b/DeliverMin__test_8cpp_source.html @@ -220,7 +220,7 @@ $(function() {
ripple::test::jtx::balance
A balance matches.
Definition: balance.h:38
ripple::test::jtx::Env::trust
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
Definition: Env.cpp:259
ripple::test::DeliverMin_test::test_convert_all_of_an_asset
void test_convert_all_of_an_asset(FeatureBitset features)
Definition: DeliverMin_test.cpp:31
-
ripple::tfPartialPayment
constexpr std::uint32_t tfPartialPayment
Definition: TxFlags.h:102
+
ripple::tfPartialPayment
constexpr std::uint32_t tfPartialPayment
Definition: TxFlags.h:103
ripple::test::jtx::sendmax
Sets the SendMax on a JTx.
Definition: sendmax.h:31
ripple::test::jtx::txflags
Set the flags on a JTx.
Definition: txflags.h:30
ripple::test::jtx::paths
Set Paths, SendMax on a JTx.
Definition: paths.h:32
diff --git a/DeliveredAmount__test_8cpp_source.html b/DeliveredAmount__test_8cpp_source.html index ba8b9a691a..739f2a1e8f 100644 --- a/DeliveredAmount__test_8cpp_source.html +++ b/DeliveredAmount__test_8cpp_source.html @@ -429,7 +429,7 @@ $(function() {
ripple::test::DeliveredAmount_test::run
void run() override
Definition: DeliveredAmount_test.cpp:330
ripple::test::CheckDeliveredAmount::CheckDeliveredAmount
CheckDeliveredAmount(bool afterSwitchTime)
Definition: DeliveredAmount_test.cpp:67
ripple::sfDeliveredAmount
const SF_AMOUNT sfDeliveredAmount
-
ripple::tfPartialPayment
constexpr std::uint32_t tfPartialPayment
Definition: TxFlags.h:102
+
ripple::tfPartialPayment
constexpr std::uint32_t tfPartialPayment
Definition: TxFlags.h:103
ripple::test::jtx::txflags
Set the flags on a JTx.
Definition: txflags.h:30
std::chrono::time_point
Json::Value::isMember
bool isMember(const char *key) const
Return true if the object has a member named key.
Definition: json_value.cpp:932
diff --git a/DepositAuth__test_8cpp_source.html b/DepositAuth__test_8cpp_source.html index 165501939e..fe4f54d945 100644 --- a/DepositAuth__test_8cpp_source.html +++ b/DepositAuth__test_8cpp_source.html @@ -826,14 +826,14 @@ $(function() {
ripple::test::DepositAuth_test
Definition: DepositAuth_test.cpp:41
ripple::featureDepositPreauth
const uint256 featureDepositPreauth
ripple::test::jtx::trust
Json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
Definition: trust.cpp:30
-
ripple::tfSetNoRipple
constexpr std::uint32_t tfSetNoRipple
Definition: TxFlags.h:109
+
ripple::tfSetNoRipple
constexpr std::uint32_t tfSetNoRipple
Definition: TxFlags.h:110
ripple::featureDepositAuth
const uint256 featureDepositAuth
ripple::test::jtx::require
Check a set of conditions.
Definition: require.h:63
ripple::DepositPreauth
Definition: DepositPreauth.h:27
ripple::temCANNOT_PREAUTH_SELF
@ temCANNOT_PREAUTH_SELF
Definition: TER.h:118
ripple::test::DepositPreauth_test::testPayment
void testPayment(FeatureBitset features)
Definition: DepositAuth_test.cpp:587
ripple::test::jtx::Env::balance
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
Definition: Env.cpp:183
-
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:93
+
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:94
ripple::test::DepositAuth_test::testEnable
void testEnable()
Definition: DepositAuth_test.cpp:44
ripple::SField::jsonName
const Json::StaticString jsonName
Definition: SField.h:136
ripple::test::jtx::Env::trust
void trust(STAmount const &amount, Account const &account)
Establish trust lines.
Definition: Env.cpp:259
@@ -865,8 +865,8 @@ $(function() {
ripple::test::DepositPreauth_test::testInvalid
void testInvalid()
Definition: DepositAuth_test.cpp:469
ripple::test::jtx::seq
Set the sequence number on a JTx.
Definition: seq.h:33
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
-
ripple::tfSell
constexpr std::uint32_t tfSell
Definition: TxFlags.h:96
-
ripple::test::jtx::flags
Match set account flags.
Definition: flags.h:108
+
ripple::tfSell
constexpr std::uint32_t tfSell
Definition: TxFlags.h:97
+
ripple::test::jtx::flags
Match set account flags.
Definition: flags.h:111
ripple::temINVALID_ACCOUNT_ID
@ temINVALID_ACCOUNT_ID
Definition: TER.h:117
Json::Value::removeMember
Value removeMember(const char *key)
Remove and return the named member.
Definition: json_value.cpp:907
ripple::test::jtx::IOU
Converts to IOU Issue or STAmount.
Definition: amount.h:291
@@ -879,7 +879,7 @@ $(function() {
ripple::FeatureBitset
Definition: Feature.h:113
ripple::tecPATH_DRY
@ tecPATH_DRY
Definition: TER.h:261
ripple::tecINSUFFICIENT_RESERVE
@ tecINSUFFICIENT_RESERVE
Definition: TER.h:274
-
ripple::test::jtx::nflags
Match clear account flags.
Definition: flags.h:125
+
ripple::test::jtx::nflags
Match clear account flags.
Definition: flags.h:128
ripple::test::DepositPreauth_test::testEnable
void testEnable()
Definition: DepositAuth_test.cpp:387
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::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
diff --git a/DirectStep_8cpp_source.html b/DirectStep_8cpp_source.html index 28798d3189..899dd68fc9 100644 --- a/DirectStep_8cpp_source.html +++ b/DirectStep_8cpp_source.html @@ -1102,10 +1102,10 @@ $(function() {
ripple::Step::directStepSrcAcct
virtual std::optional< AccountID > directStepSrcAcct() const
If this step is DirectStepI (IOU->IOU direct step), return the src account.
Definition: Steps.h:139
std::pair
ripple::DirectIPaymentStep
Definition: DirectStep.cpp:233
-
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:254
+
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:257
ripple::DirectStepI::qualities
std::pair< std::uint32_t, std::uint32_t > qualities(ReadView const &sb, DebtDirection srcDebtDir, StrandDirection strandDir) const
Definition: DirectStep.cpp:804
ripple::DirectStepI::cache_
std::optional< Cache > cache_
Definition: DirectStep.cpp:66
-
ripple::lsfLowNoRipple
@ lsfLowNoRipple
Definition: LedgerFormats.h:256
+
ripple::lsfLowNoRipple
@ lsfLowNoRipple
Definition: LedgerFormats.h:259
ripple::DirectIOfferCrossingStep::verifyPrevStepDebtDirection
bool verifyPrevStepDebtDirection(DebtDirection prevStepDir) const
Definition: DirectStep.cpp:283
ripple::accountHolds
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
Definition: View.cpp:223
ripple::DirectStepI::qualityUpperBound
std::pair< std::optional< Quality >, DebtDirection > qualityUpperBound(ReadView const &v, DebtDirection dir) const override
Definition: DirectStep.cpp:834
@@ -1130,7 +1130,7 @@ $(function() {
ripple::DirectIOfferCrossingStep
Definition: DirectStep.cpp:276
ripple::toAmount< IOUAmount >
IOUAmount toAmount< IOUAmount >(STAmount const &amt)
Definition: AmountConversions.h:77
ripple::ApplyView
Writeable view to a ledger, for applying a transaction.
Definition: ApplyView.h:134
-
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:255
+
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:258
ripple::StrandDirection
StrandDirection
Definition: Steps.h:39
ripple::DirectStepI::Cache::srcToDst
IOUAmount srcToDst
Definition: DirectStep.cpp:52
ripple::DirectIPaymentStep::logString
std::string logString() const override
Definition: DirectStep.cpp:269
@@ -1171,7 +1171,7 @@ $(function() {
ripple::keylet::line
Keylet line(AccountID const &id0, AccountID const &id1, Currency const &currency) noexcept
The index of a trust line for a given currency.
Definition: Indexes.cpp:193
ripple::ReadView::read
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
ripple::DirectStepI::j_
const beast::Journal j_
Definition: DirectStep.cpp:47
-
ripple::lsfHighNoRipple
@ lsfHighNoRipple
Definition: LedgerFormats.h:257
+
ripple::lsfHighNoRipple
@ lsfHighNoRipple
Definition: LedgerFormats.h:260
ripple::terNO_ACCOUNT
@ terNO_ACCOUNT
Definition: TER.h:198
ripple::StrandDirection::reverse
@ reverse
ripple::DebtDirection::issues
@ issues
diff --git a/Discrepancy__test_8cpp_source.html b/Discrepancy__test_8cpp_source.html index bf27c8cf47..6c8be5ae54 100644 --- a/Discrepancy__test_8cpp_source.html +++ b/Discrepancy__test_8cpp_source.html @@ -232,7 +232,7 @@ $(function() {
ripple::test::Path
Definition: PathSet.h:92
ripple::sfFinalFields
const SField sfFinalFields
ripple::sfDeletedNode
const SField sfDeletedNode
-
ripple::tfPartialPayment
constexpr std::uint32_t tfPartialPayment
Definition: TxFlags.h:102
+
ripple::tfPartialPayment
constexpr std::uint32_t tfPartialPayment
Definition: TxFlags.h:103
ripple::sfNewFields
const SField sfNewFields
ripple::JsonOptions::none
@ none
ripple::sfAffectedNodes
const SField sfAffectedNodes
diff --git a/Env_8cpp_source.html b/Env_8cpp_source.html index 29240d861d..9c50520b30 100644 --- a/Env_8cpp_source.html +++ b/Env_8cpp_source.html @@ -656,7 +656,7 @@ $(function() {
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::Config::features
std::unordered_set< uint256, beast::uhash<> > features
Definition: Config.h:282
-
ripple::test::jtx::flags
Match set account flags.
Definition: flags.h:108
+
ripple::test::jtx::flags
Match set account flags.
Definition: flags.h:111
std::endl
T endl(T... args)
ripple::test::jtx::Env::autofill
virtual void autofill(JTx &jt)
Definition: Env.cpp:411
ripple::test::jtx::Env::do_rpc
Json::Value do_rpc(std::vector< std::string > const &args, std::unordered_map< std::string, std::string > const &headers={})
Definition: Env.cpp:457
@@ -675,7 +675,7 @@ $(function() {
ripple::test::jtx::Env::master
Account const & master
Definition: Env.h:121
ripple::sfBalance
const SF_AMOUNT sfBalance
ripple::NetworkOPs::acceptLedger
virtual std::uint32_t acceptLedger(std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)=0
Accepts the current transaction tree, return the new ledger's sequence.
-
ripple::test::jtx::nflags
Match clear account flags.
Definition: flags.h:125
+
ripple::test::jtx::nflags
Match clear account flags.
Definition: flags.h:128
std::optional< std::chrono::milliseconds >
ripple::test::jtx::Env::disableFeature
void disableFeature(uint256 const feature)
Definition: Env.cpp:473
ripple::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
diff --git a/Env__test_8cpp_source.html b/Env__test_8cpp_source.html index b29ca359f6..39b6298db2 100644 --- a/Env__test_8cpp_source.html +++ b/Env__test_8cpp_source.html @@ -1098,7 +1098,7 @@ $(function() {
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::Config::features
std::unordered_set< uint256, beast::uhash<> > features
Definition: Config.h:282
ripple::test::Env_test::UDT
Definition: Env_test.cpp:496
-
ripple::test::jtx::flags
Match set account flags.
Definition: flags.h:108
+
ripple::test::jtx::flags
Match set account flags.
Definition: flags.h:111
ripple::test::jtx::noripple
std::array< Account, 1+sizeof...(Args)> noripple(Account const &account, Args const &... args)
Designate accounts as no-ripple in Env::fund.
Definition: Env.h:64
std::endl
T endl(T... args)
ripple::test::jtx::pay
Json::Value pay(Account const &account, Account const &to, AnyAmount amount)
Create a payment.
Definition: pay.cpp:29
@@ -1119,7 +1119,7 @@ $(function() {
ripple::test::Env_test::testFailHard
void testFailHard()
Definition: Env_test.cpp:372
ripple::tecPATH_DRY
@ tecPATH_DRY
Definition: TER.h:261
ripple::test::jtx::memonformat
Definition: memo.h:112
-
ripple::test::jtx::nflags
Match clear account flags.
Definition: flags.h:125
+
ripple::test::jtx::nflags
Match clear account flags.
Definition: flags.h:128
ripple::terPRE_SEQ
@ terPRE_SEQ
Definition: TER.h:202
std::is_trivially_constructible
optional
diff --git a/Escrow__test_8cpp_source.html b/Escrow__test_8cpp_source.html index eeb9244a5f..eccc529847 100644 --- a/Escrow__test_8cpp_source.html +++ b/Escrow__test_8cpp_source.html @@ -1767,7 +1767,7 @@ $(function() {
ripple::test::jtx::Env::balance
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
Definition: Env.cpp:183
ripple::test::Escrow_test::fulfillment::value_
std::string value_
Definition: Escrow_test.cpp:126
ripple::test::jtx::Env::app
Application & app()
Definition: Env.h:241
-
ripple::preflight
PreflightResult preflight(Application &app, Rules const &rules, STTx const &tx, ApplyFlags flags, beast::Journal j)
Gate a transaction based on static information.
Definition: applySteps.cpp:473
+
ripple::preflight
PreflightResult preflight(Application &app, Rules const &rules, STTx const &tx, ApplyFlags flags, beast::Journal j)
Gate a transaction based on static information.
Definition: applySteps.cpp:484
ripple::test::Escrow_test::testMetaAndOwnership
void testMetaAndOwnership()
Definition: Escrow_test.cpp:1263
ripple::tapNONE
@ tapNONE
Definition: ApplyView.h:30
ripple::SField::jsonName
const Json::StaticString jsonName
Definition: SField.h:136
diff --git a/Feature_8cpp_source.html b/Feature_8cpp_source.html index 1e7cb75756..6b222977c2 100644 --- a/Feature_8cpp_source.html +++ b/Feature_8cpp_source.html @@ -501,62 +501,63 @@ $(function() {
453 REGISTER_FIX (fixNonFungibleTokensV1_2, Supported::yes, VoteBehavior::DefaultNo);
454 REGISTER_FIX (fixNFTokenRemint, Supported::yes, VoteBehavior::DefaultNo);
455 REGISTER_FIX (fixReducedOffersV1, Supported::yes, VoteBehavior::DefaultNo);
-
456 
-
457 // The following amendments are obsolete, but must remain supported
-
458 // because they could potentially get enabled.
-
459 //
-
460 // Obsolete features are (usually) not in the ledger, and may have code
-
461 // controlled by the feature. They need to be supported because at some
-
462 // time in the past, the feature was supported and votable, but never
-
463 // passed. So the feature needs to be supported in case it is ever
-
464 // enabled (added to the ledger).
-
465 //
-
466 // If a feature remains obsolete for long enough that no clients are able
-
467 // to vote for it, the feature can be removed (entirely?) from the code.
-
468 REGISTER_FEATURE(CryptoConditionsSuite, Supported::yes, VoteBehavior::Obsolete);
-
469 REGISTER_FEATURE(NonFungibleTokensV1, Supported::yes, VoteBehavior::Obsolete);
-
470 REGISTER_FIX (fixNFTokenDirV1, Supported::yes, VoteBehavior::Obsolete);
-
471 REGISTER_FIX (fixNFTokenNegOffer, Supported::yes, VoteBehavior::Obsolete);
-
472 
-
473 // The following amendments have been active for at least two years. Their
-
474 // pre-amendment code has been removed and the identifiers are deprecated.
-
475 // All known amendments and amendments that may appear in a validated
-
476 // ledger must be registered either here or above with the "active" amendments
-
477 [[deprecated("The referenced amendment has been retired"), maybe_unused]]
-
478 uint256 const
-
479  retiredMultiSign = retireFeature("MultiSign"),
-
480  retiredTrustSetAuth = retireFeature("TrustSetAuth"),
-
481  retiredFeeEscalation = retireFeature("FeeEscalation"),
-
482  retiredPayChan = retireFeature("PayChan"),
-
483  retiredCryptoConditions = retireFeature("CryptoConditions"),
-
484  retiredTickSize = retireFeature("TickSize"),
-
485  retiredFix1368 = retireFeature("fix1368"),
-
486  retiredEscrow = retireFeature("Escrow"),
-
487  retiredFix1373 = retireFeature("fix1373"),
-
488  retiredEnforceInvariants = retireFeature("EnforceInvariants"),
-
489  retiredSortedDirectories = retireFeature("SortedDirectories"),
-
490  retiredFix1201 = retireFeature("fix1201"),
-
491  retiredFix1512 = retireFeature("fix1512"),
-
492  retiredFix1523 = retireFeature("fix1523"),
-
493  retiredFix1528 = retireFeature("fix1528");
-
494 
-
495 // clang-format on
-
496 
-
497 #undef REGISTER_FIX
-
498 #pragma pop_macro("REGISTER_FIX")
-
499 
-
500 #undef REGISTER_FEATURE
-
501 #pragma pop_macro("REGISTER_FEATURE")
-
502 
-
503 // All of the features should now be registered, since variables in a cpp file
-
504 // are initialized from top to bottom.
-
505 //
-
506 // Use initialization of one final static variable to set
-
507 // featureCollections::readOnly.
-
508 [[maybe_unused]] static const bool readOnlySet =
-
509  featureCollections.registrationIsDone();
-
510 
-
511 } // namespace ripple
+
456 REGISTER_FEATURE(Clawback, Supported::yes, VoteBehavior::DefaultNo);
+
457 
+
458 // The following amendments are obsolete, but must remain supported
+
459 // because they could potentially get enabled.
+
460 //
+
461 // Obsolete features are (usually) not in the ledger, and may have code
+
462 // controlled by the feature. They need to be supported because at some
+
463 // time in the past, the feature was supported and votable, but never
+
464 // passed. So the feature needs to be supported in case it is ever
+
465 // enabled (added to the ledger).
+
466 //
+
467 // If a feature remains obsolete for long enough that no clients are able
+
468 // to vote for it, the feature can be removed (entirely?) from the code.
+
469 REGISTER_FEATURE(CryptoConditionsSuite, Supported::yes, VoteBehavior::Obsolete);
+
470 REGISTER_FEATURE(NonFungibleTokensV1, Supported::yes, VoteBehavior::Obsolete);
+
471 REGISTER_FIX (fixNFTokenDirV1, Supported::yes, VoteBehavior::Obsolete);
+
472 REGISTER_FIX (fixNFTokenNegOffer, Supported::yes, VoteBehavior::Obsolete);
+
473 
+
474 // The following amendments have been active for at least two years. Their
+
475 // pre-amendment code has been removed and the identifiers are deprecated.
+
476 // All known amendments and amendments that may appear in a validated
+
477 // ledger must be registered either here or above with the "active" amendments
+
478 [[deprecated("The referenced amendment has been retired"), maybe_unused]]
+
479 uint256 const
+
480  retiredMultiSign = retireFeature("MultiSign"),
+
481  retiredTrustSetAuth = retireFeature("TrustSetAuth"),
+
482  retiredFeeEscalation = retireFeature("FeeEscalation"),
+
483  retiredPayChan = retireFeature("PayChan"),
+
484  retiredCryptoConditions = retireFeature("CryptoConditions"),
+
485  retiredTickSize = retireFeature("TickSize"),
+
486  retiredFix1368 = retireFeature("fix1368"),
+
487  retiredEscrow = retireFeature("Escrow"),
+
488  retiredFix1373 = retireFeature("fix1373"),
+
489  retiredEnforceInvariants = retireFeature("EnforceInvariants"),
+
490  retiredSortedDirectories = retireFeature("SortedDirectories"),
+
491  retiredFix1201 = retireFeature("fix1201"),
+
492  retiredFix1512 = retireFeature("fix1512"),
+
493  retiredFix1523 = retireFeature("fix1523"),
+
494  retiredFix1528 = retireFeature("fix1528");
+
495 
+
496 // clang-format on
+
497 
+
498 #undef REGISTER_FIX
+
499 #pragma pop_macro("REGISTER_FIX")
+
500 
+
501 #undef REGISTER_FEATURE
+
502 #pragma pop_macro("REGISTER_FEATURE")
+
503 
+
504 // All of the features should now be registered, since variables in a cpp file
+
505 // are initialized from top to bottom.
+
506 //
+
507 // Use initialization of one final static variable to set
+
508 // featureCollections::readOnly.
+
509 [[maybe_unused]] static const bool readOnlySet =
+
510  featureCollections.registrationIsDone();
+
511 
+
512 } // namespace ripple
ripple::fixRemoveNFTokenAutoTrustLine
const uint256 fixRemoveNFTokenAutoTrustLine
ripple::REGISTER_FIX
REGISTER_FIX(fix1513, Supported::yes, VoteBehavior::DefaultYes)
@@ -564,8 +565,8 @@ $(function() {
ripple::fixNFTokenNegOffer
const uint256 fixNFTokenNegOffer
std::string
STL class.
cstring
-
ripple::retiredFix1528
const uint256 retiredFix1528
Definition: Feature.cpp:493
-
ripple::retiredSortedDirectories
const uint256 retiredSortedDirectories
Definition: Feature.cpp:489
+
ripple::retiredFix1528
const uint256 retiredFix1528
Definition: Feature.cpp:494
+
ripple::retiredSortedDirectories
const uint256 retiredSortedDirectories
Definition: Feature.cpp:490
ripple::fix1515
const uint256 fix1515
ripple::detail::numFeatures
static constexpr std::size_t numFeatures
Definition: Feature.h:77
ripple::hash_value
std::size_t hash_value(ripple::uint256 const &feature)
Definition: Feature.cpp:35
@@ -575,40 +576,40 @@ $(function() {
ripple::VoteBehavior::DefaultNo
@ DefaultNo
ripple::fix1781
const uint256 fix1781
Json::check
void check(bool condition, std::string const &message)
Definition: json/Writer.h:252
-
ripple::readOnlySet
static const bool readOnlySet
Definition: Feature.cpp:508
-
ripple::retiredPayChan
const uint256 retiredPayChan
Definition: Feature.cpp:482
+
ripple::readOnlySet
static const bool readOnlySet
Definition: Feature.cpp:509
+
ripple::retiredPayChan
const uint256 retiredPayChan
Definition: Feature.cpp:483
boost
Definition: IPAddress.h:103
-
ripple::retiredFix1368
const uint256 retiredFix1368
Definition: Feature.cpp:485
-
ripple::retiredEnforceInvariants
const uint256 retiredEnforceInvariants
Definition: Feature.cpp:488
-
ripple::retiredMultiSign
const uint256 retiredMultiSign
Definition: Feature.cpp:479
+
ripple::retiredFix1368
const uint256 retiredFix1368
Definition: Feature.cpp:486
+
ripple::retiredEnforceInvariants
const uint256 retiredEnforceInvariants
Definition: Feature.cpp:489
+
ripple::retiredMultiSign
const uint256 retiredMultiSign
Definition: Feature.cpp:480
ripple::VoteBehavior::Obsolete
@ Obsolete
ripple::REGISTER_FEATURE
REGISTER_FEATURE(OwnerPaysFee, Supported::no, VoteBehavior::DefaultNo)
ripple::fixNFTokenRemint
const uint256 fixNFTokenRemint
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:550
-
ripple::retiredTickSize
const uint256 retiredTickSize
Definition: Feature.cpp:484
+
ripple::retiredTickSize
const uint256 retiredTickSize
Definition: Feature.cpp:485
ripple::detail::numUpVotedAmendments
std::size_t numUpVotedAmendments()
Amendments that this server will vote for by default.
Definition: Feature.cpp:334
ripple::base_uint< 256 >
ripple::detail::numDownVotedAmendments
std::size_t numDownVotedAmendments()
Amendments that this server won't vote for by default.
Definition: Feature.cpp:327
-
ripple::retiredEscrow
const uint256 retiredEscrow
Definition: Feature.cpp:486
+
ripple::retiredEscrow
const uint256 retiredEscrow
Definition: Feature.cpp:487
ripple::VoteBehavior
VoteBehavior
Definition: Feature.h:69
ripple::fix1513
const uint256 fix1513
ripple::fixCheckThreading
const uint256 fixCheckThreading
-
ripple::retiredFix1373
const uint256 retiredFix1373
Definition: Feature.cpp:487
+
ripple::retiredFix1373
const uint256 retiredFix1373
Definition: Feature.cpp:488
ripple::fixAmendmentMajorityCalc
const uint256 fixAmendmentMajorityCalc
-
ripple::retiredTrustSetAuth
const uint256 retiredTrustSetAuth
Definition: Feature.cpp:480
+
ripple::retiredTrustSetAuth
const uint256 retiredTrustSetAuth
Definition: Feature.cpp:481
ripple::fixTakerDryOfferRemoval
const uint256 fixTakerDryOfferRemoval
ripple::fix1623
const uint256 fix1623
ripple::featureToBitsetIndex
size_t featureToBitsetIndex(uint256 const &f)
Definition: Feature.cpp:369
ripple::fixPayChanRecipientOwnerDir
const uint256 fixPayChanRecipientOwnerDir
ripple::fixMasterKeyAsRegularKey
const uint256 fixMasterKeyAsRegularKey
std::atomic< bool >
-
ripple::retiredCryptoConditions
const uint256 retiredCryptoConditions
Definition: Feature.cpp:483
+
ripple::retiredCryptoConditions
const uint256 retiredCryptoConditions
Definition: Feature.cpp:484
std::map
STL class.
ripple::fixNFTokenDirV1
const uint256 fixNFTokenDirV1
ripple::fixRmSmallIncreasedQOffers
const uint256 fixRmSmallIncreasedQOffers
ripple::fixTrustLinesToSelf
const uint256 fixTrustLinesToSelf
ripple::fix1543
const uint256 fix1543
-
ripple::retiredFeeEscalation
const uint256 retiredFeeEscalation
Definition: Feature.cpp:481
+
ripple::retiredFeeEscalation
const uint256 retiredFeeEscalation
Definition: Feature.cpp:482
ripple::fix1578
const uint256 fix1578
ripple::registerFeature
uint256 registerFeature(std::string const &name, Supported support, VoteBehavior vote)
Definition: Feature.cpp:348
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
@@ -616,14 +617,14 @@ $(function() {
ripple::sha512Half
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition: digest.h:216
ripple::fixUniversalNumber
const uint256 fixUniversalNumber
ripple::bitsetIndexToFeature
uint256 bitsetIndexToFeature(size_t i)
Definition: Feature.cpp:375
-
ripple::retiredFix1523
const uint256 retiredFix1523
Definition: Feature.cpp:492
-
ripple::retiredFix1201
const uint256 retiredFix1201
Definition: Feature.cpp:490
+
ripple::retiredFix1523
const uint256 retiredFix1523
Definition: Feature.cpp:493
+
ripple::retiredFix1201
const uint256 retiredFix1201
Definition: Feature.cpp:491
std::optional
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::retireFeature
uint256 retireFeature(std::string const &name)
Definition: Feature.cpp:356
ripple::fixNonFungibleTokensV1_2
const uint256 fixNonFungibleTokensV1_2
-
ripple::retiredFix1512
const uint256 retiredFix1512
Definition: Feature.cpp:491
+
ripple::retiredFix1512
const uint256 retiredFix1512
Definition: Feature.cpp:492
ripple::fix1571
const uint256 fix1571
ripple::getRegisteredFeature
std::optional< uint256 > getRegisteredFeature(std::string const &name)
Definition: Feature.cpp:342
ripple::registrationIsDone
bool registrationIsDone()
Tell FeatureCollections when registration is complete.
Definition: Feature.cpp:363
diff --git a/Feature_8h_source.html b/Feature_8h_source.html index fdca93a895..a02b77786d 100644 --- a/Feature_8h_source.html +++ b/Feature_8h_source.html @@ -108,7 +108,7 @@ $(function() {
74 // Feature.cpp. Because it's only used to reserve storage, and determine how
75 // large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
76 // the actual number of amendments. A LogicError on startup will verify this.
-
77 static constexpr std::size_t numFeatures = 59;
+
77 static constexpr std::size_t numFeatures = 60;
78 
82 std::map<std::string, VoteBehavior> const&
83 supportedAmendments();
@@ -369,10 +369,11 @@ $(function() {
346 extern uint256 const fixNonFungibleTokensV1_2;
347 extern uint256 const fixNFTokenRemint;
348 extern uint256 const fixReducedOffersV1;
-
349 
-
350 } // namespace ripple
-
351 
-
352 #endif
+
349 extern uint256 const featureClawback;
+
350 
+
351 } // namespace ripple
+
352 
+
353 #endif
ripple::FeatureBitset::operator|=
FeatureBitset & operator|=(FeatureBitset const &rhs)
Definition: Feature.h:207
ripple::fixRemoveNFTokenAutoTrustLine
const uint256 fixRemoveNFTokenAutoTrustLine
@@ -382,6 +383,7 @@ $(function() {
ripple::featureXRPFees
const uint256 featureXRPFees
std::string
STL class.
std::bitset< detail::numFeatures >::all
T all(T... args)
+
ripple::featureClawback
const uint256 featureClawback
ripple::FeatureBitset::FeatureBitset
FeatureBitset()=default
ripple::fix1515
const uint256 fix1515
ripple::detail::numFeatures
static constexpr std::size_t numFeatures
Definition: Feature.h:77
diff --git a/FeeVoteImpl_8cpp_source.html b/FeeVoteImpl_8cpp_source.html index 2c2a58e8be..c77beb0f67 100644 --- a/FeeVoteImpl_8cpp_source.html +++ b/FeeVoteImpl_8cpp_source.html @@ -432,7 +432,7 @@ $(function() {
std::vector
STL class.
ripple::detail::VotableValue::noVote
void noVote()
Definition: FeeVoteImpl.cpp:55
ripple::isLegalAmountSigned
bool isLegalAmountSigned(XRPAmount const &amount)
Returns true if the absolute value of the amount does not exceed the initial XRP in existence.
Definition: SystemParameters.h:55
-
ripple::ttFEE
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
Definition: TxFormats.h:152
+
ripple::ttFEE
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
Definition: TxFormats.h:155
beast::Journal::warn
Stream warn() const
Definition: Journal.h:327
ripple::detail::VotableValue::target_
const value_type target_
Definition: FeeVoteImpl.cpp:37
ripple::detail::VotableValue::VotableValue
VotableValue(value_type current, value_type target)
Definition: FeeVoteImpl.cpp:41
diff --git a/Flow__test_8cpp_source.html b/Flow__test_8cpp_source.html index f53ccc6cbb..f428b319a7 100644 --- a/Flow__test_8cpp_source.html +++ b/Flow__test_8cpp_source.html @@ -1530,17 +1530,17 @@ $(function() {
ripple::TxSearched::all
@ all
ripple::test::jtx::balance
A balance matches.
Definition: balance.h:38
ripple::OpenView
Writable ledger view that accumulates state and tx changes.
Definition: OpenView.h:55
-
ripple::lsfLowNoRipple
@ lsfLowNoRipple
Definition: LedgerFormats.h:256
+
ripple::lsfLowNoRipple
@ lsfLowNoRipple
Definition: LedgerFormats.h:259
std::vector
STL class.
ripple::test::jtx::trust
Json::Value trust(Account const &account, STAmount const &amount, std::uint32_t flags)
Modify a trust line.
Definition: trust.cpp:30
ripple::test::Flow_test::testFalseDry
void testFalseDry(FeatureBitset features)
Definition: Flow_test.cpp:702
-
ripple::tfSetNoRipple
constexpr std::uint32_t tfSetNoRipple
Definition: TxFlags.h:109
+
ripple::tfSetNoRipple
constexpr std::uint32_t tfSetNoRipple
Definition: TxFlags.h:110
ripple::test::Flow_test::testSelfFundedXRPEndpoint
void testSelfFundedXRPEndpoint(bool consumeOffer, FeatureBitset features)
Definition: Flow_test.cpp:946
ripple::keylet::offer
Keylet offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
Definition: Indexes.cpp:222
ripple::fix1781
const uint256 fix1781
ripple::test::Flow_test::testWithFeats
void testWithFeats(FeatureBitset features)
Definition: Flow_test.cpp:1382
ripple::test::jtx::Env::balance
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
Definition: Env.cpp:183
-
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:93
+
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:94
ripple::test::jtx::Env::app
Application & app()
Definition: Env.h:241
ripple::test::Flow_test::testRIPD1443
void testRIPD1443()
Definition: Flow_test.cpp:1120
ripple::Application::openLedger
virtual OpenLedger & openLedger()=0
@@ -1557,14 +1557,14 @@ $(function() {
ripple::STPathElement::typeIssuer
@ typeIssuer
Definition: STPathSet.h:50
ripple::test::jtx::Account::id
AccountID id() const
Returns the Account ID.
Definition: Account.h:106
ripple::test::Flow_test::testSelfPayment1
void testSelfPayment1(FeatureBitset features)
Definition: Flow_test.cpp:803
-
ripple::tfLimitQuality
constexpr std::uint32_t tfLimitQuality
Definition: TxFlags.h:103
+
ripple::tfLimitQuality
constexpr std::uint32_t tfLimitQuality
Definition: TxFlags.h:104
ripple::base_uint< 160, detail::CurrencyTag >
ripple::sfTakerPays
const SF_AMOUNT sfTakerPays
ripple::test::jtx::ticket::use
Set a ticket sequence on a JTx.
Definition: ticket.h:47
ripple::flow
path::RippleCalc::Output flow(PaymentSandbox &view, STAmount const &deliver, AccountID const &src, AccountID const &dst, STPathSet const &paths, bool defaultPaths, bool partialPayment, bool ownerPaysTransferFee, bool offerCrossing, std::optional< Quality > const &limitQuality, std::optional< STAmount > const &sendMax, beast::Journal j, path::detail::FlowDebugInfo *flowDebugInfo=nullptr)
Make a payment from the src account to the dst account.
ripple::ltOFFER
@ ltOFFER
A ledger object which describes an offer on the DEX.
Definition: LedgerFormats.h:92
ripple::test::BEAST_DEFINE_TESTSUITE_MANUAL_PRIO
BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(CrossingLimits, tx, ripple, 10)
-
ripple::tfPartialPayment
constexpr std::uint32_t tfPartialPayment
Definition: TxFlags.h:102
+
ripple::tfPartialPayment
constexpr std::uint32_t tfPartialPayment
Definition: TxFlags.h:103
ripple::offerDelete
TER offerDelete(ApplyView &view, std::shared_ptr< SLE > const &sle, beast::Journal j)
Delete an offer.
Definition: View.cpp:893
ripple::fix1513
const uint256 fix1513
ripple::TERSubset< CanCvtToTER >
@@ -1591,7 +1591,7 @@ $(function() {
ripple::test::Flow_test::testRIPD1449
void testRIPD1449()
Definition: Flow_test.cpp:1169
ripple::test::jtx::qualityOutPercent
Sets the QualityOut on a trust JTx as a percentage.
Definition: quality.h:73
ripple::test::jtx::fee
Set the fee on a JTx.
Definition: fee.h:35
-
ripple::lsfHighNoRipple
@ lsfHighNoRipple
Definition: LedgerFormats.h:257
+
ripple::lsfHighNoRipple
@ lsfHighNoRipple
Definition: LedgerFormats.h:260
ripple::test::Flow_test::reserve
static XRPAmount reserve(jtx::Env &env, std::uint32_t count)
Definition: Flow_test.cpp:782
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::Flow_test::offersOnAccount
static std::vector< std::shared_ptr< SLE const > > offersOnAccount(jtx::Env &env, jtx::Account account)
Definition: Flow_test.cpp:789
@@ -1624,7 +1624,7 @@ $(function() {
ripple::test::jtx::Env::current
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition: Env.h:300
ripple::test::Flow_test::testSelfPayLowQualityOffer
void testSelfPayLowQualityOffer(FeatureBitset features)
Definition: Flow_test.cpp:1210
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:116
-
ripple::tfNoRippleDirect
constexpr std::uint32_t tfNoRippleDirect
Definition: TxFlags.h:101
+
ripple::tfNoRippleDirect
constexpr std::uint32_t tfNoRippleDirect
Definition: TxFlags.h:102
ripple::test::Flow_test::testSelfPayment2
void testSelfPayment2(FeatureBitset features)
Definition: Flow_test.cpp:876
ripple::XRPAmount
Definition: XRPAmount.h:46
ripple::test::jtx::rate
Json::Value rate(Account const &account, double multiplier)
Set a transfer rate.
Definition: rate.cpp:30
diff --git a/Freeze__test_8cpp_source.html b/Freeze__test_8cpp_source.html index 25e6bd6fb7..327aa5ade8 100644 --- a/Freeze__test_8cpp_source.html +++ b/Freeze__test_8cpp_source.html @@ -635,7 +635,7 @@ $(function() {
ripple::SField::fieldName
const std::string fieldName
Definition: SField.h:132
ripple::Freeze_test::checkArraySize
static bool checkArraySize(Json::Value const &val, unsigned int size)
Definition: Freeze_test.cpp:51
ripple::sfFinalFields
const SField sfFinalFields
-
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:93
+
ripple::tfPassive
constexpr std::uint32_t tfPassive
Definition: TxFlags.h:94
std::set::clear
T clear(T... args)
ripple::sfLowLimit
const SF_AMOUNT sfLowLimit
ripple::Freeze_test::getAccountOffers
static Json::Value getAccountOffers(test::jtx::Env &env, test::jtx::Account const &account, bool current=false)
Definition: Freeze_test.cpp:39
@@ -652,23 +652,23 @@ $(function() {
ripple::ValStatus::current
@ current
This was a new validation and was added.
ripple::sfHighLimit
const SF_AMOUNT sfHighLimit
Json::Value::isArray
bool isArray() const
Definition: json_value.cpp:1015
-
ripple::lsfHighFreeze
@ lsfHighFreeze
Definition: LedgerFormats.h:259
+
ripple::lsfHighFreeze
@ lsfHighFreeze
Definition: LedgerFormats.h:262
ripple::getJson
Json::Value getJson(LedgerFill const &fill)
Return a new Json::Value representing the ledger with given options.
Definition: LedgerToJson.cpp:296
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::sfLedgerEntryType
const SF_UINT16 sfLedgerEntryType
-
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:111
+
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:112
std::set::insert
T insert(T... args)
ripple::sfCreatedNode
const SField sfCreatedNode
ripple::sfBalance
const SF_AMOUNT sfBalance
ripple::FeatureBitset
Definition: Feature.h:113
ripple::tecPATH_DRY
@ tecPATH_DRY
Definition: TER.h:261
ripple::asfGlobalFreeze
constexpr std::uint32_t asfGlobalFreeze
Definition: TxFlags.h:80
-
ripple::tfClearFreeze
constexpr std::uint32_t tfClearFreeze
Definition: TxFlags.h:112
+
ripple::tfClearFreeze
constexpr std::uint32_t tfClearFreeze
Definition: TxFlags.h:113
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::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
ripple::Freeze_test::run
void run() override
Definition: Freeze_test.cpp:537
std::end
T end(T... args)
-
ripple::lsfLowFreeze
@ lsfLowFreeze
Definition: LedgerFormats.h:258
+
ripple::lsfLowFreeze
@ lsfLowFreeze
Definition: LedgerFormats.h:261
ripple::featureFlowCross
const uint256 featureFlowCross
std::set< std::string >
ripple::noAccount
AccountID const & noAccount()
A placeholder for empty accounts.
Definition: AccountID.cpp:175
diff --git a/GatewayBalances__test_8cpp_source.html b/GatewayBalances__test_8cpp_source.html index 604d6ec867..654a944bec 100644 --- a/GatewayBalances__test_8cpp_source.html +++ b/GatewayBalances__test_8cpp_source.html @@ -302,7 +302,7 @@ $(function() {
ripple::test::jtx::supported_amendments
FeatureBitset supported_amendments()
Definition: Env.h:70
ripple::test::GatewayBalances_test::testGWBOverflow
void testGWBOverflow()
Definition: GatewayBalances_test.cpp:152
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
-
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:111
+
ripple::tfSetFreeze
constexpr std::uint32_t tfSetFreeze
Definition: TxFlags.h:112
ripple::test::jtx::pay
Json::Value pay(Account const &account, Account const &to, AnyAmount amount)
Create a payment.
Definition: pay.cpp:29
ripple::test::jtx::Env::fund
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Definition: Env.cpp:228
ripple::FeatureBitset
Definition: Feature.h:113
diff --git a/HashRouter__test_8cpp_source.html b/HashRouter__test_8cpp_source.html index 7f65b74d38..c94810b537 100644 --- a/HashRouter__test_8cpp_source.html +++ b/HashRouter__test_8cpp_source.html @@ -345,7 +345,7 @@ $(function() {
ripple::HashRouter::shouldRelay
std::optional< std::set< PeerShortID > > shouldRelay(uint256 const &key)
Determines whether the hashed item should be relayed.
Definition: HashRouter.cpp:118
ripple::test::HashRouter_test::testSetFlags
void testSetFlags()
Definition: HashRouter_test.cpp:173
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
-
ripple::test::jtx::flags
Match set account flags.
Definition: flags.h:108
+
ripple::test::jtx::flags
Match set account flags.
Definition: flags.h:111
ripple::test::HashRouter_test::run
void run() override
Definition: HashRouter_test.cpp:247
ripple::test::HashRouter_test::testExpiration
void testExpiration()
Definition: HashRouter_test.cpp:67
std::optional
diff --git a/InvariantCheck_8cpp_source.html b/InvariantCheck_8cpp_source.html index abcec11274..c5031a10b9 100644 --- a/InvariantCheck_8cpp_source.html +++ b/InvariantCheck_8cpp_source.html @@ -94,729 +94,791 @@ $(function() {
23 #include <ripple/basics/FeeUnits.h>
24 #include <ripple/basics/Log.h>
25 #include <ripple/ledger/ReadView.h>
-
26 #include <ripple/protocol/Feature.h>
-
27 #include <ripple/protocol/STArray.h>
-
28 #include <ripple/protocol/SystemParameters.h>
-
29 #include <ripple/protocol/nftPageMask.h>
-
30 
-
31 namespace ripple {
-
32 
-
33 void
-
34 TransactionFeeCheck::visitEntry(
-
35  bool,
-
36  std::shared_ptr<SLE const> const&,
-
37  std::shared_ptr<SLE const> const&)
-
38 {
-
39  // nothing to do
-
40 }
-
41 
-
42 bool
-
43 TransactionFeeCheck::finalize(
-
44  STTx const& tx,
-
45  TER const,
-
46  XRPAmount const fee,
-
47  ReadView const&,
-
48  beast::Journal const& j)
-
49 {
-
50  // We should never charge a negative fee
-
51  if (fee.drops() < 0)
-
52  {
-
53  JLOG(j.fatal()) << "Invariant failed: fee paid was negative: "
-
54  << fee.drops();
-
55  return false;
-
56  }
-
57 
-
58  // We should never charge a fee that's greater than or equal to the
-
59  // entire XRP supply.
-
60  if (fee >= INITIAL_XRP)
-
61  {
-
62  JLOG(j.fatal()) << "Invariant failed: fee paid exceeds system limit: "
-
63  << fee.drops();
-
64  return false;
-
65  }
-
66 
-
67  // We should never charge more for a transaction than the transaction
-
68  // authorizes. It's possible to charge less in some circumstances.
-
69  if (fee > tx.getFieldAmount(sfFee).xrp())
-
70  {
-
71  JLOG(j.fatal()) << "Invariant failed: fee paid is " << fee.drops()
-
72  << " exceeds fee specified in transaction.";
-
73  return false;
-
74  }
-
75 
-
76  return true;
-
77 }
-
78 
-
79 //------------------------------------------------------------------------------
-
80 
-
81 void
-
82 XRPNotCreated::visitEntry(
-
83  bool isDelete,
-
84  std::shared_ptr<SLE const> const& before,
-
85  std::shared_ptr<SLE const> const& after)
-
86 {
-
87  /* We go through all modified ledger entries, looking only at account roots,
-
88  * escrow payments, and payment channels. We remove from the total any
-
89  * previous XRP values and add to the total any new XRP values. The net
-
90  * balance of a payment channel is computed from two fields (amount and
-
91  * balance) and deletions are ignored for paychan and escrow because the
-
92  * amount fields have not been adjusted for those in the case of deletion.
-
93  */
-
94  if (before)
-
95  {
-
96  switch (before->getType())
-
97  {
-
98  case ltACCOUNT_ROOT:
-
99  drops_ -= (*before)[sfBalance].xrp().drops();
-
100  break;
-
101  case ltPAYCHAN:
-
102  drops_ -=
-
103  ((*before)[sfAmount] - (*before)[sfBalance]).xrp().drops();
-
104  break;
-
105  case ltESCROW:
-
106  drops_ -= (*before)[sfAmount].xrp().drops();
-
107  break;
-
108  default:
-
109  break;
-
110  }
-
111  }
-
112 
-
113  if (after)
-
114  {
-
115  switch (after->getType())
-
116  {
-
117  case ltACCOUNT_ROOT:
-
118  drops_ += (*after)[sfBalance].xrp().drops();
-
119  break;
-
120  case ltPAYCHAN:
-
121  if (!isDelete)
-
122  drops_ += ((*after)[sfAmount] - (*after)[sfBalance])
-
123  .xrp()
-
124  .drops();
-
125  break;
-
126  case ltESCROW:
-
127  if (!isDelete)
-
128  drops_ += (*after)[sfAmount].xrp().drops();
-
129  break;
-
130  default:
-
131  break;
-
132  }
-
133  }
-
134 }
-
135 
-
136 bool
-
137 XRPNotCreated::finalize(
-
138  STTx const&,
-
139  TER const,
-
140  XRPAmount const fee,
-
141  ReadView const&,
-
142  beast::Journal const& j)
-
143 {
-
144  // The net change should never be positive, as this would mean that the
-
145  // transaction created XRP out of thin air. That's not possible.
-
146  if (drops_ > 0)
-
147  {
-
148  JLOG(j.fatal()) << "Invariant failed: XRP net change was positive: "
-
149  << drops_;
-
150  return false;
-
151  }
-
152 
-
153  // The negative of the net change should be equal to actual fee charged.
-
154  if (-drops_ != fee.drops())
-
155  {
-
156  JLOG(j.fatal()) << "Invariant failed: XRP net change of " << drops_
-
157  << " doesn't match fee " << fee.drops();
-
158  return false;
-
159  }
-
160 
-
161  return true;
-
162 }
-
163 
-
164 //------------------------------------------------------------------------------
-
165 
-
166 void
-
167 XRPBalanceChecks::visitEntry(
-
168  bool,
-
169  std::shared_ptr<SLE const> const& before,
-
170  std::shared_ptr<SLE const> const& after)
-
171 {
-
172  auto isBad = [](STAmount const& balance) {
-
173  if (!balance.native())
-
174  return true;
-
175 
-
176  auto const drops = balance.xrp();
-
177 
-
178  // Can't have more than the number of drops instantiated
-
179  // in the genesis ledger.
-
180  if (drops > INITIAL_XRP)
-
181  return true;
-
182 
-
183  // Can't have a negative balance (0 is OK)
-
184  if (drops < XRPAmount{0})
-
185  return true;
-
186 
-
187  return false;
-
188  };
-
189 
-
190  if (before && before->getType() == ltACCOUNT_ROOT)
-
191  bad_ |= isBad((*before)[sfBalance]);
-
192 
-
193  if (after && after->getType() == ltACCOUNT_ROOT)
-
194  bad_ |= isBad((*after)[sfBalance]);
-
195 }
-
196 
-
197 bool
-
198 XRPBalanceChecks::finalize(
-
199  STTx const&,
-
200  TER const,
-
201  XRPAmount const,
-
202  ReadView const&,
-
203  beast::Journal const& j)
-
204 {
-
205  if (bad_)
-
206  {
-
207  JLOG(j.fatal()) << "Invariant failed: incorrect account XRP balance";
-
208  return false;
-
209  }
-
210 
-
211  return true;
-
212 }
-
213 
-
214 //------------------------------------------------------------------------------
-
215 
-
216 void
-
217 NoBadOffers::visitEntry(
-
218  bool isDelete,
-
219  std::shared_ptr<SLE const> const& before,
-
220  std::shared_ptr<SLE const> const& after)
-
221 {
-
222  auto isBad = [](STAmount const& pays, STAmount const& gets) {
-
223  // An offer should never be negative
-
224  if (pays < beast::zero)
-
225  return true;
-
226 
-
227  if (gets < beast::zero)
-
228  return true;
-
229 
-
230  // Can't have an XRP to XRP offer:
-
231  return pays.native() && gets.native();
-
232  };
-
233 
-
234  if (before && before->getType() == ltOFFER)
-
235  bad_ |= isBad((*before)[sfTakerPays], (*before)[sfTakerGets]);
-
236 
-
237  if (after && after->getType() == ltOFFER)
-
238  bad_ |= isBad((*after)[sfTakerPays], (*after)[sfTakerGets]);
-
239 }
-
240 
-
241 bool
-
242 NoBadOffers::finalize(
-
243  STTx const&,
-
244  TER const,
-
245  XRPAmount const,
-
246  ReadView const&,
-
247  beast::Journal const& j)
-
248 {
-
249  if (bad_)
-
250  {
-
251  JLOG(j.fatal()) << "Invariant failed: offer with a bad amount";
-
252  return false;
-
253  }
-
254 
-
255  return true;
-
256 }
-
257 
-
258 //------------------------------------------------------------------------------
-
259 
-
260 void
-
261 NoZeroEscrow::visitEntry(
-
262  bool isDelete,
-
263  std::shared_ptr<SLE const> const& before,
-
264  std::shared_ptr<SLE const> const& after)
-
265 {
-
266  auto isBad = [](STAmount const& amount) {
-
267  if (!amount.native())
-
268  return true;
-
269 
-
270  if (amount.xrp() <= XRPAmount{0})
-
271  return true;
-
272 
-
273  if (amount.xrp() >= INITIAL_XRP)
-
274  return true;
-
275 
-
276  return false;
-
277  };
-
278 
-
279  if (before && before->getType() == ltESCROW)
-
280  bad_ |= isBad((*before)[sfAmount]);
-
281 
-
282  if (after && after->getType() == ltESCROW)
-
283  bad_ |= isBad((*after)[sfAmount]);
-
284 }
-
285 
-
286 bool
-
287 NoZeroEscrow::finalize(
-
288  STTx const&,
-
289  TER const,
-
290  XRPAmount const,
-
291  ReadView const&,
-
292  beast::Journal const& j)
-
293 {
-
294  if (bad_)
-
295  {
-
296  JLOG(j.fatal()) << "Invariant failed: escrow specifies invalid amount";
-
297  return false;
-
298  }
-
299 
-
300  return true;
-
301 }
-
302 
-
303 //------------------------------------------------------------------------------
-
304 
-
305 void
-
306 AccountRootsNotDeleted::visitEntry(
-
307  bool isDelete,
-
308  std::shared_ptr<SLE const> const& before,
-
309  std::shared_ptr<SLE const> const&)
-
310 {
-
311  if (isDelete && before && before->getType() == ltACCOUNT_ROOT)
-
312  accountsDeleted_++;
-
313 }
-
314 
-
315 bool
-
316 AccountRootsNotDeleted::finalize(
-
317  STTx const& tx,
-
318  TER const result,
-
319  XRPAmount const,
-
320  ReadView const&,
-
321  beast::Journal const& j)
-
322 {
-
323  if (tx.getTxnType() == ttACCOUNT_DELETE && result == tesSUCCESS)
-
324  {
-
325  if (accountsDeleted_ == 1)
-
326  return true;
-
327 
-
328  if (accountsDeleted_ == 0)
-
329  JLOG(j.fatal()) << "Invariant failed: account deletion "
-
330  "succeeded without deleting an account";
-
331  else
-
332  JLOG(j.fatal()) << "Invariant failed: account deletion "
-
333  "succeeded but deleted multiple accounts!";
-
334  return false;
-
335  }
-
336 
-
337  if (accountsDeleted_ == 0)
-
338  return true;
-
339 
-
340  JLOG(j.fatal()) << "Invariant failed: an account root was deleted";
-
341  return false;
-
342 }
-
343 
-
344 //------------------------------------------------------------------------------
-
345 
-
346 void
-
347 LedgerEntryTypesMatch::visitEntry(
-
348  bool,
-
349  std::shared_ptr<SLE const> const& before,
-
350  std::shared_ptr<SLE const> const& after)
-
351 {
-
352  if (before && after && before->getType() != after->getType())
-
353  typeMismatch_ = true;
-
354 
-
355  if (after)
-
356  {
-
357  switch (after->getType())
-
358  {
-
359  case ltACCOUNT_ROOT:
-
360  case ltDIR_NODE:
-
361  case ltRIPPLE_STATE:
-
362  case ltTICKET:
-
363  case ltSIGNER_LIST:
-
364  case ltOFFER:
-
365  case ltLEDGER_HASHES:
-
366  case ltAMENDMENTS:
-
367  case ltFEE_SETTINGS:
-
368  case ltESCROW:
-
369  case ltPAYCHAN:
-
370  case ltCHECK:
-
371  case ltDEPOSIT_PREAUTH:
-
372  case ltNEGATIVE_UNL:
-
373  case ltNFTOKEN_PAGE:
-
374  case ltNFTOKEN_OFFER:
-
375  break;
-
376  default:
-
377  invalidTypeAdded_ = true;
-
378  break;
-
379  }
-
380  }
-
381 }
-
382 
-
383 bool
-
384 LedgerEntryTypesMatch::finalize(
-
385  STTx const&,
-
386  TER const,
-
387  XRPAmount const,
-
388  ReadView const&,
-
389  beast::Journal const& j)
-
390 {
-
391  if ((!typeMismatch_) && (!invalidTypeAdded_))
-
392  return true;
-
393 
-
394  if (typeMismatch_)
-
395  {
-
396  JLOG(j.fatal()) << "Invariant failed: ledger entry type mismatch";
-
397  }
-
398 
-
399  if (invalidTypeAdded_)
-
400  {
-
401  JLOG(j.fatal()) << "Invariant failed: invalid ledger entry type added";
-
402  }
-
403 
-
404  return false;
-
405 }
-
406 
-
407 //------------------------------------------------------------------------------
-
408 
-
409 void
-
410 NoXRPTrustLines::visitEntry(
-
411  bool,
-
412  std::shared_ptr<SLE const> const&,
-
413  std::shared_ptr<SLE const> const& after)
-
414 {
-
415  if (after && after->getType() == ltRIPPLE_STATE)
-
416  {
-
417  // checking the issue directly here instead of
-
418  // relying on .native() just in case native somehow
-
419  // were systematically incorrect
-
420  xrpTrustLine_ =
-
421  after->getFieldAmount(sfLowLimit).issue() == xrpIssue() ||
-
422  after->getFieldAmount(sfHighLimit).issue() == xrpIssue();
-
423  }
-
424 }
-
425 
-
426 bool
-
427 NoXRPTrustLines::finalize(
-
428  STTx const&,
-
429  TER const,
-
430  XRPAmount const,
-
431  ReadView const&,
-
432  beast::Journal const& j)
-
433 {
-
434  if (!xrpTrustLine_)
-
435  return true;
-
436 
-
437  JLOG(j.fatal()) << "Invariant failed: an XRP trust line was created";
-
438  return false;
-
439 }
-
440 
-
441 //------------------------------------------------------------------------------
-
442 
-
443 void
-
444 ValidNewAccountRoot::visitEntry(
-
445  bool,
-
446  std::shared_ptr<SLE const> const& before,
-
447  std::shared_ptr<SLE const> const& after)
-
448 {
-
449  if (!before && after->getType() == ltACCOUNT_ROOT)
-
450  {
-
451  accountsCreated_++;
-
452  accountSeq_ = (*after)[sfSequence];
-
453  }
-
454 }
-
455 
-
456 bool
-
457 ValidNewAccountRoot::finalize(
-
458  STTx const& tx,
-
459  TER const result,
-
460  XRPAmount const,
-
461  ReadView const& view,
-
462  beast::Journal const& j)
-
463 {
-
464  if (accountsCreated_ == 0)
-
465  return true;
-
466 
-
467  if (accountsCreated_ > 1)
-
468  {
-
469  JLOG(j.fatal()) << "Invariant failed: multiple accounts "
-
470  "created in a single transaction";
-
471  return false;
-
472  }
-
473 
-
474  // From this point on we know exactly one account was created.
-
475  if (tx.getTxnType() == ttPAYMENT && result == tesSUCCESS)
-
476  {
-
477  std::uint32_t const startingSeq{
-
478  view.rules().enabled(featureDeletableAccounts) ? view.seq() : 1};
-
479 
-
480  if (accountSeq_ != startingSeq)
-
481  {
-
482  JLOG(j.fatal()) << "Invariant failed: account created with "
-
483  "wrong starting sequence number";
-
484  return false;
-
485  }
-
486  return true;
-
487  }
-
488 
-
489  JLOG(j.fatal()) << "Invariant failed: account root created "
-
490  "by a non-Payment or by an unsuccessful transaction";
-
491  return false;
-
492 }
-
493 
-
494 //------------------------------------------------------------------------------
-
495 
-
496 void
-
497 ValidNFTokenPage::visitEntry(
-
498  bool isDelete,
-
499  std::shared_ptr<SLE const> const& before,
-
500  std::shared_ptr<SLE const> const& after)
-
501 {
-
502  static constexpr uint256 const& pageBits = nft::pageMask;
-
503  static constexpr uint256 const accountBits = ~pageBits;
-
504 
-
505  auto check = [this, isDelete](std::shared_ptr<SLE const> const& sle) {
-
506  uint256 const account = sle->key() & accountBits;
-
507  uint256 const hiLimit = sle->key() & pageBits;
-
508  std::optional<uint256> const prev = (*sle)[~sfPreviousPageMin];
-
509 
-
510  // Make sure that any page links...
-
511  // 1. Are properly associated with the owning account and
-
512  // 2. The page is correctly ordered between links.
-
513  if (prev)
-
514  {
-
515  if (account != (*prev & accountBits))
-
516  badLink_ = true;
-
517 
-
518  if (hiLimit <= (*prev & pageBits))
-
519  badLink_ = true;
-
520  }
-
521 
-
522  if (auto const next = (*sle)[~sfNextPageMin])
-
523  {
-
524  if (account != (*next & accountBits))
-
525  badLink_ = true;
-
526 
-
527  if (hiLimit >= (*next & pageBits))
-
528  badLink_ = true;
-
529  }
-
530 
-
531  {
-
532  auto const& nftokens = sle->getFieldArray(sfNFTokens);
-
533 
-
534  // An NFTokenPage should never contain too many tokens or be empty.
-
535  if (std::size_t const nftokenCount = nftokens.size();
-
536  (!isDelete && nftokenCount == 0) ||
-
537  nftokenCount > dirMaxTokensPerPage)
-
538  invalidSize_ = true;
-
539 
-
540  // If prev is valid, use it to establish a lower bound for
-
541  // page entries. If prev is not valid the lower bound is zero.
-
542  uint256 const loLimit =
-
543  prev ? *prev & pageBits : uint256(beast::zero);
-
544 
-
545  // Also verify that all NFTokenIDs in the page are sorted.
-
546  uint256 loCmp = loLimit;
-
547  for (auto const& obj : nftokens)
-
548  {
-
549  uint256 const tokenID = obj[sfNFTokenID];
-
550  if (!nft::compareTokens(loCmp, tokenID))
-
551  badSort_ = true;
-
552  loCmp = tokenID;
-
553 
-
554  // None of the NFTs on this page should belong on lower or
-
555  // higher pages.
-
556  if (uint256 const tokenPageBits = tokenID & pageBits;
-
557  tokenPageBits < loLimit || tokenPageBits >= hiLimit)
-
558  badEntry_ = true;
-
559 
-
560  if (auto uri = obj[~sfURI]; uri && uri->empty())
-
561  badURI_ = true;
-
562  }
-
563  }
-
564  };
-
565 
-
566  if (before && before->getType() == ltNFTOKEN_PAGE)
-
567  check(before);
-
568 
-
569  if (after && after->getType() == ltNFTOKEN_PAGE)
-
570  check(after);
-
571 }
-
572 
-
573 bool
-
574 ValidNFTokenPage::finalize(
-
575  STTx const& tx,
-
576  TER const result,
-
577  XRPAmount const,
-
578  ReadView const& view,
-
579  beast::Journal const& j)
-
580 {
-
581  if (badLink_)
-
582  {
-
583  JLOG(j.fatal()) << "Invariant failed: NFT page is improperly linked.";
-
584  return false;
-
585  }
-
586 
-
587  if (badEntry_)
-
588  {
-
589  JLOG(j.fatal()) << "Invariant failed: NFT found in incorrect page.";
-
590  return false;
-
591  }
-
592 
-
593  if (badSort_)
-
594  {
-
595  JLOG(j.fatal()) << "Invariant failed: NFTs on page are not sorted.";
-
596  return false;
-
597  }
-
598 
-
599  if (badURI_)
-
600  {
-
601  JLOG(j.fatal()) << "Invariant failed: NFT contains empty URI.";
-
602  return false;
-
603  }
-
604 
-
605  if (invalidSize_)
-
606  {
-
607  JLOG(j.fatal()) << "Invariant failed: NFT page has invalid size.";
-
608  return false;
-
609  }
-
610 
-
611  return true;
-
612 }
-
613 
-
614 //------------------------------------------------------------------------------
-
615 void
-
616 NFTokenCountTracking::visitEntry(
-
617  bool,
-
618  std::shared_ptr<SLE const> const& before,
-
619  std::shared_ptr<SLE const> const& after)
-
620 {
-
621  if (before && before->getType() == ltACCOUNT_ROOT)
-
622  {
-
623  beforeMintedTotal += (*before)[~sfMintedNFTokens].value_or(0);
-
624  beforeBurnedTotal += (*before)[~sfBurnedNFTokens].value_or(0);
-
625  }
-
626 
-
627  if (after && after->getType() == ltACCOUNT_ROOT)
-
628  {
-
629  afterMintedTotal += (*after)[~sfMintedNFTokens].value_or(0);
-
630  afterBurnedTotal += (*after)[~sfBurnedNFTokens].value_or(0);
-
631  }
-
632 }
-
633 
-
634 bool
-
635 NFTokenCountTracking::finalize(
-
636  STTx const& tx,
-
637  TER const result,
-
638  XRPAmount const,
-
639  ReadView const& view,
-
640  beast::Journal const& j)
-
641 {
-
642  if (TxType const txType = tx.getTxnType();
-
643  txType != ttNFTOKEN_MINT && txType != ttNFTOKEN_BURN)
-
644  {
-
645  if (beforeMintedTotal != afterMintedTotal)
-
646  {
-
647  JLOG(j.fatal()) << "Invariant failed: the number of minted tokens "
-
648  "changed without a mint transaction!";
-
649  return false;
-
650  }
-
651 
-
652  if (beforeBurnedTotal != afterBurnedTotal)
-
653  {
-
654  JLOG(j.fatal()) << "Invariant failed: the number of burned tokens "
-
655  "changed without a burn transaction!";
-
656  return false;
-
657  }
-
658 
-
659  return true;
-
660  }
-
661 
-
662  if (tx.getTxnType() == ttNFTOKEN_MINT)
-
663  {
-
664  if (result == tesSUCCESS && beforeMintedTotal >= afterMintedTotal)
-
665  {
-
666  JLOG(j.fatal())
-
667  << "Invariant failed: successful minting didn't increase "
-
668  "the number of minted tokens.";
-
669  return false;
-
670  }
-
671 
-
672  if (result != tesSUCCESS && beforeMintedTotal != afterMintedTotal)
-
673  {
-
674  JLOG(j.fatal()) << "Invariant failed: failed minting changed the "
-
675  "number of minted tokens.";
-
676  return false;
-
677  }
-
678 
-
679  if (beforeBurnedTotal != afterBurnedTotal)
-
680  {
-
681  JLOG(j.fatal())
-
682  << "Invariant failed: minting changed the number of "
-
683  "burned tokens.";
-
684  return false;
-
685  }
-
686  }
-
687 
-
688  if (tx.getTxnType() == ttNFTOKEN_BURN)
-
689  {
-
690  if (result == tesSUCCESS)
-
691  {
-
692  if (beforeBurnedTotal >= afterBurnedTotal)
-
693  {
-
694  JLOG(j.fatal())
-
695  << "Invariant failed: successful burning didn't increase "
-
696  "the number of burned tokens.";
-
697  return false;
-
698  }
-
699  }
-
700 
-
701  if (result != tesSUCCESS && beforeBurnedTotal != afterBurnedTotal)
-
702  {
-
703  JLOG(j.fatal()) << "Invariant failed: failed burning changed the "
-
704  "number of burned tokens.";
-
705  return false;
-
706  }
-
707 
-
708  if (beforeMintedTotal != afterMintedTotal)
-
709  {
-
710  JLOG(j.fatal())
-
711  << "Invariant failed: burning changed the number of "
-
712  "minted tokens.";
-
713  return false;
-
714  }
-
715  }
-
716 
-
717  return true;
-
718 }
-
719 
-
720 } // namespace ripple
+
26 #include <ripple/ledger/View.h>
+
27 #include <ripple/protocol/Feature.h>
+
28 #include <ripple/protocol/STArray.h>
+
29 #include <ripple/protocol/SystemParameters.h>
+
30 #include <ripple/protocol/nftPageMask.h>
+
31 
+
32 namespace ripple {
+
33 
+
34 void
+
35 TransactionFeeCheck::visitEntry(
+
36  bool,
+
37  std::shared_ptr<SLE const> const&,
+
38  std::shared_ptr<SLE const> const&)
+
39 {
+
40  // nothing to do
+
41 }
+
42 
+
43 bool
+
44 TransactionFeeCheck::finalize(
+
45  STTx const& tx,
+
46  TER const,
+
47  XRPAmount const fee,
+
48  ReadView const&,
+
49  beast::Journal const& j)
+
50 {
+
51  // We should never charge a negative fee
+
52  if (fee.drops() < 0)
+
53  {
+
54  JLOG(j.fatal()) << "Invariant failed: fee paid was negative: "
+
55  << fee.drops();
+
56  return false;
+
57  }
+
58 
+
59  // We should never charge a fee that's greater than or equal to the
+
60  // entire XRP supply.
+
61  if (fee >= INITIAL_XRP)
+
62  {
+
63  JLOG(j.fatal()) << "Invariant failed: fee paid exceeds system limit: "
+
64  << fee.drops();
+
65  return false;
+
66  }
+
67 
+
68  // We should never charge more for a transaction than the transaction
+
69  // authorizes. It's possible to charge less in some circumstances.
+
70  if (fee > tx.getFieldAmount(sfFee).xrp())
+
71  {
+
72  JLOG(j.fatal()) << "Invariant failed: fee paid is " << fee.drops()
+
73  << " exceeds fee specified in transaction.";
+
74  return false;
+
75  }
+
76 
+
77  return true;
+
78 }
+
79 
+
80 //------------------------------------------------------------------------------
+
81 
+
82 void
+
83 XRPNotCreated::visitEntry(
+
84  bool isDelete,
+
85  std::shared_ptr<SLE const> const& before,
+
86  std::shared_ptr<SLE const> const& after)
+
87 {
+
88  /* We go through all modified ledger entries, looking only at account roots,
+
89  * escrow payments, and payment channels. We remove from the total any
+
90  * previous XRP values and add to the total any new XRP values. The net
+
91  * balance of a payment channel is computed from two fields (amount and
+
92  * balance) and deletions are ignored for paychan and escrow because the
+
93  * amount fields have not been adjusted for those in the case of deletion.
+
94  */
+
95  if (before)
+
96  {
+
97  switch (before->getType())
+
98  {
+
99  case ltACCOUNT_ROOT:
+
100  drops_ -= (*before)[sfBalance].xrp().drops();
+
101  break;
+
102  case ltPAYCHAN:
+
103  drops_ -=
+
104  ((*before)[sfAmount] - (*before)[sfBalance]).xrp().drops();
+
105  break;
+
106  case ltESCROW:
+
107  drops_ -= (*before)[sfAmount].xrp().drops();
+
108  break;
+
109  default:
+
110  break;
+
111  }
+
112  }
+
113 
+
114  if (after)
+
115  {
+
116  switch (after->getType())
+
117  {
+
118  case ltACCOUNT_ROOT:
+
119  drops_ += (*after)[sfBalance].xrp().drops();
+
120  break;
+
121  case ltPAYCHAN:
+
122  if (!isDelete)
+
123  drops_ += ((*after)[sfAmount] - (*after)[sfBalance])
+
124  .xrp()
+
125  .drops();
+
126  break;
+
127  case ltESCROW:
+
128  if (!isDelete)
+
129  drops_ += (*after)[sfAmount].xrp().drops();
+
130  break;
+
131  default:
+
132  break;
+
133  }
+
134  }
+
135 }
+
136 
+
137 bool
+
138 XRPNotCreated::finalize(
+
139  STTx const&,
+
140  TER const,
+
141  XRPAmount const fee,
+
142  ReadView const&,
+
143  beast::Journal const& j)
+
144 {
+
145  // The net change should never be positive, as this would mean that the
+
146  // transaction created XRP out of thin air. That's not possible.
+
147  if (drops_ > 0)
+
148  {
+
149  JLOG(j.fatal()) << "Invariant failed: XRP net change was positive: "
+
150  << drops_;
+
151  return false;
+
152  }
+
153 
+
154  // The negative of the net change should be equal to actual fee charged.
+
155  if (-drops_ != fee.drops())
+
156  {
+
157  JLOG(j.fatal()) << "Invariant failed: XRP net change of " << drops_
+
158  << " doesn't match fee " << fee.drops();
+
159  return false;
+
160  }
+
161 
+
162  return true;
+
163 }
+
164 
+
165 //------------------------------------------------------------------------------
+
166 
+
167 void
+
168 XRPBalanceChecks::visitEntry(
+
169  bool,
+
170  std::shared_ptr<SLE const> const& before,
+
171  std::shared_ptr<SLE const> const& after)
+
172 {
+
173  auto isBad = [](STAmount const& balance) {
+
174  if (!balance.native())
+
175  return true;
+
176 
+
177  auto const drops = balance.xrp();
+
178 
+
179  // Can't have more than the number of drops instantiated
+
180  // in the genesis ledger.
+
181  if (drops > INITIAL_XRP)
+
182  return true;
+
183 
+
184  // Can't have a negative balance (0 is OK)
+
185  if (drops < XRPAmount{0})
+
186  return true;
+
187 
+
188  return false;
+
189  };
+
190 
+
191  if (before && before->getType() == ltACCOUNT_ROOT)
+
192  bad_ |= isBad((*before)[sfBalance]);
+
193 
+
194  if (after && after->getType() == ltACCOUNT_ROOT)
+
195  bad_ |= isBad((*after)[sfBalance]);
+
196 }
+
197 
+
198 bool
+
199 XRPBalanceChecks::finalize(
+
200  STTx const&,
+
201  TER const,
+
202  XRPAmount const,
+
203  ReadView const&,
+
204  beast::Journal const& j)
+
205 {
+
206  if (bad_)
+
207  {
+
208  JLOG(j.fatal()) << "Invariant failed: incorrect account XRP balance";
+
209  return false;
+
210  }
+
211 
+
212  return true;
+
213 }
+
214 
+
215 //------------------------------------------------------------------------------
+
216 
+
217 void
+
218 NoBadOffers::visitEntry(
+
219  bool isDelete,
+
220  std::shared_ptr<SLE const> const& before,
+
221  std::shared_ptr<SLE const> const& after)
+
222 {
+
223  auto isBad = [](STAmount const& pays, STAmount const& gets) {
+
224  // An offer should never be negative
+
225  if (pays < beast::zero)
+
226  return true;
+
227 
+
228  if (gets < beast::zero)
+
229  return true;
+
230 
+
231  // Can't have an XRP to XRP offer:
+
232  return pays.native() && gets.native();
+
233  };
+
234 
+
235  if (before && before->getType() == ltOFFER)
+
236  bad_ |= isBad((*before)[sfTakerPays], (*before)[sfTakerGets]);
+
237 
+
238  if (after && after->getType() == ltOFFER)
+
239  bad_ |= isBad((*after)[sfTakerPays], (*after)[sfTakerGets]);
+
240 }
+
241 
+
242 bool
+
243 NoBadOffers::finalize(
+
244  STTx const&,
+
245  TER const,
+
246  XRPAmount const,
+
247  ReadView const&,
+
248  beast::Journal const& j)
+
249 {
+
250  if (bad_)
+
251  {
+
252  JLOG(j.fatal()) << "Invariant failed: offer with a bad amount";
+
253  return false;
+
254  }
+
255 
+
256  return true;
+
257 }
+
258 
+
259 //------------------------------------------------------------------------------
+
260 
+
261 void
+
262 NoZeroEscrow::visitEntry(
+
263  bool isDelete,
+
264  std::shared_ptr<SLE const> const& before,
+
265  std::shared_ptr<SLE const> const& after)
+
266 {
+
267  auto isBad = [](STAmount const& amount) {
+
268  if (!amount.native())
+
269  return true;
+
270 
+
271  if (amount.xrp() <= XRPAmount{0})
+
272  return true;
+
273 
+
274  if (amount.xrp() >= INITIAL_XRP)
+
275  return true;
+
276 
+
277  return false;
+
278  };
+
279 
+
280  if (before && before->getType() == ltESCROW)
+
281  bad_ |= isBad((*before)[sfAmount]);
+
282 
+
283  if (after && after->getType() == ltESCROW)
+
284  bad_ |= isBad((*after)[sfAmount]);
+
285 }
+
286 
+
287 bool
+
288 NoZeroEscrow::finalize(
+
289  STTx const&,
+
290  TER const,
+
291  XRPAmount const,
+
292  ReadView const&,
+
293  beast::Journal const& j)
+
294 {
+
295  if (bad_)
+
296  {
+
297  JLOG(j.fatal()) << "Invariant failed: escrow specifies invalid amount";
+
298  return false;
+
299  }
+
300 
+
301  return true;
+
302 }
+
303 
+
304 //------------------------------------------------------------------------------
+
305 
+
306 void
+
307 AccountRootsNotDeleted::visitEntry(
+
308  bool isDelete,
+
309  std::shared_ptr<SLE const> const& before,
+
310  std::shared_ptr<SLE const> const&)
+
311 {
+
312  if (isDelete && before && before->getType() == ltACCOUNT_ROOT)
+
313  accountsDeleted_++;
+
314 }
+
315 
+
316 bool
+
317 AccountRootsNotDeleted::finalize(
+
318  STTx const& tx,
+
319  TER const result,
+
320  XRPAmount const,
+
321  ReadView const&,
+
322  beast::Journal const& j)
+
323 {
+
324  if (tx.getTxnType() == ttACCOUNT_DELETE && result == tesSUCCESS)
+
325  {
+
326  if (accountsDeleted_ == 1)
+
327  return true;
+
328 
+
329  if (accountsDeleted_ == 0)
+
330  JLOG(j.fatal()) << "Invariant failed: account deletion "
+
331  "succeeded without deleting an account";
+
332  else
+
333  JLOG(j.fatal()) << "Invariant failed: account deletion "
+
334  "succeeded but deleted multiple accounts!";
+
335  return false;
+
336  }
+
337 
+
338  if (accountsDeleted_ == 0)
+
339  return true;
+
340 
+
341  JLOG(j.fatal()) << "Invariant failed: an account root was deleted";
+
342  return false;
+
343 }
+
344 
+
345 //------------------------------------------------------------------------------
+
346 
+
347 void
+
348 LedgerEntryTypesMatch::visitEntry(
+
349  bool,
+
350  std::shared_ptr<SLE const> const& before,
+
351  std::shared_ptr<SLE const> const& after)
+
352 {
+
353  if (before && after && before->getType() != after->getType())
+
354  typeMismatch_ = true;
+
355 
+
356  if (after)
+
357  {
+
358  switch (after->getType())
+
359  {
+
360  case ltACCOUNT_ROOT:
+
361  case ltDIR_NODE:
+
362  case ltRIPPLE_STATE:
+
363  case ltTICKET:
+
364  case ltSIGNER_LIST:
+
365  case ltOFFER:
+
366  case ltLEDGER_HASHES:
+
367  case ltAMENDMENTS:
+
368  case ltFEE_SETTINGS:
+
369  case ltESCROW:
+
370  case ltPAYCHAN:
+
371  case ltCHECK:
+
372  case ltDEPOSIT_PREAUTH:
+
373  case ltNEGATIVE_UNL:
+
374  case ltNFTOKEN_PAGE:
+
375  case ltNFTOKEN_OFFER:
+
376  break;
+
377  default:
+
378  invalidTypeAdded_ = true;
+
379  break;
+
380  }
+
381  }
+
382 }
+
383 
+
384 bool
+
385 LedgerEntryTypesMatch::finalize(
+
386  STTx const&,
+
387  TER const,
+
388  XRPAmount const,
+
389  ReadView const&,
+
390  beast::Journal const& j)
+
391 {
+
392  if ((!typeMismatch_) && (!invalidTypeAdded_))
+
393  return true;
+
394 
+
395  if (typeMismatch_)
+
396  {
+
397  JLOG(j.fatal()) << "Invariant failed: ledger entry type mismatch";
+
398  }
+
399 
+
400  if (invalidTypeAdded_)
+
401  {
+
402  JLOG(j.fatal()) << "Invariant failed: invalid ledger entry type added";
+
403  }
+
404 
+
405  return false;
+
406 }
+
407 
+
408 //------------------------------------------------------------------------------
+
409 
+
410 void
+
411 NoXRPTrustLines::visitEntry(
+
412  bool,
+
413  std::shared_ptr<SLE const> const&,
+
414  std::shared_ptr<SLE const> const& after)
+
415 {
+
416  if (after && after->getType() == ltRIPPLE_STATE)
+
417  {
+
418  // checking the issue directly here instead of
+
419  // relying on .native() just in case native somehow
+
420  // were systematically incorrect
+
421  xrpTrustLine_ =
+
422  after->getFieldAmount(sfLowLimit).issue() == xrpIssue() ||
+
423  after->getFieldAmount(sfHighLimit).issue() == xrpIssue();
+
424  }
+
425 }
+
426 
+
427 bool
+
428 NoXRPTrustLines::finalize(
+
429  STTx const&,
+
430  TER const,
+
431  XRPAmount const,
+
432  ReadView const&,
+
433  beast::Journal const& j)
+
434 {
+
435  if (!xrpTrustLine_)
+
436  return true;
+
437 
+
438  JLOG(j.fatal()) << "Invariant failed: an XRP trust line was created";
+
439  return false;
+
440 }
+
441 
+
442 //------------------------------------------------------------------------------
+
443 
+
444 void
+
445 ValidNewAccountRoot::visitEntry(
+
446  bool,
+
447  std::shared_ptr<SLE const> const& before,
+
448  std::shared_ptr<SLE const> const& after)
+
449 {
+
450  if (!before && after->getType() == ltACCOUNT_ROOT)
+
451  {
+
452  accountsCreated_++;
+
453  accountSeq_ = (*after)[sfSequence];
+
454  }
+
455 }
+
456 
+
457 bool
+
458 ValidNewAccountRoot::finalize(
+
459  STTx const& tx,
+
460  TER const result,
+
461  XRPAmount const,
+
462  ReadView const& view,
+
463  beast::Journal const& j)
+
464 {
+
465  if (accountsCreated_ == 0)
+
466  return true;
+
467 
+
468  if (accountsCreated_ > 1)
+
469  {
+
470  JLOG(j.fatal()) << "Invariant failed: multiple accounts "
+
471  "created in a single transaction";
+
472  return false;
+
473  }
+
474 
+
475  // From this point on we know exactly one account was created.
+
476  if (tx.getTxnType() == ttPAYMENT && result == tesSUCCESS)
+
477  {
+
478  std::uint32_t const startingSeq{
+
479  view.rules().enabled(featureDeletableAccounts) ? view.seq() : 1};
+
480 
+
481  if (accountSeq_ != startingSeq)
+
482  {
+
483  JLOG(j.fatal()) << "Invariant failed: account created with "
+
484  "wrong starting sequence number";
+
485  return false;
+
486  }
+
487  return true;
+
488  }
+
489 
+
490  JLOG(j.fatal()) << "Invariant failed: account root created "
+
491  "by a non-Payment or by an unsuccessful transaction";
+
492  return false;
+
493 }
+
494 
+
495 //------------------------------------------------------------------------------
+
496 
+
497 void
+
498 ValidNFTokenPage::visitEntry(
+
499  bool isDelete,
+
500  std::shared_ptr<SLE const> const& before,
+
501  std::shared_ptr<SLE const> const& after)
+
502 {
+
503  static constexpr uint256 const& pageBits = nft::pageMask;
+
504  static constexpr uint256 const accountBits = ~pageBits;
+
505 
+
506  auto check = [this, isDelete](std::shared_ptr<SLE const> const& sle) {
+
507  uint256 const account = sle->key() & accountBits;
+
508  uint256 const hiLimit = sle->key() & pageBits;
+
509  std::optional<uint256> const prev = (*sle)[~sfPreviousPageMin];
+
510 
+
511  // Make sure that any page links...
+
512  // 1. Are properly associated with the owning account and
+
513  // 2. The page is correctly ordered between links.
+
514  if (prev)
+
515  {
+
516  if (account != (*prev & accountBits))
+
517  badLink_ = true;
+
518 
+
519  if (hiLimit <= (*prev & pageBits))
+
520  badLink_ = true;
+
521  }
+
522 
+
523  if (auto const next = (*sle)[~sfNextPageMin])
+
524  {
+
525  if (account != (*next & accountBits))
+
526  badLink_ = true;
+
527 
+
528  if (hiLimit >= (*next & pageBits))
+
529  badLink_ = true;
+
530  }
+
531 
+
532  {
+
533  auto const& nftokens = sle->getFieldArray(sfNFTokens);
+
534 
+
535  // An NFTokenPage should never contain too many tokens or be empty.
+
536  if (std::size_t const nftokenCount = nftokens.size();
+
537  (!isDelete && nftokenCount == 0) ||
+
538  nftokenCount > dirMaxTokensPerPage)
+
539  invalidSize_ = true;
+
540 
+
541  // If prev is valid, use it to establish a lower bound for
+
542  // page entries. If prev is not valid the lower bound is zero.
+
543  uint256 const loLimit =
+
544  prev ? *prev & pageBits : uint256(beast::zero);
+
545 
+
546  // Also verify that all NFTokenIDs in the page are sorted.
+
547  uint256 loCmp = loLimit;
+
548  for (auto const& obj : nftokens)
+
549  {
+
550  uint256 const tokenID = obj[sfNFTokenID];
+
551  if (!nft::compareTokens(loCmp, tokenID))
+
552  badSort_ = true;
+
553  loCmp = tokenID;
+
554 
+
555  // None of the NFTs on this page should belong on lower or
+
556  // higher pages.
+
557  if (uint256 const tokenPageBits = tokenID & pageBits;
+
558  tokenPageBits < loLimit || tokenPageBits >= hiLimit)
+
559  badEntry_ = true;
+
560 
+
561  if (auto uri = obj[~sfURI]; uri && uri->empty())
+
562  badURI_ = true;
+
563  }
+
564  }
+
565  };
+
566 
+
567  if (before && before->getType() == ltNFTOKEN_PAGE)
+
568  check(before);
+
569 
+
570  if (after && after->getType() == ltNFTOKEN_PAGE)
+
571  check(after);
+
572 }
+
573 
+
574 bool
+
575 ValidNFTokenPage::finalize(
+
576  STTx const& tx,
+
577  TER const result,
+
578  XRPAmount const,
+
579  ReadView const& view,
+
580  beast::Journal const& j)
+
581 {
+
582  if (badLink_)
+
583  {
+
584  JLOG(j.fatal()) << "Invariant failed: NFT page is improperly linked.";
+
585  return false;
+
586  }
+
587 
+
588  if (badEntry_)
+
589  {
+
590  JLOG(j.fatal()) << "Invariant failed: NFT found in incorrect page.";
+
591  return false;
+
592  }
+
593 
+
594  if (badSort_)
+
595  {
+
596  JLOG(j.fatal()) << "Invariant failed: NFTs on page are not sorted.";
+
597  return false;
+
598  }
+
599 
+
600  if (badURI_)
+
601  {
+
602  JLOG(j.fatal()) << "Invariant failed: NFT contains empty URI.";
+
603  return false;
+
604  }
+
605 
+
606  if (invalidSize_)
+
607  {
+
608  JLOG(j.fatal()) << "Invariant failed: NFT page has invalid size.";
+
609  return false;
+
610  }
+
611 
+
612  return true;
+
613 }
+
614 
+
615 //------------------------------------------------------------------------------
+
616 void
+
617 NFTokenCountTracking::visitEntry(
+
618  bool,
+
619  std::shared_ptr<SLE const> const& before,
+
620  std::shared_ptr<SLE const> const& after)
+
621 {
+
622  if (before && before->getType() == ltACCOUNT_ROOT)
+
623  {
+
624  beforeMintedTotal += (*before)[~sfMintedNFTokens].value_or(0);
+
625  beforeBurnedTotal += (*before)[~sfBurnedNFTokens].value_or(0);
+
626  }
+
627 
+
628  if (after && after->getType() == ltACCOUNT_ROOT)
+
629  {
+
630  afterMintedTotal += (*after)[~sfMintedNFTokens].value_or(0);
+
631  afterBurnedTotal += (*after)[~sfBurnedNFTokens].value_or(0);
+
632  }
+
633 }
+
634 
+
635 bool
+
636 NFTokenCountTracking::finalize(
+
637  STTx const& tx,
+
638  TER const result,
+
639  XRPAmount const,
+
640  ReadView const& view,
+
641  beast::Journal const& j)
+
642 {
+
643  if (TxType const txType = tx.getTxnType();
+
644  txType != ttNFTOKEN_MINT && txType != ttNFTOKEN_BURN)
+
645  {
+
646  if (beforeMintedTotal != afterMintedTotal)
+
647  {
+
648  JLOG(j.fatal()) << "Invariant failed: the number of minted tokens "
+
649  "changed without a mint transaction!";
+
650  return false;
+
651  }
+
652 
+
653  if (beforeBurnedTotal != afterBurnedTotal)
+
654  {
+
655  JLOG(j.fatal()) << "Invariant failed: the number of burned tokens "
+
656  "changed without a burn transaction!";
+
657  return false;
+
658  }
+
659 
+
660  return true;
+
661  }
+
662 
+
663  if (tx.getTxnType() == ttNFTOKEN_MINT)
+
664  {
+
665  if (result == tesSUCCESS && beforeMintedTotal >= afterMintedTotal)
+
666  {
+
667  JLOG(j.fatal())
+
668  << "Invariant failed: successful minting didn't increase "
+
669  "the number of minted tokens.";
+
670  return false;
+
671  }
+
672 
+
673  if (result != tesSUCCESS && beforeMintedTotal != afterMintedTotal)
+
674  {
+
675  JLOG(j.fatal()) << "Invariant failed: failed minting changed the "
+
676  "number of minted tokens.";
+
677  return false;
+
678  }
+
679 
+
680  if (beforeBurnedTotal != afterBurnedTotal)
+
681  {
+
682  JLOG(j.fatal())
+
683  << "Invariant failed: minting changed the number of "
+
684  "burned tokens.";
+
685  return false;
+
686  }
+
687  }
+
688 
+
689  if (tx.getTxnType() == ttNFTOKEN_BURN)
+
690  {
+
691  if (result == tesSUCCESS)
+
692  {
+
693  if (beforeBurnedTotal >= afterBurnedTotal)
+
694  {
+
695  JLOG(j.fatal())
+
696  << "Invariant failed: successful burning didn't increase "
+
697  "the number of burned tokens.";
+
698  return false;
+
699  }
+
700  }
+
701 
+
702  if (result != tesSUCCESS && beforeBurnedTotal != afterBurnedTotal)
+
703  {
+
704  JLOG(j.fatal()) << "Invariant failed: failed burning changed the "
+
705  "number of burned tokens.";
+
706  return false;
+
707  }
+
708 
+
709  if (beforeMintedTotal != afterMintedTotal)
+
710  {
+
711  JLOG(j.fatal())
+
712  << "Invariant failed: burning changed the number of "
+
713  "minted tokens.";
+
714  return false;
+
715  }
+
716  }
+
717 
+
718  return true;
+
719 }
+
720 
+
721 //------------------------------------------------------------------------------
+
722 
+
723 void
+
724 ValidClawback::visitEntry(
+
725  bool,
+
726  std::shared_ptr<SLE const> const& before,
+
727  std::shared_ptr<SLE const> const&)
+
728 {
+
729  if (before && before->getType() == ltRIPPLE_STATE)
+
730  trustlinesChanged++;
+
731 }
+
732 
+
733 bool
+
734 ValidClawback::finalize(
+
735  STTx const& tx,
+
736  TER const result,
+
737  XRPAmount const,
+
738  ReadView const& view,
+
739  beast::Journal const& j)
+
740 {
+
741  if (tx.getTxnType() != ttCLAWBACK)
+
742  return true;
+
743 
+
744  if (result == tesSUCCESS)
+
745  {
+
746  if (trustlinesChanged > 1)
+
747  {
+
748  JLOG(j.fatal())
+
749  << "Invariant failed: more than one trustline changed.";
+
750  return false;
+
751  }
+
752 
+
753  AccountID const issuer = tx.getAccountID(sfAccount);
+
754  STAmount const amount = tx.getFieldAmount(sfAmount);
+
755  AccountID const& holder = amount.getIssuer();
+
756  STAmount const holderBalance = accountHolds(
+
757  view, holder, amount.getCurrency(), issuer, fhIGNORE_FREEZE, j);
+
758 
+
759  if (holderBalance.signum() < 0)
+
760  {
+
761  JLOG(j.fatal())
+
762  << "Invariant failed: trustline balance is negative";
+
763  return false;
+
764  }
+
765  }
+
766  else
+
767  {
+
768  if (trustlinesChanged != 0)
+
769  {
+
770  JLOG(j.fatal()) << "Invariant failed: some trustlines were changed "
+
771  "despite failure of the transaction.";
+
772  return false;
+
773  }
+
774  }
+
775 
+
776  return true;
+
777 }
+
778 
+
779 } // namespace ripple
beast::Journal::fatal
Stream fatal() const
Definition: Journal.h:339
ripple::STTx::getTxnType
TxType getTxnType() const
Definition: STTx.h:179
ripple::ValidNFTokenPage::badURI_
bool badURI_
Definition: InvariantCheck.h:337
-
ripple::LedgerEntryTypesMatch::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:347
+
ripple::LedgerEntryTypesMatch::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:348
ripple::ttACCOUNT_DELETE
@ ttACCOUNT_DELETE
This transaction type deletes an existing account.
Definition: TxFormats.h:122
ripple::ltTICKET
@ ltTICKET
A ledger object which describes a ticket.
Definition: LedgerFormats.h:80
-
ripple::NoZeroEscrow::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:261
+
ripple::NoZeroEscrow::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:262
ripple::Rules::enabled
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
Definition: Rules.cpp:94
std::shared_ptr
STL class.
-
ripple::TransactionFeeCheck::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:43
+
ripple::TransactionFeeCheck::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:44
ripple::sfAmount
const SF_AMOUNT sfAmount
+
ripple::ttCLAWBACK
@ ttCLAWBACK
This transaction claws back issued tokens.
Definition: TxFormats.h:143
ripple::sfNFTokenID
const SF_UINT256 sfNFTokenID
ripple::ltLEDGER_HASHES
@ ltLEDGER_HASHES
A ledger object that contains a list of ledger hashes.
Definition: LedgerFormats.h:102
-
ripple::XRPBalanceChecks::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:198
+
ripple::XRPBalanceChecks::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:199
ripple::XRPAmount::drops
constexpr value_type drops() const
Returns the number of drops.
Definition: XRPAmount.h:172
ripple::sfSequence
const SF_UINT32 sfSequence
-
ripple::NoXRPTrustLines::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:410
+
ripple::NoXRPTrustLines::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:411
+
ripple::accountHolds
STAmount accountHolds(ReadView const &view, AccountID const &account, Currency const &currency, AccountID const &issuer, FreezeHandling zeroIfFrozen, beast::Journal j)
Definition: View.cpp:223
ripple::ValidNFTokenPage::badSort_
bool badSort_
Definition: InvariantCheck.h:336
ripple::ltSIGNER_LIST
@ ltSIGNER_LIST
A ledger object which contains a signer list for an account.
Definition: LedgerFormats.h:86
ripple::sfMintedNFTokens
const SF_UINT32 sfMintedNFTokens
-
ripple::NoBadOffers::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:217
+
ripple::NoBadOffers::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:218
ripple::NoZeroEscrow::bad_
bool bad_
Definition: InvariantCheck.h:277
-
ripple::ValidNFTokenPage::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:497
+
ripple::ValidNFTokenPage::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:498
ripple::dirMaxTokensPerPage
constexpr std::size_t dirMaxTokensPerPage
The maximum number of items in an NFT page.
Definition: Protocol.h:61
+
ripple::STAmount::signum
int signum() const noexcept
Definition: STAmount.h:365
ripple::TxType
TxType
Transaction type identifiers.
Definition: TxFormats.h:56
ripple::NoBadOffers::bad_
bool bad_
Definition: InvariantCheck.h:253
-
ripple::NFTokenCountTracking::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:635
+
ripple::NFTokenCountTracking::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:636
ripple::ValidNFTokenPage::invalidSize_
bool invalidSize_
Definition: InvariantCheck.h:338
ripple::NFTokenCountTracking::beforeMintedTotal
std::uint32_t beforeMintedTotal
Definition: InvariantCheck.h:371
ripple::ltCHECK
@ ltCHECK
A ledger object which describes a check.
Definition: LedgerFormats.h:136
@@ -827,39 +889,43 @@ $(function() {
ripple::INITIAL_XRP
constexpr XRPAmount INITIAL_XRP
Configure the native currency.
Definition: SystemParameters.h:43
ripple::ValidNewAccountRoot::accountSeq_
std::uint32_t accountSeq_
Definition: InvariantCheck.h:303
ripple::ltDIR_NODE
@ ltDIR_NODE
A ledger object which contains a list of object identifiers.
Definition: LedgerFormats.h:66
-
ripple::ValidNewAccountRoot::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:457
+
ripple::STAmount::getIssuer
AccountID const & getIssuer() const
Definition: STAmount.h:359
+
ripple::ValidNewAccountRoot::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:458
ripple::nft::pageMask
constexpr uint256 pageMask(std::string_view("0000000000000000000000000000000000000000ffffffffffffffffffffffff"))
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:550
ripple::featureDeletableAccounts
const uint256 featureDeletableAccounts
ripple::ttPAYMENT
@ ttPAYMENT
This transaction type executes a payment.
Definition: TxFormats.h:59
-
ripple::NoXRPTrustLines::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:427
+
ripple::NoXRPTrustLines::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:428
ripple::base_uint< 256 >
ripple::sfTakerPays
const SF_AMOUNT sfTakerPays
ripple::ltAMENDMENTS
@ ltAMENDMENTS
The ledger object which lists details about amendments on the network.
Definition: LedgerFormats.h:110
ripple::sfLowLimit
const SF_AMOUNT sfLowLimit
ripple::LedgerEntryTypesMatch::typeMismatch_
bool typeMismatch_
Definition: InvariantCheck.h:199
-
ripple::ValidNFTokenPage::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:574
+
ripple::ValidNFTokenPage::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:575
ripple::ltOFFER
@ ltOFFER
A ledger object which describes an offer on the DEX.
Definition: LedgerFormats.h:92
-
ripple::NoBadOffers::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:242
-
ripple::LedgerEntryTypesMatch::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:384
+
ripple::NoBadOffers::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:243
+
ripple::LedgerEntryTypesMatch::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:385
ripple::NFTokenCountTracking::afterBurnedTotal
std::uint32_t afterBurnedTotal
Definition: InvariantCheck.h:374
ripple::ltESCROW
@ ltESCROW
A ledger object describing a single escrow.
Definition: LedgerFormats.h:124
+
ripple::STObject::getAccountID
AccountID getAccountID(SField const &field) const
Definition: STObject.cpp:589
ripple::ltNFTOKEN_OFFER
@ ltNFTOKEN_OFFER
A ledger object which identifies an offer to buy or sell an NFT.
Definition: LedgerFormats.h:162
ripple::ValidNFTokenPage::badEntry_
bool badEntry_
Definition: InvariantCheck.h:334
ripple::TERSubset< CanCvtToTER >
ripple::ttNFTOKEN_MINT
@ ttNFTOKEN_MINT
This transaction mints a new NFT.
Definition: TxFormats.h:128
-
ripple::ValidNewAccountRoot::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:444
+
ripple::ValidNewAccountRoot::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:445
+
ripple::ValidClawback::trustlinesChanged
std::uint32_t trustlinesChanged
Definition: InvariantCheck.h:402
+
ripple::ValidClawback::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:734
ripple::ltDEPOSIT_PREAUTH
@ ltDEPOSIT_PREAUTH
A ledger object which describes a deposit preauthorization.
Definition: LedgerFormats.h:142
ripple::STAmount
Definition: STAmount.h:45
-
ripple::XRPNotCreated::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:82
+
ripple::XRPNotCreated::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:83
ripple::sfTakerGets
const SF_AMOUNT sfTakerGets
-
ripple::XRPNotCreated::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:137
+
ripple::XRPNotCreated::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:138
ripple::STTx
Definition: STTx.h:45
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
ripple::sfHighLimit
const SF_AMOUNT sfHighLimit
-
ripple::NoZeroEscrow::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:287
-
ripple::AccountRootsNotDeleted::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:316
+
ripple::NoZeroEscrow::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:288
+
ripple::AccountRootsNotDeleted::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:317
ripple::NFTokenCountTracking::beforeBurnedTotal
std::uint32_t beforeBurnedTotal
Definition: InvariantCheck.h:372
ripple::sfNFTokens
const SField sfNFTokens
ripple::sfURI
const SF_VL sfURI
@@ -873,24 +939,28 @@ $(function() {
ripple::ValidNewAccountRoot::accountsCreated_
std::uint32_t accountsCreated_
Definition: InvariantCheck.h:302
ripple::ReadView::rules
virtual Rules const & rules() const =0
Returns the tx processing rules.
ripple::ltACCOUNT_ROOT
@ ltACCOUNT_ROOT
A ledger object which describes an account.
Definition: LedgerFormats.h:59
-
ripple::TransactionFeeCheck::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:34
+
ripple::TransactionFeeCheck::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:35
ripple::sfBalance
const SF_AMOUNT sfBalance
-
ripple::AccountRootsNotDeleted::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:306
+
ripple::AccountRootsNotDeleted::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:307
ripple::sfNextPageMin
const SF_UINT256 sfNextPageMin
ripple::xrpIssue
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
Definition: Issue.h:95
+
ripple::fhIGNORE_FREEZE
@ fhIGNORE_FREEZE
Definition: View.h:76
std::optional
ripple::sfPreviousPageMin
const SF_UINT256 sfPreviousPageMin
ripple::ttNFTOKEN_BURN
@ ttNFTOKEN_BURN
This transaction burns (i.e.
Definition: TxFormats.h:131
ripple::after
static bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: Escrow.cpp:88
std::size_t
+
ripple::ValidClawback::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:724
ripple::AccountRootsNotDeleted::accountsDeleted_
std::uint32_t accountsDeleted_
Definition: InvariantCheck.h:148
ripple::sfFee
const SF_AMOUNT sfFee
-
ripple::XRPBalanceChecks::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:167
+
ripple::XRPBalanceChecks::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:168
+
ripple::sfAccount
const SF_ACCOUNT sfAccount
ripple::ltRIPPLE_STATE
@ ltRIPPLE_STATE
A ledger object which describes a bidirectional trust line.
Definition: LedgerFormats.h:74
-
ripple::NFTokenCountTracking::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:616
+
ripple::NFTokenCountTracking::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:617
ripple::XRPBalanceChecks::bad_
bool bad_
Definition: InvariantCheck.h:175
ripple::sfBurnedNFTokens
const SF_UINT32 sfBurnedNFTokens
ripple::LedgerEntryTypesMatch::invalidTypeAdded_
bool invalidTypeAdded_
Definition: InvariantCheck.h:200
+
ripple::STAmount::getCurrency
Currency const & getCurrency() const
Definition: STAmount.h:353
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:222
ripple::XRPNotCreated::drops_
std::int64_t drops_
Definition: InvariantCheck.h:120
ripple::STObject::getFieldAmount
STAmount const & getFieldAmount(SField const &field) const
Definition: STObject.cpp:603
diff --git a/InvariantCheck_8h_source.html b/InvariantCheck_8h_source.html index 4c4f8eeb48..6f52a20bab 100644 --- a/InvariantCheck_8h_source.html +++ b/InvariantCheck_8h_source.html @@ -355,46 +355,68 @@ $(function() {
389  beast::Journal const&);
390 };
391 
-
392 // additional invariant checks can be declared above and then added to this
-
393 // tuple
-
394 using InvariantChecks = std::tuple<
-
395  TransactionFeeCheck,
-
396  AccountRootsNotDeleted,
-
397  LedgerEntryTypesMatch,
-
398  XRPBalanceChecks,
-
399  XRPNotCreated,
-
400  NoXRPTrustLines,
-
401  NoBadOffers,
-
402  NoZeroEscrow,
-
403  ValidNewAccountRoot,
-
404  ValidNFTokenPage,
-
405  NFTokenCountTracking>;
-
406 
-
415 inline InvariantChecks
-
416 getInvariantChecks()
-
417 {
-
418  return InvariantChecks{};
-
419 }
-
420 
-
421 } // namespace ripple
-
422 
-
423 #endif
+
400 class ValidClawback
+
401 {
+
402  std::uint32_t trustlinesChanged = 0;
+
403 
+
404 public:
+
405  void
+
406  visitEntry(
+
407  bool,
+
408  std::shared_ptr<SLE const> const&,
+
409  std::shared_ptr<SLE const> const&);
+
410 
+
411  bool
+
412  finalize(
+
413  STTx const&,
+
414  TER const,
+
415  XRPAmount const,
+
416  ReadView const&,
+
417  beast::Journal const&);
+
418 };
+
419 
+
420 // additional invariant checks can be declared above and then added to this
+
421 // tuple
+
422 using InvariantChecks = std::tuple<
+
423  TransactionFeeCheck,
+
424  AccountRootsNotDeleted,
+
425  LedgerEntryTypesMatch,
+
426  XRPBalanceChecks,
+
427  XRPNotCreated,
+
428  NoXRPTrustLines,
+
429  NoBadOffers,
+
430  NoZeroEscrow,
+
431  ValidNewAccountRoot,
+
432  ValidNFTokenPage,
+
433  NFTokenCountTracking,
+
434  ValidClawback>;
+
435 
+
444 inline InvariantChecks
+
445 getInvariantChecks()
+
446 {
+
447  return InvariantChecks{};
+
448 }
+
449 
+
450 } // namespace ripple
+
451 
+
452 #endif
ripple::ValidNFTokenPage::badURI_
bool badURI_
Definition: InvariantCheck.h:337
-
ripple::LedgerEntryTypesMatch::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:347
-
ripple::NoZeroEscrow::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:261
+
ripple::LedgerEntryTypesMatch::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:348
+
ripple::NoZeroEscrow::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:262
std::shared_ptr
STL class.
utility
-
ripple::TransactionFeeCheck::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:43
-
ripple::XRPBalanceChecks::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:198
-
ripple::NoXRPTrustLines::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:410
+
ripple::TransactionFeeCheck::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:44
+
ripple::XRPBalanceChecks::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:199
+
ripple::NoXRPTrustLines::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:411
ripple::ValidNFTokenPage::badSort_
bool badSort_
Definition: InvariantCheck.h:336
-
ripple::NoBadOffers::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:217
+
ripple::NoBadOffers::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:218
ripple::NoZeroEscrow::bad_
bool bad_
Definition: InvariantCheck.h:277
-
ripple::ValidNFTokenPage::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:497
+
ripple::ValidClawback
Invariant: Token holder's trustline balance cannot be negative after Clawback.
Definition: InvariantCheck.h:400
+
ripple::ValidNFTokenPage::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:498
ripple::NoBadOffers::bad_
bool bad_
Definition: InvariantCheck.h:253
tuple
-
ripple::NFTokenCountTracking::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:635
+
ripple::NFTokenCountTracking::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:636
ripple::ValidNFTokenPage::invalidSize_
bool invalidSize_
Definition: InvariantCheck.h:338
ripple::NFTokenCountTracking::beforeMintedTotal
std::uint32_t beforeMintedTotal
Definition: InvariantCheck.h:371
ripple::NoBadOffers
Invariant: offers should be for non-negative amounts and must not be XRP to XRP.
Definition: InvariantCheck.h:251
@@ -403,30 +425,32 @@ $(function() {
ripple::InvariantChecker_PROTOTYPE::InvariantChecker_PROTOTYPE
InvariantChecker_PROTOTYPE()=default
ripple::ValidNewAccountRoot::accountSeq_
std::uint32_t accountSeq_
Definition: InvariantCheck.h:303
ripple::XRPBalanceChecks
Invariant: An account XRP balance must be in XRP and take a value between 0 and INITIAL_XRP drops,...
Definition: InvariantCheck.h:173
-
ripple::ValidNewAccountRoot::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:457
-
ripple::NoXRPTrustLines::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:427
+
ripple::ValidNewAccountRoot::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:458
+
ripple::NoXRPTrustLines::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:428
ripple::LedgerEntryTypesMatch::typeMismatch_
bool typeMismatch_
Definition: InvariantCheck.h:199
ripple::NFTokenCountTracking
Invariant: Validates counts of NFTokens after all transaction types.
Definition: InvariantCheck.h:369
-
ripple::ValidNFTokenPage::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:574
-
ripple::NoBadOffers::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:242
+
ripple::ValidNFTokenPage::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:575
+
ripple::NoBadOffers::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:243
ripple::TransactionFeeCheck
Invariant: We should never charge a transaction a negative fee or a fee that is larger than what the ...
Definition: InvariantCheck.h:92
-
ripple::LedgerEntryTypesMatch::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:384
+
ripple::LedgerEntryTypesMatch::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:385
ripple::NFTokenCountTracking::afterBurnedTotal
std::uint32_t afterBurnedTotal
Definition: InvariantCheck.h:374
ripple::ValidNFTokenPage::badEntry_
bool badEntry_
Definition: InvariantCheck.h:334
ripple::TERSubset< CanCvtToTER >
-
ripple::ValidNewAccountRoot::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:444
+
ripple::ValidNewAccountRoot::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:445
+
ripple::ValidClawback::trustlinesChanged
std::uint32_t trustlinesChanged
Definition: InvariantCheck.h:402
+
ripple::ValidClawback::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:734
ripple::AccountRootsNotDeleted
Invariant: we cannot remove an account ledger entry.
Definition: InvariantCheck.h:146
ripple::XRPNotCreated
Invariant: A transaction must not create XRP and should only destroy the XRP fee.
Definition: InvariantCheck.h:118
-
ripple::XRPNotCreated::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:82
-
ripple::XRPNotCreated::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:137
+
ripple::XRPNotCreated::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:83
+
ripple::XRPNotCreated::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:138
cstdint
ripple::STTx
Definition: STTx.h:45
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::int64_t
ripple::ValidNewAccountRoot
Invariant: a new account root must be the consequence of a payment, must have the right starting sequ...
Definition: InvariantCheck.h:300
map
-
ripple::NoZeroEscrow::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:287
-
ripple::AccountRootsNotDeleted::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:316
+
ripple::NoZeroEscrow::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:288
+
ripple::AccountRootsNotDeleted::finalize
bool finalize(STTx const &, TER const, XRPAmount const, ReadView const &, beast::Journal const &)
Definition: InvariantCheck.cpp:317
ripple::LedgerEntryTypesMatch
Invariant: corresponding modified ledger entries should match in type and added entries should be a v...
Definition: InvariantCheck.h:197
ripple::NFTokenCountTracking::beforeBurnedTotal
std::uint32_t beforeBurnedTotal
Definition: InvariantCheck.h:372
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:125
@@ -434,15 +458,16 @@ $(function() {
ripple::InvariantChecker_PROTOTYPE
Prototype for invariant check implementations.
Definition: InvariantCheck.h:46
ripple::NoXRPTrustLines::xrpTrustLine_
bool xrpTrustLine_
Definition: InvariantCheck.h:226
ripple::ValidNewAccountRoot::accountsCreated_
std::uint32_t accountsCreated_
Definition: InvariantCheck.h:302
-
ripple::TransactionFeeCheck::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:34
-
ripple::AccountRootsNotDeleted::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:306
+
ripple::TransactionFeeCheck::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:35
+
ripple::AccountRootsNotDeleted::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:307
ripple::after
static bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: Escrow.cpp:88
+
ripple::ValidClawback::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:724
ripple::AccountRootsNotDeleted::accountsDeleted_
std::uint32_t accountsDeleted_
Definition: InvariantCheck.h:148
-
ripple::XRPBalanceChecks::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:167
-
ripple::NFTokenCountTracking::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:616
+
ripple::XRPBalanceChecks::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:168
+
ripple::NFTokenCountTracking::visitEntry
void visitEntry(bool, std::shared_ptr< SLE const > const &, std::shared_ptr< SLE const > const &)
Definition: InvariantCheck.cpp:617
ripple::NoXRPTrustLines
Invariant: Trust lines using XRP are not allowed.
Definition: InvariantCheck.h:224
ripple::XRPBalanceChecks::bad_
bool bad_
Definition: InvariantCheck.h:175
-
ripple::getInvariantChecks
InvariantChecks getInvariantChecks()
get a tuple of all invariant checks
Definition: InvariantCheck.h:416
+
ripple::getInvariantChecks
InvariantChecks getInvariantChecks()
get a tuple of all invariant checks
Definition: InvariantCheck.h:445
ripple::LedgerEntryTypesMatch::invalidTypeAdded_
bool invalidTypeAdded_
Definition: InvariantCheck.h:200
ripple::XRPNotCreated::drops_
std::int64_t drops_
Definition: InvariantCheck.h:120
ripple::XRPAmount
Definition: XRPAmount.h:46
diff --git a/LedgerFormats_8cpp_source.html b/LedgerFormats_8cpp_source.html index 0acc4299d6..69c524ddc6 100644 --- a/LedgerFormats_8cpp_source.html +++ b/LedgerFormats_8cpp_source.html @@ -443,7 +443,7 @@ $(function() {
ripple::sfMessageKey
const SF_VL sfMessageKey
ripple::sfHighQualityOut
const SF_UINT32 sfHighQualityOut
ripple::sfPreviousPageMin
const SF_UINT256 sfPreviousPageMin
-
ripple::LedgerFormats
Holds the list of known ledger entry formats.
Definition: LedgerFormats.h:276
+
ripple::LedgerFormats
Holds the list of known ledger entry formats.
Definition: LedgerFormats.h:279
ripple::sfFinishAfter
const SF_UINT32 sfFinishAfter
ripple::sfAccount
const SF_ACCOUNT sfAccount
ripple::ltRIPPLE_STATE
@ ltRIPPLE_STATE
A ledger object which describes a bidirectional trust line.
Definition: LedgerFormats.h:74
diff --git a/LedgerFormats_8h_source.html b/LedgerFormats_8h_source.html index 62788578a3..f46edff267 100644 --- a/LedgerFormats_8h_source.html +++ b/LedgerFormats_8h_source.html @@ -169,89 +169,93 @@ $(function() {
243  0x10000000, // True, reject new paychans
244  lsfDisallowIncomingTrustline =
245  0x20000000, // True, reject new trustlines (only if no issued assets)
-
246 
-
247  // ltOFFER
-
248  lsfPassive = 0x00010000,
-
249  lsfSell = 0x00020000, // True, offer was placed as a sell.
-
250 
-
251  // ltRIPPLE_STATE
-
252  lsfLowReserve = 0x00010000, // True, if entry counts toward reserve.
-
253  lsfHighReserve = 0x00020000,
-
254  lsfLowAuth = 0x00040000,
-
255  lsfHighAuth = 0x00080000,
-
256  lsfLowNoRipple = 0x00100000,
-
257  lsfHighNoRipple = 0x00200000,
-
258  lsfLowFreeze = 0x00400000, // True, low side has set freeze flag
-
259  lsfHighFreeze = 0x00800000, // True, high side has set freeze flag
-
260 
-
261  // ltSIGNER_LIST
-
262  lsfOneOwnerCount = 0x00010000, // True, uses only one OwnerCount
+
246  lsfAMM [[maybe_unused]] = 0x40000000, // True, AMM account
+
247  lsfAllowClawback =
+
248  0x80000000, // True, enable clawback
+
249 
+
250  // ltOFFER
+
251  lsfPassive = 0x00010000,
+
252  lsfSell = 0x00020000, // True, offer was placed as a sell.
+
253 
+
254  // ltRIPPLE_STATE
+
255  lsfLowReserve = 0x00010000, // True, if entry counts toward reserve.
+
256  lsfHighReserve = 0x00020000,
+
257  lsfLowAuth = 0x00040000,
+
258  lsfHighAuth = 0x00080000,
+
259  lsfLowNoRipple = 0x00100000,
+
260  lsfHighNoRipple = 0x00200000,
+
261  lsfLowFreeze = 0x00400000, // True, low side has set freeze flag
+
262  lsfHighFreeze = 0x00800000, // True, high side has set freeze flag
263 
-
264  // ltDIR_NODE
-
265  lsfNFTokenBuyOffers = 0x00000001,
-
266  lsfNFTokenSellOffers = 0x00000002,
-
267 
-
268  // ltNFTOKEN_OFFER
-
269  lsfSellNFToken = 0x00000001,
-
270 };
-
271 
-
272 //------------------------------------------------------------------------------
-
273 
-
276 class LedgerFormats : public KnownFormats<LedgerEntryType, LedgerFormats>
-
277 {
-
278 private:
-
282  LedgerFormats();
-
283 
-
284 public:
-
285  static LedgerFormats const&
-
286  getInstance();
-
287 };
-
288 
-
289 } // namespace ripple
-
290 
-
291 #endif
+
264  // ltSIGNER_LIST
+
265  lsfOneOwnerCount = 0x00010000, // True, uses only one OwnerCount
+
266 
+
267  // ltDIR_NODE
+
268  lsfNFTokenBuyOffers = 0x00000001,
+
269  lsfNFTokenSellOffers = 0x00000002,
+
270 
+
271  // ltNFTOKEN_OFFER
+
272  lsfSellNFToken = 0x00000001,
+
273 };
+
274 
+
275 //------------------------------------------------------------------------------
+
276 
+
279 class LedgerFormats : public KnownFormats<LedgerEntryType, LedgerFormats>
+
280 {
+
281 private:
+
285  LedgerFormats();
+
286 
+
287 public:
+
288  static LedgerFormats const&
+
289  getInstance();
+
290 };
+
291 
+
292 } // namespace ripple
+
293 
+
294 #endif
ripple::ltTICKET
@ ltTICKET
A ledger object which describes a ticket.
Definition: LedgerFormats.h:80
ripple::lsfPasswordSpent
@ lsfPasswordSpent
Definition: LedgerFormats.h:223
ripple::lsfGlobalFreeze
@ lsfGlobalFreeze
Definition: LedgerFormats.h:231
ripple::ltANY
@ ltANY
A special type, matching any ledger entry type.
Definition: LedgerFormats.h:176
ripple::lsfDisableMaster
@ lsfDisableMaster
Definition: LedgerFormats.h:229
-
ripple::lsfLowReserve
@ lsfLowReserve
Definition: LedgerFormats.h:252
+
ripple::lsfLowReserve
@ lsfLowReserve
Definition: LedgerFormats.h:255
ripple::ltLEDGER_HASHES
@ ltLEDGER_HASHES
A ledger object that contains a list of ledger hashes.
Definition: LedgerFormats.h:102
ripple::ltCONTRACT
@ ltCONTRACT
A legacy, deprecated type.
Definition: LedgerFormats.h:206
-
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:254
-
ripple::lsfLowNoRipple
@ lsfLowNoRipple
Definition: LedgerFormats.h:256
+
ripple::lsfLowAuth
@ lsfLowAuth
Definition: LedgerFormats.h:257
+
ripple::lsfLowNoRipple
@ lsfLowNoRipple
Definition: LedgerFormats.h:259
ripple::ltSIGNER_LIST
@ ltSIGNER_LIST
A ledger object which contains a signer list for an account.
Definition: LedgerFormats.h:86
ripple::ltCHECK
@ ltCHECK
A ledger object which describes a check.
Definition: LedgerFormats.h:136
ripple::ltFEE_SETTINGS
@ ltFEE_SETTINGS
The ledger object which lists the network's fee settings.
Definition: LedgerFormats.h:118
ripple::ltCHILD
@ ltCHILD
A special type, matching any ledger type except directory nodes.
Definition: LedgerFormats.h:189
ripple::lsfDepositAuth
@ lsfDepositAuth
Definition: LedgerFormats.h:234
-
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:255
+
ripple::lsfHighAuth
@ lsfHighAuth
Definition: LedgerFormats.h:258
ripple::ltDIR_NODE
@ ltDIR_NODE
A ledger object which contains a list of object identifiers.
Definition: LedgerFormats.h:66
-
ripple::lsfSellNFToken
@ lsfSellNFToken
Definition: LedgerFormats.h:269
+
ripple::lsfSellNFToken
@ lsfSellNFToken
Definition: LedgerFormats.h:272
ripple::ltAMENDMENTS
@ ltAMENDMENTS
The ledger object which lists details about amendments on the network.
Definition: LedgerFormats.h:110
ripple::lsfRequireAuth
@ lsfRequireAuth
Definition: LedgerFormats.h:226
ripple::ltOFFER
@ ltOFFER
A ledger object which describes an offer on the DEX.
Definition: LedgerFormats.h:92
ripple::lsfDefaultRipple
@ lsfDefaultRipple
Definition: LedgerFormats.h:232
-
ripple::lsfSell
@ lsfSell
Definition: LedgerFormats.h:249
+
ripple::lsfSell
@ lsfSell
Definition: LedgerFormats.h:252
+
ripple::lsfAllowClawback
@ lsfAllowClawback
Definition: LedgerFormats.h:247
ripple::KnownFormats
Manages a list of known formats.
Definition: KnownFormats.h:40
ripple::ltESCROW
@ ltESCROW
A ledger object describing a single escrow.
Definition: LedgerFormats.h:124
ripple::lsfDisallowIncomingPayChan
@ lsfDisallowIncomingPayChan
Definition: LedgerFormats.h:242
ripple::ltNFTOKEN_OFFER
@ ltNFTOKEN_OFFER
A ledger object which identifies an offer to buy or sell an NFT.
Definition: LedgerFormats.h:162
ripple::LedgerFormats::LedgerFormats
LedgerFormats()
Create the object.
Definition: LedgerFormats.cpp:26
ripple::ltDEPOSIT_PREAUTH
@ ltDEPOSIT_PREAUTH
A ledger object which describes a deposit preauthorization.
Definition: LedgerFormats.h:142
-
ripple::lsfOneOwnerCount
@ lsfOneOwnerCount
Definition: LedgerFormats.h:262
+
ripple::lsfOneOwnerCount
@ lsfOneOwnerCount
Definition: LedgerFormats.h:265
std::uint16_t
-
ripple::lsfPassive
@ lsfPassive
Definition: LedgerFormats.h:248
+
ripple::lsfPassive
@ lsfPassive
Definition: LedgerFormats.h:251
ripple::ltNICKNAME
@ ltNICKNAME
A legacy, deprecated type.
Definition: LedgerFormats.h:198
ripple::LedgerFormats::getInstance
static LedgerFormats const & getInstance()
Definition: LedgerFormats.cpp:274
ripple::lsfRequireDestTag
@ lsfRequireDestTag
Definition: LedgerFormats.h:224
-
ripple::lsfHighNoRipple
@ lsfHighNoRipple
Definition: LedgerFormats.h:257
-
ripple::lsfHighFreeze
@ lsfHighFreeze
Definition: LedgerFormats.h:259
+
ripple::lsfHighNoRipple
@ lsfHighNoRipple
Definition: LedgerFormats.h:260
+
ripple::lsfHighFreeze
@ lsfHighFreeze
Definition: LedgerFormats.h:262
ripple::ltNFTOKEN_PAGE
@ ltNFTOKEN_PAGE
A ledger object which contains a list of NFTs.
Definition: LedgerFormats.h:156
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
-
ripple::lsfNFTokenSellOffers
@ lsfNFTokenSellOffers
Definition: LedgerFormats.h:266
-
ripple::lsfNFTokenBuyOffers
@ lsfNFTokenBuyOffers
Definition: LedgerFormats.h:265
+
ripple::lsfNFTokenSellOffers
@ lsfNFTokenSellOffers
Definition: LedgerFormats.h:269
+
ripple::lsfNFTokenBuyOffers
@ lsfNFTokenBuyOffers
Definition: LedgerFormats.h:268
ripple::LedgerEntryType
LedgerEntryType
Identifiers for on-ledger objects.
Definition: LedgerFormats.h:53
ripple::ltNEGATIVE_UNL
@ ltNEGATIVE_UNL
The ledger object which tracks the current negative UNL state.
Definition: LedgerFormats.h:150
ripple::lsfDisallowIncomingNFTokenOffer
@ lsfDisallowIncomingNFTokenOffer
Definition: LedgerFormats.h:238
@@ -261,11 +265,12 @@ $(function() {
ripple::LedgerSpecificFlags
LedgerSpecificFlags
Definition: LedgerFormats.h:221
ripple::ltGENERATOR_MAP
@ ltGENERATOR_MAP
A legacy, deprecated type.
Definition: LedgerFormats.h:214
ripple::lsfDisallowIncomingCheck
@ lsfDisallowIncomingCheck
Definition: LedgerFormats.h:240
-
ripple::LedgerFormats
Holds the list of known ledger entry formats.
Definition: LedgerFormats.h:276
+
ripple::LedgerFormats
Holds the list of known ledger entry formats.
Definition: LedgerFormats.h:279
ripple::lsfDisallowXRP
@ lsfDisallowXRP
Definition: LedgerFormats.h:228
ripple::ltRIPPLE_STATE
@ ltRIPPLE_STATE
A ledger object which describes a bidirectional trust line.
Definition: LedgerFormats.h:74
-
ripple::lsfLowFreeze
@ lsfLowFreeze
Definition: LedgerFormats.h:258
-
ripple::lsfHighReserve
@ lsfHighReserve
Definition: LedgerFormats.h:253
+
ripple::lsfAMM
@ lsfAMM
Definition: LedgerFormats.h:246
+
ripple::lsfLowFreeze
@ lsfLowFreeze
Definition: LedgerFormats.h:261
+
ripple::lsfHighReserve
@ lsfHighReserve
Definition: LedgerFormats.h:256
ripple::ltPAYCHAN
@ ltPAYCHAN
A ledger object describing a single unidirectional XRP payment channel.
Definition: LedgerFormats.h:130