Skip to content

Commit 6343062

Browse files
davekay100abarmat
authored andcommitted
Rename recoveryPause to partialPause
1 parent 6cdea71 commit 6343062

File tree

10 files changed

+48
-46
lines changed

10 files changed

+48
-46
lines changed

cli/commands/protocol/get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const gettersList = {
4949
'controller-governor': { contract: 'Controller', name: 'governor' },
5050
'controller-get-contract-proxy': { contract: 'Controller', name: 'getContractProxy' },
5151
'controller-get-paused': { contract: 'Controller', name: 'paused' },
52-
'controller-get-recovery-paused': { contract: 'Controller', name: 'recoveryPaused' },
52+
'controller-get-partial-paused': { contract: 'Controller', name: 'partialPaused' },
5353
'controller-get-pause-guardian': { contract: 'Controller', name: 'pauseGuardian' },
5454
}
5555

cli/commands/protocol/set.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const settersList = {
5555
'controller-accept-governor': { contract: 'Controller', name: 'acceptOwnership' },
5656
'controller-set-contract-proxy': { contract: 'Controller', name: 'setContractProxy' },
5757
'controller-set-paused': { contract: 'Controller', name: 'setPaused' },
58-
'controller-set-recovery-paused': { contract: 'Controller', name: 'setRecoveryPaused' },
58+
'controller-set-partial-paused': { contract: 'Controller', name: 'setPartialPaused' },
5959
'controller-set-pause-guardian': { contract: 'Controller', name: 'setPauseGuardian' },
6060
}
6161

