Skip to content

Commit

Permalink
test(medusa): false pos fix
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-something committed Dec 16, 2024
1 parent c0ffee2 commit c0ffeea
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
31 changes: 31 additions & 0 deletions test/invariants/Reproducers.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,35 @@ import {FuzzTest} from './FuzzTest.t.sol';
import {IEBORequestModule, IOracle} from './Setup.t.sol';

contract Reproducers is FuzzTest {
// forge test --match-test test_property_proposerProposeBeforeDeadline_0 -vv

function test_property_proposerProposeBeforeDeadline_0() public {
vm.roll(3);
vm.warp(5);
vm.prank(0x0000000000000000000000000000000000050000);
this.property_requesterCanAlwaysCreateRequest(
374_144_410_540_673_166_053_842_224_195_120_560_619_866_525_050_602,
5_986_310_706_507_378_352_962_293_074_772_827_676_701_747_093_414_338
);

vm.roll(3);
vm.warp(5);
vm.prank(0x0000000000000000000000000000000000080000);
this.property_proposerProposeBeforeDeadline(
28_269_553_036_454_149_273_332_760_011_729_145_844_444_279_663_245_845_661_993_448_680_761_270_657
);

vm.roll(3);
vm.warp(5);
vm.prank(0x00000000000000000000000000000000000a0000);
this.property_disputerCanAlwaysCreateDispute(
52_656_145_834_278_593_348_801_540_361_656_756_882_899_066_090_699_848_781_561_730_236,
23_384_028_043_587_125_922_018_477_620_072_735_176_296_069_636_430
);

vm.roll(3);
vm.warp(5);
vm.prank(0x0000000000000000000000000000000000080000);
this.property_proposerProposeBeforeDeadline(2_106_197_910_122_343_031_135_180_017_583_558_693_042_066_481_234);
}
}
3 changes: 3 additions & 0 deletions test/invariants/properties/PropertyDisputer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,12 @@ contract PropertyDisputer is HandlerParent {
} catch {
// add tying buffer to deadline

IBondEscalationModule.BondEscalation memory _escalation = bondEscalationModule.getEscalation(_disputeId);

assertTrue(
!_ghost_escalatedDisputes[_disputeId]
|| block.timestamp > oracle.disputeCreatedAt(_disputeId) + DISPUTE_DEADLINE
|| _escalation.status != IBondEscalationModule.BondEscalationStatus.Active
|| _totalPledgesFor(_disputeId) > _totalPledgesAgainst(_disputeId),
'property 8a: fails on pledging for the correct side'
);
Expand Down
8 changes: 5 additions & 3 deletions test/invariants/properties/PropertyProposer.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {IOracle} from '../Setup.t.sol';
import {IOracle, ValidatorLib} from '../Setup.t.sol';
import {HandlerParent} from '../handlers/HandlerParent.t.sol';

contract PropertyProposer is HandlerParent {
Expand Down Expand Up @@ -47,9 +47,11 @@ contract PropertyProposer is HandlerParent {

emit ResponseProposed(requestId, responseId);
} catch {
// property 3 and 4
// property 3 and 4 + cannot propose the same response twice
bytes32 responseId = ValidatorLib._validateResponse(requestData, responseData);

assertTrue(
activeResponses && (prevDisputeId == 0 || status == IOracle.DisputeStatus.Lost)
prevResponseId == responseId || activeResponses && (prevDisputeId == 0 || status == IOracle.DisputeStatus.Lost)
|| block.timestamp >= oracle.requestCreatedAt(requestId) + RESPONSE_DEADLINE,
'prop-3-4: fails but no active response disputed or with lost dispute'
);
Expand Down

0 comments on commit c0ffeea

Please sign in to comment.