mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 23:15:52 +00:00
Add invariant checks for pseudo-account
This commit is contained in:
@@ -829,6 +829,74 @@ class Invariants_test : public beast::unit_test::suite
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttPAYMENT, [](STObject& tx) {}});
|
||||
|
||||
doInvariantCheck(
|
||||
{{"pseudo-account created by a wrong transaction type"}},
|
||||
[](Account const&, Account const&, ApplyContext& ac) {
|
||||
Account const A3{"A3"};
|
||||
Keylet const acctKeylet = keylet::account(A3);
|
||||
auto const sleNew = std::make_shared<SLE>(acctKeylet);
|
||||
sleNew->setFieldU32(sfSequence, 0);
|
||||
sleNew->setFieldH256(sfAMMID, uint256(1));
|
||||
sleNew->setFieldU32(
|
||||
sfFlags,
|
||||
lsfDisableMaster | lsfDefaultRipple | lsfDefaultRipple);
|
||||
ac.view().insert(sleNew);
|
||||
return true;
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttPAYMENT, [](STObject& tx) {}});
|
||||
|
||||
doInvariantCheck(
|
||||
{{"account created with wrong starting sequence number"}},
|
||||
[](Account const&, Account const&, ApplyContext& ac) {
|
||||
Account const A3{"A3"};
|
||||
Keylet const acctKeylet = keylet::account(A3);
|
||||
auto const sleNew = std::make_shared<SLE>(acctKeylet);
|
||||
sleNew->setFieldU32(sfSequence, ac.view().seq());
|
||||
sleNew->setFieldH256(sfAMMID, uint256(1));
|
||||
sleNew->setFieldU32(
|
||||
sfFlags,
|
||||
lsfDisableMaster | lsfDefaultRipple | lsfDepositAuth);
|
||||
ac.view().insert(sleNew);
|
||||
return true;
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttAMM_CREATE, [](STObject& tx) {}});
|
||||
|
||||
doInvariantCheck(
|
||||
{{"pseudo-account created with wrong flags"}},
|
||||
[](Account const&, Account const&, ApplyContext& ac) {
|
||||
Account const A3{"A3"};
|
||||
Keylet const acctKeylet = keylet::account(A3);
|
||||
auto const sleNew = std::make_shared<SLE>(acctKeylet);
|
||||
sleNew->setFieldU32(sfSequence, 0);
|
||||
sleNew->setFieldH256(sfAMMID, uint256(1));
|
||||
sleNew->setFieldU32(
|
||||
sfFlags, lsfDisableMaster | lsfDefaultRipple);
|
||||
ac.view().insert(sleNew);
|
||||
return true;
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttVAULT_CREATE, [](STObject& tx) {}});
|
||||
|
||||
doInvariantCheck(
|
||||
{{"pseudo-account created with wrong flags"}},
|
||||
[](Account const&, Account const&, ApplyContext& ac) {
|
||||
Account const A3{"A3"};
|
||||
Keylet const acctKeylet = keylet::account(A3);
|
||||
auto const sleNew = std::make_shared<SLE>(acctKeylet);
|
||||
sleNew->setFieldU32(sfSequence, 0);
|
||||
sleNew->setFieldH256(sfAMMID, uint256(1));
|
||||
sleNew->setFieldU32(
|
||||
sfFlags,
|
||||
lsfDisableMaster | lsfDefaultRipple | lsfDepositAuth |
|
||||
lsfRequireDestTag);
|
||||
ac.view().insert(sleNew);
|
||||
return true;
|
||||
},
|
||||
XRPAmount{},
|
||||
STTx{ttAMM_CREATE, [](STObject& tx) {}});
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user