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

Calculation in LibDibbler is incompatible with most L2 and will cause issue if not deployed on Base.

Summary

Calculation in LibDibbler is incompatible with most L2 and will cause issue if not deployed on Base.

Vulnerability Details

The current implementation uses the following constants for the calculations

uint256 private constant L1_BLOCK_TIME = 12;
uint256 private constant L2_BLOCK_TIME = 2;

So it assumes that the difference between L1 Block time and L2 block time is 6 fold, which is actually only true for the Optimism-based chain, for example on a chain like Arbitrum it will completely mess up the calculations.

Also, Dev mentioned the chain the on which code deployed is not final and it will be chosen via governance and if the governance chooses any chain for which these params don't hold it will completely mess up the delta calculation in the morningTemperature function which is the core function for the correct working of the field facet.

Impact

In this case the impace is medium, chances of such chain being approved through governance are low but are present and if go through could mess up whole field facet calculations in multiple functions like totalSoil and _totalSoilAndTemperature

Tools Used

Brain

Recommendations

Instead of making them constant make these values immutable and pass via constructor on deployment.

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

L2_BLOCK_TIME hardcoded to 2 seconds is not right for most L2's

Appeal created

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

L2_BLOCK_TIME hardcoded to 2 seconds is not right for most L2's

Support

FAQs

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