it is a better know the number of treats we are adding to the constructor. As numerous additions can be computationally expensive in an unbounded loop.
https://github.com/Cyfrin/2024-10-trick-or-treat/blob/9cb3955058cad9dd28a24eb5162a96d759bfa842/src/TrickOrTreat.sol#L29
returning excess payments in function resolveTrick
needs to be refactored such that excess payment is successful before sending nft to user and deleting state changes. while the whole transaction will revert if not successful, gas has already been spent. function also fails to follow Checks-Effect-interaction(CEI) and will easily be broken if not for the re-entrant modifier.
https://github.com/Cyfrin/2024-10-trick-or-treat/blob/9cb3955058cad9dd28a24eb5162a96d759bfa842/src/TrickOrTreat.sol#L139
spending more gas
manual search
optimize code to follow CEI and use less gas
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.