Skip to content

Implement Soroban integer width rounding feature (#1805)#1810

Merged
salaheldinsoliman merged 12 commits intohyperledger-solang:mainfrom
guptapratykshh:soroban-integer-width-rounding
Aug 24, 2025
Merged

Implement Soroban integer width rounding feature (#1805)#1810
salaheldinsoliman merged 12 commits intohyperledger-solang:mainfrom
guptapratykshh:soroban-integer-width-rounding

Conversation

@guptapratykshh
Copy link
Contributor

Description

This PR adds automatic rounding of integer widths to Soroban-compatible sizes when developers use unsupported integer types like int56 or uint72.

Key Changes

Automatic Rounding - int56 → int64, uint72 → uint128, etc.
Warning Messages - Shows exact warnings for non-compatible widths
Strict Mode Flag - --strict-soroban-types turns warnings into errors
Soroban-Only - Only applies when targeting Soroban runtime

Fixes #1805

…1805)

Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
@salaheldinsoliman
Copy link
Contributor

@guptapratykshh It looks good, but will need some MockVm test cases in tests directory

…cs tests

Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
@guptapratykshh
Copy link
Contributor Author

Added the test cases for the integer width rounding feature @salaheldinsoliman Please look into this

@salaheldinsoliman
Copy link
Contributor

@guptapratykshh You need to make sure tests are passing. Some CI tests will fail, like VSCode, polkadot and anchor integration tests
However the rest shall be fine

…fined_variable_detection test

Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
@guptapratykshh guptapratykshh force-pushed the soroban-integer-width-rounding branch from f57b10c to 08fba39 Compare June 22, 2025 13:04
guptapratykshh and others added 3 commits June 22, 2025 21:43
Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
…havior

Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
@guptapratykshh
Copy link
Contributor Author

Please look into this @salaheldinsoliman

@salaheldinsoliman
Copy link
Contributor

@guptapratykshh Tests are still failing, could you make sure they pass by running
cargo test --workspace locally first?

…nalyzer behavior

Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
@guptapratykshh
Copy link
Contributor Author

@salaheldinsoliman All the test have been passed and i have also checked it locally. Please have a look at it

generate_debug_information: false,
log_runtime_errors: false,
log_prints: true,
strict_soroban_types: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guptapratykshh Looks good now, however why is that file changed?
This seems not related to this PR

Copy link
Contributor Author

@guptapratykshh guptapratykshh Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made the change please look into this @salaheldinsoliman

@guptapratykshh guptapratykshh force-pushed the soroban-integer-width-rounding branch from 30e435e to 8a1f00b Compare August 4, 2025 07:09
…detection test

Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
@guptapratykshh guptapratykshh force-pushed the soroban-integer-width-rounding branch from 8a1f00b to ce62df8 Compare August 4, 2025 07:12
@guptapratykshh
Copy link
Contributor Author

guptapratykshh commented Aug 17, 2025

Plaese look into this , i think everything is sorted in this PR @salaheldinsoliman

@salaheldinsoliman salaheldinsoliman merged commit c63cfcc into hyperledger-solang:main Aug 24, 2025
15 of 17 checks passed
guptapratykshh added a commit to guptapratykshh/pg-solang that referenced this pull request Nov 16, 2025
…1805) (hyperledger-solang#1810)

## Description
This PR adds automatic rounding of integer widths to Soroban-compatible
sizes when developers use unsupported integer types like `int56` or
`uint72`.

### Key Changes
Automatic Rounding - int56 → int64, uint72 → uint128, etc.
Warning Messages - Shows exact warnings for non-compatible widths
Strict Mode Flag - `--strict-soroban-types` turns warnings into errors
Soroban-Only - Only applies when targeting Soroban runtime

Fixes hyperledger-solang#1805

---------

Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
Co-authored-by: salaheldinsoliman <49910731+salaheldinsoliman@users.noreply.github.com>
Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mentee Task 1: Round Soroban target integer width to proper width

2 participants