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

QA Report #107

Open
code423n4 opened this issue Feb 23, 2022 · 1 comment
Open

QA Report #107

code423n4 opened this issue Feb 23, 2022 · 1 comment
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

[L1] Add check against parameters _amount and _shares:

Assessed risk: 1/10

Urgency: N/A

Codebase frequency: 2

[L1 - Impact]:

The amount that the user deposits is not checked against being !=0. It’s a good practice to check arbitrary inputs against being null. Although the transaction would revert anyhow(due to arithmetic error of division /0) you should consider adding a check against it. The same goes with parameter _shares in the withdraw() function.

[L1 - References]:

InsuranceFund.sol lines 62 and 39

[L1 - Mitigation]:

Adding require statements would prevent such operations.

function deposit(uint _amount) external { 
    require(_amount !=0, "IF.deposit.amount_zero");
	...
}

function withdraw(uint _shares) external {
    require(_shares !=0, "IF.withdraw.shares_not_zero");
	...
}
@code423n4 code423n4 added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax bug Something isn't working labels Feb 23, 2022
code423n4 added a commit that referenced this issue Feb 23, 2022
@atvanguard atvanguard added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Feb 26, 2022
@moose-code
Copy link
Collaborator

Yes agree this is a great sanity check. Have seen non zero deposit amounts leading to strange things in some systems and as the code is refactored and built upon in subsequent upgrades, leaving this out may come back to haunt in a weird way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

3 participants