diff --git a/crates/hyperdrive-math/src/long/max.rs b/crates/hyperdrive-math/src/long/max.rs index 7e3e1cbe..c67fec74 100644 --- a/crates/hyperdrive-math/src/long/max.rs +++ b/crates/hyperdrive-math/src/long/max.rs @@ -655,10 +655,9 @@ mod tests { }) { Ok(p) => match p { Ok(p) => p, - Err(_) => continue, + Err(_) => continue, // Err; the amount results in the pool being insolvent. }, - // If the amount results in the pool being insolvent, skip this iteration. - Err(_) => continue, + Err(_) => continue, // panic; likely in FixedPoint }; let p2 = match panic::catch_unwind(|| { diff --git a/crates/hyperdrive-math/src/short/open.rs b/crates/hyperdrive-math/src/short/open.rs index e63388cc..865b51cd 100644 --- a/crates/hyperdrive-math/src/short/open.rs +++ b/crates/hyperdrive-math/src/short/open.rs @@ -678,9 +678,9 @@ mod tests { }) { Ok(max_bond_amount) => match max_bond_amount { Ok(max_bond_amount) => max_bond_amount, - Err(_) => continue, + Err(_) => continue, // Err; max short insolvent }, - Err(_) => continue, + Err(_) => continue, // panic; likely in FixedPoint }; if max_bond_amount == fixed!(0) { continue; @@ -730,6 +730,10 @@ mod tests { alice.fund(contribution).await?; bob.fund(budget).await?; + // Alice initializes the pool. + // TODO: We'd like to set a random position duration & checkpoint duration. + alice.initialize(fixed_rate, contribution, None).await?; + // Set a random variable rate. let variable_rate = rng.gen_range(fixed!(0.01e18)..=fixed!(1e18)); let vault = MockERC4626::new( @@ -738,10 +742,6 @@ mod tests { ); vault.set_rate(variable_rate.into()).send().await?; - // Alice initializes the pool. - // TODO: We'd like to set a random position duration & checkpoint duration. - alice.initialize(fixed_rate, contribution, None).await?; - // Bob opens a short with a random bond amount. Before opening the // short, we calculate the implied rate. let bond_amount = rng.gen_range( diff --git a/crates/hyperdrive-math/src/test_utils/agent.rs b/crates/hyperdrive-math/src/test_utils/agent.rs index f26fe641..7b6e8be0 100644 --- a/crates/hyperdrive-math/src/test_utils/agent.rs +++ b/crates/hyperdrive-math/src/test_utils/agent.rs @@ -83,10 +83,9 @@ pub trait HyperdriveMathAgent { impl HyperdriveMathAgent for Agent, ChaCha8Rng> { /// Gets the current state of the pool. async fn get_state(&self) -> Result { - Ok(State::new( - self.get_config().clone(), - self.hyperdrive().get_pool_info().await?, - )) + let pool_config = self.get_config().clone(); + let pool_info = self.hyperdrive().get_pool_info().await?; + Ok(State::new(pool_config, pool_info)) } /// Gets the latest checkpoint. diff --git a/crates/hyperdrive-math/src/utils.rs b/crates/hyperdrive-math/src/utils.rs index b52ba5e2..15df333e 100644 --- a/crates/hyperdrive-math/src/utils.rs +++ b/crates/hyperdrive-math/src/utils.rs @@ -257,9 +257,9 @@ mod tests { }) { Ok(max_short) => match max_short { Ok(max_short) => max_short, - Err(_) => continue, // Max threw an Err. Don't finish this fuzz iteration. + Err(_) => continue, // Max threw an Err; don't finish this fuzz iteration. }, - Err(_) => continue, // Max threw a paanic. Don't finish this fuzz iteration. + Err(_) => continue, // Max threw a panic; don't finish this fuzz iteration. }; let max_rate = state.calculate_spot_rate_after_short(max_short, None)?; diff --git a/crates/hyperdrive-test-utils/src/constants.rs b/crates/hyperdrive-test-utils/src/constants.rs index dff57888..bb5bf7a0 100644 --- a/crates/hyperdrive-test-utils/src/constants.rs +++ b/crates/hyperdrive-test-utils/src/constants.rs @@ -10,8 +10,8 @@ lazy_static! { // The amount of fuzz runs that Hyperdrive fuzz tests will use. This is only // used by end-to-end fuzz tests that spin up all of the Hyperdrive machinery // since lower-level fuzz tests have less constraints. - pub static ref FUZZ_RUNS: u64 = env::var("HYPERDRIVE_FUZZ_RUNS").ok().map(|s| s.parse().unwrap()).unwrap_or(100); + pub static ref FUZZ_RUNS: u64 = env::var("HYPERDRIVE_FUZZ_RUNS").ok().map(|s| s.parse().unwrap()).unwrap_or(1_000); // The amount of fuzz runs that fast fuzz tests use. - pub static ref FAST_FUZZ_RUNS: u64 = env::var("HYPERDRIVE_FAST_FUZZ_RUNS").ok().map(|s| s.parse().unwrap()).unwrap_or(10_000); + pub static ref FAST_FUZZ_RUNS: u64 = env::var("HYPERDRIVE_FAST_FUZZ_RUNS").ok().map(|s| s.parse().unwrap()).unwrap_or(50_000); }