DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: low
Valid

`LibFertilizer.beginBarnRaiseMigration()` incorrectly checks that Oracle supports such token

Summary

Here you can see it calls LibUsdOracle to ensure it supports token. However LibUsdOracle.getTokenPrice() returns 0 on failure instead of revert.

function beginBarnRaiseMigration(address well) internal {
...
// Check that Lib Usd Oracle supports the non-Bean token in the Well.
@> LibUsdOracle.getTokenPrice(address(tokens[tokens[0] == C.bean() ? 1 : 0]));
...
}

Impact

Well with unsupported token can be migrated by mistake because sanity check doesn't work.

Tools Used

Manual Review

Recommendations

// Check that Lib Usd Oracle supports the non-Bean token in the Well.
- LibUsdOracle.getTokenPrice(address(tokens[tokens[0] == C.bean() ? 1 : 0]));
+ require(LibUsdOracle.getTokenPrice(address(tokens[tokens[0] == C.bean() ? 1 : 0])) != 0)
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Appeal created

T1MOH Submitter
about 1 year ago
inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

`LibFertilizer.beginBarnRaiseMigration()` incorrectly checks that Oracle supports such token

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.