Skip to content

Commit

Permalink
fix: invariant limit
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo committed Oct 19, 2024
1 parent 295ac1a commit 9af43f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {Multicall} from "./utils/Multicall.sol";
import {WAD, PermitParams} from "./utils/Types.sol";
import {safeCallWithMinGas} from "./utils/SafeCallMinGas.sol";


/// @title Governance: Modular Initiative based Governance
contract Governance is Multicall, UserProxyFactory, ReentrancyGuard, IGovernance {
using SafeERC20 for IERC20;
Expand Down Expand Up @@ -502,8 +503,8 @@ contract Governance is Multicall, UserProxyFactory, ReentrancyGuard, IGovernance
// Must be below, else we cannot reset"
// Makes cast safe
/// @audit INVARIANT: property_ensure_user_alloc_cannot_dos
assert(alloc.voteLQTY < uint88(type(int88).max));
assert(alloc.vetoLQTY < uint88(type(int88).max));
assert(alloc.voteLQTY <= uint88(type(int88).max));
assert(alloc.vetoLQTY <= uint88(type(int88).max));

// Cache, used to enforce limits later
cachedData[i] = ResetInitiativeData({
Expand Down
17 changes: 16 additions & 1 deletion test/recon/CryticToFoundry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,27 @@ contract CryticToFoundry is Test, TargetFunctions, FoundryAsserts {
property_BI04();
}


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

vm.roll(block.number + 1);
vm.warp(block.timestamp + 193521);
governance_depositLQTY(155989603725201422915398867);

vm.roll(block.number + 1);
vm.warp(block.timestamp + 411452);
governance_allocateLQTY_clamped_single_initiative(0,0,154742504910672534362390527);

property_resetting_never_reverts();

}

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

vm.roll(block.number + 1);
vm.warp(block.timestamp + 461046);
vm.prank(0x0000000000000000000000000000000000030000);
governance_depositLQTY(2);

vm.roll(block.number + 1);
Expand Down

0 comments on commit 9af43f3

Please sign in to comment.