From 163afc3f4ce8476ae49c2967d425cecb170b3b79 Mon Sep 17 00:00:00 2001 From: garyghayrat Date: Fri, 22 Mar 2024 10:06:33 -0400 Subject: [PATCH] Hash `stealthMetaAddress` in `dataHash` --- src/ERC6538Registry.sol | 5 ++++- test/ERC6538Registry.t.sol | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ERC6538Registry.sol b/src/ERC6538Registry.sol index fc0a8b1..8a0ac53 100644 --- a/src/ERC6538Registry.sol +++ b/src/ERC6538Registry.sol @@ -85,7 +85,10 @@ contract ERC6538Registry { DOMAIN_SEPARATOR(), keccak256( abi.encode( - ERC6538REGISTRY_ENTRY_TYPE_HASH, schemeId, stealthMetaAddress, nonceOf[registrant]++ + ERC6538REGISTRY_ENTRY_TYPE_HASH, + schemeId, + keccak256(stealthMetaAddress), + nonceOf[registrant]++ ) ) ) diff --git a/test/ERC6538Registry.t.sol b/test/ERC6538Registry.t.sol index 81abcc3..6ee507c 100644 --- a/test/ERC6538Registry.t.sol +++ b/test/ERC6538Registry.t.sol @@ -43,7 +43,12 @@ contract ERC6538RegistryTest is Test, Deploy { uint256 _nonce ) public view returns (bytes memory _signature) { bytes32 _dataHash = keccak256( - abi.encode(registry.ERC6538REGISTRY_ENTRY_TYPE_HASH(), _schemeId, _stealthMetaAddress, _nonce) + abi.encode( + registry.ERC6538REGISTRY_ENTRY_TYPE_HASH(), + _schemeId, + keccak256(_stealthMetaAddress), + _nonce + ) ); bytes32 _hash = keccak256(abi.encodePacked("\x19\x01", registry.DOMAIN_SEPARATOR(), _dataHash)); (uint8 v, bytes32 r, bytes32 s) = vm.sign(_registrantPrivateKey, _hash);