diff --git a/CHANGELOG.md b/CHANGELOG.md index 45173209..cd7e2b94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,17 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - [22d2859](https://github.com/bloxapp/ssv-network/pull/262/commits/22d2859d8fe6267b09c7a1c9c645df19bdaa03ff) Fix bug in network earnings withdrawals. +- [d25d188](https://github.com/bloxapp/ssv-network/pull/265/commits/d25d18886459e631fb4453df7a47db19982ec80e) Fix Types.shrink() bug. ### Added -- [bf0c51d](https://github.com/bloxapp/ssv-network/pull/263/commits/bf0c51d4df191018052d11425c9fcc252de61431) A validator can voluntarily exit. \ No newline at end of file +- [bf0c51d](https://github.com/bloxapp/ssv-network/pull/263/commits/bf0c51d4df191018052d11425c9fcc252de61431) A validator can voluntarily exit. + + +## [v1.0.0.rc4] - 2023-08-31 + +- Audit fixes/recommendations +- Validate a cluster with 0 validators can not be liquidated +- Deployment process now uses hardhat tasks +- The DAO can set a maximum operator fee (SSV) +- Remove the setRegisterAuth function (register operator/validator without restrictions) +- SSVNetworkViews contract does not throw an error as a way of return. diff --git a/contracts/libraries/Types.sol b/contracts/libraries/Types.sol index f0e3257e..e0f49156 100644 --- a/contracts/libraries/Types.sol +++ b/contracts/libraries/Types.sol @@ -11,7 +11,7 @@ library Types64 { library Types256 { function shrink(uint256 value) internal pure returns (uint64) { - require(value <= (2 ** 64 * DEDUCTED_DIGITS), "Max value exceeded"); + require(value < (2 ** 64 * DEDUCTED_DIGITS), "Max value exceeded"); return uint64(shrinkable(value) / DEDUCTED_DIGITS); } diff --git a/contracts/modules/SSVDAO.sol b/contracts/modules/SSVDAO.sol index e3e0a700..1e916610 100644 --- a/contracts/modules/SSVDAO.sol +++ b/contracts/modules/SSVDAO.sol @@ -19,7 +19,7 @@ contract SSVDAO is ISSVDAO { uint64 previousFee = sp.networkFee; sp.updateNetworkFee(fee); - emit NetworkFeeUpdated(previousFee.expand(), fee); + emit NetworkFeeUpdated(previousFee.expand(), sp.networkFee.expand()); } function withdrawNetworkEarnings(uint256 amount) external override { diff --git a/test/dao/network-fee-change.ts b/test/dao/network-fee-change.ts index ae67b6a0..88290138 100644 --- a/test/dao/network-fee-change.ts +++ b/test/dao/network-fee-change.ts @@ -22,6 +22,12 @@ describe('Network Fee Tests', () => { )).to.emit(ssvNetworkContract, 'NetworkFeeUpdated').withArgs(0, networkFee); }); + it('Change network fee providing UINT64 max value reverts "Max value exceeded"', async () => { + const amount = (ethers.BigNumber.from(2).pow(64)).mul(ethers.BigNumber.from(1e8)); + await expect(ssvNetworkContract.updateNetworkFee(amount + )).to.be.revertedWith('Max value exceeded'); + }); + it('Change network fee when it was set emits "NetworkFeeUpdated"', async () => { const initialNetworkFee = helpers.CONFIG.minimalOperatorFee; await ssvNetworkContract.updateNetworkFee(initialNetworkFee); diff --git a/test/dao/network-fee-withdraw.ts b/test/dao/network-fee-withdraw.ts index c09cdad1..9bc63bdc 100644 --- a/test/dao/network-fee-withdraw.ts +++ b/test/dao/network-fee-withdraw.ts @@ -66,6 +66,12 @@ describe('DAO Network Fee Withdraw Tests', () => { )).to.be.revertedWith('Ownable: caller is not the owner'); }); + it('Withdraw network earnings providing UINT64 max value reverts "Max value exceeded"', async () => { + const amount = (ethers.BigNumber.from(2).pow(64)).mul(ethers.BigNumber.from(1e8)); + await expect(ssvNetworkContract.withdrawNetworkEarnings(amount + )).to.be.revertedWith('Max value exceeded'); + }); + it('Withdraw network earnings sequentially when not enough balance reverts "InsufficientBalance"', async () => { const amount = await ssvViews.getNetworkEarnings() / 2;