The matchRewards
function does not validate that userBalances[from]
and userBalances[to]
are greater than zero before performing calculations and transfers. This could result in deploying a multisig wallet and sending zero ETH, wasting gas and creating unnecessary state changes.
Root Cause:
The matchRewards
function assumes that userBalances[from]
and userBalances[to]
are greater than zero. However, if either balance is zero, the function will still deploy a multisig wallet and attempt to send zero ETH, which is inefficient and unnecessary.
Example Scenario:
User A and User B mutually like each other, but one or both of their balances are zero.
The matchRewards
function is called, deploying a multisig wallet and attempting to send zero ETH.
Gas is wasted on unnecessary operations, and the multisig wallet is created without any funds.
Gas Waste: Unnecessary gas is spent on deploying multisig wallets and performing zero-value transfers.
Add checks to ensure that both users have a positive balance before proceeding with the match rewards logic.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.