Skip to content

Commit

Permalink
VetoCooldown
Browse files Browse the repository at this point in the history
  • Loading branch information
PetarMax committed Aug 8, 2024
1 parent 485e593 commit aa72a4d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions test/kontrol/VetoCooldown.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ pragma solidity 0.8.23;
import "forge-std/Vm.sol";
import "kontrol-cheatcodes/KontrolCheats.sol";

import {Duration, Durations} from "contracts/types/Duration.sol";
import {addTo, Duration, Durations} from "contracts/types/Duration.sol";
import {Timestamp, Timestamps} from "contracts/types/Timestamp.sol";

import "test/kontrol/DualGovernanceSetUp.sol";

contract VetoCooldownTest is DualGovernanceSetUp {
function testVetoCooldownDuration() external {
vm.assume(dualGovernance.getCurrentState() == State.VetoCooldown);
Timestamp timeEnteredAt = Timestamp.wrap(_getEnteredAt(dualGovernance));
Timestamp maxCooldownDuration = addTo(config.VETO_COOLDOWN_DURATION(), timeEnteredAt);

dualGovernance.activateNextState();

bool stillInVetoCooldown = (dualGovernance.getCurrentState() == State.VetoCooldown);
Timestamp timeEnteredAt = Timestamp.wrap(_getEnteredAt(dualGovernance));
Duration timeInVetoCooldown = Durations.between(Timestamps.now(), timeEnteredAt);
bool durationHasElapsed = (timeInVetoCooldown > config.VETO_COOLDOWN_DURATION());
bool durationHasElapsed = (Timestamps.now() > maxCooldownDuration);
assert(stillInVetoCooldown != durationHasElapsed);
}
}
26 changes: 13 additions & 13 deletions test/kontrol/VetoSignalling.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -261,19 +261,19 @@ contract VetoSignallingTest is DualGovernanceSetUp {
// Establish third invariant
_vetoSignallingDeactivationInvariant(Mode.Assert, current);
}
// // Try establishing fourth invariant
// if (!_vetoSignallingMaxDelayInvariant(Mode.Try, current)) {
// // Assume third invariant if not already assumed
// if (!assumedDeactivationInvariant) {
// _vetoSignallingDeactivationInvariant(Mode.Assume, previous);
// }
// // Assume fourth invariant if not already assumed
// if (!assumedMaxDelayInvariant) {
// _vetoSignallingMaxDelayInvariant(Mode.Assume, previous);
// }
// // Establish fourth invariant
// _vetoSignallingMaxDelayInvariant(Mode.Assert, current);
// }
// Try establishing fourth invariant
if (!_vetoSignallingMaxDelayInvariant(Mode.Try, current)) {
// Assume third invariant if not already assumed
if (!assumedDeactivationInvariant) {
_vetoSignallingDeactivationInvariant(Mode.Assume, previous);
}
// Assume fourth invariant if not already assumed
if (!assumedMaxDelayInvariant) {
_vetoSignallingMaxDelayInvariant(Mode.Assume, previous);
}
// Establish fourth invariant
_vetoSignallingMaxDelayInvariant(Mode.Assert, current);
}
return;
}
vm.assume(currentState == State.VetoSignalling || currentState == State.VetoSignallingDeactivation);
Expand Down

0 comments on commit aa72a4d

Please sign in to comment.