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

Governance fee can be set to zero #66

Open
hats-bug-reporter bot opened this issue Jan 31, 2024 · 1 comment
Open

Governance fee can be set to zero #66

hats-bug-reporter bot opened this issue Jan 31, 2024 · 1 comment
Labels
invalid This doesn't seem right

Comments

@hats-bug-reporter
Copy link

Github username: --
Twitter username: 97Sabit
Submission hash (on-chain): 0x3d7281573f7522cc131a8e44606498a2f7738e86c5a0d81018b020878d40b42e
Severity: low

Description:
Description
There is no protection against setting governance fee and vault fee to zero.

There are two functions involved in setting governance fee - _setGovernanceFee and setGovernanceFee.

In both functions, there is no check against setting governance fee to 0.

In the localSwap function, _collectGovernanceFee function was called. If govnerance fee is set to zero, no governance fee will be received by the factory owner when a swap is done.

This is because of this check in _collectGovernanceFee:
if (governanceFeeShare != 0)

Also, there is no check against setting the _vaultFee to zero.

Though these functions have a specified caller, the fees can still be set to zero.

  1. Proof of Concept (PoC) File

https://github.com/catalystdao/catalyst/blob/27b4d0a2bca177aff00def8cd745623bfbf7cb6b/evm/src/CatalystVaultCommon.sol#L366

https://github.com/catalystdao/catalyst/blob/27b4d0a2bca177aff00def8cd745623bfbf7cb6b/evm/src/CatalystVaultCommon.sol#L354

https://github.com/catalystdao/catalyst/blob/27b4d0a2bca177aff00def8cd745623bfbf7cb6b/evm/src/CatalystVaultAmplified.sol#L829

https://github.com/catalystdao/catalyst/blob/27b4d0a2bca177aff00def8cd745623bfbf7cb6b/evm/src/CatalystVaultCommon.sol#L347

https://github.com/catalystdao/catalyst/blob/27b4d0a2bca177aff00def8cd745623bfbf7cb6b/evm/src/CatalystVaultCommon.sol#L371

@hats-bug-reporter hats-bug-reporter bot added the bug Something isn't working label Jan 31, 2024
@reednaa
Copy link
Collaborator

reednaa commented Jan 31, 2024

The check is a gas optimisation: If the governance fee is 0 => don't worry about associated logic.

Governance fee is default 0.

@reednaa reednaa added the invalid This doesn't seem right label Jan 31, 2024
@reednaa reednaa removed the bug Something isn't working label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant