mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-29 10:00:30 +00:00
Merge branch 'develop' into dangell7/batch-v1
This commit is contained in:
@@ -65,6 +65,26 @@ public:
|
||||
BEAST_EXPECT(jv[jss::error_message] == "Account malformed.");
|
||||
});
|
||||
|
||||
// Account is not a string
|
||||
testAMM([&](AMM& ammAlice, Env&) {
|
||||
auto const jv =
|
||||
ammAlice.ammRpcInfo(json::Value{42}, std::nullopt, XRP, USD, std::nullopt, true, 3);
|
||||
BEAST_EXPECT(jv[jss::error_message] == "Account malformed.");
|
||||
});
|
||||
|
||||
// AMM Account is not a string
|
||||
testAMM([&](AMM& ammAlice, Env&) {
|
||||
auto const jv = ammAlice.ammRpcInfo(
|
||||
json::Value{to_string(ammAlice.ammAccount())},
|
||||
std::nullopt,
|
||||
XRP,
|
||||
USD,
|
||||
json::Value{42},
|
||||
false,
|
||||
3);
|
||||
BEAST_EXPECT(jv[jss::error_message] == "Account malformed.");
|
||||
});
|
||||
|
||||
std::vector<std::tuple<std::optional<Issue>, std::optional<Issue>, TestAccount, bool>> const
|
||||
invalidParams = {
|
||||
{xrpIssue(), std::nullopt, TestAccount::None, false},
|
||||
|
||||
@@ -583,24 +583,17 @@ public:
|
||||
static constexpr std::pair<std::string_view, std::uint32_t> kAllowTrustLineClawbackFlag{
|
||||
"allowTrustLineClawback", asfAllowTrustLineClawback};
|
||||
|
||||
if (features[featureClawback])
|
||||
{
|
||||
// must use bob's account because alice has noFreeze set
|
||||
auto const f1 = getAccountFlag(kAllowTrustLineClawbackFlag.first, bob);
|
||||
BEAST_EXPECT(f1.has_value());
|
||||
BEAST_EXPECT(!f1.value()); // NOLINT(bugprone-unchecked-optional-access)
|
||||
// must use bob's account because alice has noFreeze set
|
||||
auto const f1 = getAccountFlag(kAllowTrustLineClawbackFlag.first, bob);
|
||||
BEAST_EXPECT(f1.has_value());
|
||||
BEAST_EXPECT(!f1.value()); // NOLINT(bugprone-unchecked-optional-access)
|
||||
|
||||
// Set allowTrustLineClawback
|
||||
env(fset(bob, kAllowTrustLineClawbackFlag.second));
|
||||
env.close();
|
||||
auto const f2 = getAccountFlag(kAllowTrustLineClawbackFlag.first, bob);
|
||||
BEAST_EXPECT(f2.has_value());
|
||||
BEAST_EXPECT(f2.value()); // NOLINT(bugprone-unchecked-optional-access)
|
||||
}
|
||||
else
|
||||
{
|
||||
BEAST_EXPECT(!getAccountFlag(kAllowTrustLineClawbackFlag.first, bob));
|
||||
}
|
||||
// Set allowTrustLineClawback
|
||||
env(fset(bob, kAllowTrustLineClawbackFlag.second));
|
||||
env.close();
|
||||
auto const f2 = getAccountFlag(kAllowTrustLineClawbackFlag.first, bob);
|
||||
BEAST_EXPECT(f2.has_value());
|
||||
BEAST_EXPECT(f2.value()); // NOLINT(bugprone-unchecked-optional-access)
|
||||
|
||||
static constexpr std::pair<std::string_view, std::uint32_t> kAllowTrustLineLockingFlag{
|
||||
"allowTrustLineLocking", asfAllowTrustLineLocking};
|
||||
@@ -634,8 +627,7 @@ public:
|
||||
|
||||
FeatureBitset const allFeatures{xrpl::test::jtx::testableAmendments()};
|
||||
testAccountFlags(allFeatures);
|
||||
testAccountFlags(allFeatures - featureClawback);
|
||||
testAccountFlags(allFeatures - featureClawback - featureTokenEscrow);
|
||||
testAccountFlags(allFeatures - featureTokenEscrow);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -589,7 +589,7 @@ class AccountTx_test : public beast::unit_test::Suite
|
||||
env(payChanCreate, Sig(alie));
|
||||
env.close();
|
||||
|
||||
std::string const payChanIndex{strHex(keylet::payChan(alice, gw, payChanSeq).key)};
|
||||
std::string const payChanIndex{strHex(keylet::payChannel(alice, gw, payChanSeq).key)};
|
||||
|
||||
{
|
||||
json::Value payChanFund;
|
||||
|
||||
@@ -1476,7 +1476,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
|
||||
// positive test
|
||||
{
|
||||
Keylet const keylet = keylet::fees();
|
||||
Keylet const keylet = keylet::feeSettings();
|
||||
json::Value jvParams;
|
||||
jvParams[jss::fee] = to_string(keylet.key);
|
||||
json::Value const jrr =
|
||||
@@ -1526,7 +1526,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
uint256 const nftokenID0 = token::getNextID(env, issuer, 0, tfTransferable);
|
||||
env(token::mint(issuer, 0), Txflags(tfTransferable));
|
||||
env.close();
|
||||
uint256 const offerID = keylet::nftoffer(issuer, env.seq(issuer)).key;
|
||||
uint256 const offerID = keylet::nftokenOffer(issuer, env.seq(issuer)).key;
|
||||
env(token::createOffer(issuer, nftokenID0, drops(1)),
|
||||
token::Destination(buyer),
|
||||
Txflags(tfSellNFToken));
|
||||
@@ -1560,7 +1560,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
env(token::mint(issuer, 0), Txflags(tfTransferable));
|
||||
env.close();
|
||||
|
||||
auto const nftpage = keylet::nftpageMax(issuer);
|
||||
auto const nftpage = keylet::nftokenPageMax(issuer);
|
||||
BEAST_EXPECT(env.le(nftpage) != nullptr);
|
||||
|
||||
{
|
||||
@@ -1710,7 +1710,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
|
||||
std::string const ledgerHash{to_string(env.closed()->header().hash)};
|
||||
|
||||
uint256 const payChanIndex{keylet::payChan(alice, env.master, env.seq(alice) - 1).key};
|
||||
uint256 const payChanIndex{keylet::payChannel(alice, env.master, env.seq(alice) - 1).key};
|
||||
{
|
||||
// Request the payment channel using its index.
|
||||
json::Value jvParams;
|
||||
@@ -2421,7 +2421,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
};
|
||||
|
||||
test(jss::amendments, jss::Amendments, keylet::amendments(), true);
|
||||
test(jss::fee, jss::FeeSettings, keylet::fees(), true);
|
||||
test(jss::fee, jss::FeeSettings, keylet::feeSettings(), true);
|
||||
// There won't be an nunl
|
||||
test(jss::nunl, jss::NegativeUNL, keylet::negativeUNL(), false);
|
||||
// Can only get the short skip list this way
|
||||
|
||||
@@ -1452,12 +1452,12 @@ public:
|
||||
// Alice creates one sell offer for each NFT
|
||||
// Verify the offer indexes are correct in the NFTokenCreateOffer tx
|
||||
// meta
|
||||
uint256 const aliceOfferIndex1 = keylet::nftoffer(alice, env.seq(alice)).key;
|
||||
uint256 const aliceOfferIndex1 = keylet::nftokenOffer(alice, env.seq(alice)).key;
|
||||
env(token::createOffer(alice, nftId1, drops(1)), Txflags(tfSellNFToken));
|
||||
BEAST_EXPECT(env.syncClose());
|
||||
verifyNFTokenOfferID(aliceOfferIndex1);
|
||||
|
||||
uint256 const aliceOfferIndex2 = keylet::nftoffer(alice, env.seq(alice)).key;
|
||||
uint256 const aliceOfferIndex2 = keylet::nftokenOffer(alice, env.seq(alice)).key;
|
||||
env(token::createOffer(alice, nftId2, drops(1)), Txflags(tfSellNFToken));
|
||||
BEAST_EXPECT(env.syncClose());
|
||||
verifyNFTokenOfferID(aliceOfferIndex2);
|
||||
@@ -1471,7 +1471,7 @@ public:
|
||||
|
||||
// Bobs creates a buy offer for nftId1
|
||||
// Verify the offer id is correct in the NFTokenCreateOffer tx meta
|
||||
auto const bobBuyOfferIndex = keylet::nftoffer(bob, env.seq(bob)).key;
|
||||
auto const bobBuyOfferIndex = keylet::nftokenOffer(bob, env.seq(bob)).key;
|
||||
env(token::createOffer(bob, nftId1, drops(1)), token::Owner(alice));
|
||||
BEAST_EXPECT(env.syncClose());
|
||||
verifyNFTokenOfferID(bobBuyOfferIndex);
|
||||
@@ -1492,7 +1492,7 @@ public:
|
||||
verifyNFTokenID(nftId);
|
||||
|
||||
// Alice creates sell offer and set broker as destination
|
||||
uint256 const offerAliceToBroker = keylet::nftoffer(alice, env.seq(alice)).key;
|
||||
uint256 const offerAliceToBroker = keylet::nftokenOffer(alice, env.seq(alice)).key;
|
||||
env(token::createOffer(alice, nftId, drops(1)),
|
||||
token::Destination(broker),
|
||||
Txflags(tfSellNFToken));
|
||||
@@ -1500,7 +1500,7 @@ public:
|
||||
verifyNFTokenOfferID(offerAliceToBroker);
|
||||
|
||||
// Bob creates buy offer
|
||||
uint256 const offerBobToBroker = keylet::nftoffer(bob, env.seq(bob)).key;
|
||||
uint256 const offerBobToBroker = keylet::nftokenOffer(bob, env.seq(bob)).key;
|
||||
env(token::createOffer(bob, nftId, drops(1)), token::Owner(alice));
|
||||
BEAST_EXPECT(env.syncClose());
|
||||
verifyNFTokenOfferID(offerBobToBroker);
|
||||
@@ -1521,12 +1521,12 @@ public:
|
||||
verifyNFTokenID(nftId);
|
||||
|
||||
// Alice creates 2 sell offers for the same NFT
|
||||
uint256 const aliceOfferIndex1 = keylet::nftoffer(alice, env.seq(alice)).key;
|
||||
uint256 const aliceOfferIndex1 = keylet::nftokenOffer(alice, env.seq(alice)).key;
|
||||
env(token::createOffer(alice, nftId, drops(1)), Txflags(tfSellNFToken));
|
||||
BEAST_EXPECT(env.syncClose());
|
||||
verifyNFTokenOfferID(aliceOfferIndex1);
|
||||
|
||||
uint256 const aliceOfferIndex2 = keylet::nftoffer(alice, env.seq(alice)).key;
|
||||
uint256 const aliceOfferIndex2 = keylet::nftokenOffer(alice, env.seq(alice)).key;
|
||||
env(token::createOffer(alice, nftId, drops(1)), Txflags(tfSellNFToken));
|
||||
BEAST_EXPECT(env.syncClose());
|
||||
verifyNFTokenOfferID(aliceOfferIndex2);
|
||||
@@ -1540,7 +1540,8 @@ public:
|
||||
|
||||
if (features[featureNFTokenMintOffer])
|
||||
{
|
||||
uint256 const aliceMintWithOfferIndex1 = keylet::nftoffer(alice, env.seq(alice)).key;
|
||||
uint256 const aliceMintWithOfferIndex1 =
|
||||
keylet::nftokenOffer(alice, env.seq(alice)).key;
|
||||
env(token::mint(alice), token::Amount(XRP(0)));
|
||||
BEAST_EXPECT(env.syncClose());
|
||||
verifyNFTokenOfferID(aliceMintWithOfferIndex1);
|
||||
|
||||
Reference in New Issue
Block a user