code-423n4 / 2021-04-marginswap-findings

1 stars 0 forks source link

diffMaxMinRuntime gets default value of 0 #37

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Email address

pauliax6@gmail.com

Handle

paulius.eth

Eth address

0x523B5b2Cc58A818667C22c862930B141f85d49DD

Vulnerability details

uint256 public diffMaxMinRuntime; This variable is never set nor updated so it gets a default value of 0.

Impact

diffMaxMinRuntime with 0 value is making the calculations that use it either always return 0 (when multiplying) or fail (when dividing) when calculating bucket indexes or sizes.

Recommended mitigation steps

Set the appropriate value for diffMaxMinRuntime and update it whenever min or max runtime variables change.