MultiSignerERC7913: prevent setting the threshold to zero (#5772)

Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
Hadrien Croubois
2025-06-27 13:29:40 +02:00
parent a60baa22c6
commit d7930daa48
2 changed files with 11 additions and 2 deletions

View File

@ -67,6 +67,9 @@ abstract contract MultiSignerERC7913 is AbstractSigner {
/// @dev The `signer` is less than 20 bytes long.
error MultiSignerERC7913InvalidSigner(bytes signer);
/// @dev The `threshold` is zero.
error MultiSignerERC7913ZeroThreshold();
/// @dev The `threshold` is unreachable given the number of `signers`.
error MultiSignerERC7913UnreachableThreshold(uint64 signers, uint64 threshold);
@ -147,6 +150,7 @@ abstract contract MultiSignerERC7913 is AbstractSigner {
* * See {_validateReachableThreshold} for the threshold validation.
*/
function _setThreshold(uint64 newThreshold) internal virtual {
require(newThreshold > 0, MultiSignerERC7913ZeroThreshold());
_threshold = newThreshold;
_validateReachableThreshold();
emit ERC7913ThresholdSet(newThreshold);