diff --git a/solidity/contracts/BondedECDSAKeepFactory.sol b/solidity/contracts/BondedECDSAKeepFactory.sol index 4022f6ec6..1aabdfbb6 100644 --- a/solidity/contracts/BondedECDSAKeepFactory.sol +++ b/solidity/contracts/BondedECDSAKeepFactory.sol @@ -239,7 +239,12 @@ contract BondedECDSAKeepFactory is uint256 _bond, uint256 _stakeLockDuration ) external payable returns (address keepAddress) { + require(_groupSize > 0, "Minimum signing group size is 1"); require(_groupSize <= 16, "Maximum signing group size is 16"); + require( + _honestThreshold > 0, + "Honest threshold must be greater than 0" + ); require( _honestThreshold <= _groupSize, "Honest threshold must be less or equal the group size" diff --git a/solidity/test/BondedECDSAKeepFactoryTest.js b/solidity/test/BondedECDSAKeepFactoryTest.js index 8bed883ec..4f4f92bf0 100644 --- a/solidity/test/BondedECDSAKeepFactoryTest.js +++ b/solidity/test/BondedECDSAKeepFactoryTest.js @@ -926,6 +926,25 @@ contract("BondedECDSAKeepFactory", async (accounts) => { ) }) + it("reverts when honest threshold is 0", async () => { + const honestThreshold = 0 + + await expectRevert( + keepFactory.openKeep( + groupSize, + honestThreshold, + keepOwner, + bond, + stakeLockDuration, + { + from: application, + value: feeEstimate, + } + ), + "Honest threshold must be greater than 0" + ) + }) + it("works when honest threshold is equal to the group size", async () => { const honestThreshold = 3 const groupSize = honestThreshold @@ -1080,6 +1099,25 @@ contract("BondedECDSAKeepFactory", async (accounts) => { ) }) + it("reverts when trying to use a group of 0 signers", async () => { + const groupSize = 0 + + await expectRevert( + keepFactory.openKeep( + groupSize, + threshold, + keepOwner, + bond, + stakeLockDuration, + { + from: application, + value: feeEstimate, + } + ), + "Minimum signing group size is 1" + ) + }) + async function createDepositAndRegisterMembers( memberCount, unbondedAmount