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

absolute max short bug #200

Open
dpaiton opened this issue Oct 4, 2024 · 0 comments · May be fixed by #193
Open

absolute max short bug #200

dpaiton opened this issue Oct 4, 2024 · 0 comments · May be fixed by #193
Assignees

Comments

@dpaiton
Copy link
Contributor

dpaiton commented Oct 4, 2024

We have a few functions associated with calculating the absolute max short:

calculate_max_short_upper_bound --> max only considering yieldspace curve
absolute_max_short_guess --> one-shot approximation to the Hyperdrive pool's max short (incl fees & solvency reqs)
calculate_absolute_max_short --> iterative method for refining pool's absolute max short guess

They all seem to have some problems.

  • calculate_max_short_upper_bound fails this test:
- tolerance = some small value (ideally zero)
- initialize & trade to a random state on-chain
- ys_max = state.calculate_max_short_upper_bound()
- celine.open_short(ys_max)
- new_max = state.calculate_max_short_upper_bound()
- assert!(new_max <= tolerance)

I'm seeing failures with tolerances on the order of 1e36.

  • absolute_max_short_guess does not always a return solvent result

  • calculate_absolute_max_short often throws errors from insolvent guesses, resulting in many tests having to catch panics and errors whenever using the function.

@dpaiton dpaiton self-assigned this Oct 4, 2024
@dpaiton dpaiton linked a pull request Oct 4, 2024 that will close this issue
7 tasks
@dpaiton dpaiton linked a pull request Dec 10, 2024 that will close this issue
7 tasks
@dpaiton dpaiton linked a pull request Dec 20, 2024 that will close this issue
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 a pull request may close this issue.

1 participant