Skip to content

Commit

Permalink
reset chain when skipping fuzz loop
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Dec 17, 2024
1 parent 119f54c commit ee792ad
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/hyperdrive-math/src/short/max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ mod tests {

let min_share_reserves = state.calculate_min_share_reserves(checkpoint_exposure)?;

// Make sure a short is possible.
// Check that a short is possible.
if state
.effective_share_reserves()?
.min(state.share_reserves())
Expand Down Expand Up @@ -992,6 +992,9 @@ mod tests {
if state.effective_share_reserves()?
< state.calculate_min_share_reserves(checkpoint_exposure)?
{
chain.revert(id).await?;
alice.reset(Default::default()).await?;
// Don't need to reset bob because he hasn't done anything.
continue;
}

Expand Down Expand Up @@ -1110,6 +1113,10 @@ mod tests {
if state.effective_share_reserves()?
< state.calculate_min_share_reserves(checkpoint_exposure)?
{
chain.revert(id).await?;
alice.reset(Default::default()).await?;
bob.reset(Default::default()).await?;
celine.reset(Default::default()).await?;
continue;
}

Expand Down
14 changes: 14 additions & 0 deletions crates/hyperdrive-math/src/short/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,10 @@ mod tests {
if original_state.effective_share_reserves()?
< original_state.calculate_min_share_reserves(checkpoint_exposure)?
{
chain.revert(id).await?;
alice.reset(Default::default()).await?;
bob.reset(Default::default()).await?;
celine.reset(Default::default()).await?;
continue;
}

Expand Down Expand Up @@ -880,6 +884,9 @@ mod tests {
if state.effective_share_reserves()?
< state.calculate_min_share_reserves(checkpoint_exposure)?
{
chain.revert(id).await?;
alice.reset(Default::default()).await?;
bob.reset(Default::default()).await?;
continue;
}

Expand Down Expand Up @@ -1022,6 +1029,9 @@ mod tests {
if state.effective_share_reserves()?
< state.calculate_min_share_reserves(checkpoint_exposure)?
{
chain.revert(id).await?;
alice.reset(Default::default()).await?;
bob.reset(Default::default()).await?;
continue;
}

Expand Down Expand Up @@ -1193,6 +1203,10 @@ mod tests {
if state.effective_share_reserves()?
< state.calculate_min_share_reserves(checkpoint_exposure)?
{
chain.revert(id).await?;
alice.reset(Default::default()).await?;
bob.reset(Default::default()).await?;
celine.reset(Default::default()).await?;
continue;
}

Expand Down
4 changes: 4 additions & 0 deletions crates/hyperdrive-math/src/test_utils/preamble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ mod tests {
if state.effective_share_reserves()?
< state.calculate_min_share_reserves(checkpoint_exposure)?
{
chain.revert(id).await?;
alice.reset(Default::default()).await?;
bob.reset(Default::default()).await?;
celine.reset(Default::default()).await?;
continue;
}

Expand Down

0 comments on commit ee792ad

Please sign in to comment.