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

Fix bulk register validator #298

Merged
merged 10 commits into from
Apr 15, 2024
4 changes: 2 additions & 2 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
uses: actions/checkout@v3

- name: Run Slither
uses: crytic/slither-action@v0.3.0
uses: crytic/slither-action@v0.3.2
id: slither
with:
node-version: 18
fail-on: high
slither-args: --exclude controlled-delegatecall
slither-args: --exclude controlled-delegatecall,incorrect-return
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### [v1.1.1] 2024-04-12
- [7b61d4f](https://github.com/bloxapp/ssv-network/commit/7b61d4f) - [Fix] Revert when passing an empty public keys list.

## [Released]

### [v1.1.0] 2024-01-08
- [c80dc3b](https://github.com/bloxapp/ssv-network/commit/c80dc3b) - [Feature] Bulk exit of validators.
- [6431a00](https://github.com/bloxapp/ssv-network/commit/6431a00) - [Feature] Bulk removal of validators.
Expand All @@ -15,8 +20,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- [7564dfe](https://github.com/bloxapp/ssv-network/commit/7564dfe) - [Feature] Integration ssv-keys in ssv-network for generating keyshares.
- [8647401](https://github.com/bloxapp/ssv-network/commit/8647401) - [Update]: Configuration for publishing npm package.

## [Released]

### [v1.0.2] 2023-11-08
- [8f5df42](https://github.com/bloxapp/ssv-network/commit/8f5df42633d2b92c6bb70253a41e6afa80b9f111) - Change ValidatorExited signature: owner indexed.

Expand Down
1 change: 1 addition & 0 deletions contracts/interfaces/ISSVNetworkCore.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.18;

interface ISSVNetworkCore {

Check warning on line 4 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Contract has 36 states declarations but allowed no more than 15
/***********/
/* Structs */
/***********/
Expand Down Expand Up @@ -58,10 +58,10 @@
/* Errors */
/**********/

error CallerNotOwner(); // 0x5cd83192

Check warning on line 61 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Variable name must be in mixedCase

Check warning on line 61 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Explicitly mark visibility of state
error CallerNotWhitelisted(); // 0x8c6e5d71

Check warning on line 62 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Variable name must be in mixedCase

Check warning on line 62 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Explicitly mark visibility of state
error FeeTooLow(); // 0x732f9413

Check warning on line 63 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Variable name must be in mixedCase

Check warning on line 63 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Explicitly mark visibility of state
error FeeExceedsIncreaseLimit(); // 0x958065d9

Check warning on line 64 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Variable name must be in mixedCase

Check warning on line 64 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Explicitly mark visibility of state
error NoFeeDeclared(); // 0x1d226c30
error ApprovalNotWithinTimeframe(); // 0x97e4b518
error OperatorDoesNotExist(); // 0x961e3e8c
Expand All @@ -87,8 +87,9 @@
error MaxValueExceeded(); // 0x91aa3017
error FeeTooHigh(); // 0xcd4e6167
error PublicKeysSharesLengthMismatch(); // 0x9ad467b8
error IncorrectValidatorStateWithData(bytes publicKey); // 0x89307938

Check failure on line 90 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 4 spaces but found 42
error ValidatorAlreadyExistsWithData(bytes publicKey); // 0x388e7999

Check failure on line 91 in contracts/interfaces/ISSVNetworkCore.sol

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 4 spaces but found 41
error EmptyPublicKeysList(); // df83e679

// legacy errors
error ValidatorAlreadyExists(); // 0x8d09a73e
Expand Down
7 changes: 4 additions & 3 deletions contracts/modules/SSVClusters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ contract SSVClusters is ISSVClusters {
uint256 amount,
Cluster memory cluster
) external override {
if (publicKeys.length != sharesData.length) revert PublicKeysSharesLengthMismatch();
uint256 validatorsLength = publicKeys.length;

if (validatorsLength == 0) revert EmptyPublicKeysList();
if (validatorsLength != sharesData.length) revert PublicKeysSharesLengthMismatch();

StorageData storage s = SSVStorage.load();
StorageProtocol storage sp = SSVStorageProtocol.load();

uint256 validatorsLength = publicKeys.length;

ValidatorLib.validateOperatorsLength(operatorIds);

for (uint i; i < validatorsLength; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ssv-network",
"version": "1.0.2",
"version": "1.1.1",
"description": "Solidity smart contracts for the SSV Network",
"author": "SSV.Network",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/gas-usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const MAX_GAS_PER_GROUP: any = {
[GasGroup.REDUCE_OPERATOR_FEE]: 51900,

[GasGroup.REGISTER_VALIDATOR_EXISTING_CLUSTER]: 202000,
[GasGroup.REGISTER_VALIDATOR_NEW_STATE]: 235500,
[GasGroup.REGISTER_VALIDATOR_NEW_STATE]: 236000,
[GasGroup.REGISTER_VALIDATOR_WITHOUT_DEPOSIT]: 180600,

[GasGroup.BULK_REGISTER_10_VALIDATOR_NEW_STATE_4]: 889900,
Expand Down
Loading
Loading