Conversation
86f22a7 to
ac93b24
Compare
| reserve += hookObj.getFieldArray(sfHookParameters).size(); | ||
|
|
||
| if (hookObj.isFieldPresent(sfHookGrants)) | ||
| reserve += hookObj.getFieldArray(sfHookGrants).size(); |
There was a problem hiding this comment.
would be nice to have a way to ensure hookSetObj is never accidentally passed into here, even just via a comment at the top
| @@ -247,7 +249,10 @@ struct XahauGenesis_test : public beast::unit_test::suite | |||
| BEAST_EXPECT( | |||
| genesisAccRoot->getFieldAmount(sfBalance) == | |||
| XahauGenesis::GenesisAmount); | |||
| BEAST_EXPECT(genesisAccRoot->getFieldU32(sfOwnerCount) == 2); | |||
| BEAST_EXPECT( | |||
| genesisAccRoot->getFieldU32(sfOwnerCount) == !testFlag | |||
| ? expectedOwnerCount | |||
| : 14); | |||
|
|
|||
| // ensure the definitions are correctly set | |||
| { | |||
| @@ -583,7 +588,14 @@ struct XahauGenesis_test : public beast::unit_test::suite | |||
| toBase58(t), membersStr); | |||
| } | |||
|
|
|||
| activate(__LINE__, env, true, false, true); | |||
| activate( | |||
| __LINE__, | |||
| env, | |||
| true, | |||
| false, | |||
| true, | |||
| {}, | |||
| 3 /* IRR,IRD,IMC */ + members.size() + tables.size()); | |||
|
|
|||
| env.close(); | |||
| env.close(); | |||
| @@ -2235,13 +2247,18 @@ struct XahauGenesis_test : public beast::unit_test::suite | |||
| BEAST_EXPECT(!!hookLE); | |||
| uint256 const ns = beast::zero; | |||
| uint8_t mc = 0; | |||
| uint8_t paramsCount = 0; | |||
|
|
|||
| if (hookLE) | |||
| { | |||
| auto const hooksArray = hookLE->getFieldArray(sfHooks); | |||
| BEAST_EXPECT( | |||
| hooksArray.size() == 1 && | |||
| hooksArray[0].getFieldH256(sfHookHash) == governHookHash); | |||
|
|
|||
| paramsCount = | |||
| hooksArray[0].getFieldArray(sfHookParameters).size(); | |||
|
|
|||
| for (Account const* m : members) | |||
| { | |||
| auto const mVec = vecFromAcc(*m); | |||
| @@ -2308,7 +2325,9 @@ struct XahauGenesis_test : public beast::unit_test::suite | |||
| BEAST_EXPECT(!!root); | |||
| if (root) | |||
| { | |||
| BEAST_EXPECT(root->getFieldU32(sfOwnerCount) == mc * 2 + 2); | |||
| BEAST_EXPECT( | |||
| root->getFieldU32(sfOwnerCount) == | |||
| mc * 2 + 2 + paramsCount); | |||
| BEAST_EXPECT(root->getFieldU32(sfFlags) & lsfDisableMaster); | |||
| BEAST_EXPECT(root->getAccountID(sfRegularKey) == noAccount()); | |||
| } | |||
There was a problem hiding this comment.
This assertion currently has a precedence bug and is not checking what it appears to check. As written, ownerCount == !testFlag ? expectedOwnerCount : 14 is parsed as (ownerCount == !testFlag) ? expectedOwnerCount : 14, so BEAST_EXPECT(...) receives either expectedOwnerCount or 14 (both non-zero), which can pass even when ownerCount is wrong. The intended check is that owner count
equals expectedOwnerCount when testFlag == false, otherwise equals 14. We need to parenthesize the ternary on the right-hand side: ownerCount == (!testFlag ? expectedOwnerCount : 14).
| XahauGenesis::GenesisAmount); | ||
| BEAST_EXPECT(genesisAccRoot->getFieldU32(sfOwnerCount) == 2); | ||
| BEAST_EXPECT( | ||
| genesisAccRoot->getFieldU32(sfOwnerCount) == !testFlag |
There was a problem hiding this comment.
This assertion currently has a precedence bug and is not checking what it appears to check. As written, \ownerCount == !testFlag ? expectedOwnerCount : 14is parsed as(ownerCount == !testFlag) ?
expectedOwnerCount : 14, so BEAST_EXPECT(...)receives eitherexpectedOwnerCountor14(both non-zero), which can pass even whenownerCountis wrong. The intended check is that owner count equalsexpectedOwnerCountwhentestFlag == false, otherwise equals 14. Please parenthesize the ternary on the right-hand side: ownerCount == (!testFlag ? expectedOwnerCount : 14).
High Level Overview of Change
Context of Change
Type of Change
.gitignore, formatting, dropping support for older tooling)API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)