Skip to content

Refactored equalWithinVariance to use it with any custom variance#255

Merged
UlyanaAndrukhiv merged 6 commits intomainfrom
UlianaAndrukhiv/equalWithinVariance-refactoring
Mar 23, 2026
Merged

Refactored equalWithinVariance to use it with any custom variance#255
UlyanaAndrukhiv merged 6 commits intomainfrom
UlianaAndrukhiv/equalWithinVariance-refactoring

Conversation

@UlyanaAndrukhiv
Copy link
Contributor

Context

This PR refactors the equalWithinVariance test helper to support any custom variance and improves how variance comparisons are used throughout the code. It decouples the function from hard‑coded assumptions, making tests and logic that rely on approximate equality clearer and more flexible.

Tests were updated to use the new custom variance.

@UlyanaAndrukhiv UlyanaAndrukhiv marked this pull request as ready for review March 10, 2026 14:21
@UlyanaAndrukhiv UlyanaAndrukhiv requested a review from a team as a code owner March 10, 2026 14:21
@UlyanaAndrukhiv UlyanaAndrukhiv requested review from a team, holyfuchs and zhangchiqing March 10, 2026 15:53
Base automatically changed from UlianaAndrukhiv/211-update-fee-rates to main March 19, 2026 14:44
@holyfuchs
Copy link
Member

A few test files still use inline variance logic instead of equalWithinVariance

  • rebalance_undercollateralised_test.cdc (lines 96, 101)
  • rebalance_overcollateralised_test.cdc (lines 90, 94)
  • position_lifecycle_happy_test.cdc (lines 67–68)
  • auto_borrow_behavior_test.cdc (lines 78, 88)
  • interest_curve_advanced_test.cdc (lines 195–196, 233–234, 268–269, 431–435, 660–664)

Would be good to convert these to use equalWithinVariance for consistency.

@UlyanaAndrukhiv
Copy link
Contributor Author

@holyfuchs, I’ve updated the remaining test files for consistency

Co-authored-by: patrick <72362902+holyfuchs@users.noreply.github.com>
@UlyanaAndrukhiv UlyanaAndrukhiv merged commit 786f928 into main Mar 23, 2026
1 check passed
@UlyanaAndrukhiv UlyanaAndrukhiv deleted the UlianaAndrukhiv/equalWithinVariance-refactoring branch March 23, 2026 09:25
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.

3 participants