Sway-libs/floating_point causes compiler to stall and crash

Issue with project’s dependency
fixed_point = { git = “GitHub - FuelLabs/sway-libs: Miscellaneous Sway libraries.”, branch = “master” }

Referencing past discussion of the issue on discord

Summary: compilation ultimately crashes after stalling for about 20 minutes due to excessive use of floats (especially via nesting, that is…across function calls, one function using floats calling into another function using floats, etc.)

Demonstrating the issue can be done by running forc build on this commit (which uncomments all float usage except for a couple of function calls)

  • see that it successfully builds
  • then do a search for the keyword “uncomment” and uncomment any one of the lines.
  • forc build
  • if it happens miraculously that contract compiles, keep uncommenting the lines (there’s 7 total)

Fuel-toolchain.toml

[toolchain]
channel = “latest-2023-12-7”

[components]
forc = “0.48.1”
fuel-core = “0.20.8”

Hey @johnquid It’s taking much longer to compile but does compile in the end without trouble for me.

Can you specify the exact lines I should uncomment here or push a commit with the specific lines uncommented so I can try to replicate your issue again?

1 Like