In Solidity, the ^ operator represents bitwise XOR, not exponentiation. Developers may mistakenly assume x ^ y computes x raised to the power of y, but in Solidity exponentiation is done using **.
This is a common source of logic bugs in mathematical operations. In audited libraries such as OpenZeppelin’s Math.sol, you may encounter:
inverse = (3 * denominator) ^ 2;
This expression performs a bitwise XOR between 3 * denominator and 2, rather than squaring the value as might be assumed.
Likelihood:
This mistake is easy to make — especially by developers coming from other languages where ^
means exponentiation (like Python).
However, compilers do not warn about this — so errors often go unnoticed unless tested.
Impact:
Mathematical calculations are silently incorrect.
Financial formulas relying on accurate math may yield unexpected or unsafe results.
Downstream algorithms using incorrect intermediate values may misbehave or revert.
In financial protocols, this could result in loss of precision, mispriced orders, or protocol insolvency.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
View preliminary resultsAppeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.