Skip to content

Commit

Permalink
fix: use fetchPrice to get price in properties
Browse files Browse the repository at this point in the history
  • Loading branch information
nican0r committed Oct 22, 2024
1 parent 3ad19c5 commit 159808d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ abstract contract Properties is BeforeAfter, PropertiesDescriptions, Asserts, Pr
PriceFeedTestnet priceFeedMock,
CRLens crLens
) internal returns (bool) {
uint256 curentPrice = priceFeedMock.lastGoodPrice();
return crLens.quoteRealTCR() == cdpManager.getSyncedTCR(curentPrice);
uint256 currentPrice = priceFeedMock.fetchPrice();
return crLens.quoteRealTCR() == cdpManager.getSyncedTCR(currentPrice);
}

function invariant_GENERAL_13(
Expand All @@ -478,7 +478,7 @@ abstract contract Properties is BeforeAfter, PropertiesDescriptions, Asserts, Pr
) internal returns (bool) {
bytes32 currentCdp = sortedCdps.getFirst();

uint256 _price = priceFeedMock.lastGoodPrice();
uint256 _price = priceFeedMock.fetchPrice();

// Compare synched with quote for all Cdps
while (currentCdp != bytes32(0)) {
Expand Down
33 changes: 13 additions & 20 deletions packages/contracts/foundry_test/ForkToFoundry.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,29 @@ contract ForkToFoundry is
}

// forge test --match-test test_asserts_GENERAL_12_1 -vv
// @audit passes without warping
function test_asserts_GENERAL_12_1() public {
// NOTE: from reproducer test immediately breaks but when asserts_test_fail is commented it doesn't
vm.roll(block.number + 60364);
vm.warp(block.timestamp + 11077);
asserts_active_pool_invariant_5();
// vm.roll(block.number + 60364);
// vm.warp(block.timestamp + 11077);
// asserts_active_pool_invariant_5();

// NOTE: removing this assertion and warp causes a failure
// vm.roll(block.number + 1984);
// vm.warp(block.timestamp + 322370);
// asserts_test_fail();
// // NOTE: removing this assertion and warp causes a failure
// // vm.roll(block.number + 1984);
// // vm.warp(block.timestamp + 322370);
// // asserts_test_fail();

vm.roll(block.number + 33560);
vm.warp(block.timestamp + 95);
asserts_GENERAL_12();
// vm.roll(block.number + 33560);
// vm.warp(block.timestamp + 95);
// asserts_GENERAL_12();
// ========================

// NOTE: from shrunken logs breaks immediately
// vm.roll(block.number + 1);
// vm.warp(block.timestamp + 2973);
// asserts_GENERAL_12();
vm.roll(block.number + 1);
vm.warp(block.timestamp + 2973);
asserts_GENERAL_12();
}

// forge test --match-test test_asserts_GENERAL_13_2 -vv
// @audit this fails only for blocks/timestamps at which echidna tests fail
function test_asserts_GENERAL_13_2() public {
// NOTE: from shrunken logs
// vm.roll(block.number + 1);
Expand All @@ -104,9 +102,4 @@ contract ForkToFoundry is

asserts_GENERAL_13();
}

// NOTE: sanity check
function test_asserts_GENERAL_14() public {
asserts_GENERAL_14();
}
}

0 comments on commit 159808d

Please sign in to comment.