Closed howlbot-integration[bot] closed 3 months ago
alex-ppg marked the issue as satisfactory
Hi @alex-ppg
This report identifies two issues:
dirty
statuslastToildDate
Missing each update has a different impact (as explained in the report). The primary issue #26 Mentioned only the first missing update
I believe this one should either be selected for the report and other issues that pointed only to dirty status should receive partial-50
, or this report should be credited for two different findings
Hey @Brivan-26 , I just wanted to double check one fact:
Not updating the lastToildDate
: I spoke about this with the sponsor during the contest and lastToildDate
is not mandaroty to be updated here as the modifier forceFarmPlots
will actually udpate it. Does that make sense or you are claiming something different here?
Thanks for pointing out @dontonka . I'm claiming something different here:
When the token is already in the dirty state, the forceFarmPlots
will skip the token update. So, if a token that had already been in a dirty state is transferred to a new plot, the lastToilDate
will still reference an old time, and when toiling again on the new valid plot, the rewards will be farmed starting from the outdated lastToilDate
rather then from when the transfer to valid plot happened.
Hey @Brivan-26 and @dontonka, thank you for your PJQA contributions.
Per C4 guidelines all submissions are graded based on the state of the codebase at the time the contest was initiated. An absence of the lastToilDate
update does not result in any impact on this version, and updating it independently will not result in rewards being accumulated. As such, we cannot evaluate it as a distinct finding.
Based on the above, we will have the absence of the lastToilDate
update factor in as an incorrect remediation to the issue. Per the C4 guidelines around satisfactory reports, this would warrant a partial penalty as it represents an incorrect alleviation to this submission.
Based on the above, I have proceeded with downgrading the reward of all duplicate reports not mentioning the lastToilDate
to partial-75
, and re-selected the primary report of this duplicate group.
Lines of code
https://github.com/code-423n4/2024-07-munchables/blob/94cf468aaabf526b7a8319f7eba34014ccebe7b9/src/managers/LandManager.sol#L199-L226
Vulnerability details
Impact
The _farmPlots function is executed during every toiling operation on a plot (staking, unstaking, and transferring a token to a new plot). The function checks if the plotId associated with the ToilerState exceeds the number of available plots for the landlord. If so, it sets the
dirty
status to true:If the
dirty
status is set to true, it means that the current plot is no longer valid (so, schnibbles will not be farmed) and the token should be moved to a new valid plot to start farming again. And to transfer the token to a new valid plot, transferToUnoccupiedPlot should be called. The issue is that the function does not update thedirty
andlastToildDate
states:We can see that the function does not update the
dirty
status back to false if it was set to true. Therefore, even if the user transfers his token to a new valid plot because of the dirty status, the token will still be considered dirty and will not be able to farm schnibbles rewards.lastToilDate
was not updated either, and it still points to the previous toiling action.Tools Used
Manual Review
Recommended Mitigation Steps
Consider updating the
lastToilDate
state and thedirty
status if it was true. Below is a suggestion for an updated code oftransferToUnoccupiedPlot
:Assessed type
Context