SaturatingSub/SaturatingSubAssign for BigUint#2324
Merged
andrei-marinica merged 7 commits intorc/v0.66from Mar 31, 2026
Merged
Conversation
|
Contract comparison - from a29dc7c to e1711c1
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds saturating subtraction support for managed BigUint in the framework, and extends the operator test generator + feature-test scenarios to cover the new behavior.
Changes:
- Introduce
SaturatingSub/SaturatingSubAssigntraits and implement them forBigUintvia a new BigInt API helper (bi_sub_unsigned_saturated). - Extend
op-test-gento generate endpoints + scenarios forsaturating_sub/saturating_sub_assign. - Add unit + scenario test coverage and wire new endpoints into the basic-features WASM adapter.
Reviewed changes
Copilot reviewed 18 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/op-test-gen/src/op_list.rs | Adds SaturatingSub operator metadata and formatting support for method-style ops. |
| tools/op-test-gen/src/op_gen_scenario.rs | Generates a new saturating-sub scenario JSON. |
| tools/op-test-gen/src/op_gen_lib.rs | Emits generated endpoints for saturating-sub methods/assign methods. |
| tools/op-test-gen/src/op_gen_endpoints.rs | Generates method-call bodies for saturating-sub and adds endpoint combinations for BigUint. |
| framework/scenario/tests/big_uint_test.rs | Adds unit tests for BigUint saturating sub + assign. |
| framework/base/src/types/managed/wrapped/traits/saturating_sub.rs | New public trait definition for saturating subtraction returning a new value. |
| framework/base/src/types/managed/wrapped/traits/saturating_sub_assign.rs | New public trait definition for in-place saturating subtraction. |
| framework/base/src/types/managed/wrapped/traits.rs | Registers new traits and adjusts trait module structure/exports. |
| framework/base/src/types/managed/wrapped/num/big_uint_operators.rs | Implements saturating sub/sub-assign for BigUint via API calls. |
| framework/base/src/types/managed/wrapped.rs | Re-exports wrapped traits from the managed types module. |
| framework/base/src/api/managed_types/big_int_api.rs | Adds bi_sub_unsigned_saturated default implementation. |
| contracts/feature-tests/basic-features/wasm-basic-features/src/lib.rs | Updates exported endpoint list/counts to include saturating-sub endpoints. |
| contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_test.rs | Adds (ignored) fast-test entry for saturating-sub scenario; also marks cmp as ignored here. |
| contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_slow_test.rs | Adds slow-test entries for cmp + saturating-sub scenarios. |
| contracts/feature-tests/basic-features/tests/basic_features_scenario_go_test.rs | Adds Go-vm scenario test for saturating-sub. |
| contracts/feature-tests/basic-features/src/big_num_operators.rs | Adds generated endpoints exercising saturating sub/sub-assign variants. |
| contracts/feature-tests/basic-features/scenarios/big_num_ops_shift.scen.json | Regenerated scenario JSON (field name changes for query IDs). |
| contracts/feature-tests/basic-features/scenarios/big_num_ops_saturating_sub.scen.json | New generated scenario JSON covering saturating subtraction. |
| contracts/feature-tests/basic-features/scenarios/big_num_ops_cmp.scen.json | Regenerated scenario JSON (field name changes for query IDs). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request overview
Adds saturating subtraction support for managed
BigUintin the framework, and extends the operator test generator + feature-test scenarios to cover the new behavior.Changes:
SaturatingSub/SaturatingSubAssigntraits and implement them forBigUintvia a new BigInt API helper (bi_sub_unsigned_saturated).op-test-gento generate endpoints + scenarios forsaturating_sub/saturating_sub_assign.