Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapting the test to the latest client code #7

Draft
wants to merge 126 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
c8b4b4d
Committing KaaS Compute Setup for RV Testing / Development
F-WRunTime Jun 12, 2024
c2db612
Test using variables to get org name / repo name
F-WRunTime Jun 12, 2024
bb73582
Merge conflict resolution
F-WRunTime Jun 12, 2024
ef5a282
Revert changes to lido-ci.yml for merge into parent repo
lucasmt Jun 12, 2024
740b5c5
Committing KaaS Compute Setup for RV Testing / Development
F-WRunTime Jun 12, 2024
3e2804d
Test using variables to get org name / repo name
F-WRunTime Jun 12, 2024
979bd73
Merge conflict resolution
F-WRunTime Jun 12, 2024
bef8491
Adding workflow_dispatch event triggers
F-WRunTime Jun 14, 2024
49c836f
Add StETH token model
lucasmt Jun 17, 2024
29d4c76
Add new version of Escrow model using rebasable StETH token
lucasmt Jun 17, 2024
dd713cf
Rename original Escrow model to EscrowNonRebasable.sol
lucasmt Jun 18, 2024
e145cbc
Make the Escrow version using StETH the default Escrow contract in th…
lucasmt Jun 18, 2024
ee7d042
Adapt VetoSignalling tests to StETH
lucasmt Jun 18, 2024
51c4470
Split off test set-up and helper functions into separate base contract
lucasmt Jun 18, 2024
ac347ff
Reduce SMT timeout in run-kontrol.sh script
lucasmt Jun 18, 2024
b074a16
Add test to run-kontrol.sh script
lucasmt Jun 18, 2024
1cc7737
Update versions.json to the latest kontrol version
lucasmt Jun 18, 2024
4eff4c7
Adjust StETH model to be closer to original StETH contract
lucasmt Jun 21, 2024
748790e
renaming contracts for easier use with Kontrol
PetarMax Jun 21, 2024
19fb17a
additional lemma for cleaning up specification of getRageQuitSupport
PetarMax Jun 22, 2024
e26f832
assumptions
PetarMax Jun 22, 2024
5f84969
Refactor DualGovernanceSetUp into 3 contracts for more fine-grained f…
lucasmt Jun 24, 2024
a8b7377
Make Escrow storage setup compatible with the new storage layout of t…
lucasmt Jun 24, 2024
f26be16
Fix assumptions on StETHModel to avoid division by 0 problem
lucasmt Jun 25, 2024
ac4dde4
Rename variable in comment of DualGovernanceSetUp
lucasmt Jun 25, 2024
538c657
Add --verbose and --max-frontier-parallel options to run-kontrol.sh s…
lucasmt Jun 25, 2024
28ee0ed
further limiting branching
PetarMax Jun 22, 2024
7ab371f
additional constraints to minimise calls to calculateDynamicTimelock
PetarMax Jun 22, 2024
5e3c1e8
merge
PetarMax Jun 26, 2024
a825995
Update unlock function in EscrowModel to unlock all of the user's shares
lucasmt Jul 1, 2024
eb9461c
Add EscrowAccountingTest
lucasmt Jul 1, 2024
7320f8d
Add EscrowAccounting tests to run-kontrol.sh script
lucasmt Jul 1, 2024
5317bd2
Add EscrowOperationsTest and update Setup
qian-hu Jul 4, 2024
235f93d
Add EscrowOperations tests to run-kontrol.sh script
qian-hu Jul 4, 2024
9e0f326
Add postconditions to testLockStEth and testUnlockStEth, accounting f…
lucasmt Jul 5, 2024
2946832
Adapt tests from model to client code
lucasmt Jul 8, 2024
9c3062c
Add VetoCooldownTest
lucasmt Jul 8, 2024
51e37c5
Merge branch 'develop' into tests-on-client-code
lucasmt Jul 8, 2024
6fa07ac
Adapt to latest updates
lucasmt Jul 8, 2024
22d1d3b
Remove VetoCooldown test from list for now
lucasmt Jul 8, 2024
fb9de96
Fix issues in DualGovernanceModel and EmergencyProtectedTimelockModel
qian-hu Jul 9, 2024
89217a2
Update kontrol to latest version
lucasmt Jul 10, 2024
d7ee973
Move top-level Status enum inside WithdrawalBatchesQueue library
lucasmt Jul 10, 2024
d6d86de
Add constants to WithdrawalQueue model
lucasmt Jul 10, 2024
ef49604
Fix issues in setUp() function
lucasmt Jul 10, 2024
efc341d
Set a concrete block.chainid in EscrowAccountingTest
lucasmt Jul 10, 2024
97f97ec
Relabel comments on STORAGE and WORD symbolic variables
lucasmt Jul 10, 2024
625220e
Relabel STORAGE and WORD comments on EscrowAccountingTest as well
lucasmt Jul 10, 2024
cd197c0
Remove unused arguments in storage setup functions
lucasmt Jul 10, 2024
0fa97c4
Fixed assumptions on _signallingEscrowStorageSetup to adapt to the cl…
lucasmt Jul 10, 2024
bc55c63
polishing of lemmas
PetarMax Jul 10, 2024
ef29411
Limiting times to year 3058
PetarMax Jul 10, 2024
326d8ae
correction
PetarMax Jul 11, 2024
9a24862
one more correction
PetarMax Jul 11, 2024
a49c11c
Add RageQuitTest
lucasmt Jul 12, 2024
9ad09b0
Add additional EscrowAccounting tests
lucasmt Jul 12, 2024
03f7acf
Add batchesQueue to storage setup
lucasmt Jul 15, 2024
08fba87
Update comment on EscrowAccountingTest to account for batchesQueue
lucasmt Jul 15, 2024
f3caac7
StorageSetup: Status -> WithdrawalsBatchesQueue.Status
lucasmt Jul 15, 2024
31a3351
Changes to reproduce mockFunction crash
lucasmt Jul 17, 2024
cef5dd0
New version of kontrol-cheatcodes
lucasmt Jul 17, 2024
3d2f27b
Refactor tests for using mockFunction cheatcode
lucasmt Jul 20, 2024
5336955
Move assumptions back to ...StorageSetup functions to avoid TooManyIt…
lucasmt Jul 21, 2024
ed2cb4e
further externals
PetarMax Jul 22, 2024
be33180
further external calls
PetarMax Jul 23, 2024
acad7bb
removing mock
PetarMax Jul 23, 2024
76553bc
minor adjustments
PetarMax Jul 23, 2024
05baf70
Adapt EscrowOperations tests to latest updates
qian-hu Jul 23, 2024
6baf163
Revert EscrowOperationsTest base to EscrowAccountingTest
qian-hu Jul 23, 2024
b170211
simplified mocks and more
PetarMax Jul 24, 2024
12b447b
full test with full mock
PetarMax Jul 24, 2024
97feb0d
full test
PetarMax Jul 24, 2024
b19c812
unlock test, further simplifications, streamlining of fresh variables
PetarMax Jul 26, 2024
cc713a5
merge with tests-on-client-code
PetarMax Jul 26, 2024
d127e46
further merging
PetarMax Jul 26, 2024
acaf186
corrections
PetarMax Jul 26, 2024
cfdb6a1
Revert EscrowOperationsTest base to EscrowAccountingTest
qian-hu Jul 23, 2024
83e85fa
further corrections
PetarMax Jul 26, 2024
b6c977d
Merge remote-tracking branch 'origin/petar/external-functions-in-setu…
PetarMax Jul 26, 2024
f4e2678
Refine assumptions in testUnlockStEth
lucasmt Jul 27, 2024
7895266
Fix asserts in testUnlockStEth
lucasmt Jul 29, 2024
d27e88b
Fix typo in testVetoCooldownDuration
lucasmt Jul 29, 2024
0ca16a0
tests
PetarMax Jul 29, 2024
34e3adf
much better slot update lemmas, version 1
PetarMax Jul 29, 2024
15351bc
more tests and lemmas
PetarMax Jul 29, 2024
c55fe77
corrections to storage slot 8
PetarMax Jul 29, 2024
de0de8d
escrow correctness test
PetarMax Jul 30, 2024
38d0724
isolating rageQuit cases
PetarMax Jul 30, 2024
d2160f8
simplification correction
PetarMax Jul 30, 2024
1bd6f38
Move to master branch to run code
F-WRunTime Jul 31, 2024
37a27e3
KOntrol version > 0.1.380
F-WRunTime Jul 31, 2024
d4ee537
Fix calculation for rage quit support
qian-hu Aug 1, 2024
e4762ca
invariant check correction
PetarMax Aug 2, 2024
eb7ebd3
rearranging testDeactivationNotCancelled
PetarMax Aug 3, 2024
ad10520
Update test and summary for unlockStETH
lucasmt Aug 6, 2024
3bfceaf
Add missing bound in StorageSetup
lucasmt Aug 6, 2024
bc09d7a
Add lemmas for testUnlockStEth
lucasmt Aug 6, 2024
6f5cb23
Add stETH assumptions and invariants
lucasmt Aug 6, 2024
e73ae0a
redesigning establish
PetarMax Aug 5, 2024
73aef2a
gradually establishing invariants
PetarMax Aug 7, 2024
485e593
adding VetoSignalling invariant
PetarMax Aug 8, 2024
aa72a4d
VetoCooldown
PetarMax Aug 8, 2024
a7d9694
Update CI configurations
qian-hu Aug 8, 2024
18e0047
testDeactivationNotCancelled
PetarMax Aug 8, 2024
e61ea55
removing fourth invariant from ...ArePreserved
PetarMax Aug 8, 2024
b3c083d
Add ProposalOperations tests
qian-hu Aug 9, 2024
0dc5424
Refactor ProposalOperation tests
qian-hu Aug 9, 2024
9cbf486
proposal tests, mirroring mechanism
PetarMax Aug 9, 2024
c0dca20
corrections
PetarMax Aug 10, 2024
25ac0b5
corrections
PetarMax Aug 10, 2024
98d46e3
correction
PetarMax Aug 10, 2024
8ac38de
corrections
PetarMax Aug 12, 2024
b3394e6
new tests
PetarMax Aug 13, 2024
c2fd803
Add assumptions to EscrowAccountingTest
qian-hu Aug 16, 2024
ad66780
Update CI configurations
qian-hu Aug 16, 2024
0fda36c
Update dependencies
qian-hu Aug 16, 2024
473bcd7
Add kontrol.toml, restructure scripts, and update CI config
qian-hu Aug 16, 2024
1c9abbc
tweaking parameters
PetarMax Aug 16, 2024
272c711
lemma correction
PetarMax Aug 21, 2024
63727d8
lemma corrections
PetarMax Aug 21, 2024
9ac62f3
Update Kontrol version
qian-hu Aug 21, 2024
a6eb909
adjusting lemmas to Kontrol 1.0
PetarMax Aug 24, 2024
088597b
adding auxiliary lemmas
PetarMax Sep 2, 2024
b03139f
minor corrections, adding syntactics
PetarMax Sep 3, 2024
2922d2e
Update Kontrol version
qian-hu Sep 30, 2024
d48291a
Update lido-ci.yml and run-kontrol.sh
qian-hu Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/lido-ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
name: "Test Proofs"
on:
workflow_dispatch:
push:
branches:
- develop
- rvdevelop
- tests-on-client-code
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -23,10 +26,9 @@
-H "Authorization: Bearer ${{ secrets.RV_COMPUTE_TOKEN }}" \
https://github.com/repos/runtimeverification/_kaas_lidofinance_dual-governance/actions/workflows/lido-ci.yml/dispatches \
-d '{
"ref": "develop",
"ref": "master",
"inputs": {
"branch_name": "'"${{ github.event.pull_request.head.sha || github.sha }}"'",
"extra_args": "script",
"statuses_sha": "'$sha'",
"org": "${{ github.repository_owner }}",
"repository": "${{ github.event.repository.name }}",
Expand Down
3 changes: 2 additions & 1 deletion contracts/interfaces/IStETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ interface IStETH is IERC20 {

function getPooledEthByShares(uint256 sharesAmount) external view returns (uint256);

function transferShares(address to, uint256 amount) external;
function transferShares(address to, uint256 amount) external returns (uint256);
function transferSharesFrom(
address _sender,
address _recipient,
uint256 _sharesAmount
) external returns (uint256);
function sharesOf(address _account) external view returns (uint256);
}
33 changes: 22 additions & 11 deletions contracts/libraries/DualGovernanceState.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity 0.8.23;

import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

import {IEscrow} from "../interfaces/IEscrow.sol";
import {ISealable} from "../interfaces/ISealable.sol";
Expand Down Expand Up @@ -297,14 +298,14 @@ library DualGovernanceState {
DualGovernanceConfig memory config,
uint256 rageQuitSupport
) private pure returns (bool) {
return rageQuitSupport > config.firstSealRageQuitSupport;
return rageQuitSupport >= config.firstSealRageQuitSupport;
}

function _isSecondSealRageQuitSupportCrossed(
DualGovernanceConfig memory config,
uint256 rageQuitSupport
) private pure returns (bool) {
return rageQuitSupport > config.secondSealRageQuitSupport;
return rageQuitSupport >= config.secondSealRageQuitSupport;
}

function _isDynamicTimelockMaxDurationPassed(
Expand All @@ -327,7 +328,17 @@ library DualGovernanceState {
Store storage self,
DualGovernanceConfig memory config
) private view returns (bool) {
return Timestamps.now() > config.vetoSignallingMinActiveDuration.addTo(self.vetoSignallingReactivationTime);
return Timestamps.now()
> config.vetoSignallingMinActiveDuration.addTo(
Timestamp.wrap(
uint40(
Math.max(
Timestamp.unwrap(self.vetoSignallingActivationTime),
Timestamp.unwrap(self.vetoSignallingReactivationTime)
)
)
)
);
}

function _isVetoSignallingDeactivationMaxDurationPassed(
Expand Down Expand Up @@ -381,15 +392,15 @@ library DualGovernanceState {
return Durations.ZERO;
}

if (rageQuitSupport >= secondSealRageQuitSupport) {
return dynamicTimelockMaxDuration;
if (rageQuitSupport < secondSealRageQuitSupport) {
return dynamicTimelockMinDuration
+ Durations.from(
(rageQuitSupport - firstSealRageQuitSupport)
* (dynamicTimelockMaxDuration - dynamicTimelockMinDuration).toSeconds()
/ (secondSealRageQuitSupport - firstSealRageQuitSupport)
);
}

duration_ = dynamicTimelockMinDuration
+ Durations.from(
(rageQuitSupport - firstSealRageQuitSupport)
* (dynamicTimelockMaxDuration - dynamicTimelockMinDuration).toSeconds()
/ (secondSealRageQuitSupport - firstSealRageQuitSupport)
);
return dynamicTimelockMaxDuration;
}
}
22 changes: 11 additions & 11 deletions contracts/libraries/WithdrawalBatchesQueue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import {ArrayUtils} from "../utils/arrays.sol";
import {SequentialBatch, SequentialBatches} from "../types/SequentialBatches.sol";

enum Status {
// The default status of the WithdrawalsBatchesQueue. In the closed state the only action allowed
// to be called is open(), which transfers it into Opened state.
Empty,
// In the Opened state WithdrawalsBatchesQueue allows to add batches into the queue
Opened,
// When the WithdrawalsBatchesQueue enters Filled queue - it's not allowed to add batches and
// only allowed to mark batches claimed
Closed
}

struct QueueIndex {
uint32 batchIndex;
uint16 valueIndex;
Expand All @@ -26,6 +15,17 @@ struct QueueIndex {
library WithdrawalsBatchesQueue {
using SafeCast for uint256;

enum Status {
// The default status of the WithdrawalsBatchesQueue. In the closed state the only action allowed
// to be called is open(), which transfers it into Opened state.
Empty,
// In the Opened state WithdrawalsBatchesQueue allows to add batches into the queue
Opened,
// When the WithdrawalsBatchesQueue enters Filled queue - it's not allowed to add batches and
// only allowed to mark batches claimed
Closed
}

struct State {
Status status;
QueueIndex lastClaimedUnstETHIdIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/Math.sol";

import "./EmergencyProtectedTimelock.sol";
import "./Escrow.sol";
import "./EmergencyProtectedTimelockModel.sol";
import "./EscrowModel.sol";

/**
* @title Dual Governance Mechanism
Expand All @@ -13,7 +13,7 @@ import "./Escrow.sol";
*/

// DualGovernance contract to handle proposal submissions and lifecycle management.
contract DualGovernance {
contract DualGovernanceModel {
enum State {
Normal,
VetoSignalling,
Expand All @@ -22,13 +22,12 @@ contract DualGovernance {
RageQuit
}

EmergencyProtectedTimelock public emergencyProtectedTimelock;
Escrow public signallingEscrow;
Escrow public rageQuitEscrow;
EmergencyProtectedTimelockModel public emergencyProtectedTimelock;
EscrowModel public signallingEscrow;
EscrowModel public rageQuitEscrow;
address public fakeETH;

// State Variables
State public currentState;
mapping(address => bool) public proposers;
mapping(address => bool) public admin_proposers;
uint256 public lastStateChangeTime;
Expand All @@ -37,6 +36,8 @@ contract DualGovernance {
uint256 public lastVetoSignallingTime;
uint256 public rageQuitSequenceNumber;

State public currentState;

// Constants
uint256 public constant FIRST_SEAL_RAGE_QUIT_SUPPORT = 10 ** 16; // Threshold required for transition from Normal to Veto Signalling state (1%).
uint256 public constant SECOND_SEAL_RAGE_QUIT_SUPPORT = 10 ** 17; // Transition to Rage Quit occurs if t - t^S_{act} > DynamicTimelockMaxDuration and R > SecondSealRageQuitSupport (10%).
Expand All @@ -52,8 +53,8 @@ contract DualGovernance {
currentState = State.Normal;
lastStateChangeTime = block.timestamp;
fakeETH = _fakeETH;
emergencyProtectedTimelock = new EmergencyProtectedTimelock(address(this), emergencyProtectionTimelock);
signallingEscrow = new Escrow(address(this), _fakeETH);
emergencyProtectedTimelock = new EmergencyProtectedTimelockModel(address(this), emergencyProtectionTimelock);
signallingEscrow = new EscrowModel(address(this), _fakeETH);
}

// Operations
Expand Down Expand Up @@ -86,7 +87,7 @@ contract DualGovernance {
"Proposals can only be scheduled in Normal or Veto Cooldown states."
);
if (currentState == State.VetoCooldown) {
(,,, uint256 submissionTime,) = emergencyProtectedTimelock.proposals(proposalId);
(,, uint256 submissionTime,,) = emergencyProtectedTimelock.proposals(proposalId);
require(
submissionTime < lastVetoSignallingTime,
"Proposal submitted after the last time Veto Signalling state was entered."
Expand Down Expand Up @@ -117,7 +118,7 @@ contract DualGovernance {
function calculateDynamicTimelock(uint256 rageQuitSupport) public pure returns (uint256) {
if (rageQuitSupport <= FIRST_SEAL_RAGE_QUIT_SUPPORT) {
return 0;
} else if (rageQuitSupport < SECOND_SEAL_RAGE_QUIT_SUPPORT) {
} else if (rageQuitSupport <= SECOND_SEAL_RAGE_QUIT_SUPPORT) {
return linearInterpolation(rageQuitSupport);
} else {
return DYNAMIC_TIMELOCK_MAX_DURATION;
Expand All @@ -132,6 +133,13 @@ contract DualGovernance {
function linearInterpolation(uint256 rageQuitSupport) private pure returns (uint256) {
uint256 L_min = DYNAMIC_TIMELOCK_MIN_DURATION;
uint256 L_max = DYNAMIC_TIMELOCK_MAX_DURATION;
// Assumption: No underflow
require(FIRST_SEAL_RAGE_QUIT_SUPPORT <= rageQuitSupport);
// Assumption: No overflow
require(
((rageQuitSupport - FIRST_SEAL_RAGE_QUIT_SUPPORT) * (L_max - L_min)) / (L_max - L_min)
== (rageQuitSupport - FIRST_SEAL_RAGE_QUIT_SUPPORT)
);
return L_min
+ ((rageQuitSupport - FIRST_SEAL_RAGE_QUIT_SUPPORT) * (L_max - L_min))
/ (SECOND_SEAL_RAGE_QUIT_SUPPORT - FIRST_SEAL_RAGE_QUIT_SUPPORT);
Expand All @@ -149,7 +157,7 @@ contract DualGovernance {
signallingEscrow.startRageQuit();
rageQuitSequenceNumber++;
rageQuitEscrow = signallingEscrow;
signallingEscrow = new Escrow(address(this), fakeETH);
signallingEscrow = new EscrowModel(address(this), fakeETH);
}

lastStateChangeTime = block.timestamp;
Expand Down Expand Up @@ -180,6 +188,11 @@ contract DualGovernance {
// State Transitions

function activateNextState() public {
// Assumption: various time stamps are in the past
require(lastStateChangeTime <= block.timestamp);
require(lastSubStateActivationTime <= block.timestamp);
require(lastStateReactivationTime <= block.timestamp);

uint256 rageQuitSupport = signallingEscrow.getRageQuitSupport();

State previousState;
Expand Down Expand Up @@ -224,12 +237,14 @@ contract DualGovernance {

// Check the conditions for transitioning to RageQuit or Veto Deactivation based on the time elapsed and support level.
if (
block.timestamp - lastStateChangeTime > DYNAMIC_TIMELOCK_MAX_DURATION
block.timestamp != lastStateChangeTime
&& block.timestamp - lastStateChangeTime > DYNAMIC_TIMELOCK_MAX_DURATION
&& rageQuitSupport > SECOND_SEAL_RAGE_QUIT_SUPPORT
) {
transitionState(State.RageQuit);
} else if (
block.timestamp - lastStateChangeTime > calculateDynamicTimelock(rageQuitSupport)
block.timestamp != lastStateChangeTime
&& block.timestamp - lastStateChangeTime > calculateDynamicTimelock(rageQuitSupport)
&& block.timestamp - Math.max(lastStateChangeTime, lastStateReactivationTime)
> VETO_SIGNALLING_MIN_ACTIVE_DURATION
) {
Expand All @@ -247,7 +262,8 @@ contract DualGovernance {
uint256 elapsed = block.timestamp - lastSubStateActivationTime;
// Check the conditions for transitioning to VetoCooldown or back to VetoSignalling
if (
block.timestamp - lastStateChangeTime <= calculateDynamicTimelock(rageQuitSupport)
block.timestamp == lastStateChangeTime
|| block.timestamp - lastStateChangeTime <= calculateDynamicTimelock(rageQuitSupport)
|| rageQuitSupport > SECOND_SEAL_RAGE_QUIT_SUPPORT
) {
exitSubState(State.VetoSignalling);
Expand All @@ -264,7 +280,7 @@ contract DualGovernance {
require(currentState == State.VetoCooldown, "Must be in Veto Cooldown state.");

// Ensure the Veto Cooldown has lasted for at least the minimum duration.
if (block.timestamp - lastStateChangeTime > VETO_COOLDOWN_DURATION) {
if (block.timestamp != lastStateChangeTime && block.timestamp - lastStateChangeTime > VETO_COOLDOWN_DURATION) {
// Depending on the level of rage quit support, transition to Normal or Veto Signalling.
if (rageQuitSupport <= FIRST_SEAL_RAGE_QUIT_SUPPORT) {
transitionState(State.Normal);
Expand All @@ -279,7 +295,7 @@ contract DualGovernance {
* Checks if withdrawal process is complete, cooldown period expired.
* Transitions to VetoCooldown if support has decreased below the threshold; otherwise, transitions to VetoSignalling.
*/
function fromRageQuit(uint256 rageQuitSupport) private {
function fromRageQuit(uint256 rageQuitSupport) public {
require(currentState == State.RageQuit, "Must be in Rage Quit state.");

// Check if the withdrawal process is completed and if the RageQuitExtensionDelay has elapsed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct Proposal {

// This contract manages the timelocking of proposals with emergency intervention capabilities.
// It provides controls for entering and managing emergency states as well as executing proposals under normal and emergency conditions.
contract EmergencyProtectedTimelock {
contract EmergencyProtectedTimelockModel {
// Addresses associated with governance roles and permissions.
address public governance;
address public emergencyGovernance;
Expand Down Expand Up @@ -124,11 +124,13 @@ contract EmergencyProtectedTimelock {
function cancelAllNonExecutedProposals() public {
require(msg.sender == governance, "Caller is not authorized to cancel proposal.");

// Loop through all the proposals stored in the contract.
for (uint256 i = 0; i < nextProposalId; i++) {
// Ensure that only proposals in 'Submitted' or 'Scheduled' status are canceled.
if (proposals[i].status != ProposalStatus.Executed) {
proposals[i].status = ProposalStatus.Canceled;
if (nextProposalId > 0) {
// Loop through all the proposals stored in the contract.
for (uint256 i = 0; i < nextProposalId; i++) {
// Ensure that only proposals in 'Submitted' or 'Scheduled' status are canceled.
if (proposals[i].status != ProposalStatus.Executed) {
proposals[i].status = ProposalStatus.Canceled;
}
}
}
}
Expand Down
Loading