hats-finance / SeeR-PM-0x899bc13919880db76edf4ccd72bdfa5dfa666fb7

1 stars 0 forks source link

_payPayee may be called with 0 value leading to potential cluttered logs #7

Open hats-bug-reporter[bot] opened 4 hours ago

hats-bug-reporter[bot] commented 4 hours ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0xa12d42f476f20830a264cbc23a927d34e2ef13fd1e0364ee588147dbb15ca3be Severity: low

Description: Description\ At _processHistoryItem function the answer_takeover_fee will be equal to queued_funds if queued_funds == bond , which would lead to calling _payPayee with zero value.

_payPayee(question_id, payee, queued_funds - answer_takeover_fee); The queued_funds and answer_takeover_fee variables above, are both equal to bond .

Attachments

  1. Proof of Concept (PoC)
uint256 answer_takeover_fee = (queued_funds >= bond) ? bond : queued_funds;
// Settle up with the old (higher-bonded) payee
_payPayee(question_id, payee, queued_funds - answer_takeover_fee);
  1. Revised Code\ Either change the boolean statement to strictly greater than or check if queued_funds - answer_takeover_fee is greater than zero before calling _payPayee .
uint256 answer_takeover_fee = (queued_funds >= bond) ? bond : queued_funds;
// Settle up with the old (higher-bonded) payee
++ if(queued_funds - answer_takeover_fee > 0) {
_payPayee(question_id, payee, queued_funds - answer_takeover_fee);
++ }
clesaege commented 3 hours ago

There if no issue in "doing 0". Filtering logs is a frontend job.

Per competition rules, are excluded: