Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logClaim fee logic can be improved #62

Open
hats-bug-reporter bot opened this issue Nov 5, 2023 · 1 comment
Open

logClaim fee logic can be improved #62

hats-bug-reporter bot opened this issue Nov 5, 2023 · 1 comment
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@hats-bug-reporter
Copy link

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

Description:
Description

When a user logs a claim, depending on if a claim fee is set, a user will have to pay a fee. The function checks if the amount sent by the user is less than the claim fee, however it doesn't account for cases where a user sends more than the required fee.

A user who sends more than the claimFee for any reason will lose his funds, which is not acceptable.

Attachments

  1. Proof of Concept (PoC) File

HatsVaultsRegistry

    function logClaim(string calldata _descriptionHash) external payable {
        uint256 _claimFee = generalParameters.claimFee;
        if (_claimFee > 0) { 
            if (msg.value < _claimFee) //@note only less
                revert NotEnoughFeePaid();
            // solhint-disable-next-line avoid-low-level-calls
            (bool success,) = payable(owner()).call{value: msg.value}("");
            if (!success) revert ClaimFeeTransferFailed();
        }
        emit LogClaim(msg.sender, _descriptionHash);
    }
  1. Revised Code File (Optional)

change the check;

if (msg.valiue != _claimFee)
   
@hats-bug-reporter hats-bug-reporter bot added the bug Something isn't working label Nov 5, 2023
@jellegerbrandy
Copy link

this is by design. Also, no funds are "lost" here

@jellegerbrandy jellegerbrandy added the invalid This doesn't seem right label Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant