delvtech / hyperdrive-rs

Rust SDK for the Hyperdrive AMM.
https://docs.rs/crate/hyperdrive-math/latest
Apache License 2.0
3 stars 0 forks source link

Tests fail when using large (but valid) `share_adjustment` #171

Open dpaiton opened 4 months ago

dpaiton commented 4 months ago

https://github.com/delvtech/hyperdrive-rs/pull/170 highlights that using the upper-bound on share_adjustment when generating a random state causes a set of tests to fail:

test lp::math::tests::fuzz_calculate_net_curve_trade_safe
test lp::math::tests::fuzz_calculate_present_value
test long::max::tests::fuzz_sol_calculate_max_long
test short::open::tests::test_defaults_calculate_spot_price_after_short

After an initial inspection, @jalextowle concluded that at least the fuzz_sol_calculate_max_long, fuzz_calculate_present_value, and fuzz_calculate_net_curve_trade_safe failures indicate a discrepancy between Rust and Solidity.

We need to dig into each test and correct it or the underlying code it is testing.