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

Cannot configure `temperature` in ReseedField due to type mismatch

Summary

ReseedField.init() defines initialTemperature as uint8, however it's real type is uint32:

function init(
MigratedPlotData[] calldata accountPlots,
uint256 totalPods,
uint256 harvestable,
uint256 harvested,
uint256 fieldId,
@> uint8 initialTemperature
) external {
...
@> s.sys.weather.temp = initialTemperature;
}
struct Weather {
uint128 lastDeltaSoil; // ───┐ 16 (16)
uint32 lastSowTime; // │ 4 (20)
uint32 thisSowTime; // │ 4 (24)
@> uint32 temp; // ─────────────┘ 4 (28/32)
bytes32[4] _buffer;
}

At the moment of writing report current value of s.sys.weather.temp is 24028, you can check the site:
https://app.bean.money/#/field

So obviously this value exceeds max allowed in uint8 and cannot be set.

Impact

Correct temperature cannot be configured during migration.

Tools Used

Manual Review

Recommendations

Define initialTemperature as uint32 in ReseedField.init()

Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Cannot configure `temperature` in ReseedField due to type mismatch (uint8 vs uint32)

Appeal created

T1MOH Submitter
12 months ago
T1MOH Submitter
12 months ago
inallhonesty Lead Judge
12 months ago
inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Cannot configure `temperature` in ReseedField due to type mismatch (uint8 vs uint32)

Support

FAQs

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