You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Floating-point numbers are not supported in smart contracts, but if you don't know that and you try to use them (or you use a library that uses floats), the error message when building with cargo concordium is very cryptic.
Steps to Reproduce
Use floating-point numbers in your contract.
Make sure that the compiler doesn't optimize the floats away.
Something like this worked for me with 1.53.0:
fng(){iff(f(1.)) < 2.{println!("hello");}}#[inline(never)]fnf(x:f64) -> f64{if x < 1.{
x + 1.}else{
x + 2.}}
Compile the contract with cargo concordium build
Expected Result
An error message saying: Floating point numbers are not allowed.
Actual Result
Error: Could not build smart contract.
Caused by:
0: Could not validate resulting smart contract module as a V1 contract.
1: Unknown value type byte 0x7c
Description
Floating-point numbers are not supported in smart contracts, but if you don't know that and you try to use them (or you use a library that uses floats), the error message when building with cargo concordium is very cryptic.
Steps to Reproduce
Make sure that the compiler doesn't optimize the floats away.
Something like this worked for me with 1.53.0:
cargo concordium build
Expected Result
An error message saying:
Floating point numbers are not allowed.
Actual Result
(
0x7c
is the encoding of thef64
type in https://webassembly.github.io/spec/core/binary/types.html#number-types.)Versions
The text was updated successfully, but these errors were encountered: