hats-finance / Tapioca-0xe0b920d38a0900af3bab7ff0ca0af554129f54ad

1 stars 2 forks source link

The code won't revert if `(_getChainId() == _data.governanceEid)` is false #41

Open hats-bug-reporter[bot] opened 3 weeks ago

hats-bug-reporter[bot] commented 3 weeks ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0x49f7f912d008fde61c3be1d3177bc8fd25dc7135c0d0dd5d6c8046778c0f552a Severity: medium

Description: Description\ Assuming (_getChainId() == _data.governanceEid) is correct, the if block containing this check will not revert if the condition evaluates to false. The if block will be skipped, including minting, and the code proceeds to run the rest of the code as if everything is okay.

This is because there's no revert statement to this effect when the condition (_getChainId() == _data.governanceEid) is false.

It's important to note that the if block is inside a constructor which only run once.

Attachments https://github.com/hats-finance/Tapioca-0xe0b920d38a0900af3bab7ff0ca0af554129f54ad/blob/baddafc15616a5674e73c2f5a920b92bf9b21888/contracts/tokens/TapToken.sol#L154C3-L163C1

  1. Revised Code File (Optional)

    The code should revert if (_getChainId() == _data.governanceEid) is false.

0xRektora commented 3 weeks ago

That is because minting is supposed to happen only on the governance chain, which if not, we'll just skip minting.