sherlock-audit / 2024-10-gamma-rewarder-judging

7 stars 3 forks source link

Striped Opaque Pigeon - [INFO] createDistribution function should check if blocksPerEpoch is set #251

Closed sherlock-admin3 closed 2 weeks ago

sherlock-admin3 commented 2 weeks ago

Striped Opaque Pigeon

Low/Info

[INFO] createDistribution function should check if blocksPerEpoch is set

Summary

Although createDistribution has so many requirements, it lacks a check whether the variable blocksPerEpoch is set.

If funciton is called without this variable being set, this line will revert with the following message:

"error": "Failed to decode output: Error: data out-of-bounds (length=36, offset=64, code=BUFFER_OVERRUN"

Which is not clear why it reverts.

Root Cause

No response

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

No response

PoC

No response

Mitigation

Consider adding the following check:

require(blocksPerEpoch != 0, "Blocks per epoch is not set");