Skip to content

Commit

Permalink
test: ensure SpotPriceAfterBelowSpotPriceBefore is never thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
0xteddybear committed Jul 26, 2024
1 parent 1112382 commit 57c17b0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/invariants/fuzz/Protocol.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ contract FuzzProtocol is EchidnaTest {

// 19
assert(pool.isFinalized());
} catch {
} catch (bytes memory errorData) {
if (keccak256(errorData) == IBPool.BPool_SpotPriceAfterBelowSpotPriceBefore.selector) {
assert(false);
}
assert(
// above max ratio
_amountIn > bnum.bmul_exposed(tokens[_tokenIn].balanceOf(address(pool)), bconst.MAX_IN_RATIO())
Expand Down Expand Up @@ -296,7 +299,10 @@ contract FuzzProtocol is EchidnaTest {

// 19
assert(pool.isFinalized());
} catch {
} catch (bytes memory errorData) {
if (keccak256(errorData) == IBPool.BPool_SpotPriceAfterBelowSpotPriceBefore.selector) {
assert(false);
}
uint256 _spotBefore = bmath.calcSpotPrice(
tokens[_tokenIn].balanceOf(address(pool)),
pool.getDenormalizedWeight(address(tokens[_tokenIn])),
Expand Down

0 comments on commit 57c17b0

Please sign in to comment.