Skip to content

Commit

Permalink
Remove sig check to increase compatibility with crypto libs
Browse files Browse the repository at this point in the history
  • Loading branch information
garyghayrat committed Feb 20, 2024
1 parent 7047b0e commit e1c0d19
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
6 changes: 1 addition & 5 deletions src/ERC6538Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ contract ERC6538Registry {
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}

// If the signature is valid and not malleable, `ecrecover` returns the signing address.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {} else {
recoveredAddress = ecrecover(dataHash, v, r, s);
}
recoveredAddress = ecrecover(dataHash, v, r, s);
}

if (
Expand Down
14 changes: 0 additions & 14 deletions test/ERC6538Registry.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,6 @@ contract RegisterKeysOnBehalf is ERC6538RegistryTest {
registry.registerKeysOnBehalf(registrant, schemeId, signature, stealthMetaAddress);
}

function testFuzz_RevertIf_AManipulatedErc712SignatureIsUsedToRegister(
string memory registrantSeed,
uint256 schemeId,
bytes memory stealthMetaAddress
) external {
(address registrant, uint256 registrantPrivateKey) = makeAddrAndKey(registrantSeed);
bytes memory signature =
_generateRegistrationSignature(registrantPrivateKey, schemeId, stealthMetaAddress, 0);
bytes memory manipulatedSignature = manipulateSignature(signature);

vm.expectRevert(bytes(""));
registry.registerKeysOnBehalf(registrant, schemeId, manipulatedSignature, stealthMetaAddress);
}

function testFuzz_RevertIf_AManipulatedErc712SignatureIsUsedToRegisterADifferentStealthMetaAddress(
string memory registrantSeed,
uint256 schemeId,
Expand Down

0 comments on commit e1c0d19

Please sign in to comment.