Skip to content

absolute max short bug #200

@dpaiton

Description

@dpaiton

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions