Skip to content

Commit

Permalink
Merge branch 'fix-reset-votes' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo committed Oct 19, 2024
2 parents 578a57e + a4add3d commit 9c11366
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 31 deletions.
50 changes: 32 additions & 18 deletions test/recon/CryticToFoundry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,43 @@ contract CryticToFoundry is Test, TargetFunctions, FoundryAsserts {
property_sum_of_initatives_matches_total_votes();
}

// forge test --match-test test_property_sum_of_initatives_matches_total_votes_5 -vv
function test_property_sum_of_initatives_matches_total_votes_5() public {
// forge test --match-test test_property_sum_of_initatives_matches_total_votes_5 -vv
function test_property_sum_of_initatives_matches_total_votes_5() public {
governance_depositLQTY(2);

vm.roll(block.number + 1);
vm.warp(block.timestamp + 856945);

governance_depositLQTY(2);
governance_allocateLQTY_clamped_single_initiative(0, 133753, 0);
helper_deployInitiative();

vm.roll(block.number + 1);
vm.warp(block.timestamp + 856945);
vm.roll(block.number + 1);
vm.warp(block.timestamp + 315310);
governance_registerInitiative(1);

vm.roll(block.number + 1);
vm.warp(block.timestamp + 366454);
governance_depositLQTY(1);
governance_allocateLQTY_clamped_single_initiative(1, 1338466836127459, 0);
vm.roll(block.number + 1);
vm.warp(block.timestamp + 276119);
property_sum_of_initatives_matches_total_votes();
}

governance_allocateLQTY_clamped_single_initiative(0,133753,0);
helper_deployInitiative();
// forge test --match-test test_check_unregisterable_consistecy_0 -vv
function test_check_unregisterable_consistecy_0() public {
vm.roll(block.number + 1);
vm.warp(block.timestamp + 385918);
governance_depositLQTY(2);

vm.roll(block.number + 1);
vm.warp(block.timestamp + 315310);
governance_registerInitiative(1);
vm.roll(block.number + 1);
vm.warp(block.timestamp + 300358);
governance_allocateLQTY_clamped_single_initiative(0, 0, 1);

vm.roll(block.number + 1);
vm.warp(block.timestamp + 366454);
governance_depositLQTY(1);
governance_allocateLQTY_clamped_single_initiative(1,1338466836127459,0);
vm.roll(block.number + 1);
vm.warp(block.timestamp + 276119);
property_sum_of_initatives_matches_total_votes();
vm.roll(block.number + 1);
vm.warp(block.timestamp + 525955);
property_resetting_never_reverts();

}
check_unregisterable_consistecy(0);
}
}
13 changes: 0 additions & 13 deletions test/recon/properties/GovernanceProperties.sol
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,7 @@ abstract contract GovernanceProperties is BeforeAfter {



// Resetting never fails and always resets
function property_resetting_never_reverts() public {
int88[] memory zeroes = new int88[](deployedInitiatives.length);

try governance.allocateLQTY(deployedInitiatives, deployedInitiatives, zeroes, zeroes) {} catch {
t(false, "must never revert");
}

(uint88 user_allocatedLQTY, ) = governance.userStates(user);

eq(user_allocatedLQTY, 0, "User has 0 allocated on a reset");
}

// After resetting the sum of votes is always correct


function property_sum_of_initatives_matches_total_votes() public {
Expand Down
13 changes: 13 additions & 0 deletions test/recon/targets/GovernanceTargets.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ abstract contract GovernanceTargets is BaseTargetFunctions, Properties {
}
}

// Resetting never fails and always resets
function property_resetting_never_reverts() withChecks public {
int88[] memory zeroes = new int88[](deployedInitiatives.length);

try governance.allocateLQTY(deployedInitiatives, deployedInitiatives, zeroes, zeroes) {} catch {
t(false, "must never revert");
}

(uint88 user_allocatedLQTY, ) = governance.userStates(user);

eq(user_allocatedLQTY, 0, "User has 0 allocated on a reset");
}

// For every previous epoch go grab ghost values and ensure they match snapshot
// For every initiative, make ghost values and ensure they match
// For all operations, you also need to add the VESTED AMT?
Expand Down

0 comments on commit 9c11366

Please sign in to comment.