self.last_block_number
Not Initialized in Constructor
In the __init__
function, the variable self.last_block_number
is missing an initial value. This omission allows the first execution of update_price
to pass even if _block_number
is far lower than the current block number, potentially leading to outdated or incorrect price updates.
The constructor initializes multiple parameters but does not set self.last_block_number
.
update_price
:Since self.last_block_number
is not set during deployment, its initial value is undefined.
On the first call to update_price
, this assertion will pass even if _block_number
is outdated, leading to incorrect price updates.
Bypasses Block Number Check on First Update: Allows an outdated _block_number
to be accepted.
Potential Manipulation: Malicious prover could exploit this to use older price parameters.
Inconsistent Price Updates: The system may start with an incorrect reference point, affecting future calculations.
self.last_block_number
in the ConstructorModify __init__
to include:
This ensures self.last_block_number
starts with a valid reference and prevents outdated block numbers from being used during the first update.
I believe low to be appropriate, although could hear arguments for informational. The next `_block_number` for each price/max unlock time update will always be greater than the default zero, so the assertion of `assert self.last_block_number <= _block_number, "Outdated"` will pass without issue, but for consistency could be updated during deployment. Arguably at deployment, an update that has been verified via the verifier has not occur yet, so there would likely be no issues here given after the first correct update it will work as intended. The first update for price/profit max unlock time will also unlikely be outdated based on block number, which can be presumed to be true given this are extracted and verified within the OOS `StateProofVerifier`.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.