@@ -179,6 +179,7 @@ contract EthereumVaultConnectorWithFallback is EthereumVaultConnectorHarness {
179179}
180180
181181contract PermitTest is Test {
182+ address internal constant EIP_7587_PRECOMPILES = 0x0000000000000000000000000000000000000100 ;
182183 address internal constant COMMON_PREDEPLOYS = 0x4200000000000000000000000000000000000000 ;
183184 EthereumVaultConnectorWithFallback internal evc;
184185 SignerECDSA internal signerECDSA;
@@ -217,8 +218,8 @@ contract PermitTest is Test {
217218 data = abi.encode (keccak256 (data));
218219
219220 vm.assume (
220- ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS )
221- && alice != address (evc)
221+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES )
222+ && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) && alice != address (evc)
222223 );
223224 vm.assume (msgSender != address (evc));
224225 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
@@ -268,7 +269,10 @@ contract PermitTest is Test {
268269 data = abi.encode (keccak256 (data));
269270
270271 vm.assume (msgSender != address (evc));
271- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS));
272+ vm.assume (
273+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES)
274+ && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS) && alice != address (evc)
275+ );
272276 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
273277
274278 vm.warp (deadline);
@@ -315,8 +319,8 @@ contract PermitTest is Test {
315319 );
316320 address alice = vm.addr (privateKey);
317321 vm.assume (
318- ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS )
319- && alice != address (evc)
322+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES )
323+ && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) && alice != address (evc)
320324 );
321325 bytes19 addressPrefix = evc.getAddressPrefix (alice);
322326 data2 = abi.encode (keccak256 (data2));
@@ -359,8 +363,8 @@ contract PermitTest is Test {
359363 );
360364 address alice = vm.addr (privateKey);
361365 vm.assume (
362- ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS )
363- && alice != address (evc)
366+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES )
367+ && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) && alice != address (evc)
364368 );
365369 bytes19 addressPrefix = evc.getAddressPrefix (alice);
366370 data = abi.encode (keccak256 (data));
@@ -379,7 +383,7 @@ contract PermitTest is Test {
379383 }
380384
381385 function test_RevertIfSignerInvalid_Permit (
382- bool option ,
386+ uint256 option ,
383387 address alice ,
384388 uint256 nonceNamespace ,
385389 uint256 nonce ,
@@ -388,8 +392,10 @@ contract PermitTest is Test {
388392 bytes memory data ,
389393 bytes calldata signature
390394 ) public {
391- alice = option
392- ? address (uint160 (bound (uint160 (alice), 0 , 0xFF )))
395+ alice = option % 3 == 0
396+ ? option % 2 == 0
397+ ? address (uint160 (bound (uint160 (alice), 0 , 0xFF )))
398+ : address (uint160 (bound (uint160 (alice), uint160 (EIP_7587_PRECOMPILES), uint160 (EIP_7587_PRECOMPILES) + 0xFF )))
393399 : address (uint160 (bound (uint160 (alice), uint160 (COMMON_PREDEPLOYS), uint160 (COMMON_PREDEPLOYS) + 0xFF )));
394400 bytes19 addressPrefix = evc.getAddressPrefix (alice);
395401 data = abi.encode (keccak256 (data));
@@ -418,8 +424,8 @@ contract PermitTest is Test {
418424 bytes19 addressPrefix = evc.getAddressPrefix (alice);
419425 data = abi.encode (keccak256 (data));
420426 vm.assume (
421- ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS )
422- && alice != address (evc)
427+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES )
428+ && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) && alice != address (evc)
423429 );
424430 vm.assume (nonce < type (uint256 ).max);
425431 vm.warp (deadline);
@@ -453,8 +459,8 @@ contract PermitTest is Test {
453459 bytes19 addressPrefix = evc.getAddressPrefix (alice);
454460 data = abi.encode (keccak256 (data));
455461 vm.assume (
456- ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS )
457- && alice != address (evc)
462+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES )
463+ && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) && alice != address (evc)
458464 );
459465 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
460466 vm.assume (deadline < type (uint256 ).max);
@@ -486,8 +492,8 @@ contract PermitTest is Test {
486492 bytes19 addressPrefix = evc.getAddressPrefix (alice);
487493 data = abi.encode (keccak256 (data));
488494 vm.assume (
489- ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS )
490- && alice != address (evc)
495+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES )
496+ && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) && alice != address (evc)
491497 );
492498 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
493499 vm.assume (value > 0 );
@@ -522,8 +528,8 @@ contract PermitTest is Test {
522528 ) public {
523529 bytes19 addressPrefix = evc.getAddressPrefix (alice);
524530 vm.assume (
525- ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS )
526- && alice != address (evc)
531+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES )
532+ && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) && alice != address (evc)
527533 );
528534 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
529535 vm.warp (deadline);
@@ -557,8 +563,8 @@ contract PermitTest is Test {
557563 signerECDSA.setPrivateKey (privateKey);
558564
559565 vm.assume (
560- ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS )
561- && alice != address (evc)
566+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES )
567+ && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS) && alice != address (evc)
562568 );
563569 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
564570 vm.warp (deadline);
@@ -598,8 +604,8 @@ contract PermitTest is Test {
598604 uint16 value
599605 ) public {
600606 vm.assume (
601- ! evc.haveCommonOwner (signer, address (0 )) && ! evc.haveCommonOwner (signer, COMMON_PREDEPLOYS )
602- && signer != address (evc)
607+ ! evc.haveCommonOwner (signer, address (0 )) && ! evc.haveCommonOwner (signer, EIP_7587_PRECOMPILES )
608+ && ! evc. haveCommonOwner (signer, COMMON_PREDEPLOYS) && signer != address (evc)
603609 );
604610 vm.assume (nonce > 0 && nonce < type (uint256 ).max);
605611
@@ -628,7 +634,10 @@ contract PermitTest is Test {
628634 address alice = vm.addr (privateKey);
629635 signerECDSA.setPrivateKey (privateKey);
630636
631- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS));
637+ vm.assume (
638+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES)
639+ && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
640+ );
632641 vm.warp (deadline);
633642
634643 // ECDSA signature invalid due to signer.
@@ -726,7 +735,10 @@ contract PermitTest is Test {
726735 address alice = address (new SignerERC1271 (evc));
727736 SignerERC1271 (alice).setSignatureHash (signature);
728737
729- vm.assume (! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS));
738+ vm.assume (
739+ ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES)
740+ && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
741+ );
730742 vm.warp (deadline);
731743
732744 // ECDSA signature is always invalid here hence we fall back to ERC-1271 signature
@@ -818,7 +830,7 @@ contract PermitTest is Test {
818830
819831 vm.assume (
820832 ! evc.haveCommonOwner (alice, address (0 )) && ! evc.haveCommonOwner (alice, bob)
821- && ! evc.haveCommonOwner (alice, COMMON_PREDEPLOYS)
833+ && ! evc.haveCommonOwner (alice, EIP_7587_PRECOMPILES) && ! evc. haveCommonOwner (alice, COMMON_PREDEPLOYS)
822834 );
823835 vm.deal (address (this ), type (uint128 ).max);
824836 signerECDSA.setPrivateKey (privateKey);
0 commit comments