Description
Introduction
The Soroban runtime environment supports only a limited set of integer bit widths: 32, 64, 128, and 256 bits.
By contrast, Solidity supports integer types in 8-bit increments, from 8 to 256 (e.g., int8, int16, ..., int248, int256).
This discrepancy can lead to confusion or runtime issues for Stellar developers using Solidity via Solang.
Expected Compiler Behavior (Solang for Soroban)
When a developer defines an integer type with a bit width not directly supported by Soroban (e.g., int56), the compiler should:
Emit a warning
Example:
int56 is not supported by the Soroban runtime and will be rounded up to int64.
Automatically round up the bit width to the next Soroban-compatible size:
int56 → int64
int96 → int128
int200 → int256
and so on.
Insert a safe type coercion internally to reflect the change in representation.
Notes
-
This behavior should apply to both intN and uintN types.
-
Also Consider adding a compiler flag (e.g., --strict-soroban-types) to turn these warnings into hard errors for stricter type safety.
-
Most of the work should be done in
sema
. I'm not sure yet if this should touchcodegen
, but most probably not
@guptapratykshh please let me know if the description is clear enough