Open sherlock-admin3 opened 5 months ago
The protocol team fixed this issue in the following PRs/commits: https://github.com/GenerationSoftware/pt-v5-draw-manager/pull/15
Fixed. Now the lastStartDrawAuction.closedAt is used incase there are failed requests
The Lead Senior Watson signed off on the fix.
berndartmueller
medium
DrawManager.canStartDraw
does not consider retried RNG requests when determining if a new draw auction can be startedSummary
Inconsistent checks in the
DrawManager.canStartDraw
function, neglecting to consider retried RNG requests, might lead to wrongly assuming that a new draw auction cannot be started.Vulnerability Detail
The
DrawManager.canStartDraw
function checks if thestartDraw
function can be called. However, the checks are not consistent with thestartDraw
function. Specifically, the check in line289
to determine if the draw has expired is different than the auction duration check in thestartDraw
function in lines250-251
. The latter uses the last RNG request'sclosedAt
timestamp to determine the elapsed auction time, to consider any retried failed RNG requests, while the former checks if the draw has expired, not considering retried RNG requests.As a result, if for a given draw a RNG request has been retried, and thus the total elapsed time from the draw close until now (
block.timestamp
) might exceed the auction duration, off-chain actors calling thecanStartDraw
function might wrongly assume that the draw auction can not be started, even though such a call would succeed.Impact
As
canStartDraw
is also called internally by thestartDrawReward
function and both functions are likely to be used by off-chain actors to determine if a new draw auction an be started, this might lead to wrongly assuming that a new draw auction cannot be started, even though it should be possible. As a result, the current draw might not get awarded.Code Snippet
DrawManager.canStartDraw()
Tool used
Manual Review
Recommendation
Consider using the last request's
closedAt
timestamp instead ofdrawClosesAt
to determine if the auction has expired to consider failed RNG requests that have been retried by callingstartDraw
again.