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.
We have a few functions associated with calculating the absolute max short:
calculate_max_short_upper_bound
--> max only considering yieldspace curveabsolute_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 guessThey 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)
absolute_max_short_guess
does not always a return solvent resultcalculate_absolute_max_short
often throws errors from insolvent guesses, resulting in many tests having to catch panics and errors whenever using the function.