@@ -341,7 +341,7 @@ contract MinimalDelegationIsValidSignatureTest is DelegationHandler, HookHandler
341341 assertEq (result, _1271_MAGIC_VALUE);
342342 }
343343
344- function test_isValidSignature_personalSign_notNested_andNotHashTypedData_isInvalid () public {
344+ function test_isValidSignature_personalSign_notNested_isInvalid () public {
345345 string memory message = "test " ;
346346 bytes32 messageHash = MessageHashUtils.toEthSignedMessageHash (bytes (message));
347347 // Incorrectly do personal_sign instead of over the typed PersonalSign digest
@@ -352,21 +352,6 @@ contract MinimalDelegationIsValidSignatureTest is DelegationHandler, HookHandler
352352 assertEq (signerAccount.isValidSignature (messageHash, wrappedSignature), _1271_INVALID_VALUE);
353353 }
354354
355- function test_isValidSignature_personalSign_p256Key_notNested_andNotHashTypedData_isInvalid () public {
356- TestKey memory p256Key = TestKeyManager.initDefault (KeyType.P256);
357- vm.prank (address (signerAccount));
358- signerAccount.register (p256Key.toKey ());
359-
360- string memory message = "test " ;
361- bytes32 messageHash = MessageHashUtils.toEthSignedMessageHash (bytes (message));
362- // Incorrectly do personal_sign instead of over the typed PersonalSign digest
363- bytes memory signature = p256Key.sign (messageHash);
364- bytes memory wrappedSignature = abi.encode (p256Key.toKeyHash (), signature, EMPTY_HOOK_DATA);
365- // Should return the invalid value
366- vm.prank (address (mockERC1271VerifyingContract));
367- assertEq (signerAccount.isValidSignature (messageHash, wrappedSignature), _1271_INVALID_VALUE);
368- }
369-
370355 /// forge-config: default.isolate = true
371356 /// forge-config: ci.isolate = true
372357 function test_isValidSignature_rootKey_notNested_safeERC1271Caller_isValid_gas () public {
@@ -407,38 +392,4 @@ contract MinimalDelegationIsValidSignatureTest is DelegationHandler, HookHandler
407392 assertEq (result, _1271_MAGIC_VALUE);
408393 vm.snapshotGasLastCall ("isValidSignature_P256_typedData_notNested_safeERC1271Caller " );
409394 }
410-
411- /// forge-config: default.isolate = true
412- /// forge-config: ci.isolate = true
413- function test_isValidSignature_rootKey_personalSign_notNested_usingHashTypedData_isValid_gas () public {
414- string memory message = "test " ;
415- bytes32 messageHash = MessageHashUtils.toEthSignedMessageHash (bytes (message));
416- // We don't do ERC-7739 NestedPersonalSign, but rather apply EIP-712 hashing over the message
417- // which is also accepted since it protects against replay attacks by using the account's domain separator
418- bytes memory signature = signerTestKey.sign (signerAccount.hashTypedData (messageHash));
419- bytes memory wrappedSignature = abi.encode (KeyLib.ROOT_KEY_HASH, signature, EMPTY_HOOK_DATA);
420- vm.prank (address (mockERC1271VerifyingContract));
421- // Should be valid and return the magic value
422- assertEq (signerAccount.isValidSignature (messageHash, wrappedSignature), _1271_MAGIC_VALUE);
423- vm.snapshotGasLastCall ("isValidSignature_rootKey_personalSign_notNested_usingHashTypedData " );
424- }
425-
426- /// forge-config: default.isolate = true
427- /// forge-config: ci.isolate = true
428- function test_isValidSignature_p256Key_personalSign_notNested_usingHashTypedData_isValid_gas () public {
429- TestKey memory p256Key = TestKeyManager.initDefault (KeyType.P256);
430- vm.prank (address (signerAccount));
431- signerAccount.register (p256Key.toKey ());
432-
433- string memory message = "test " ;
434- bytes32 messageHash = MessageHashUtils.toEthSignedMessageHash (bytes (message));
435- // We don't do ERC-7739 NestedPersonalSign, but rather apply EIP-712 hashing over the message
436- // which is also accepted since it protects against replay attacks by using the account's domain separator
437- bytes memory signature = p256Key.sign (signerAccount.hashTypedData (messageHash));
438- bytes memory wrappedSignature = abi.encode (p256Key.toKeyHash (), signature, EMPTY_HOOK_DATA);
439- vm.prank (address (mockERC1271VerifyingContract));
440- // Should be valid and return the magic value
441- assertEq (signerAccount.isValidSignature (messageHash, wrappedSignature), _1271_MAGIC_VALUE);
442- vm.snapshotGasLastCall ("isValidSignature_P256_personalSign_notNested_usingHashTypedData " );
443- }
444395}
0 commit comments