rippled
rippled copied to clipboard
Test for testCancelOfferInvalid fails
Issue Description
$./rippled --unittest NFTokenAllFeatures
ripple.tx.NFTokenAllFeatures
ripple.tx.NFTokenAllFeatures Enabled
ripple.tx.NFTokenAllFeatures Mint reserve
ripple.tx.NFTokenAllFeatures Mint max tokens
ripple.tx.NFTokenAllFeatures Mint invalid
ripple.tx.NFTokenAllFeatures Burn invalid
ripple.tx.NFTokenAllFeatures Invalid NFT offer create
ripple.tx.NFTokenAllFeatures Invalid NFT offer cancel
zsh: trace trap ./rippled --unittest NFTokenAllFeatures
NFToken_test.cpp testCancelOfferInvalid()
// Provide neither offers to cancel nor a root index.
env(token::cancelOffer(buyer), ter(temMALFORMED));
env.close();
BEAST_EXPECT(ownerCount(env, buyer) == 1);
The GHA and other PRs do not seem to cause errors in testing, but it does in my environment.
Maybe it is affected by the fact that the second argument of token::cancelOffer is not set?
Environment
develop branch (commit hash: 901152bd930447720ca4e738a10ffd878f401a53
)
MacStudio (M1 Max) macOS 14.0
The following test works without the second argument, so it may be that the required field, sfNFTokenOffers, is not specified.
{
Json::Value jv = token::cancelOffer(buyer);
jv[sfNFTokenOffers.jsonName] = Json::arrayValue;
env(jv, ter(temMALFORMED));
env.close();
BEAST_EXPECT(ownerCount(env, buyer) == 1);
}
are you sure it's caused by the cancelOffer
function? Have you tried to insert breakpoint to see that it failed exactly at that line?
I checked the comment out and the env(token::cancelOffer(buyer), ter(temMALFORMED));
line is clearly the cause.
The following test works without the second argument, so it may be that the required field, sfNFTokenOffers, is not specified.
{ Json::Value jv = token::cancelOffer(buyer); jv[sfNFTokenOffers.jsonName] = Json::arrayValue; env(jv, ter(temMALFORMED)); env.close(); BEAST_EXPECT(ownerCount(env, buyer) == 1); }
The purpose of testCancelOfferInvalid
test is to test invalid transaction format. In this case, it tries to to submit an NFTokenCancelOffers without specifying a sfNFTokenOffers
field, which would return temMALFORMED
because it is required field.
{
Json::Value jv = token::cancelOffer(buyer);
jv[sfNFTokenOffers.jsonName] = Json::arrayValue;
env(jv, ter(temMALFORMED));
env.close();
BEAST_EXPECT(ownerCount(env, buyer) == 1);
}
checks for sfNFTokenOffers
is empty arrays or longer than the maximum length, right?
if (auto const& ids = ctx.tx[sfNFTokenOffers];
ids.empty() || (ids.size() > maxTokenOfferCancelCount))
return temMALFORMED;
// Provide neither offers to cancel nor a root index.
env(token::cancelOffer(buyer), ter(temMALFORMED));
env.close();
BEAST_EXPECT(ownerCount(env, buyer) == 1);
add(jss::NFTokenCancelOffer,
ttNFTOKEN_CANCEL_OFFER,
{
{sfNFTokenOffers, soeREQUIRED},
},
commonFields);
If required field sfNFTokenOffers
is unspecified, will the result be temMALFORMED
?
Is this a fresh build? Delete your build directory and try again. If that doesn't work, delete (rename) your ~/.conan/data
directory, rebuild the conan deps, and try again.
I tried it, but it is an error as well.
Other tests also fail.
Suite: ripple.app.ShardArchiveHandler failed to complete. Child process may have crashed.
Suite: ripple.app.ValidatorSite processing failed. Child process may have crashed.
Suite: ripple.tx.NFTokenAllFeatures failed. The child process may have crashed.
Suite: Processing ripple.tx.NFTokenBaseUtil failed. NFTokenBaseUtil failed, child process may have crashed.
Suite: ripple.tx.NFTokenDisallowIncoming failed. NFTokenDisallowIncoming failed.
Suite: ripple.tx.OfferAllFeatures failed. The child process may have crashed.
Suite: ripple.tx.OfferWOFillOrKill failed. The child process may have crashed.
Suite: ripple.tx.OfferWOFlowCross did not complete. The child process may have crashed.
In which branch are you seeing this happening? What are your hardware specs?
In which branch are you seeing this happening? What are your hardware specs?
This occurs in many branches, including the develop branch.
MacStudio (M1 Max) macOS 14.0