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

124 add functions in the contracts that allow minstake and mindelegation to be changeable by the governor #11

Merged
Changes from 1 commit
Commits
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
Prev Previous commit
fix md
SamBorisov committed May 10, 2024
commit 0d6b04e2fb887de679746abb4059cdb783ed0286
23 changes: 14 additions & 9 deletions docs/ValidatorSet/ValidatorSet.md
Original file line number Diff line number Diff line change
@@ -246,32 +246,37 @@ function bls() external view returns (contract IBLS)
|---|---|---|
| _0 | contract IBLS | undefined |

### changeWithdrawalWaitPeriod
### changeMinStake

```solidity
function changeWithdrawalWaitPeriod(uint256 newWaitPeriod) external nonpayable
function changeMinStake(uint256 newMinStake) external nonpayable
```

Changes the withdrawal wait period.
Changes minimum stake required for validators.

*This function should be called only by the Governed contract.*
*Should be called by the Governance.*

### changeMinStake
#### Parameters

| Name | Type | Description |
|---|---|---|
| newMinStake | uint256 | New minimum stake |

### changeWithdrawalWaitPeriod

```solidity
function changeMinStake(uint256 newMinStake) external nonpayable
function changeWithdrawalWaitPeriod(uint256 newWaitPeriod) external nonpayable
```

Changes minimum stake required for validators.
Changes the withdrawal wait period.

*Should be called by the Governance.*
*This function should be called only by the Governed contract.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| newWaitPeriod | uint256 | The new withdrawal wait period. MUST be longer than a single epoch (in some realistic worst-case scenario) in case somebody's stake needs to be penalized. |
| newMinStake | uint256 | New minimum stake |

### commitEpoch

23 changes: 14 additions & 9 deletions docs/ValidatorSet/modules/Staking/Staking.md
Original file line number Diff line number Diff line change
@@ -144,32 +144,37 @@ function bls() external view returns (contract IBLS)
|---|---|---|
| _0 | contract IBLS | undefined |

### changeWithdrawalWaitPeriod
### changeMinStake

```solidity
function changeWithdrawalWaitPeriod(uint256 newWaitPeriod) external nonpayable
function changeMinStake(uint256 newMinStake) external nonpayable
```

Changes the withdrawal wait period.
Changes minimum stake required for validators.

*This function should be called only by the Governed contract.*
*Should be called by the Governance.*

### changeMinStake
#### Parameters

| Name | Type | Description |
|---|---|---|
| newMinStake | uint256 | New minimum stake |

### changeWithdrawalWaitPeriod

```solidity
function changeMinStake(uint256 newMinStake) external nonpayable
function changeWithdrawalWaitPeriod(uint256 newWaitPeriod) external nonpayable
```

Changes minimum stake required for validators.
Changes the withdrawal wait period.

*Should be called by the Governance.*
*This function should be called only by the Governed contract.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| newWaitPeriod | uint256 | The new withdrawal wait period. MUST be longer than a single epoch (in some realistic worst-case scenario) in case somebody's stake needs to be penalized. |
| newMinStake | uint256 | New minimum stake |

### currentEpochId


Unchanged files with check annotations Beta

pragma solidity 0.8.17;
import "./IBLS.sol";

Check warning on line 29 in contracts/BLS/BLS.sol

GitHub Actions / lint

global import of path ./IBLS.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import {ModexpInverse, ModexpSqrt} from "./libs/ModExp.sol";
/**
) external view returns (bool checkResult, bool callSuccess) {
uint256 size = pubkeys.length;
// solhint-disable-next-line reason-string
require(size > 0, "BLS: number of public key is zero");

Check warning on line 110 in contracts/BLS/BLS.sol

GitHub Actions / lint

Use Custom Errors instead of require statements
// solhint-disable-next-line reason-string
require(size == messages.length, "BLS: number of public keys and messages must be equal");

Check warning on line 112 in contracts/BLS/BLS.sol

GitHub Actions / lint

Use Custom Errors instead of require statements
uint256 inputSize = (size + 1) * 6;
uint256[] memory input = new uint256[](inputSize);
input[0] = signature[0];
) external view returns (bool checkResult, bool callSuccess) {
uint256 size = pubkeys.length;
// solhint-disable-next-line reason-string
require(size > 0, "BLS: number of public key is zero");

Check warning on line 151 in contracts/BLS/BLS.sol

GitHub Actions / lint

Use Custom Errors instead of require statements
uint256 inputSize = (size + 1) * 6;
uint256[] memory input = new uint256[](inputSize);
input[0] = signature[0];
invalid()
}
}
require(success, "BLS: bn add call failed");

Check warning on line 201 in contracts/BLS/BLS.sol

GitHub Actions / lint

Use Custom Errors instead of require statements
return p0;
}
*/
function mapToPoint(uint256 _x) external pure returns (uint256[2] memory p) {
// solhint-disable-next-line reason-string
require(_x < N, "mapToPointFT: invalid field element");

Check warning on line 210 in contracts/BLS/BLS.sol

GitHub Actions / lint

Use Custom Errors instead of require statements
uint256 x = _x;
(, bool decision) = sqrt(x);
a1 = addmod(a1, 3, N);
(a1, found) = sqrt(a1);
// solhint-disable-next-line reason-string
require(found, "BLS: bad ft mapping implementation");

Check warning on line 265 in contracts/BLS/BLS.sol

GitHub Actions / lint

Use Custom Errors instead of require statements
if (!decision) {
a1 = N - a1;
}
*/
pragma solidity 0.8.17;

Check warning on line 27 in contracts/BLS/libs/ModExp.sol

GitHub Actions / lint

Found more than One contract per file. 2 contracts found!
/**
@title Compute Inverse by Modular Exponentiation
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";

Check warning on line 4 in contracts/common/Governed/Governed.sol

GitHub Actions / lint

global import of path @openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
abstract contract Governed is AccessControlUpgradeable {
function __Governed_init(address governer) internal onlyInitializing {

Check warning on line 7 in contracts/common/Governed/Governed.sol

GitHub Actions / lint

Function name must be in mixedCase
__AccessControl_init();
__Governed_init_unchained(governer);
}