diff --git a/src/CCIP2ETH.sol b/src/CCIP2ETH.sol index be88b00..80efa5e 100644 --- a/src/CCIP2ETH.sol +++ b/src/CCIP2ETH.sol @@ -282,44 +282,6 @@ contract CCIP2ETH is iCCIP2ETH { iCCIP2ETH.__callback.selector, // Callback function abi.encode(_node, block.number - 1, _checkhash, _domain, _recType, _path, name, request) ); - if (_signer != iCCIP2ETH(this).getSigner(signRequest, _recordSignature)) { - revert InvalidRequest("BAD_SIGNED_RECORD"); - } - } else if (_type == iCallbackType.signedDAppService.selector) { - if (result[0] == 0x0 || result[result.length - 1] != 0x0) { - revert InvalidRequest("BAD_DAPP_SERVICE_REQUEST"); - } - (bytes4 _req, bytes32 _redirectNamehash, bytes memory _redirectRequest, string memory _redirectDomain) = - iCCIP2ETH(this).redirectService(result, _request); - signRequest = string.concat( - "Requesting Signature To Install DApp Service\n", - "\nOrigin: ", - _domain, // e.g. ens.domain.eth - "\nDApp: ", - _redirectDomain, // e.g. app.ens.eth - "\nExtradata: 0x", - gateway.bytesToHexString(abi.encodePacked(keccak256(result)), 0), - "\nSigned By: eip155:1:", - gateway.toChecksumAddress(_signer) - ); - if (_signer != iCCIP2ETH(this).getSigner(signRequest, _recordSignature)) { - revert InvalidRequest("BAD_DAPP_SIGNATURE"); - } - address _resolver = ENS.resolver(_redirectNamehash); - if (iERC165(_resolver).supportsInterface(iENSIP10.resolve.selector)) { - return iENSIP10(_resolver).resolve(result, _redirectRequest); - } else if (iERC165(_resolver).supportsInterface(_req)) { - bool ok; - (ok, result) = _resolver.staticcall(_redirectRequest); - if (!ok) { - revert InvalidRequest("BAD_RESOLVER"); - } - } else { - revert InvalidRequest("BAD_RESOLVER_FUNCTION"); - } - } else { - /// @dev Future features in __fallback - return gateway.__fallback(response, extradata); } } diff --git a/test/CCIP2ETH.t.sol b/test/CCIP2ETH.t.sol index a944192..20873c4 100644 --- a/test/CCIP2ETH.t.sol +++ b/test/CCIP2ETH.t.sol @@ -101,7 +101,6 @@ contract CCIP2ETHTest is Test { ) ); ccip2eth.resolve(_encoded, _request); - _subdomains; } /// @dev Test subdomain-level CCIP-Read call @@ -116,7 +115,7 @@ contract CCIP2ETHTest is Test { ENS.setOwner(_namehash, address(this)); bytes memory _recordhash = hex"e50101720024080112203c5aba6c9b5055a5fa12281c486188ed8ae2b6ef394b3d981b00d17a4b51735c"; - ccip2eth.setDeepSubRecordhash(_namehash, _subdomains, _recordhash); + ccip2eth.setRecordhash(_namehash, _recordhash); (string memory _path, string memory _domain) = utils.Format(_encoded); bytes memory _request = abi.encodeWithSelector(iResolver.text.selector, _namehash, abi.encode(string("avatar"))); string memory _recType = gateway.funcToJson(_request); @@ -136,7 +135,6 @@ contract CCIP2ETHTest is Test { ) ); ccip2eth.resolve(_encoded, _request); - _subdomains; } /// @dev Test deep CCIP-Read call @@ -182,7 +180,6 @@ contract CCIP2ETHTest is Test { ) ); ccip2eth.resolve(_encoded, _request); - _subdomains; } /// @dev CCIP end-to-end test with on-chain signer @@ -248,7 +245,6 @@ contract CCIP2ETHTest is Test { bytes memory _response = abi.encodeWithSelector(iCallbackType.signedRecord.selector, _signer, _signature, bytes("0"), _result); assertEq(_result, ccip2eth.__callback(_response, _extradata)); - _subdomains; } /// @dev CCIP end-to-end test with off-chain signer (with fake parameters) @@ -335,7 +331,6 @@ contract CCIP2ETHTest is Test { bytes memory _response = abi.encodeWithSelector(iCallbackType.signedRecord.selector, _signer, _recordSig, _approvedSig, _result); assertEq(_result, ccip2eth.__callback(_response, _extradata)); - _subdomains; } /// @dev CCIP end-to-end with off-chain signer and real parameters @@ -422,7 +417,6 @@ contract CCIP2ETHTest is Test { bytes memory _response = abi.encodeWithSelector(iCallbackType.signedRecord.selector, _signer, _recordSig, _approvedSig, _result); assertEq(_result, ccip2eth.__callback(_response, _extradata)); - _subdomains; } /// @dev Test setting regular and short recordhash @@ -460,9 +454,9 @@ contract CCIP2ETHTest is Test { /// @dev Test setting deep recordhash function test10_setDeepSubRecordhash() public { - string[] memory _subdomain = new string[](2); - _subdomain[0] = "hello"; - _subdomain[1] = "world"; + string[] memory _subdomains = new string[](2); + _subdomains[0] = "hello"; + _subdomains[1] = "world"; bytes[] memory _name = new bytes[](2); _name[0] = "domain"; _name[1] = "eth"; @@ -471,10 +465,10 @@ contract CCIP2ETHTest is Test { ENS.setOwner(_node, EOA); bytes memory _recordhash = hex"e501017200240801122008dd085b86d16226791544f4628c4efc0936c69221fef17dfac843d9713233bb"; - ccip2eth.setDeepSubRecordhash(_node, _subdomain, _recordhash); + ccip2eth.setDeepSubRecordhash(_node, _subdomains, _recordhash); vm.expectRevert(abi.encodeWithSelector(CCIP2ETH.NotAuthorised.selector, "NOT_APPROVED")); vm.prank(address(0xc0ffee)); - ccip2eth.setDeepSubRecordhash(_node, _subdomain, _recordhash); + ccip2eth.setDeepSubRecordhash(_node, _subdomains, _recordhash); _encoded; } }