delvtech / hyperdrive-rs

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

Dry up test preamble; code cleanup #142

Closed dpaiton closed 4 months ago

dpaiton commented 4 months ago

Resolved Issues

Making testing more consistent to help narrow problems found when investigating https://github.com/delvtech/hyperdrive-rs/issues/29

Description

NOTE:

I had to increase test tolerance for fuzz_sol_calc_open_short from 1e9 to 10e18. My best guess as to why this happened is because we're now testing a wider variety of valid states and we're hitting error modes. I know that calculate_open_short does not match solidity exactly, so most likely this is the source of the error. I added a comment as a reminder in #29, but for now I think we should live with the high tolerance.

That being said, I encourage the reviewer to look carefully. I may have missed a change in this PR that is causing such a big error.