The bid
function in the FjordAuction
contract does not validate that the bid amount is greater than zero, potentially allowing users to place zero amount bids. This could lead to unnecessary state changes and gas consumptions as well as even complicate the auction's accounting process.
Looking at the bid
function:
There is no check to ensure that the amount
parameter is greater than zero. This allows users to submit bids with zero value, which are processed as valid bids by the contract.
Unnecessary state changes and gas consumption for zero-value bids. It can also complicate the auction accounting and final token distribution calculations.
Manual code review
Implement a check at the beginning of the bid
function to ensure the bid amount is greater than zero:
Also add a new custom error for invalid bid amounts:
Consider making these changes to the unbid
function as well:
These changes will ensure that all bids and unbids have a positive value thus, preventing potential issues related to zero-value transactions.
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.