diff --git a/contracts/LCPOperator.sol b/contracts/LCPOperator.sol index 6cb574a..fd48f04 100644 --- a/contracts/LCPOperator.sol +++ b/contracts/LCPOperator.sol @@ -14,9 +14,9 @@ library LCPOperator { bytes32 internal constant DOMAIN_SEPARATOR_NAME = keccak256("LCPClient"); bytes32 internal constant DOMAIN_SEPARATOR_VERSION = keccak256("1"); - // domainSeparator(0, address(0)) + // domainSeparatorUniversal() bytes32 internal constant DOMAIN_SEPARATOR_REGISTER_ENCLAVE_KEY = - 0xe33d217bff42bc015bf037be8386bf5055ec6019e58e8c5e89b5c74b8225fa6a; + 0x7fd21c2453e80741907e7ff11fd62ae1daa34c6fc0c2eced821f1c1d3fe88a4c; ChainType internal constant CHAIN_TYPE_EVM = ChainType.wrap(1); // chainTypeSalt(CHAIN_TYPE_EVM, hex"") bytes32 internal constant CHAIN_TYPE_EVM_SALT = keccak256(abi.encodePacked(CHAIN_TYPE_EVM, hex"")); @@ -25,7 +25,15 @@ library LCPOperator { return keccak256(abi.encodePacked(chainType, args)); } - function domainSeparator(uint256 chainId, address verifyingContract) internal pure returns (bytes32) { + function domainSeparatorUniversal() internal pure returns (bytes32) { + return keccak256( + abi.encode( + TYPEHASH_DOMAIN_SEPARATOR, DOMAIN_SEPARATOR_NAME, DOMAIN_SEPARATOR_VERSION, 0, address(0), bytes32(0) + ) + ); + } + + function domainSeparatorEVM(uint256 chainId, address verifyingContract) internal pure returns (bytes32) { return keccak256( abi.encode( TYPEHASH_DOMAIN_SEPARATOR, @@ -69,7 +77,7 @@ library LCPOperator { ) internal pure returns (bytes memory) { return abi.encodePacked( hex"1901", - domainSeparator(chainId, verifyingContract), + domainSeparatorEVM(chainId, verifyingContract), keccak256( abi.encode( TYPEHASH_UPDATE_OPERATORS, diff --git a/test/LCPClientOperator.t.sol b/test/LCPClientOperator.t.sol index ac03a24..7b21e3a 100644 --- a/test/LCPClientOperator.t.sol +++ b/test/LCPClientOperator.t.sol @@ -33,7 +33,7 @@ contract LCPClientOperatorTest is BasicTest { } function testPreComputationValues() public pure { - assertEq(LCPOperator.domainSeparator(0, address(0)), LCPOperator.DOMAIN_SEPARATOR_REGISTER_ENCLAVE_KEY); + assertEq(LCPOperator.domainSeparatorUniversal(), LCPOperator.DOMAIN_SEPARATOR_REGISTER_ENCLAVE_KEY); assertEq(LCPOperator.chainTypeSalt(LCPOperator.CHAIN_TYPE_EVM, hex""), LCPOperator.CHAIN_TYPE_EVM_SALT); }