improve: [L08] Add comment about shutting down contract before uint32 timestamps roll over in year 2106 #95
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
a uint32 value. This means that the value will be truncated to fit within 32 bits, and at some point
around Feb 6, 2106, it will "roll over" and the value returned by casting to uint32 will drop down to 0.
This will set pooledToken.lastLpFeeUpdate to a much lower number than the previous
lastLpFeeUpdate. Any subsequent time _getAccumulatedFees is called, the
timeFromLastInteraction calculation will be exceedingly high, and all "undistributed" fees will be
accounted for as accumulated.
cast from uint32 to a larger number, like uint64. This should be more than enough to not encounter
limits within a reasonably distant future. Alternatively, consider documenting the behavior and defining
a procedure for what to do if the system is still in operation when the uint32 limit is hit, or for shutting
down the system before the year 2106.
Solution: