@@ -6,6 +6,7 @@ const { getDomain } = require('../helpers/eip712');
6
6
const { ERC4337Helper } = require ( '../helpers/erc4337' ) ;
7
7
const { NonNativeSigner, P256SigningKey, RSASHA256SigningKey, MultiERC7913SigningKey } = require ( '../helpers/signers' ) ;
8
8
const { PackedUserOperation } = require ( '../helpers/eip712-types' ) ;
9
+ const { MAX_UINT64 } = require ( '../helpers/constants' ) ;
9
10
10
11
const { shouldBehaveLikeAccountCore, shouldBehaveLikeAccountHolder } = require ( './Account.behavior' ) ;
11
12
const { shouldBehaveLikeERC1271 } = require ( '../utils/cryptography/ERC1271.behavior' ) ;
@@ -292,5 +293,20 @@ describe('AccountMultiSignerWeighted', function () {
292
293
. withArgs ( signer1 )
293
294
. to . not . emit ( this . mock , 'ERC7913SignerWeightChanged' ) ;
294
295
} ) ;
296
+
297
+ it ( 'should revert if total weight to overflow (_setSignerWeights)' , async function ( ) {
298
+ await expect ( this . mock . $_setSignerWeights ( [ signer1 , signer2 , signer3 ] , [ 1n , 1n , MAX_UINT64 - 1n ] ) )
299
+ . to . be . revertedWithCustomError ( this . mock , 'SafeCastOverflowedUintDowncast' )
300
+ . withArgs ( 64 , MAX_UINT64 + 1n ) ;
301
+ } ) ;
302
+
303
+ it ( 'should revert if total weight to overflow (_addSigner)' , async function ( ) {
304
+ await this . mock . $_setSignerWeights ( [ signer1 , signer2 , signer3 ] , [ 1n , 1n , MAX_UINT64 - 2n ] ) ;
305
+ await expect ( this . mock . totalWeight ( ) ) . to . eventually . equal ( MAX_UINT64 ) ;
306
+
307
+ await expect ( this . mock . $_addSigners ( [ signer4 ] ) )
308
+ . to . be . revertedWithCustomError ( this . mock , 'SafeCastOverflowedUintDowncast' )
309
+ . withArgs ( 64 , MAX_UINT64 + 1n ) ;
310
+ } ) ;
295
311
} ) ;
296
312
} ) ;
0 commit comments