Skip to content

Commit

Permalink
feat: debugging of broken properties
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo committed Nov 4, 2024
1 parent 7f6565c commit f510655
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 15 deletions.
38 changes: 23 additions & 15 deletions test/recon/CryticToFoundry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,46 @@ contract CryticToFoundry is Test, TargetFunctions, FoundryAsserts {

}

// forge test --match-test test_property_sum_of_initatives_matches_total_votes_strict_0 -vv
function test_property_sum_of_initatives_matches_total_votes_strict_0() public {
// forge test --match-test test_optimize_max_claim_underpay_assertion_0 -vv
function test_optimize_max_claim_underpay_assertion_0() public {

vm.warp(block.timestamp + 162964);
helper_accrueBold(1001125329789697909641);

vm.roll(block.number + 1);
check_warmup_unregisterable_consistency(0);

governance_depositLQTY(2);
optimize_max_claim_underpay_assertion();

vm.warp(block.timestamp + 471948);
}

// forge test --match-test test_property_sum_of_initatives_matches_total_votes_insolvency_assertion_mid_0 -vv
function test_property_sum_of_initatives_matches_total_votes_insolvency_assertion_mid_0() public {

vm.roll(block.number + 1);
governance_depositLQTY_2(1439490298322854874);

governance_allocateLQTY_clamped_single_initiative(0,2,0);
vm.roll(block.number + 1);
vm.warp(block.timestamp + 313704);
governance_depositLQTY(1);

vm.warp(block.timestamp + 344203);
vm.warp(block.timestamp + 413441);

vm.roll(block.number + 1);

governance_depositLQTY_2(2);
governance_allocateLQTY_clamped_single_initiative(0,1,0);

vm.warp(block.timestamp + 173473);

vm.roll(block.number + 1);

helper_deployInitiative();

governance_registerInitiative(1);

vm.warp(block.timestamp + 232088);

vm.roll(block.number + 1);
vm.warp(block.timestamp + 315415);
governance_allocateLQTY_clamped_single_initiative_2nd_user(1,1293868687551209131,0);

governance_allocateLQTY_clamped_single_initiative_2nd_user(1,268004076687567,0);

property_sum_of_initatives_matches_total_votes_strict();
property_sum_of_initatives_matches_total_votes_insolvency_assertion_mid();

}

}
8 changes: 8 additions & 0 deletions test/recon/properties/OptimizationProperties.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {MockStakingV1} from "test/mocks/MockStakingV1.sol";
import {vm} from "@chimera/Hevm.sol";
import {IUserProxy} from "src/interfaces/IUserProxy.sol";
import {GovernanceProperties} from "./GovernanceProperties.sol";
import {console} from "forge-std/console.sol";

// NOTE: These run only if you use `optimization` mode and set the correct prefix
// See echidna.yaml
Expand Down Expand Up @@ -148,8 +149,15 @@ abstract contract OptimizationProperties is GovernanceProperties {

if(votedPowerSum > govPower) {
delta = votedPowerSum - govPower;

console.log("votedPowerSum * 1e18 / govPower", votedPowerSum * 1e18 / govPower);
}

console.log("votedPowerSum", votedPowerSum);
console.log("govPower", govPower);
console.log("delta", delta);


t(delta < 1e18, "Delta is too big");
}

Expand Down

0 comments on commit f510655

Please sign in to comment.