Skip to content

Commit 2324420

Browse files
Fixed intermittent test failuires (#532)
* fixed intermittent test failuires * remove console
1 parent 76fc785 commit 2324420

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

contracts/src/HyperdriveLong.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ abstract contract HyperdriveLong is HyperdriveLP {
267267
// reserves and the bond reserves decreased, we must ensure that the
268268
// base reserves are greater than the longsOutstanding.
269269
if (
270-
_sharePrice.mulDown(_marketState.shareReserves) <
270+
_marketState.shareReserves <
271271
uint256(longsOutstanding_).divDown(_sharePrice) +
272272
_minimumShareReserves
273273
) {

contracts/src/HyperdriveShort.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ abstract contract HyperdriveShort is HyperdriveLP {
287287
// Since the share reserves are reduced, we need to verify that the base
288288
// reserves are greater than or equal to the amount of longs outstanding.
289289
if (
290-
_sharePrice.mulDown(shareReserves_) <
290+
shareReserves_ <
291291
uint256(_marketState.longsOutstanding).divDown(_sharePrice) +
292292
_minimumShareReserves
293293
) {

test/integrations/ERC4626Validation.t.sol

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,18 +440,20 @@ abstract contract ERC4626ValidationTest is HyperdriveTest {
440440
vm.startPrank(alice);
441441
shortAmount = shortAmount.normalizeToRange(
442442
0.00001e18,
443-
Lib.min(
444-
HyperdriveUtils.calculateMaxShort(hyperdrive),
445-
underlyingToken.balanceOf(alice)
446-
)
443+
Lib
444+
.min(
445+
HyperdriveUtils.calculateMaxShort(hyperdrive),
446+
underlyingToken.balanceOf(alice)
447+
)
448+
.mulDown(0.95e18)
447449
);
448450

449451
// Deposit into the actual ERC4626
450452
underlyingToken.approve(address(token), type(uint256).max);
451453
token.deposit(shortAmount, alice);
452454

453455
// Open the short
454-
(uint256 maturityTime, ) = openShortERC4626(alice, shortAmount, true);
456+
(uint256 maturityTime, ) = openShortERC4626(alice, shortAmount, false);
455457

456458
// The term passes and interest accrues.
457459
variableRate = variableRate.normalizeToRange(0, 2.5e18);

0 commit comments

Comments
 (0)