ref: tests for fixed-point package - #248
Conversation
WalkthroughReplaced two large monolithic Move test files (sd29x9 and ud30x9) with many focused test modules and small helper modules covering abs, arithmetic, bitwise, casting, ceil, floor, comparison, div, mod, mul, negate, pow, unchecked, and wrap; also removed the original monolithic test files. Changes
Sequence Diagram(s)(Skipped — changes are test additions/removals and do not introduce new multi-component runtime control flow requiring a sequence diagram.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-v1.1 #248 +/- ##
================================================
+ Coverage 89.74% 89.87% +0.12%
================================================
Files 19 19
Lines 1785 1787 +2
Branches 484 484
================================================
+ Hits 1602 1606 +4
Misses 168 168
+ Partials 15 13 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
math/fixed_point/tests/ud30x9_tests/unchecked_tests.move (1)
63-68: Exercise the inverse property across wrap-around.Lines 65-67 only use values far from
MAX_VALUE, so this verifies the non-wrapping path but not the modular behaviorunchecked_*is supposed to guarantee.Suggested addition
- let cases = vector[fixed(10), fixed(100), fixed(1_000_000), fixed(42)]; + let cases = vector[ + fixed(10), + fixed(100), + fixed(1_000_000), + fixed(42), + fixed(MAX_VALUE - 2), + ];🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@math/fixed_point/tests/ud30x9_tests/unchecked_tests.move` around lines 63 - 68, The test unchecked_add_and_sub_are_inverse only checks non-wrapping values; extend it to exercise wrap-around by adding cases near the type bounds and using deltas that cause overflow, e.g., include values like MAX_VALUE, MAX_VALUE - 1, MIN_VALUE, MIN_VALUE + 1 (referencing the fixed type's max/min constants) and a delta that will force wrapping so that for each x the property x.unchecked_add(delta).unchecked_sub(delta) == x (and optionally x.unchecked_sub(delta).unchecked_add(delta) == x) is validated; update the cases vector in unchecked_add_and_sub_are_inverse and reuse unchecked_add/unckecked_sub to assert the modular inverse behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@math/fixed_point/tests/sd29x9_tests/arithmetic_tests.move`:
- Around line 58-60: The three duplicated addition assertions should instead
exercise subtraction boundaries so the subtraction side of
sub_handles_edge_cases is tested: replace the second and third expect calls
(currently using .add in combinations with max, min, epsilon, epsilon.negate(),
and max.negate()) so they perform the corresponding .sub operations (e.g., test
max.sub(epsilon).sub(epsilon) yields expected min, and
min.sub(epsilon).negate().sub(epsilon) yields expected max) — update the expect
expressions that reference max, min, epsilon, max.negate(), and epsilon.negate()
to use .sub where the subtraction boundary is intended.
In `@math/fixed_point/tests/sd29x9_tests/mul_tests.move`:
- Around line 16-24: The zero-multiplication table in the tests omits the
extreme operands; update the vector used in mul() tests (the values variable) to
include sd29x9::min() and sd29x9::max() so the test exercises min * 0 and max *
0 (and their sign/normalization behavior) alongside existing entries; ensure
these are added to the same vector passed into the zero-multiplication
assertions so the cases are covered without changing test structure.
In `@math/fixed_point/tests/sd29x9_tests/pow_tests.move`:
- Around line 48-51: The test pow_supports_high_exponents currently only calls
val.pow(255) to check it doesn't abort; replace that with an explicit assertion
of the result: compute the expected fixed-point representation for pos(SCALE +
250_000_000).pow(255) (i.e., (1.25)^255 scaled by SCALE) and assert equality (or
assert an exact known integer literal for the scaled result) against the
returned value from val.pow(255); reference the test function
pow_supports_high_exponents, the variable val, the pos(SCALE + 250_000_000)
initializer, and the pow(255) call to locate and update the assertion.
---
Nitpick comments:
In `@math/fixed_point/tests/ud30x9_tests/unchecked_tests.move`:
- Around line 63-68: The test unchecked_add_and_sub_are_inverse only checks
non-wrapping values; extend it to exercise wrap-around by adding cases near the
type bounds and using deltas that cause overflow, e.g., include values like
MAX_VALUE, MAX_VALUE - 1, MIN_VALUE, MIN_VALUE + 1 (referencing the fixed type's
max/min constants) and a delta that will force wrapping so that for each x the
property x.unchecked_add(delta).unchecked_sub(delta) == x (and optionally
x.unchecked_sub(delta).unchecked_add(delta) == x) is validated; update the cases
vector in unchecked_add_and_sub_are_inverse and reuse
unchecked_add/unckecked_sub to assert the modular inverse behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b6f55cf9-1257-458d-b8c5-29657b897fc9
📒 Files selected for processing (30)
math/fixed_point/tests/sd29x9_tests.movemath/fixed_point/tests/sd29x9_tests/abs_tests.movemath/fixed_point/tests/sd29x9_tests/arithmetic_tests.movemath/fixed_point/tests/sd29x9_tests/bitwise_tests.movemath/fixed_point/tests/sd29x9_tests/casting_tests.movemath/fixed_point/tests/sd29x9_tests/ceil_tests.movemath/fixed_point/tests/sd29x9_tests/comparison_tests.movemath/fixed_point/tests/sd29x9_tests/div_tests.movemath/fixed_point/tests/sd29x9_tests/floor_tests.movemath/fixed_point/tests/sd29x9_tests/helpers.movemath/fixed_point/tests/sd29x9_tests/mod_tests.movemath/fixed_point/tests/sd29x9_tests/mul_tests.movemath/fixed_point/tests/sd29x9_tests/negate_tests.movemath/fixed_point/tests/sd29x9_tests/pow_tests.movemath/fixed_point/tests/sd29x9_tests/unchecked_tests.movemath/fixed_point/tests/sd29x9_tests/wrap_tests.movemath/fixed_point/tests/ud30x9_tests.movemath/fixed_point/tests/ud30x9_tests/abs_tests.movemath/fixed_point/tests/ud30x9_tests/arithmetic_tests.movemath/fixed_point/tests/ud30x9_tests/bitwise_tests.movemath/fixed_point/tests/ud30x9_tests/casting_tests.movemath/fixed_point/tests/ud30x9_tests/ceil_tests.movemath/fixed_point/tests/ud30x9_tests/comparison_tests.movemath/fixed_point/tests/ud30x9_tests/div_tests.movemath/fixed_point/tests/ud30x9_tests/floor_tests.movemath/fixed_point/tests/ud30x9_tests/helpers.movemath/fixed_point/tests/ud30x9_tests/mul_tests.movemath/fixed_point/tests/ud30x9_tests/pow_tests.movemath/fixed_point/tests/ud30x9_tests/unchecked_tests.movemath/fixed_point/tests/ud30x9_tests/wrap_tests.move
💤 Files with no reviewable changes (2)
- math/fixed_point/tests/sd29x9_tests.move
- math/fixed_point/tests/ud30x9_tests.move
ericnordelo
left a comment
There was a problem hiding this comment.
Besides the minor AI review comments, it looks good to me. Good work.
|
@coderabbitai review again |
|
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@math/fixed_point/tests/sd29x9_tests/wrap_tests.move`:
- Around line 39-47: The tests wrap_small_positive and
wrap_negative_one_is_all_ones currently only validate the helper functions pos()
and neg(); update each test to call sd29x9::wrap() directly with the same
underlying inputs and assert the expected outputs (e.g., call sd29x9::wrap(...)
for the small positive case and for the -1 case and compare to 1 and ALL_ONES
respectively), you can still keep the helper assertions if desired but make sure
sd29x9::wrap() is asserted explicitly in each test so the wrap() behavior is
pinned independent of pos()/neg() helpers.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0753ebcc-b4bd-490f-9774-b66f57c6f59e
📒 Files selected for processing (30)
math/fixed_point/tests/sd29x9_tests.movemath/fixed_point/tests/sd29x9_tests/abs_tests.movemath/fixed_point/tests/sd29x9_tests/arithmetic_tests.movemath/fixed_point/tests/sd29x9_tests/bitwise_tests.movemath/fixed_point/tests/sd29x9_tests/casting_tests.movemath/fixed_point/tests/sd29x9_tests/ceil_tests.movemath/fixed_point/tests/sd29x9_tests/comparison_tests.movemath/fixed_point/tests/sd29x9_tests/div_tests.movemath/fixed_point/tests/sd29x9_tests/floor_tests.movemath/fixed_point/tests/sd29x9_tests/helpers.movemath/fixed_point/tests/sd29x9_tests/mod_tests.movemath/fixed_point/tests/sd29x9_tests/mul_tests.movemath/fixed_point/tests/sd29x9_tests/negate_tests.movemath/fixed_point/tests/sd29x9_tests/pow_tests.movemath/fixed_point/tests/sd29x9_tests/unchecked_tests.movemath/fixed_point/tests/sd29x9_tests/wrap_tests.movemath/fixed_point/tests/ud30x9_tests.movemath/fixed_point/tests/ud30x9_tests/abs_tests.movemath/fixed_point/tests/ud30x9_tests/arithmetic_tests.movemath/fixed_point/tests/ud30x9_tests/bitwise_tests.movemath/fixed_point/tests/ud30x9_tests/casting_tests.movemath/fixed_point/tests/ud30x9_tests/ceil_tests.movemath/fixed_point/tests/ud30x9_tests/comparison_tests.movemath/fixed_point/tests/ud30x9_tests/div_tests.movemath/fixed_point/tests/ud30x9_tests/floor_tests.movemath/fixed_point/tests/ud30x9_tests/helpers.movemath/fixed_point/tests/ud30x9_tests/mul_tests.movemath/fixed_point/tests/ud30x9_tests/pow_tests.movemath/fixed_point/tests/ud30x9_tests/unchecked_tests.movemath/fixed_point/tests/ud30x9_tests/wrap_tests.move
💤 Files with no reviewable changes (2)
- math/fixed_point/tests/sd29x9_tests.move
- math/fixed_point/tests/ud30x9_tests.move
The base branch was changed.
|
@coderabbitai review again |
|
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
math/fixed_point/tests/ud30x9_tests/helpers.move (1)
19-25: Move shared UD30x9 test constants into this helper module.Now that the suite is split across many files,
SCALE/MAX_VALUEare being re-declared in multiple UD30x9 test modules. Keeping those shared fixtures alongsidefixed/expectwould make the suite less repetitive and reduce drift if the numeric format ever changes.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@math/fixed_point/tests/ud30x9_tests/helpers.move` around lines 19 - 25, The test suite duplicates SCALE and MAX_VALUE across UD30x9 test modules; move those shared constants into the same helpers.move module that already defines fixed(value: u128): UD30x9 and expect(left: UD30x9, right: UD30x9) so all tests import them from one place—add public(package) const SCALE and MAX_VALUE (matching UD30x9 format) to the helpers.move file and update tests to use helpers.SCALE and helpers.MAX_VALUE rather than redeclaring them, leaving fixed and expect unchanged.math/fixed_point/tests/sd29x9_tests/helpers.move (1)
19-28: Centralize shared SD29x9 fixtures here.This helper is already the shared entry point for constructors and assertions. Pulling
SCALEand any other common test constants into it would remove the repeated per-file declarations across the split SD29x9 suite.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@math/fixed_point/tests/sd29x9_tests/helpers.move` around lines 19 - 28, Add shared test constants (e.g., public(package) const SCALE: u128 and any other repeated constants) into this helper module so all SD29x9 tests can import them from one place; keep the existing factory helpers (pos, neg) and assertion (expect) as-is (sd29x9::wrap, SD29x9, pos, neg, expect) and update test files to use the centralized SCALE and other constants instead of redefining them per-file. Ensure the constants are exported with public(package) visibility and named consistently so callers can reference SCALE, and add any additional commonly reused constants here to avoid duplication across the SD29x9 suite.math/fixed_point/tests/ud30x9_tests/pow_tests.move (1)
44-52: Consider consolidating duplicate overflow tests.Both
pow_overflow_aborts_for_large_baseandpow_overflow_aborts_with_correct_abort_codetest the same behavior (overflow abort withEOverflow). The only difference is the exponent (2 vs 32), but both trigger overflow onmax(). One test would suffice unless there's specific behavior you want to pin for different exponent magnitudes.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@math/fixed_point/tests/ud30x9_tests/pow_tests.move` around lines 44 - 52, These two tests duplicate the same overflow behavior for ud30x9::max().pow(...); consolidate by keeping a single overflow test (e.g., pow_overflow_aborts_for_large_base) that asserts the expected_failure(abort_code = ud30x9_base::EOverflow) when calling ud30x9::max().pow(...) and remove the other redundant test; alternatively, replace both with one parameterized test or a small loop inside one test that calls ud30x9::max().pow(exponent) for exponents (2, 32) and expects ud30x9_base::EOverflow, ensuring the test name and expected_failure attribute reference pow and EOverflow accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@math/fixed_point/tests/ud30x9_tests/casting_tests.move`:
- Around line 4-8: Add an import for std::option so option::some() and
option::none() are in scope: update the top-of-file imports (where use
openzeppelin_fp_math::sd29x9, ud30x9, ud30x9_base, ud30x9_test_helpers::fixed,
and std::unit_test::assert_eq are declared) to include use std::option; so the
tests that call option::some and option::none compile.
---
Nitpick comments:
In `@math/fixed_point/tests/sd29x9_tests/helpers.move`:
- Around line 19-28: Add shared test constants (e.g., public(package) const
SCALE: u128 and any other repeated constants) into this helper module so all
SD29x9 tests can import them from one place; keep the existing factory helpers
(pos, neg) and assertion (expect) as-is (sd29x9::wrap, SD29x9, pos, neg, expect)
and update test files to use the centralized SCALE and other constants instead
of redefining them per-file. Ensure the constants are exported with
public(package) visibility and named consistently so callers can reference
SCALE, and add any additional commonly reused constants here to avoid
duplication across the SD29x9 suite.
In `@math/fixed_point/tests/ud30x9_tests/helpers.move`:
- Around line 19-25: The test suite duplicates SCALE and MAX_VALUE across UD30x9
test modules; move those shared constants into the same helpers.move module that
already defines fixed(value: u128): UD30x9 and expect(left: UD30x9, right:
UD30x9) so all tests import them from one place—add public(package) const SCALE
and MAX_VALUE (matching UD30x9 format) to the helpers.move file and update tests
to use helpers.SCALE and helpers.MAX_VALUE rather than redeclaring them, leaving
fixed and expect unchanged.
In `@math/fixed_point/tests/ud30x9_tests/pow_tests.move`:
- Around line 44-52: These two tests duplicate the same overflow behavior for
ud30x9::max().pow(...); consolidate by keeping a single overflow test (e.g.,
pow_overflow_aborts_for_large_base) that asserts the expected_failure(abort_code
= ud30x9_base::EOverflow) when calling ud30x9::max().pow(...) and remove the
other redundant test; alternatively, replace both with one parameterized test or
a small loop inside one test that calls ud30x9::max().pow(exponent) for
exponents (2, 32) and expects ud30x9_base::EOverflow, ensuring the test name and
expected_failure attribute reference pow and EOverflow accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fc97247c-22c4-484f-8266-a2506a69ba3d
📒 Files selected for processing (30)
math/fixed_point/tests/sd29x9_tests.movemath/fixed_point/tests/sd29x9_tests/abs_tests.movemath/fixed_point/tests/sd29x9_tests/arithmetic_tests.movemath/fixed_point/tests/sd29x9_tests/bitwise_tests.movemath/fixed_point/tests/sd29x9_tests/casting_tests.movemath/fixed_point/tests/sd29x9_tests/ceil_tests.movemath/fixed_point/tests/sd29x9_tests/comparison_tests.movemath/fixed_point/tests/sd29x9_tests/div_tests.movemath/fixed_point/tests/sd29x9_tests/floor_tests.movemath/fixed_point/tests/sd29x9_tests/helpers.movemath/fixed_point/tests/sd29x9_tests/mod_tests.movemath/fixed_point/tests/sd29x9_tests/mul_tests.movemath/fixed_point/tests/sd29x9_tests/negate_tests.movemath/fixed_point/tests/sd29x9_tests/pow_tests.movemath/fixed_point/tests/sd29x9_tests/unchecked_tests.movemath/fixed_point/tests/sd29x9_tests/wrap_tests.movemath/fixed_point/tests/ud30x9_tests.movemath/fixed_point/tests/ud30x9_tests/abs_tests.movemath/fixed_point/tests/ud30x9_tests/arithmetic_tests.movemath/fixed_point/tests/ud30x9_tests/bitwise_tests.movemath/fixed_point/tests/ud30x9_tests/casting_tests.movemath/fixed_point/tests/ud30x9_tests/ceil_tests.movemath/fixed_point/tests/ud30x9_tests/comparison_tests.movemath/fixed_point/tests/ud30x9_tests/div_tests.movemath/fixed_point/tests/ud30x9_tests/floor_tests.movemath/fixed_point/tests/ud30x9_tests/helpers.movemath/fixed_point/tests/ud30x9_tests/mul_tests.movemath/fixed_point/tests/ud30x9_tests/pow_tests.movemath/fixed_point/tests/ud30x9_tests/unchecked_tests.movemath/fixed_point/tests/ud30x9_tests/wrap_tests.move
💤 Files with no reviewable changes (2)
- math/fixed_point/tests/sd29x9_tests.move
- math/fixed_point/tests/ud30x9_tests.move
* ref: tests for fixed-point package (#248) * Removed test files aggregating all type's tests * Refactor fixed-point test suite, add more test cases * Format files * tests: apply AI comments * fix: apply review comments * fix: apply comment --------- Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com> * feat: update CHANGELOG (#249) * ref: apply auditor3 improvements to rc (#254) * feat: update CHANGELOG * feat: apply improvements * build: sui v1.67.3 (#252) * ref: apply auditor3 fp math improvements (#255) * feat: update CHANGELOG * feat: update comment * feat: add more doc entries * feat: add more comments * feat: apply copilot suggestions --------- Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com> Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
* ref: tests for fixed-point package (#248) * Removed test files aggregating all type's tests * Refactor fixed-point test suite, add more test cases * Format files * tests: apply AI comments * fix: apply review comments * fix: apply comment --------- Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com> * feat: update CHANGELOG (#249) * ref: apply auditor3 improvements to rc (#254) * feat: update CHANGELOG * feat: apply improvements * build: sui v1.67.3 (#252) * ref: apply auditor3 fp math improvements (#255) * feat: update CHANGELOG * feat: update comment * feat: add more doc entries * feat: add more comments * feat: apply copilot suggestions * build: Sui mainnet-v1.68.1 (#265) * test: change expect helper function into macro (#282) * test: change expect helper function into macro * test: fmt * test: remove expect macro * test: use assert_eq instead of .eq on fp values * fix: add missing 10^77 entry to u256::is_power_of_ten lookup table (#291) * fix: add missing 10^77 entry to u256::is_power_of_ten lookup table * chore: add missing PR id to changelog entry * docs: fix module name in quick_sort example docs (#296) * fix: Fixed-Point `pow` Now Uses Binary Exponentiation (#281) * ref: use binary exponentiation in sd29x9 pow * test: change pow invariant to exact result value * ref: add newline * doc: update * fix: assert base limit in sd29x9 pow * test: increase exp in pow_overflow_aborts_for_large_base * ref: apply binary exponentiation in ud30x9::pow * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Enhance pow_tests with grouping behavior check (#283) * Enhance pow_tests with grouping behavior check Add test for rounding behavior in binary exponentiation with large exponents. * Add expect_ne to sd29x9_pow_tests * Add inequality assertion macro for SD29x9 Added a new macro 'expect_ne' to assert inequality between two SD29x9 values. * Improve expect_ne macro with debugging output Refactor expect_ne macro to unwrap values and add debug output on assertion failure. * Refactor expect_ne macro for better readability Refactor expect_ne macro to unwrap values after assignment. * Fix debug print statements in assertion check * Enhance ud30x9 pow tests with expect_ne for validation Added expect_ne helper to validate non-equality in pow tests. * Enhance pow test with comment on exponent behavior Add comment about rounding/truncation behavior in pow test. * Update math/fixed_point/sources/sd29x9/sd29x9_base.move Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * test: Add expect_ne macro for inequality assertions in ud30x9 * Refactor pow test for clarity and reuse result * test: precalculate val.pow(255) in ud30x9 * test: fix to use fixed instead of pos in ud30x9 * refactor: extract binary_pow helper, replace expect with assert_eq in pow_tests, use pow(2) for overflow test Agent-Logs-Url: https://github.com/OpenZeppelin/contracts-sui/sessions/96584ab5-2b3d-4442-9775-45db402402a7 Co-authored-by: bidzyyys <25967634+bidzyyys@users.noreply.github.com> * refactor: format binary_pow parameters and adjust pow overflow test exponent * ref: revert pow logic: no longer use internal helper * test: remove redundant unwraps * test: revert changes to unwrap * ref: shadow exp instead of mutating fun param --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bidzyyys <25967634+bidzyyys@users.noreply.github.com> * fix: `EUnderflow` for `SD30x9` (N-03) (#297) * Fix audit issue N-03 * Add changelog entry --------- Co-authored-by: Eric Nordelo <eric.nordelo39@gmail.com> * fix: changed `mod`, add `rem` (L-03) (#301) * Add `rem` function for truncated remainder semantics on SD29x9 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Redefine `mod` on SD29x9 to use Euclidean remainder semantics Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update changelog * Improve the mod code slightly * Remove unnecessary dots from the changelog --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com> Co-authored-by: Nenad <nenad.misic@openzeppelin.com> * feat: improve fp math conversion API (#264) * feat: update CHANGELOG * feat: add conversion API * feat: add pending files * feat: improve API * feat: add missing files * feat: update CHANGELOG * feat: remove casting * feat: reuse macro constant * feat: apply review updates * fix: nits * feat: apply review updates --------- Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com> Co-authored-by: Nenad <nenad.misic@openzeppelin.com> * Remove SD29x9 bitwise operations (#285) * feat: update CHANGELOG * refactor: remove bitwise operations for SD --------- Co-authored-by: Nenad <nenad.misic@openzeppelin.com> * Rounding Direction improvements (L-06 & N-04) (#289) * feat: update CHANGELOG * feat: apply review updates * feat: add division checks * feat: apply review updates * feat: apply copilot suggestions * feat: centralize common helpers * feat: update CHNGELOG * feat: apply suggestion * ref: sd29x9::pow intermediate positive values are strictly < min. neg. value (#280) * ref: sd29x9::pow intermediate pos. value must be < min. neg. value * refactor: rename limit to min_negative and simplify overflow check in pow Agent-Logs-Url: https://github.com/OpenZeppelin/contracts-sui/sessions/af15164d-616a-4f49-9fd9-8abc5f612c5f Co-authored-by: 0xNeshi <19427053+0xNeshi@users.noreply.github.com> * chore: update changelog * chore: fix pr id * ref: rename min_negative->max_mag in wrap_components * refactor: use macro expressions for max whole value constants --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> * feat: Support both checked and unchecked versions of left and right shift (#288) * feat: rename lshift -> unchecked_lshift * chore: update changelog * docs: add missing error documentation for EOverflow in ud30x9 * ref: use ud30x9::zero instead of manual wrap(0) * feat: add new checked version of ud30x9::lshift * feat: rename ud30x9::rshift -> unchecked_rshift * feat: add new checked version of ud30x9::rshift * docs: mention unchecked shifts in README * chore: add missing PR ids to new changelog entries * ref: reimplement to avoid casts in lshift * ref: remove zero-value special cases from lshift and rshift * feat: add EInvalidShiftSize error for shift operations Replace EOverflow with EInvalidShiftSize for shift size validation in lshift and rshift functions. Update corresponding test cases to expect the new error code. * chore: fix pr id * chore: reword changelog * docs: clarify EOverflow range * docs: reference checked and unchecked shifts in each other's docs * chore: move back `rem` changeling * chore: remove rem entry from changed * refactor: use `std::u128::max_value!()` macro in `lshift` * build: Sui mainnet-v1.69.2 (#302) * ref: replace Lomuto partition with three-way partitioning in quicksort (#298) * feat: use insertion sort for vectors with up to 10 elements * ref: replace Lomuto partition with three-way partitioning in quicksort Replace the Lomuto partition scheme with three-way partitioning (Dutch National Flag scheme) to handle duplicate elements more efficiently. Move insertion sort optimization from preprocessing to inline handling of small sub-partitions (≤10 elements) during partitioning. Remove the standalone `insertion_sort_by` helper macro as it's now inlined. * chore: changelog * chore: fix wording in changelog * fix: update vector size check * docs: reword three way partition comment * test: add quick_sort tests * test: remove redundant quick_sort test cases Remove three test cases that are already covered by existing tests: quick_sort_partition_edge_case_pivot - Subset of quick_sort_already_sorted; ≤10 elements doesn't test pivot quick_sort_single_large_value_at_start - Same pattern as quick_sort_mostly_sorted_with_one_outlier quick_sort_single_small_value_at_end - Same pattern as quick_sort_mostly_sorted_with_one_outlier_at_end * ref: swap in insertion sort only when prev. is strictly less * test: remove comment mentions of specific code lines * test: clarify comment and fix test function name Update comment in quick_sort_by_descending_large_vector to clarify that >10 elements forces quicksort partitioning before insertion sort. Rename quick_sort_by_sort_by_id_ascending to quick_sort_by_id_ascending to remove redundant "sort_by" prefix. * chore: mention quick_sort in changelog * docs: align generic type name with actual quick_sort_by generic name * test: increase code coverage with quick_sort tests * Revert "test: increase code coverage with quick_sort tests" This reverts commit 47439ca. * docs: clarify quick_sort worst-case complexity and comparator requirements Update documentation for `quick_sort` and `quick_sort_by` to clarify that O(n²) worst-case is practically unreachable due to median-of-three pivot selection and three-way partitioning. Add warning that strict comparators (e.g., `<` instead of `<=`) can degrade performance to O(n²) with duplicate elements by defeating three-way partitioning optimization. * docs: clarify impact of sctrict comparison operators * docs: soften wording for worst case scenario * test: ensure quick_sort_by_median_of_three_crafted_inputs covers all branches * fix: handle empty, single-element & edge cases in quick_sort * docs: align range notation for eq_end --------- Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com> * feat: update CHANGELOG * feat: update error constant name * Fix error constant name (#303) * feat: update CHANGELOG * feat: update error constant name * fix: CHANGELOG * fix: comment * Add audit reports (#305) * feat: update CHANGELOG * feat: add audits * feat: add published info --------- Co-authored-by: immrsd <103599616+immrsd@users.noreply.github.com> Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com> Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com> Co-authored-by: Nenad <nenad.misic@openzeppelin.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bidzyyys <25967634+bidzyyys@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Primary changes
fixed-pointtest suite by splitting test cases in separate filesSummary by CodeRabbit