Skip to content

Commit 3c12e52

Browse files
authored
Fix bulk register validator (#298)
* bulk register: revert when empty public keys list * fix slither ci
1 parent a01f259 commit 3c12e52

File tree

7 files changed

+186
-113
lines changed

7 files changed

+186
-113
lines changed

.github/workflows/slither.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
uses: actions/checkout@v3
99

1010
- name: Run Slither
11-
uses: crytic/[email protected].0
11+
uses: crytic/[email protected].2
1212
id: slither
1313
with:
1414
node-version: 18
1515
fail-on: high
16-
slither-args: --exclude controlled-delegatecall
16+
slither-args: --exclude controlled-delegatecall,incorrect-return

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
66

77
## [Unreleased]
88

9+
### [v1.1.1] 2024-04-12
10+
- [7b61d4f](https://github.com/bloxapp/ssv-network/commit/7b61d4f) - [Fix] Revert when passing an empty public keys list.
11+
12+
## [Released]
13+
914
### [v1.1.0] 2024-01-08
1015
- [c80dc3b](https://github.com/bloxapp/ssv-network/commit/c80dc3b) - [Feature] Bulk exit of validators.
1116
- [6431a00](https://github.com/bloxapp/ssv-network/commit/6431a00) - [Feature] Bulk removal of validators.
@@ -15,8 +20,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1520
- [7564dfe](https://github.com/bloxapp/ssv-network/commit/7564dfe) - [Feature] Integration ssv-keys in ssv-network for generating keyshares.
1621
- [8647401](https://github.com/bloxapp/ssv-network/commit/8647401) - [Update]: Configuration for publishing npm package.
1722

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

contracts/interfaces/ISSVNetworkCore.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ interface ISSVNetworkCore {
8989
error PublicKeysSharesLengthMismatch(); // 0x9ad467b8
9090
error IncorrectValidatorStateWithData(bytes publicKey); // 0x89307938
9191
error ValidatorAlreadyExistsWithData(bytes publicKey); // 0x388e7999
92+
error EmptyPublicKeysList(); // df83e679
9293

9394
// legacy errors
9495
error ValidatorAlreadyExists(); // 0x8d09a73e

contracts/modules/SSVClusters.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ contract SSVClusters is ISSVClusters {
4949
uint256 amount,
5050
Cluster memory cluster
5151
) external override {
52-
if (publicKeys.length != sharesData.length) revert PublicKeysSharesLengthMismatch();
52+
uint256 validatorsLength = publicKeys.length;
53+
54+
if (validatorsLength == 0) revert EmptyPublicKeysList();
55+
if (validatorsLength != sharesData.length) revert PublicKeysSharesLengthMismatch();
5356

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

57-
uint256 validatorsLength = publicKeys.length;
58-
5960
ValidatorLib.validateOperatorsLength(operatorIds);
6061

6162
for (uint i; i < validatorsLength; ++i) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ssv-network",
3-
"version": "1.0.2",
3+
"version": "1.1.1",
44
"description": "Solidity smart contracts for the SSV Network",
55
"author": "SSV.Network",
66
"repository": {

test/helpers/gas-usage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const MAX_GAS_PER_GROUP: any = {
8686
[GasGroup.REDUCE_OPERATOR_FEE]: 51900,
8787

8888
[GasGroup.REGISTER_VALIDATOR_EXISTING_CLUSTER]: 202000,
89-
[GasGroup.REGISTER_VALIDATOR_NEW_STATE]: 235500,
89+
[GasGroup.REGISTER_VALIDATOR_NEW_STATE]: 236000,
9090
[GasGroup.REGISTER_VALIDATOR_WITHOUT_DEPOSIT]: 180600,
9191

9292
[GasGroup.BULK_REGISTER_10_VALIDATOR_NEW_STATE_4]: 889900,

0 commit comments

Comments
 (0)