@@ -179,6 +179,7 @@ contract EthereumVaultConnectorWithFallback is EthereumVaultConnectorHarness {
179179}
180180
181181contract PermitTest is Test {
182+ address internal constant COMMON_PREDEPLOYS = 0x4200000000000000000000000000000000000000 ;
182183 EthereumVaultConnectorWithFallback internal evc;
183184 SignerECDSA internal signerECDSA;
184185 SignerERC1271 internal signerERC1271;
@@ -215,7 +216,10 @@ contract PermitTest is Test {
215216 address msgSender = sender == address (0 ) ? address (uint160 (uint256 (keccak256 (abi.encode (alice))))) : sender;
216217 data = abi.encode (keccak256 (data));
217218
218- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && alice != address (evc));
219+ vm.assume (
220+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
221+ && alice != address (evc)
222+ );
219223 vm.assume (msgSender != address (evc));
220224 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
221225
@@ -264,7 +268,7 @@ contract PermitTest is Test {
264268 data = abi.encode (keccak256 (data));
265269
266270 vm.assume (msgSender != address (evc));
267- vm.assume (! evc.haveCommonOwner (alice, address (0 )));
271+ vm.assume (! evc.haveCommonOwner (alice, address (0 )) && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) );
268272 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
269273
270274 vm.warp (deadline);
@@ -310,7 +314,10 @@ contract PermitTest is Test {
310314 && privateKey < 115792089237316195423570985008687907852837564279074904382605163141518161494337
311315 );
312316 address alice = vm.addr (privateKey);
313- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && alice != address (evc));
317+ vm.assume (
318+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
319+ && alice != address (evc)
320+ );
314321 bytes19 addressPrefix = evc.getAddressPrefix (alice);
315322 data2 = abi.encode (keccak256 (data2));
316323 vm.assume (nonce > 0 && nonce < type (uint256 ).max - 1 );
@@ -351,7 +358,10 @@ contract PermitTest is Test {
351358 && privateKey < 115792089237316195423570985008687907852837564279074904382605163141518161494337
352359 );
353360 address alice = vm.addr (privateKey);
354- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && alice != address (evc));
361+ vm.assume (
362+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
363+ && alice != address (evc)
364+ );
355365 bytes19 addressPrefix = evc.getAddressPrefix (alice);
356366 data = abi.encode (keccak256 (data));
357367 vm.assume (sender != address (0 ) && sender != address (this ));
@@ -369,6 +379,7 @@ contract PermitTest is Test {
369379 }
370380
371381 function test_RevertIfSignerInvalid_Permit (
382+ bool option ,
372383 address alice ,
373384 uint256 nonceNamespace ,
374385 uint256 nonce ,
@@ -377,7 +388,9 @@ contract PermitTest is Test {
377388 bytes memory data ,
378389 bytes calldata signature
379390 ) public {
380- alice = address (uint160 (bound (uint160 (alice), 0 , 0xFF )));
391+ alice = option
392+ ? address (uint160 (bound (uint160 (alice), 0 , 0xFF )))
393+ : address (uint160 (bound (uint160 (alice), uint160 (COMMON_PREDEPLOYS), uint160 (COMMON_PREDEPLOYS) + 0xFF )));
381394 bytes19 addressPrefix = evc.getAddressPrefix (alice);
382395 data = abi.encode (keccak256 (data));
383396 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
@@ -404,7 +417,10 @@ contract PermitTest is Test {
404417 ) public {
405418 bytes19 addressPrefix = evc.getAddressPrefix (alice);
406419 data = abi.encode (keccak256 (data));
407- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && alice != address (evc));
420+ vm.assume (
421+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
422+ && alice != address (evc)
423+ );
408424 vm.assume (nonce < type (uint256 ).max);
409425 vm.warp (deadline);
410426
@@ -436,7 +452,10 @@ contract PermitTest is Test {
436452 ) public {
437453 bytes19 addressPrefix = evc.getAddressPrefix (alice);
438454 data = abi.encode (keccak256 (data));
439- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && alice != address (evc));
455+ vm.assume (
456+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
457+ && alice != address (evc)
458+ );
440459 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
441460 vm.assume (deadline < type (uint256 ).max);
442461 vm.warp (deadline + 1 );
@@ -466,7 +485,10 @@ contract PermitTest is Test {
466485 address alice = vm.addr (privateKey);
467486 bytes19 addressPrefix = evc.getAddressPrefix (alice);
468487 data = abi.encode (keccak256 (data));
469- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && alice != address (evc));
488+ vm.assume (
489+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
490+ && alice != address (evc)
491+ );
470492 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
471493 vm.assume (value > 0 );
472494 vm.warp (deadline);
@@ -499,7 +521,10 @@ contract PermitTest is Test {
499521 bytes calldata signature
500522 ) public {
501523 bytes19 addressPrefix = evc.getAddressPrefix (alice);
502- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && alice != address (evc));
524+ vm.assume (
525+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
526+ && alice != address (evc)
527+ );
503528 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
504529 vm.warp (deadline);
505530
@@ -531,7 +556,10 @@ contract PermitTest is Test {
531556 data = abi.encode (keccak256 (data));
532557 signerECDSA.setPrivateKey (privateKey);
533558
534- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && alice != address (evc));
559+ vm.assume (
560+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
561+ && alice != address (evc)
562+ );
535563 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
536564 vm.warp (deadline);
537565 vm.deal (address (evc), value);
@@ -569,7 +597,10 @@ contract PermitTest is Test {
569597 bytes calldata signature ,
570598 uint16 value
571599 ) public {
572- vm.assume (! evc.haveCommonOwner (signer, address (0 )) && signer != address (evc));
600+ vm.assume (
601+ ! evc.haveCommonOwner (signer, address (0 )) && ! evc.haveCommonOwner (signer, COMMON_PREDEPLOYS)
602+ && signer != address (evc)
603+ );
573604 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
574605
575606 bytes19 addressPrefix = evc.getAddressPrefix (signer);
@@ -597,7 +628,7 @@ contract PermitTest is Test {
597628 address alice = vm.addr (privateKey);
598629 signerECDSA.setPrivateKey (privateKey);
599630
600- vm.assume (! evc.haveCommonOwner (alice, address (0 )));
631+ vm.assume (! evc.haveCommonOwner (alice, address (0 )) && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) );
601632 vm.warp (deadline);
602633
603634 // ECDSA signature invalid due to signer.
@@ -695,7 +726,7 @@ contract PermitTest is Test {
695726 address alice = address (new SignerERC1271 (evc));
696727 SignerERC1271 (alice).setSignatureHash (signature);
697728
698- vm.assume (! evc.haveCommonOwner (alice, address (0 )));
729+ vm.assume (! evc.haveCommonOwner (alice, address (0 )) && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) );
699730 vm.warp (deadline);
700731
701732 // ECDSA signature is always invalid here hence we fall back to ERC-1271 signature
@@ -785,7 +816,10 @@ contract PermitTest is Test {
785816 address bob = address (new SignerERC1271 (evc));
786817 address target = address (new Vault (evc));
787818
788- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, bob));
819+ vm.assume (
820+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, bob)
821+ && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
822+ );
789823 vm.deal (address (this ), type (uint128 ).max);
790824 signerECDSA.setPrivateKey (privateKey);
791825
0 commit comments