-
Notifications
You must be signed in to change notification settings - Fork 976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump expiration op #3775
Bump expiration op #3775
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably strictly enforce MAX_ENTRY_LIFETIME for manual bumps. For autobumps and contract defined bumps, if the requested lifetime extension goes beyond the maximum, we don't fail, but just bump up to the maximum. Here it might make more sense to actually fail, since the user is manually specifying the bump amount. If a user specifies 10 years of rent in the manual bump op, it's probably best to fail instead of bumping the entry by only a year and silently ignore the 9 years of additional rent.
return false; | ||
} | ||
} | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should set the code to BUMP_EXPIRATION_MALFORMED
and fail here if op.ledgersToExpire > networkConfig.maxEntryExpiration
to more strictly enforce the max.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// Multiply by 2 for the metadata check since the previous state is | ||
// also included in the meta. | ||
if (resources.extendedMetaDataSizeBytes < | ||
metrics.mLedgerWriteByte * 2 || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid integer overflow with multiplication of 2, should we use division instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. This should be changing anyways when we start using EXPIRATION_EXTENSIONS.
if (UINT32_MAX - ledgerSeq > mBumpExpirationOp.ledgersToExpire()) | ||
{ | ||
bumpTo = ledgerSeq + mBumpExpirationOp.ledgersToExpire(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we cover the else condition as well? Assuming UINT32_MAX is the max Ledger sequence,
bumpTo = Math.min(ledgerSeq + mBumpExpirationOp.ledgersToExpire(), UINT32_MAX)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial value of bumpTo
is UINT32_MAX, so that else case is already handled.
a3314d8
to
8a2bc55
Compare
r+ b5386da |
Bump expiration op Reviewed-by: dmkozh
Description
Resolves stellar/rs-soroban-env#759.
Uses xdr from stellar/stellar-xdr#106.
Checklist
clang-format
v8.0.0 (viamake format
or the Visual Studio extension)