Skip to content

Commit

Permalink
Fix bulk register validator (#298)
Browse files Browse the repository at this point in the history
* bulk register: revert when empty public keys list

* fix slither ci
  • Loading branch information
mtabasco authored Apr 15, 2024
1 parent a01f259 commit 3c12e52
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 113 deletions.
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
Expand Up @@ -89,6 +89,7 @@ interface ISSVNetworkCore {
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

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

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

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

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

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

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

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

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

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

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

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

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

0 comments on commit 3c12e52

Please sign in to comment.