hats-finance / HATs-Arbitration-Contracts-0x79a618f675857b45934ca1c413fd5f409cf89735

MIT License
0 stars 0 forks source link

`HATArbitrator.dispute()`can be called after dispute has been resolved #45

Open hats-bug-reporter[bot] opened 8 months ago

hats-bug-reporter[bot] commented 8 months ago

Github username: @bahurum Submission hash (on-chain): 0xc0f8b633fa893a1125a9c2b8676a28a3e5b56a75e29024a55b24fcf0d3ce8cdf Severity: low

Description: Description\ HATArbitrator.dispute() can be called even after a dispute has been resolved, while users should be able to add to a dispute only when the dispute is not resolved yet.

Disputes of a claim can can be made after resolution when:

Note that currently all tokens used for disputes coming after resolution can be recovered after some time by calling reclaimBond() so there is no loss of funds.

Recommendation\ Consider adding the onlyUnresolvedDispute(_vault, _claimId) modifier to the dispute() function so that only unresolved claims can be disputed.

    function dispute(
        IHATClaimsManager _vault,
        bytes32 _claimId,
        uint256 _bondAmount,
        string calldata _descriptionHash
-   ) external {        
+   ) external 
+   onlyUnresolvedDispute(_vault, _claimId)
+   {
        if (_bondAmount < minBondAmount) {
            revert BondAmountSubmittedTooLow();
        }
jellegerbrandy commented 8 months ago

HATArbitrator.dispute() can be called even after a dispute has been resolved,

I do not think this is true, at least not with the same claimId

bahurum commented 8 months ago

dispute() can be called with the same claimId for example after approveSubmitClaimRequest() is called. The call won't fail. _vault.challengeClaim(_claimId) won't be reached but the event ClaimDisputed() will be emitted.