contracts/curation/Curation.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
175175
function mint(bytes32 _subgraphDeploymentID, uint256 _tokens)
176176
external
177177
override
178-
notRecoveryPaused
178+
notPartialPaused
179179
returns (uint256)
180180
{
181181
address curator = msg.sender;
@@ -233,7 +233,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable, ICuration {
233233
function burn(bytes32 _subgraphDeploymentID, uint256 _signal)
234234
external
235235
override
236-
notRecoveryPaused
236+
notPartialPaused
237237
returns (uint256, uint256)
238238
{
239239
address curator = msg.sender;

contracts/governance/Controller.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ contract Controller is IController, Governed, Pausable {
6161
}
6262

6363
/**
64-
* @notice Change the recovery paused state of the contract
65-
* Recovery pause is intented as a partial pause of the protocol
64+
* @notice Change the partial paused state of the contract
65+
* Partial pause is intented as a partial pause of the protocol
6666
*/
67-
function setRecoveryPaused(bool _recoveryPaused) external onlyGovernorOrGuardian {
68-
_setRecoveryPaused(_recoveryPaused);
67+
function setPartialPaused(bool _partialPaused) external onlyGovernorOrGuardian {
68+
_setPartialPaused(_partialPaused);
6969
}
7070

7171
/**
@@ -100,9 +100,9 @@ contract Controller is IController, Governed, Pausable {
100100
}
101101

102102
/**
103-
* @notice Getter to access recovery paused
103+
* @notice Getter to access partial pause status
104104
*/
105-
function recoveryPaused() external override view returns (bool) {
106-
return _recoveryPaused;
105+
function partialPaused() external override view returns (bool) {
106+
return _partialPaused;
107107
}
108108
}

contracts/governance/IController.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ interface IController {
1313

1414
function paused() external view returns (bool);
1515

16-
function recoveryPaused() external view returns (bool);
16+
function partialPaused() external view returns (bool);
1717
}

contracts/governance/Managed.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ contract Managed {
2121
event ParameterUpdated(string param);
2222
event SetController(address controller);
2323

24-
function _notRecoveryPaused() internal view {
24+
function _notPartialPaused() internal view {
2525
require(!controller.paused(), "Paused");
26-
require(!controller.recoveryPaused(), "Recovery-paused");
26+
require(!controller.partialPaused(), "Partial-paused");
2727
}
2828

2929
function _paused() internal view {
3030
require(!controller.paused(), "Paused");
3131
}
3232

33-
modifier notRecoveryPaused {
34-
_notRecoveryPaused();
33+
modifier notPartialPaused {
34+
_notPartialPaused();
3535
_;
3636
}
3737

contracts/governance/Pausable.sol

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
pragma solidity ^0.6.12;
22

33
contract Pausable {
4-
// Two types of pausing in the protocol
5-
bool internal _recoveryPaused;
4+
// Partial paused paused exit and enter functions for GRT, but not internal
5+
// functions, such as allocating
6+
bool internal _partialPaused;
7+
// Paused will pause all major protocol functions
68
bool internal _paused;
79

810
// Time last paused for both pauses
9-
uint256 public lastPauseRecoveryTime;
11+
uint256 public lastPausePartialTime;
1012
uint256 public lastPauseTime;
1113

1214
// Pause guardian is a separate entity from the governor that can pause
1315
address public pauseGuardian;
1416

15-
event RecoveryPauseChanged(bool isPaused);
17+
event PartialPauseChanged(bool isPaused);
1618
event PauseChanged(bool isPaused);
1719
event NewPauseGuardian(address oldPauseGuardian, address pauseGuardian);
1820

1921
/**
20-
* @notice Change the recovery paused state of the contract
22+
* @notice Change the partial paused state of the contract
2123
*/
22-
function _setRecoveryPaused(bool _toPause) internal {
23-
if (_toPause == _recoveryPaused) {
24+
function _setPartialPaused(bool _toPause) internal {
25+
if (_toPause == _partialPaused) {
2426
return;
2527
}
26-
_recoveryPaused = _toPause;
27-
if (_recoveryPaused) {
28-
lastPauseRecoveryTime = now;
28+
_partialPaused = _toPause;
29+
if (_partialPaused) {
30+
lastPausePartialTime = now;
2931
}
30-
emit RecoveryPauseChanged(_recoveryPaused);
32+
emit PartialPauseChanged(_partialPaused);
3133
}
3234

3335
/**

contracts/staking/Staking.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ contract Staking is StakingV1Storage, GraphUpgradeable, IStaking {
512512
* @param _indexer Adress of the indexer
513513
* @param _tokens Amount of tokens to stake
514514
*/
515-
function stakeTo(address _indexer, uint256 _tokens) public override notRecoveryPaused {
515+
function stakeTo(address _indexer, uint256 _tokens) public override notPartialPaused {
516516
require(_tokens > 0, "Cannot stake zero tokens");
517517

518518
// Transfer tokens to stake from caller to this contract
@@ -529,7 +529,7 @@ contract Staking is StakingV1Storage, GraphUpgradeable, IStaking {
529529
* @dev Unstake tokens from the indexer stake, lock them until thawing period expires.
530530
* @param _tokens Amount of tokens to unstake
531531
*/
532-
function unstake(uint256 _tokens) external override notRecoveryPaused {
532+
function unstake(uint256 _tokens) external override notPartialPaused {
533533
address indexer = msg.sender;
534534
Stakes.Indexer storage indexerStake = stakes[indexer];
535535

@@ -621,7 +621,7 @@ contract Staking is StakingV1Storage, GraphUpgradeable, IStaking {
621621
* @param _indexer Address of the indexer to delegate tokens to
622622
* @param _tokens Amount of tokens to delegate
623623
*/
624-
function delegate(address _indexer, uint256 _tokens) external override notRecoveryPaused {
624+
function delegate(address _indexer, uint256 _tokens) external override notPartialPaused {
625625
address delegator = msg.sender;
626626

627627
// Transfer tokens to delegate to this contract
@@ -639,7 +639,7 @@ contract Staking is StakingV1Storage, GraphUpgradeable, IStaking {
639639
* @param _indexer Address of the indexer where tokens had been delegated
640640
* @param _shares Amount of shares to return and undelegate tokens
641641
*/
642-
function undelegate(address _indexer, uint256 _shares) external override notRecoveryPaused {
642+
function undelegate(address _indexer, uint256 _shares) external override notPartialPaused {
643643
_undelegate(msg.sender, _indexer, _shares);
644644
}
645645

test/governance/pausing.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ describe('Pausing', () => {
1717
let staking: Staking
1818
let controller: Controller
1919

20-
const setRecoveryPause = async (account: Account, setValue: boolean) => {
21-
const tx = controller.connect(account.signer).setRecoveryPaused(setValue)
22-
await expect(tx).emit(controller, 'RecoveryPauseChanged').withArgs(setValue)
23-
expect(await controller.recoveryPaused()).eq(setValue)
20+
const setPartialPause = async (account: Account, setValue: boolean) => {
21+
const tx = controller.connect(account.signer).setPartialPaused(setValue)
22+
await expect(tx).emit(controller, 'PartialPauseChanged').withArgs(setValue)
23+
expect(await controller.partialPaused()).eq(setValue)
2424
}
2525
const setPause = async (account: Account, setValue: boolean) => {
2626
const tx = controller.connect(account.signer).setPaused(setValue)
@@ -51,29 +51,29 @@ describe('Pausing', () => {
5151
const tx = controller.connect(me.signer).setPauseGuardian(guardian.address)
5252
await expect(tx).revertedWith('Only Governor can call')
5353
})
54-
it('should set recoveryPause and unset from governor and guardian', async function () {
55-
expect(await controller.recoveryPaused()).eq(false)
54+
it('should set partialPaused and unset from governor and guardian', async function () {
55+
expect(await controller.partialPaused()).eq(false)
5656
// Governor set
57-
await setRecoveryPause(governor, true)
57+
await setPartialPause(governor, true)
5858
// Governor unset
59-
await setRecoveryPause(governor, false)
59+
await setPartialPause(governor, false)
6060

6161
await controller.connect(governor.signer).setPauseGuardian(guardian.address)
6262
// Guardian set
63-
await setRecoveryPause(guardian, true)
63+
await setPartialPause(guardian, true)
6464
// Guardian unset
65-
await setRecoveryPause(guardian, false)
65+
await setPartialPause(guardian, false)
6666
})
67-
it('should fail recovery pause if not guardian or governor', async function () {
67+
it('should fail partial pause if not guardian or governor', async function () {
6868
const tx = controller.connect(me.signer).setPauseGuardian(guardian.address)
6969
await expect(tx).revertedWith('Only Governor can call')
7070
})
71-
it('should check that a function fails when recoveryPause is set', async function () {
72-
await setRecoveryPause(governor, true)
71+
it('should check that a function fails when partialPause is set', async function () {
72+
await setPartialPause(governor, true)
7373

7474
const tokensToStake = toGRT('100')
7575
const tx = staking.connect(me.signer).stake(tokensToStake)
76-
await expect(tx).revertedWith('Recovery-paused')
76+
await expect(tx).revertedWith('Partial-paused')
7777
})
7878
it('should set pause and unset from governor and guardian', async function () {
7979
expect(await controller.paused()).eq(false)

test/lib/fixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class NetworkFixture {
5252

5353
// Unpause the protocol
5454
await controller.connect(deployer).setPaused(false)
55-
await controller.connect(deployer).setRecoveryPaused(false)
55+
await controller.connect(deployer).setPartialPaused(false)
5656

5757
return {
5858
controller,

0 commit comments

Comments
 (0)