Conversation
- not fully tested - need to modify: Reserve check where using sfOwnerCount
src/test/app/Invariants_test.cpp
Outdated
| { | ||
| // uncomment if you want to log the invariant failure | ||
| // std::cerr << " --> " << m << std::endl; | ||
| // std::cerr << " expected --> " << m << std::endl; |
There was a problem hiding this comment.
The std::cerr lines should be deleted, as well as line 98
There was a problem hiding this comment.
I think these lines are well worth keeping for debugging purposes.
There was a problem hiding this comment.
OK. I see. Just verified that the existing rippled/develop is already having the std::cerr.
So maybe we don't need to make any change here.
| if (account != sponsor) | ||
| return temMALFORMED; | ||
|
|
||
| if ((flags & tfSponsorshipSetRequireSignForFee) && (flags & tfSponsorshipClearRequireSignForFee)) |
There was a problem hiding this comment.
I was suggesting in my previous comment (#5887 (comment)) that we should move the flag check for deleting object into our main if (flags & tfDeleteObject) section.
////// this was in your previous version in the beginning of preflight.
if (flags & tfDeleteObject)
{
// check Flags
if (flags &
(tfSponsorshipSetRequireSignForFee | tfSponsorshipSetRequireSignForReserve |
tfSponsorshipClearRequireSignForFee | tfSponsorshipClearRequireSignForReserve))
return temINVALID_FLAG;
}
The else section should not be touched.
There was a problem hiding this comment.
This did not address the comment either.
- You have a global check for the flags, but you checked them again in the else section.
- We should not use two
if (flags & tfDeleteObject)... else ...in preflight. Please combine in one if else.
The code will be like:
NotTEC
SponsorshipSet::preflight(PreflightContext const& ctx)
{
auto const flags = ctx.tx.getFlags();
if ((flags & tfSponsorshipSetRequireSignForFee) && (flags & tfSponsorshipClearRequireSignForFee))
return temINVALID_FLAG;
if ((flags & tfSponsorshipSetRequireSignForReserve) && (flags & tfSponsorshipClearRequireSignForReserve))
return temINVALID_FLAG;
//.....
if (flags & tfDeleteObject)
{
// can not combine with any modification flags when deleting
constexpr std::uint32_t modifyFlags = tfSponsorshipSetRequireSignForFee |
tfSponsorshipSetRequireSignForReserve | tfSponsorshipClearRequireSignForFee |
tfSponsorshipClearRequireSignForReserve;
if (flags & modifyFlags)
return temINVALID_FLAG;
// can not include these fields when deleting
if (ctx.tx.isFieldPresent(sfFeeAmount) || ctx.tx.isFieldPresent(sfReserveCount) ||
ctx.tx.isFieldPresent(sfMaxFee))
return temMALFORMED;
}
else
{
// ...
}
return tesSUCCESS;
}
There was a problem hiding this comment.
Sorry about that. Now I understand what you were pointing out.
| TYPED_SFIELD(sfSponsor, ACCOUNT, 27) | ||
| TYPED_SFIELD(sfHighSponsor, ACCOUNT, 28) | ||
| TYPED_SFIELD(sfLowSponsor, ACCOUNT, 29) | ||
| TYPED_SFIELD(sfCounterpartySponsor, ACCOUNT, 30) |
There was a problem hiding this comment.
XLS-68 updated, sfCounterpartySponsor not present
There was a problem hiding this comment.
@mvadari
I believe this field is necessary, but was it missing from the spec?
| featureSponsor, | ||
| noPriv, | ||
| ({ | ||
| {sfCounterpartySponsor, soeOPTIONAL}, |
There was a problem hiding this comment.
XLS-68 updated, please fix (sfSponsor)
| featureSponsor, | ||
| noPriv, | ||
| ({ | ||
| {sfCounterpartySponsor, soeOPTIONAL}, |
High Level Overview of Change
Context of Change
Type of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)