xrpld
Loading...
Searching...
No Matches
PermissionedDomains_test.cpp
1
2#include <test/jtx/Account.h>
3#include <test/jtx/Env.h>
4#include <test/jtx/acctdelete.h>
5#include <test/jtx/amount.h>
6#include <test/jtx/balance.h> // IWYU pragma: keep
7#include <test/jtx/fee.h>
8#include <test/jtx/pay.h>
9#include <test/jtx/permissioned_domains.h>
10#include <test/jtx/ter.h>
11#include <test/jtx/ticket.h>
12#include <test/jtx/txflags.h>
13
14#include <xrpl/basics/base_uint.h>
15#include <xrpl/beast/unit_test/suite.h>
16#include <xrpl/json/json_value.h>
17#include <xrpl/protocol/Feature.h>
18#include <xrpl/protocol/Indexes.h>
19#include <xrpl/protocol/Protocol.h>
20#include <xrpl/protocol/SeqProxy.h>
21#include <xrpl/protocol/TER.h>
22#include <xrpl/protocol/TxFlags.h>
23#include <xrpl/protocol/jss.h>
24
25#include <cstddef>
26#include <cstdint>
27#include <exception>
28#include <map>
29#include <optional>
30#include <string>
31#include <string_view>
32#include <unordered_map>
33#include <utility>
34#include <vector>
35
36namespace xrpl::test {
37
38using namespace jtx;
39
40static std::string
42{
43 try
44 {
45 env(jv, Ter(temMALFORMED));
46 }
47 catch (std::exception const& ex)
48 {
49 return ex.what();
50 }
51 return {};
52}
53
55{
57 (testableAmendments() | featurePermissionedDomains | featureCredentials) - fixCleanup3_1_3,
58 };
60 testableAmendments() | featurePermissionedDomains | featureCredentials | fixCleanup3_1_3,
61 };
62
63 // Verify that each tx type can execute if the feature is enabled.
64 void
66 {
67 testcase("Enabled");
68 Account const alice("alice");
69 Env env(*this, features);
70 env.fund(XRP(1000), alice);
71 pdomain::Credentials const credentials{{.issuer = alice, .credType = "first credential"}};
72 env(pdomain::setTx(alice, credentials));
73 BEAST_EXPECT(env.ownerCount(alice) == 1);
74 auto objects = pdomain::getObjects(alice, env);
75 BEAST_EXPECT(objects.size() == 1);
76 // Test that account_objects is correct without passing it the type
77 BEAST_EXPECT(objects == pdomain::getObjects(alice, env, false));
78 auto const domain = objects.begin()->first;
79 env(pdomain::deleteTx(alice, domain));
80 }
81
82 // Verify that PD cannot be created or updated if credentials are disabled
83 void
85 {
86 auto amendments = testableAmendments();
87 amendments.set(featurePermissionedDomains);
88 amendments.reset(featureCredentials);
89 testcase("Credentials disabled");
90 Account const alice("alice");
91 Env env(*this, amendments);
92 env.fund(XRP(1000), alice);
93 pdomain::Credentials const credentials{{.issuer = alice, .credType = "first credential"}};
95 }
96
97 // Verify that each tx does not execute if feature is disabled
98 void
100 {
101 testcase("Disabled");
102 Account const alice("alice");
103 Env env(*this, testableAmendments() - featurePermissionedDomains);
104 env.fund(XRP(1000), alice);
105 pdomain::Credentials const credentials{{.issuer = alice, .credType = "first credential"}};
107 env(pdomain::deleteTx(alice, UInt256(75)), Ter(temDISABLED));
108 }
109
110 // Verify that bad inputs fail for each of create new and update
111 // behaviors of PermissionedDomainSet
112 void
113 testBadData(Account const& account, Env& env, std::optional<UInt256> domain = std::nullopt)
114 {
115 Account const alice2("alice2");
116 Account const alice3("alice3");
117 Account const alice4("alice4");
118 Account const alice5("alice5");
119 Account const alice6("alice6");
120 Account const alice7("alice7");
121 Account const alice8("alice8");
122 Account const alice9("alice9");
123 Account const alice10("alice10");
124 Account const alice11("alice11");
125 Account const alice12("alice12");
126 auto const setFee(drops(env.current()->fees().increment));
127
128 // Test empty credentials.
129 env(pdomain::setTx(account, pdomain::Credentials(), domain), Ter(temARRAY_EMPTY));
130
131 // Test 11 credentials.
132 pdomain::Credentials const credentials11{
133 {.issuer = alice2, .credType = "credential1"},
134 {.issuer = alice3, .credType = "credential2"},
135 {.issuer = alice4, .credType = "credential3"},
136 {.issuer = alice5, .credType = "credential4"},
137 {.issuer = alice6, .credType = "credential5"},
138 {.issuer = alice7, .credType = "credential6"},
139 {.issuer = alice8, .credType = "credential7"},
140 {.issuer = alice9, .credType = "credential8"},
141 {.issuer = alice10, .credType = "credential9"},
142 {.issuer = alice11, .credType = "credential10"},
143 {.issuer = alice12, .credType = "credential11"},
144 };
145 BEAST_EXPECT(credentials11.size() == kMaxPermissionedDomainCredentialsArraySize + 1);
146 env(pdomain::setTx(account, credentials11, domain), Ter(temARRAY_TOO_LARGE));
147
148 // Test credentials including non-existent issuer.
149 Account const nobody("nobody");
150 pdomain::Credentials const credentialsNon{
151 {.issuer = alice2, .credType = "credential1"},
152 {.issuer = alice3, .credType = "credential2"},
153 {.issuer = alice4, .credType = "credential3"},
154 {.issuer = nobody, .credType = "credential4"},
155 {.issuer = alice5, .credType = "credential5"},
156 {.issuer = alice6, .credType = "credential6"},
157 {.issuer = alice7, .credType = "credential7"},
158 };
159 env(pdomain::setTx(account, credentialsNon, domain), Ter(tecNO_ISSUER));
160
161 // Test bad fee
162 env(pdomain::setTx(account, credentials11, domain), Fee(1, true), Ter(temBAD_FEE));
163
164 pdomain::Credentials const credentials4{
165 {.issuer = alice2, .credType = "credential1"},
166 {.issuer = alice3, .credType = "credential2"},
167 {.issuer = alice4, .credType = "credential3"},
168 {.issuer = alice5, .credType = "credential4"},
169 };
170 auto txJsonMutable = pdomain::setTx(account, credentials4, domain);
171 auto const credentialOrig = txJsonMutable["AcceptedCredentials"][2u];
172
173 // Remove Issuer from a credential and apply.
174 txJsonMutable["AcceptedCredentials"][2u][jss::Credential].removeMember(jss::Issuer);
175 BEAST_EXPECT(exceptionExpected(env, txJsonMutable).starts_with("invalidParams"));
176
177 // Make an empty CredentialType.
178 txJsonMutable["AcceptedCredentials"][2u] = credentialOrig;
179 txJsonMutable["AcceptedCredentials"][2u][jss::Credential]["CredentialType"] = "";
180 env(txJsonMutable, Ter(temMALFORMED));
181
182 // Make too long CredentialType.
183 static constexpr std::string_view kLongCredentialType =
184 "Cred0123456789012345678901234567890123456789012345678901234567890";
185 static_assert(kLongCredentialType.size() == kMaxCredentialTypeLength + 1);
186 txJsonMutable["AcceptedCredentials"][2u] = credentialOrig;
187 txJsonMutable["AcceptedCredentials"][2u][jss::Credential]["CredentialType"] =
188 std::string(kLongCredentialType);
189 BEAST_EXPECT(exceptionExpected(env, txJsonMutable).starts_with("invalidParams"));
190
191 // Remove Credentialtype from a credential and apply.
192 txJsonMutable["AcceptedCredentials"][2u][jss::Credential].removeMember("CredentialType");
193 BEAST_EXPECT(exceptionExpected(env, txJsonMutable).starts_with("invalidParams"));
194
195 // Remove both
196 txJsonMutable["AcceptedCredentials"][2u][jss::Credential].removeMember(jss::Issuer);
197 BEAST_EXPECT(exceptionExpected(env, txJsonMutable).starts_with("invalidParams"));
198
199 // Make 2 identical credentials. Duplicates are not supported by
200 // permissioned domains, so transactions should return errors
201 {
202 pdomain::Credentials const credentialsDup{
203 {.issuer = alice7, .credType = "credential6"},
204 {.issuer = alice2, .credType = "credential1"},
205 {.issuer = alice3, .credType = "credential2"},
206 {.issuer = alice2, .credType = "credential1"},
207 {.issuer = alice5, .credType = "credential4"},
208 };
209
211 for (auto const& c : credentialsDup)
212 human2Acc.emplace(c.issuer.human(), c.issuer);
213
214 auto const sorted = pdomain::sortCredentials(credentialsDup);
215 BEAST_EXPECT(sorted.size() == 4);
216 env(pdomain::setTx(account, credentialsDup, domain), Ter(temMALFORMED));
217
218 env.close();
219 env(pdomain::setTx(account, sorted, domain));
220
221 UInt256 d;
222 if (domain)
223 {
224 d = *domain;
225 }
226 else
227 {
228 d = pdomain::getNewDomain(env.meta());
229 }
230 env.close();
231 auto objects = pdomain::getObjects(account, env);
232 auto const fromObject = pdomain::credentialsFromJson(objects[d], human2Acc);
233 auto const sortedCreds = pdomain::sortCredentials(credentialsDup);
234 BEAST_EXPECT(fromObject == sortedCreds);
235 }
236
237 // Have equal issuers but different credentials and make sure they
238 // sort correctly.
239 {
240 pdomain::Credentials const credentialsSame{
241 {.issuer = alice2, .credType = "credential3"},
242 {.issuer = alice3, .credType = "credential2"},
243 {.issuer = alice2, .credType = "credential9"},
244 {.issuer = alice5, .credType = "credential4"},
245 {.issuer = alice2, .credType = "credential6"},
246 };
248 for (auto const& c : credentialsSame)
249 human2Acc.emplace(c.issuer.human(), c.issuer);
250
251 BEAST_EXPECT(credentialsSame != pdomain::sortCredentials(credentialsSame));
252 env(pdomain::setTx(account, credentialsSame, domain));
253
254 UInt256 d;
255 if (domain)
256 {
257 d = *domain;
258 }
259 else
260 {
261 d = pdomain::getNewDomain(env.meta());
262 }
263 env.close();
264 auto objects = pdomain::getObjects(account, env);
265 auto const fromObject = pdomain::credentialsFromJson(objects[d], human2Acc);
266 auto const sortedCreds = pdomain::sortCredentials(credentialsSame);
267 BEAST_EXPECT(fromObject == sortedCreds);
268 }
269 }
270
271 // Test PermissionedDomainSet
272 void
274 {
275 testcase("Set");
276 Env env(*this, features);
277 env.setParseFailureExpected(true);
278
279 int const accNum = 12;
280 Account const alice[accNum] = {
281 "alice",
282 "alice2",
283 "alice3",
284 "alice4",
285 "alice5",
286 "alice6",
287 "alice7",
288 "alice8",
289 "alice9",
290 "alice10",
291 "alice11",
292 "alice12",
293 };
295 for (auto const& c : alice)
296 human2Acc.emplace(c.human(), c);
297
298 for (auto const& account : alice)
299 env.fund(XRP(1000), account);
300
301 // Create new from existing account with a single credential.
302 pdomain::Credentials const credentials1{{.issuer = alice[2], .credType = "credential1"}};
303 {
304 env(pdomain::setTx(alice[0], credentials1));
305 BEAST_EXPECT(env.ownerCount(alice[0]) == 1);
306 auto tx = env.tx()->getJson(JsonOptions::Values::None);
307 BEAST_EXPECT(tx[jss::TransactionType] == "PermissionedDomainSet");
308 BEAST_EXPECT(tx["Account"] == alice[0].human());
309 auto objects = pdomain::getObjects(alice[0], env);
310 auto const domain = objects.begin()->first;
311 BEAST_EXPECT(domain.isNonZero());
312 auto object = objects.begin()->second;
313 BEAST_EXPECT(object["LedgerEntryType"] == "PermissionedDomain");
314 BEAST_EXPECT(object["Owner"] == alice[0].human());
315 BEAST_EXPECT(object["Sequence"] == tx["Sequence"]);
316 BEAST_EXPECT(pdomain::credentialsFromJson(object, human2Acc) == credentials1);
317 }
318
319 // Make longest possible CredentialType.
320 {
321 static constexpr std::string_view kLongCredentialType =
322 "Cred0123456789012345678901234567890123456789012345678901234567"
323 "89";
324 static_assert(kLongCredentialType.size() == kMaxCredentialTypeLength);
325 pdomain::Credentials const longCredentials{
326 {.issuer = alice[1], .credType = std::string(kLongCredentialType)},
327 };
328
329 env(pdomain::setTx(alice[0], longCredentials));
330
331 // One account can create multiple domains
332 BEAST_EXPECT(env.ownerCount(alice[0]) == 2);
333
334 auto tx = env.tx()->getJson(JsonOptions::Values::None);
335 BEAST_EXPECT(tx[jss::TransactionType] == "PermissionedDomainSet");
336 BEAST_EXPECT(tx["Account"] == alice[0].human());
337
338 bool findSeq = false;
339 for (auto const& [domain, object] : pdomain::getObjects(alice[0], env))
340 {
341 findSeq = object["Sequence"] == tx["Sequence"];
342 if (findSeq)
343 {
344 BEAST_EXPECT(domain.isNonZero());
345 BEAST_EXPECT(object["LedgerEntryType"] == "PermissionedDomain");
346 BEAST_EXPECT(object["Owner"] == alice[0].human());
347 BEAST_EXPECT(
348 pdomain::credentialsFromJson(object, human2Acc) == longCredentials);
349 break;
350 }
351 }
352 BEAST_EXPECT(findSeq);
353 }
354
355 // Create new from existing account with 10 credentials.
356 // Last credential describe domain owner itself
357 pdomain::Credentials const credentials10{
358 {.issuer = alice[2], .credType = "credential1"},
359 {.issuer = alice[3], .credType = "credential2"},
360 {.issuer = alice[4], .credType = "credential3"},
361 {.issuer = alice[5], .credType = "credential4"},
362 {.issuer = alice[6], .credType = "credential5"},
363 {.issuer = alice[7], .credType = "credential6"},
364 {.issuer = alice[8], .credType = "credential7"},
365 {.issuer = alice[9], .credType = "credential8"},
366 {.issuer = alice[10], .credType = "credential9"},
367 {.issuer = alice[0], .credType = "credential10"},
368 };
369 UInt256 domain2;
370 {
371 BEAST_EXPECT(credentials10.size() == kMaxPermissionedDomainCredentialsArraySize);
372 BEAST_EXPECT(credentials10 != pdomain::sortCredentials(credentials10));
373 env(pdomain::setTx(alice[0], credentials10));
374 auto const tx = env.tx()->getJson(JsonOptions::Values::None);
375 domain2 = pdomain::getNewDomain(env.meta());
376 auto objects = pdomain::getObjects(alice[0], env);
377 auto const object = objects[domain2];
378 BEAST_EXPECT(
379 pdomain::credentialsFromJson(object, human2Acc) ==
380 pdomain::sortCredentials(credentials10));
381 }
382
383 // Update with 1 credential.
384 env(pdomain::setTx(alice[0], credentials1, domain2));
385 BEAST_EXPECT(
386 pdomain::credentialsFromJson(pdomain::getObjects(alice[0], env)[domain2], human2Acc) ==
387 credentials1);
388
389 // Update with 10 credentials.
390 env(pdomain::setTx(alice[0], credentials10, domain2));
391 env.close();
392 BEAST_EXPECT(
393 pdomain::credentialsFromJson(pdomain::getObjects(alice[0], env)[domain2], human2Acc) ==
394 pdomain::sortCredentials(credentials10));
395
396 // Update from the wrong owner.
397 env(pdomain::setTx(alice[2], credentials1, domain2), Ter(tecNO_PERMISSION));
398
399 // Update a UInt256(0) domain
400 env(pdomain::setTx(alice[0], credentials1, UInt256(0)), Ter(temMALFORMED));
401
402 // Update non-existent domain
403 env(pdomain::setTx(alice[0], credentials1, UInt256(75)), Ter(tecNO_ENTRY));
404
405 // Wrong flag
406 env(pdomain::setTx(alice[0], credentials1), Txflags(tfClawTwoAssets), Ter(temINVALID_FLAG));
407
408 // Test bad data when creating a domain.
409 testBadData(alice[0], env);
410 // Test bad data when updating a domain.
411 testBadData(alice[0], env, domain2);
412
413 // Try to delete the account with domains.
414 auto const acctDelFee(drops(env.current()->fees().increment));
415 static constexpr std::size_t kDeleteDelta = 255;
416 {
417 // Close enough ledgers to make it potentially deletable if empty.
418 std::size_t const ownerSeq = env.seq(alice[0]);
419 while (kDeleteDelta + ownerSeq > env.current()->seq())
420 env.close();
421 env(acctdelete(alice[0], alice[2]), Fee(acctDelFee), Ter(tecHAS_OBLIGATIONS));
422 }
423
424 {
425 // Delete the domains and then the owner account.
426 for (auto const& objs : pdomain::getObjects(alice[0], env))
427 env(pdomain::deleteTx(alice[0], objs.first));
428 env.close();
429 std::size_t const ownerSeq = env.seq(alice[0]);
430 while (kDeleteDelta + ownerSeq > env.current()->seq())
431 env.close();
432 env(acctdelete(alice[0], alice[2]), Fee(acctDelFee));
433 }
434 }
435
436 // Test PermissionedDomainDelete
437 void
439 {
440 testcase("Delete");
441 Env env(*this, features);
442 Account const alice("alice");
443
444 env.fund(XRP(1000), alice);
445 auto const setFee(drops(env.current()->fees().increment));
446
447 pdomain::Credentials const credentials{{.issuer = alice, .credType = "first credential"}};
448 env(pdomain::setTx(alice, credentials));
449 env.close();
450
451 auto objects = pdomain::getObjects(alice, env);
452 BEAST_EXPECT(objects.size() == 1);
453 auto const domain = objects.begin()->first;
454
455 // Delete a domain that doesn't belong to the account.
456 Account const bob("bob");
457 env.fund(XRP(1000), bob);
458 env(pdomain::deleteTx(bob, domain), Ter(tecNO_PERMISSION));
459
460 // Delete a non-existent domain.
461 env(pdomain::deleteTx(alice, UInt256(75)), Ter(tecNO_ENTRY));
462
463 // Test bad fee
464 env(pdomain::deleteTx(alice, UInt256(75)), Ter(temBAD_FEE), Fee(1, true));
465
466 // Wrong flag
467 env(pdomain::deleteTx(alice, domain), Ter(temINVALID_FLAG), Txflags(tfClawTwoAssets));
468
469 // Delete a zero domain.
470 env(pdomain::deleteTx(alice, UInt256(0)), Ter(temMALFORMED));
471
472 // Make sure owner count reflects the existing domain.
473 BEAST_EXPECT(env.ownerCount(alice) == 1);
474 auto const objID = pdomain::getObjects(alice, env).begin()->first;
475 BEAST_EXPECT(pdomain::objectExists(objID, env));
476
477 // Delete domain that belongs to user.
478 env(pdomain::deleteTx(alice, domain));
479 auto const tx = env.tx()->getJson(JsonOptions::Values::None);
480 BEAST_EXPECT(tx[jss::TransactionType] == "PermissionedDomainDelete");
481
482 // Make sure the owner count goes back to 0.
483 BEAST_EXPECT(env.ownerCount(alice) == 0);
484
485 // The object needs to be gone.
486 BEAST_EXPECT(pdomain::getObjects(alice, env).empty());
487 BEAST_EXPECT(!pdomain::objectExists(objID, env));
488 }
489
490 void
492 {
493 // Verify that the reserve behaves as expected for creating.
494 testcase("Account Reserve");
495
496 using namespace test::jtx;
497
498 Env env(*this, features);
499 Account const alice("alice");
500
501 // Fund alice enough to exist, but not enough to meet
502 // the reserve.
503 auto const acctReserve = env.current()->fees().reserve;
504 auto const incReserve = env.current()->fees().increment;
505 env.fund(acctReserve, alice);
506 env.close();
507 BEAST_EXPECT(env.balance(alice) == acctReserve);
508 BEAST_EXPECT(env.ownerCount(alice) == 0);
509
510 // alice does not have enough XRP to cover the reserve.
511 pdomain::Credentials const credentials{{.issuer = alice, .credType = "first credential"}};
513 BEAST_EXPECT(env.ownerCount(alice) == 0);
514 BEAST_EXPECT(pdomain::getObjects(alice, env).empty());
515 env.close();
516
517 auto const baseFee = env.current()->fees().base.drops();
518
519 // Pay alice almost enough to make the reserve.
520 env(pay(env.master, alice, incReserve + drops(2 * baseFee) - drops(1)));
521 BEAST_EXPECT(env.balance(alice) == acctReserve + incReserve + drops(baseFee) - drops(1));
522 env.close();
523
524 // alice still does not have enough XRP for the reserve.
526 env.close();
527 BEAST_EXPECT(env.ownerCount(alice) == 0);
528
529 // Pay alice enough to make the reserve.
530 env(pay(env.master, alice, drops(baseFee) + drops(1)));
531 env.close();
532
533 // Now alice can create a PermissionedDomain.
534 env(pdomain::setTx(alice, credentials));
535 env.close();
536 BEAST_EXPECT(env.ownerCount(alice) == 1);
537 }
538
539 void
541 {
542 testcase("Tickets");
543
544 using namespace test::jtx;
545
546 Env env(*this, features);
547 Account const alice("alice");
548 env.fund(XRP(1000), alice);
549
551 {.issuer = alice, .credType = "credential1"},
552 };
553
554 std::uint32_t seq{env.seq(alice)};
555 env(ticket::create(alice, 2));
556
557 {
558 env(pdomain::setTx(alice, credentials), ticket::Use(++seq));
559 auto const domain = pdomain::getNewDomain(env.meta());
560 if (features[fixCleanup3_1_3])
561 {
562 BEAST_EXPECT(
563 domain ==
565 }
566 else
567 {
568 BEAST_EXPECT(
569 domain == keylet::permissionedDomain(alice.id(), SeqProxy::rawSequence(0)).key);
570 }
571 }
572
573 if (features[fixCleanup3_1_3])
574 {
575 env(pdomain::setTx(alice, credentials), ticket::Use(++seq));
576 }
577 else
578 {
580 }
581 }
582
583public:
584 void
600};
601
602BEAST_DEFINE_TESTSUITE(PermissionedDomains, app, xrpl);
603
604} // namespace xrpl::test
A testsuite class.
Definition suite.h:52
TestcaseT testcase
Memberspace for declaring test cases.
Definition suite.h:155
Represents a JSON value.
Definition json_value.h:121
static constexpr SeqProxy rawSequence(std::uint32_t v)
Factory function to return a sequence-based SeqProxy.
Definition SeqProxy.h:62
void testBadData(Account const &account, Env &env, std::optional< UInt256 > domain=std::nullopt)
Immutable cryptographic account descriptor.
Definition jtx/Account.h:21
AccountID id() const
Returns the Account ID.
A transaction testing environment.
Definition Env.h:161
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
Definition Env.cpp:133
std::uint32_t ownerCount(Account const &account) const
Return the number of objects owned by an account.
Definition Env.cpp:266
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
Definition Env.cpp:323
std::uint32_t seq(Account const &account) const
Returns the next sequence number on account.
Definition Env.cpp:302
Account const & master
Definition Env.h:165
void setParseFailureExpected(bool b)
Definition Env.h:553
PrettyAmount balance(Account const &account) const
Returns the XRP balance on an account.
Definition Env.cpp:201
std::shared_ptr< STObject const > meta()
Return metadata for the last JTx.
Definition Env.cpp:538
std::shared_ptr< STTx const > tx() const
Return the tx data for the last JTx.
Definition Env.cpp:560
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition Env.h:377
Set the fee on a JTx.
Definition fee.h:20
Set the expected result code for a JTx The test will fail if the code doesn't match.
Definition ter.h:18
Set the flags on a JTx.
Definition txflags.h:14
Set a ticket sequence on a JTx.
Definition ticket.h:36
T emplace(T... args)
Keylet permissionedDomain(AccountID const &account, SeqProxy const &seq) noexcept
Definition Indexes.cpp:583
std::map< UInt256, json::Value > getObjects(Account const &account, Env &env, bool withType)
std::vector< Credential > Credentials
Credentials credentialsFromJson(json::Value const &object, std::unordered_map< std::string, Account > const &human2Acc)
json::Value deleteTx(AccountID const &account, UInt256 const &domain)
UInt256 getNewDomain(std::shared_ptr< STObject const > const &meta)
json::Value setTx(AccountID const &account, Credentials const &credentials, std::optional< UInt256 > domain)
bool objectExists(UInt256 const &objID, Env &env)
Credentials sortCredentials(Credentials const &input)
json::Value create(Account const &account, std::uint32_t count)
Create one of more tickets.
Definition ticket.cpp:16
json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
Definition pay.cpp:14
XrpT const XRP
Converts to XRP Issue or STAmount.
Definition amount.cpp:92
FeatureBitset testableAmendments()
Definition Env.h:92
json::Value acctdelete(Account const &account, Account const &dest)
Delete account.
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
static std::string exceptionExpected(Env &env, json::Value const &jv)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
constexpr std::size_t kMaxCredentialTypeLength
The maximum length of a CredentialType inside a Credential.
Definition Protocol.h:276
@ tefEXCEPTION
Definition TER.h:166
BaseUInt< 256 > UInt256
Definition base_uint.h:581
@ temARRAY_TOO_LARGE
Definition TER.h:129
@ temBAD_FEE
Definition TER.h:80
@ temINVALID_FLAG
Definition TER.h:99
@ temMALFORMED
Definition TER.h:75
@ temARRAY_EMPTY
Definition TER.h:128
@ temDISABLED
Definition TER.h:102
constexpr std::size_t kMaxPermissionedDomainCredentialsArraySize
The maximum number of credentials can be passed in array for permissioned domain.
Definition Protocol.h:287
@ tecNO_ENTRY
Definition TER.h:317
@ tecINSUFFICIENT_RESERVE
Definition TER.h:318
@ tecNO_PERMISSION
Definition TER.h:316
@ tecNO_ISSUER
Definition TER.h:310
@ tecHAS_OBLIGATIONS
Definition TER.h:328
T size(T... args)
T what(T... args)