Skip to content

Commit

Permalink
increase number of iterations and tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Jan 11, 2025
1 parent b764db9 commit c065238
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/hyperdrive-math/src/short/max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ impl State {
/// deposit amount.
///
/// If the result is Ok then the answer is guaranteed to be within
/// `maybe_base_tolerance` of the target base amount (default is 1e9).
/// `maybe_base_tolerance` of the target base amount (default is 1e10).
///
/// Increasing `maybe_max_iterations` will increase the accuracy of the
/// result (default is 500).
/// result (default is 1_000).
pub fn calculate_short_bonds_given_deposit(
&self,
target_base_amount: FixedPoint<U256>,
Expand All @@ -103,8 +103,8 @@ impl State {
maybe_base_tolerance: Option<FixedPoint<U256>>,
maybe_max_iterations: Option<usize>,
) -> Result<FixedPoint<U256>> {
let base_tolerance = maybe_base_tolerance.unwrap_or(fixed!(1e9));
let max_iterations = maybe_max_iterations.unwrap_or(500);
let base_tolerance = maybe_base_tolerance.unwrap_or(fixed!(1e10));
let max_iterations = maybe_max_iterations.unwrap_or(1_000);

// The max bond amount might be below the pool's minimum.
// If so, no short can be opened.
Expand Down Expand Up @@ -1109,8 +1109,8 @@ mod tests {
#[tokio::test]
async fn fuzz_open_short_inversion() -> Result<()> {
let abs_max_bonds_tolerance = fixed_u256!(1e9);
let budget_base_tolerance = fixed_u256!(1e9);
let max_iterations = 500;
let budget_base_tolerance = fixed_u256!(1e10);
let max_iterations = 1_000;
let mut rng = thread_rng();

// Run the fuzz tests.
Expand Down

0 comments on commit c065238

Please sign in to comment.