Open hats-bug-reporter[bot] opened 2 months ago
The last round will be empty if no one funds appeals. If one does, it will not be be.
hey @clesaege, thank you for the reply.
In case you are referring to last round, meaning this: Round storage round = challenge.rounds[challenge.lastRoundId];
,
it will be empty even if an appeal gets funded, because in the line Round storage round = challenge.rounds[challenge.lastRoundId];
the appeal
edits the round with the lastRoundId
and increments the lastRoundId challenge.lastRoundId++;
after it has started editing this round. Which will lead to the rule()
function reading an empty round because the lastRoundId
is incremented only after the round has been edited, so it ends up pointing to an empty round.
What you say seems correct, but it is just a description of the contract behaviour, I don't see any issue. If there is an appeal, the last round will be empty, unless someone funds an appeal (and then it won't be empty). The last round is only non empty if a side was funded while the other was not.
Github username: -- Twitter username: johny37GR Submission hash (on-chain): 0x4a8bf545098f51115e614fa80feaa91cb27b2cb54c63839cb7727e3e65adbc11 Severity: low
Description: Description\ In
challengeRequest()
thechallenge.lastRoundId
is incremented by one after calling_contribute()
with_roundId
equals zero. Which leads to therule()
always retrieving an empty roundRound storage round = challenge.rounds[challenge.lastRoundId];
, because thelastRoundId
will be 1, while the_roundId
that was used in_contribute()
was 0.Attachments
ProofOfHumanity.sol@L1005-1071
ProofOfHumanity.sol@L1315-1377
challenge.lastRoundId
, usechallenge.lastRoundId - 1