Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update calc open short & target long #956

Merged
merged 6 commits into from
Apr 11, 2024
Merged

Conversation

dpaiton
Copy link
Contributor

@dpaiton dpaiton commented Apr 9, 2024

Resolved Issues

partially addresses delvtech/hyperdrive-rs#40

Description

  • The calculate_open_short was written at a different time from calculate_open_long; I updated it so that they follow the same process.
    edit: this caused trouble for reasons I can't explain but probably have to do with share/base conversions. I reverted it, but left some new error stuff.

  • I also added some better error checking in calculate_targeted_long so that it can safely return in what was previously considered an error state.

  • I added a new random test variable, the target rate itself, in the calculate_targeted_long tests.

Review Checklists

Please check each item before approving the pull request. While going
through the checklist, it is recommended to leave comments on items that are
referenced in the checklist to make sure that they are reviewed. If there are
multiple reviewers, copy the checklists into sections titled ## [Reviewer Name].
If the PR doesn't touch Solidity and/or Rust, the corresponding checklist can
be removed.

[[Reviewer Name]]

Rust

  • Testing
    • Are there new or updated unit or integration tests?
    • Do the tests cover the happy paths?
    • Do the tests cover the unhappy paths?
    • Are there an adequate number of fuzz tests to ensure that we are
      covering the full input space?
    • If matching Solidity behavior, are there differential fuzz tests that
      ensure that Rust matches Solidity?

crates/hyperdrive-math/src/long/targeted.rs Show resolved Hide resolved
crates/hyperdrive-math/src/long/targeted.rs Outdated Show resolved Hide resolved
crates/hyperdrive-math/src/long/targeted.rs Outdated Show resolved Hide resolved
@dpaiton dpaiton force-pushed the dpaiton/update-calc-open-short branch from 7027594 to 998f154 Compare April 11, 2024 20:58
@dpaiton dpaiton added this pull request to the merge queue Apr 11, 2024
Merged via the queue into main with commit b97f2c8 Apr 11, 2024
36 checks passed
@dpaiton dpaiton deleted the dpaiton/update-calc-open-short branch April 11, 2024 22:11
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.

2 participants