From 8e632bad5c50d9001c9800701a1469692af30383 Mon Sep 17 00:00:00 2001 From: Mohsen-T Date: Mon, 18 Mar 2024 17:13:24 +0100 Subject: [PATCH] fix: updated echidna test --- .echidna.test.js | 2 +- contracts/echidna/Clusters.sol | 40 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.echidna.test.js b/.echidna.test.js index 885308d7..72b72552 100644 --- a/.echidna.test.js +++ b/.echidna.test.js @@ -8,7 +8,7 @@ async function getBrewPrefixPath() { console.log(`Homebrew prefix path: ${stdout.trim()}`); fuzzTestByEchidna(stdout.trim()); } catch (error) { - console.error(`Error: ${error}`); + console.error(`Please install brew and echidna.`); } } diff --git a/contracts/echidna/Clusters.sol b/contracts/echidna/Clusters.sol index ba66efb0..f91591f6 100644 --- a/contracts/echidna/Clusters.sol +++ b/contracts/echidna/Clusters.sol @@ -94,26 +94,26 @@ contract Clusters is SSVClusters { } } - // function check_bulkRegisterValidator(uint256 amount) public { - // bytes[] memory publicKey = new bytes[](4); - // bytes[] memory sharesData = new bytes[](4); - // for (uint256 i; i < publicKey.length; i++) { - // publicKey[i] = EchidnaLib.generatePublicKey(sault++); - // } - // Cluster memory cluster; - // cluster.active = true; - - // uint256 minLiquidationCollateral = SSVStorageProtocol.load().minimumLiquidationCollateral.expand(); - // require(amount > minLiquidationCollateral, "InsufficientBalance"); - - // try this.bulkRegisterValidator(publicKey, opIds, sharesData, amount, cluster) { - // for (uint256 i; i < publicKey.length; i++) { - // publicKeys.push(publicKey[i]); - // } - // } catch { - // assert(false); - // } - // } + function check_bulkRegisterValidator(uint256 amount) public { + bytes[] memory publicKey = new bytes[](4); + bytes[] memory sharesData = new bytes[](4); + for (uint256 i; i < publicKey.length; i++) { + publicKey[i] = EchidnaLib.generatePublicKey(sault++); + } + Cluster memory cluster; + cluster.active = true; + + uint256 minLiquidationCollateral = SSVStorageProtocol.load().minimumLiquidationCollateral.expand(); + require(amount > minLiquidationCollateral, "InsufficientBalance"); + + try this.bulkRegisterValidator(publicKey, opIds, sharesData, amount, cluster) { + for (uint256 i; i < publicKey.length; i++) { + publicKeys.push(publicKey[i]); + } + } catch { + assert(false); + } + } function check_validRegisteredOperators() public { assert(opIds.length == MAX_OPERATORS_LENGTH);