Attackathon _ Fuel Network 33240 - [Smart Contract - Insight] Incorrect Bitness in IFP Types
Last updated
Was this helpful?
Last updated
Was this helpful?
Submitted on Mon Jul 15 2024 20:11:00 GMT-0400 (Atlantic Standard Time) by @Blockian for
Report ID: #33240
Report type: Smart Contract
Report severity: Insight
Target: https://github.com/FuelLabs/sway-libs/tree/0f47d33d6e5da25f782fc117d4be15b7b12d291b
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
The bitness of the IFP
types is incorrectly defined. Specifically:
IFP64
is actually 33 bits. IFP128
is actually 65 bits. IFP256
is actually 129 bits.
Examining the definition of IFP64
as an example:
The IFP64
type internally uses a UFP32
, which occupies 32
bits, along with a single bit for the non_negative
boolean. This totals 33
bits, not 64
as the name suggests.
The primary impact is the misleading and confusing naming of these types. This issue is of low severity but can cause misunderstanding.
Correct the names of the IFP types to accurately reflect their bitness.
Run the POC's with forc test