Merge remote-tracking branch 'upstream/develop' into sponsor

This commit is contained in:
tequ
2026-02-23 23:20:21 +09:00
815 changed files with 26958 additions and 12467 deletions

View File

@@ -159,7 +159,8 @@ public:
params[jss::account] = bob.human();
params[jss::type] = 10;
auto resp = env.rpc("json", "account_objects", to_string(params));
BEAST_EXPECT(resp[jss::result][jss::error_message] == "Invalid field 'type', not string.");
BEAST_EXPECT(
resp[jss::result][jss::error_message] == "Invalid field 'type', not string.");
}
// test error on type param not a valid type
{
@@ -175,7 +176,9 @@ public:
params[jss::account] = bob.human();
params[jss::limit] = -1;
auto resp = env.rpc("json", "account_objects", to_string(params));
BEAST_EXPECT(resp[jss::result][jss::error_message] == "Invalid field 'limit', not unsigned integer.");
BEAST_EXPECT(
resp[jss::result][jss::error_message] ==
"Invalid field 'limit', not unsigned integer.");
}
// test errors on marker
{
@@ -195,7 +198,8 @@ public:
std::string mark = to_string(resume_marker);
params[jss::marker] = 10;
resp = env.rpc("json", "account_objects", to_string(params));
BEAST_EXPECT(resp[jss::result][jss::error_message] == "Invalid field 'marker', not string.");
BEAST_EXPECT(
resp[jss::result][jss::error_message] == "Invalid field 'marker', not string.");
params[jss::marker] = "This is a string with no comma";
resp = env.rpc("json", "account_objects", to_string(params));
@@ -525,7 +529,8 @@ public:
Account const gw{"gateway"};
auto const USD = gw["USD"];
auto const features = testable_amendments() | featureXChainBridge | featurePermissionedDomains;
auto const features =
testable_amendments() | featureXChainBridge | featurePermissionedDomains;
Env env(*this, features);
// Make a lambda we can use to get "account_objects" easily.
@@ -597,7 +602,8 @@ public:
auto const& nftPage = resp[jss::result][jss::account_objects][0u];
BEAST_EXPECT(nftPage[sfNFTokens.jsonName].size() == 1);
BEAST_EXPECT(
nftPage[sfNFTokens.jsonName][0u][sfNFToken.jsonName][sfNFTokenID.jsonName] == to_string(nftID));
nftPage[sfNFTokens.jsonName][0u][sfNFToken.jsonName][sfNFTokenID.jsonName] ==
to_string(nftID));
}
// Set up a trust line so we can find it.
@@ -675,7 +681,9 @@ public:
BEAST_EXPECT(acctObjsIsSize(resp, 1));
auto const& permissionedDomain = resp[jss::result][jss::account_objects][0u];
BEAST_EXPECT(permissionedDomain.isMember(jss::Owner) && (permissionedDomain[jss::Owner] == gw.human()));
BEAST_EXPECT(
permissionedDomain.isMember(jss::Owner) &&
(permissionedDomain[jss::Owner] == gw.human()));
bool const check1 = BEAST_EXPECT(
permissionedDomain.isMember(jss::AcceptedCredentials) &&
permissionedDomain[jss::AcceptedCredentials].isArray() &&
@@ -684,9 +692,11 @@ public:
if (check1)
{
auto const& credential = permissionedDomain[jss::AcceptedCredentials][0u][jss::Credential];
auto const& credential =
permissionedDomain[jss::AcceptedCredentials][0u][jss::Credential];
BEAST_EXPECT(
credential.isMember(sfIssuer.jsonName) && (credential[sfIssuer.jsonName] == issuer.human()));
credential.isMember(sfIssuer.jsonName) &&
(credential[sfIssuer.jsonName] == issuer.human()));
BEAST_EXPECT(
credential.isMember(sfCredentialType.jsonName) &&
(credential[sfCredentialType.jsonName] == strHex(credentialType1)));
@@ -771,7 +781,16 @@ public:
// quorum is reached
scEnv(
test::jtx::create_account_attestation(
x.scAttester, x.jvb, x.mcCarol, amt, x.reward, x.payees[0], true, 1, x.scuAlice, x.signers[0]));
x.scAttester,
x.jvb,
x.mcCarol,
amt,
x.reward,
x.payees[0],
true,
1,
x.scuAlice,
x.signers[0]));
scEnv.close();
auto scEnvAcctObjs = [&](Account const& acct, char const* type) {
@@ -784,12 +803,17 @@ public:
{
// Find the xchain_create_account_claim_id
Json::Value const resp = scEnvAcctObjs(Account::master, jss::xchain_owned_create_account_claim_id);
Json::Value const resp =
scEnvAcctObjs(Account::master, jss::xchain_owned_create_account_claim_id);
BEAST_EXPECT(acctObjsIsSize(resp, 1));
auto const& xchain_create_account_claim_id = resp[jss::result][jss::account_objects][0u];
BEAST_EXPECT(xchain_create_account_claim_id[sfAccount.jsonName] == Account::master.human());
BEAST_EXPECT(xchain_create_account_claim_id[sfXChainAccountCreateCount.getJsonName()].asUInt() == 1);
auto const& xchain_create_account_claim_id =
resp[jss::result][jss::account_objects][0u];
BEAST_EXPECT(
xchain_create_account_claim_id[sfAccount.jsonName] == Account::master.human());
BEAST_EXPECT(
xchain_create_account_claim_id[sfXChainAccountCreateCount.getJsonName()]
.asUInt() == 1);
}
}
@@ -895,7 +919,8 @@ public:
BEAST_EXPECT(sponsorship[sfOwner.jsonName] == alice.human());
BEAST_EXPECT(sponsorship[sfSponsee.jsonName] == gw.human());
BEAST_EXPECT(sponsorship[sfFlags.jsonName].asUInt() == tfSponsorshipSetRequireSignForFee);
BEAST_EXPECT(
sponsorship[sfFlags.jsonName].asUInt() == tfSponsorshipSetRequireSignForFee);
BEAST_EXPECT(sponsorship[sfReserveCount.jsonName].asUInt() == 200);
BEAST_EXPECT(sponsorship[sfFeeAmount.jsonName].asUInt() == 100000000);
BEAST_EXPECT(sponsorship[sfMaxFee.jsonName].asUInt() == 10);
@@ -922,7 +947,8 @@ public:
return v;
}();
std::uint32_t const expectedAccountObjects{static_cast<std::uint32_t>(std::size(expectedLedgerTypes))};
std::uint32_t const expectedAccountObjects{
static_cast<std::uint32_t>(std::size(expectedLedgerTypes))};
if (BEAST_EXPECT(acctObjsIsSize(resp, expectedAccountObjects)))
{
@@ -962,7 +988,8 @@ public:
};
// Make a lambda we can use to check the number of fetched
// account objects and their ledger type
auto expectObjects = [&](Json::Value const& resp, std::vector<std::string> const& types) -> bool {
auto expectObjects = [&](Json::Value const& resp,
std::vector<std::string> const& types) -> bool {
if (!acctObjsIsSize(resp, types.size()))
return false;
std::vector<std::string> typesOut;
@@ -982,16 +1009,21 @@ public:
std::vector<std::string> typesOut;
getTypes(resp, typesOut);
// request next two objects
resp = acctObjs(amm.ammAccount(), std::nullopt, 10, resp[jss::result][jss::marker].asString());
resp = acctObjs(
amm.ammAccount(), std::nullopt, 10, resp[jss::result][jss::marker].asString());
getTypes(resp, typesOut);
BEAST_EXPECT(
(typesOut ==
std::vector<std::string>{
jss::AMM.c_str(), jss::RippleState.c_str(), jss::RippleState.c_str(), jss::RippleState.c_str()}));
jss::AMM.c_str(),
jss::RippleState.c_str(),
jss::RippleState.c_str(),
jss::RippleState.c_str()}));
// filter by state: there are three trustlines
resp = acctObjs(amm.ammAccount(), jss::state, 10);
BEAST_EXPECT(
expectObjects(resp, {jss::RippleState.c_str(), jss::RippleState.c_str(), jss::RippleState.c_str()}));
BEAST_EXPECT(expectObjects(
resp,
{jss::RippleState.c_str(), jss::RippleState.c_str(), jss::RippleState.c_str()}));
// AMM account doesn't own offers
BEAST_EXPECT(acctObjsIsSize(acctObjs(amm.ammAccount(), jss::offer), 0));
// gw account doesn't own AMM object
@@ -1104,7 +1136,8 @@ public:
// test an invalid marker that has a non-hex character
BEAST_EXPECT(testInvalidMarker(
"00000000F51DFC2A09D62CBBA1DFBDD4691DAC96AD98B900000000000000000G", "Invalid field \'marker\'."));
"00000000F51DFC2A09D62CBBA1DFBDD4691DAC96AD98B900000000000000000G",
"Invalid field \'marker\'."));
// this lambda function is used to create some fake marker using given
// taxon and sequence because we want to test some unassociated markers
@@ -1115,17 +1148,18 @@ public:
std::uint16_t flags = 0,
std::uint16_t fee = 0) {
// the marker has the exact same format as an NFTokenID
return to_string(NFTokenMint::createNFTokenID(flags, fee, issuer, nft::toTaxon(taxon), tokenSeq));
return to_string(
NFTokenMint::createNFTokenID(flags, fee, issuer, nft::toTaxon(taxon), tokenSeq));
};
// test an unassociated marker which does not exist in the NFTokenIDs
BEAST_EXPECT(
testInvalidMarker(createFakeNFTMarker(bob.id(), 0x000000000, 0x00000000), "Invalid field \'marker\'."));
BEAST_EXPECT(testInvalidMarker(
createFakeNFTMarker(bob.id(), 0x000000000, 0x00000000), "Invalid field \'marker\'."));
// test an unassociated marker which exceeds the maximum value of the
// existing NFTokenID
BEAST_EXPECT(
testInvalidMarker(createFakeNFTMarker(bob.id(), 0xFFFFFFFF, 0xFFFFFFFF), "Invalid field \'marker\'."));
BEAST_EXPECT(testInvalidMarker(
createFakeNFTMarker(bob.id(), 0xFFFFFFFF, 0xFFFFFFFF), "Invalid field \'marker\'."));
}
void