Closed JayWelsh closed 2 years ago
Appeal:
As per the following:
"The linked assignment essentially calculates the value of block.timestamp + extensionWindow."
This seems to not be the case, while the "end time" of the Auction would indeed be block.timestamp + extensionWindow
, the duration
of the auction is not the same as the "end time", in this case, we are calculating the new duration (from start to finish) of the auction. If there is a simpler way to calculate this then we can make any required change but setting auction.duration
to block.timestamp + extensionWindow
would cause an issue.
My apology if perhaps I am making a silly error here.
To put the current logic into words:
Knowing that we need to extent the auction duration because of the if ((block.timestamp + extensionWindow) >= endTime) {
, and knowing that we can't straight up add the extension window to the duration as we want the remaining duration to become the duration of extensionWindow
(e.g. assuming a 15 minute extension window, a bid coming in with 10 minutes remaining should set the remaining time to 15 minutes, not to 10 + 15 = 25 minutes):
endTime - block.timestamp
) and then subtracting this from the extensionWindow
, this should be safe to do because the if
statement wrapping the relevant logic should ensure that endTime - block.timestamp
is never larger than extensionWindow
(which could cause an underflow if that assumption is incorrect). We should also be able to assume that block.timestamp
will never be larger than endTime
because there is a require(block.timestamp <= endTime, "Auction timer has elapsed");
check above this logic, higher up in the bid
function.
ARF-01C: Assignment Simplification
Description:
The linked assignment essentially calculates the value of
block.timestamp + extensionWindow
.Example:
Recommendation:
We advise that value to be directly assigned to
auction.duration
instead to increase the legibility of the codebase and reduce its gas cost.