IS_HAPPY_HORSE()
has a vulnerability where the comparison of the time difference is inverted.
The vulnerability lies in the IS_HAPPY_HORSE()
macro. This macro uses the lt
opcode to compare the time since the horse was last fed (timestamp - horseFedTimestamp
) with a constant (HORSE_HAPPY_IF_FED_WITHIN_CONST
). However, the order of the operands is inverted, meaning it checks if HORSE_HAPPY_IF_FED_WITHIN_CONST
is less than timestamp - horseFedTimestamp
.
HORSE_HAPPY_IF_FED_WITHIN_CONST < timestamp - horseFedTimestamp
can be manipulated to break the first invariant:
Foundry test.
Swap the operands of lt
.
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.