Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resolve method on L1Resolver #84

Merged
merged 5 commits into from
Jul 30, 2024
Merged

Conversation

stevieraykatz
Copy link
Collaborator

@stevieraykatz stevieraykatz commented Jul 29, 2024

The ENS team correctly identified that the deployed L1 Resolver at 0x480F8F2FfE823Dc70F499Cc2542C42a3a6aD3f20 expects that the rootResolver implements the resolve method. However, the PublicResolver at 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41 (our rootResolver) does not implement the resolve method. Thus, calling:

return IExtendedResolver(rootResolver).resolve(name, data);

will always revert.

This fix implements a new internal method _resolve(bytes,bytes) to correctly handle resolve requests inteded for the base.eth name. The implementation is identical to the ENS ExtendedResolver:resolve(bytes,bytes) with the exception that address(this) has been replaced with rootResolver.

A new forking test file has been added to validate that this resolves the issue.

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Jul 29, 2024

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

src/L1/L1Resolver.sol Fixed Show fixed Hide fixed
src/L1/L1Resolver.sol Fixed Show fixed Hide fixed
src/L1/L1Resolver.sol Fixed Show fixed Hide fixed
src/L1/L1Resolver.sol Fixed Show fixed Hide fixed
import "src/util/Constants.sol";
import "ens-contracts/resolvers/profiles/IAddrResolver.sol";

contract L1ResolverMainnet is Test {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have. Are there other forking tests that we could add for similar type? Maybe all the base.eth sub names behaving as expected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolution requests for L1 base.eth subdomains (i.e. mint.base.eth) shouldn't ever hit the base.eth resolver since they have resolvers set on the Registry. Generally, I think that expanding the fork test infra is a good idea. Happy to work on a separate PR with expanded test files.

Copy link
Collaborator

@cb-elileers cb-elileers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of small typos in comments, otherwise looks good to me. The assembly revert message code is interesting, I'll have to look into it more.

src/L1/L1Resolver.sol Outdated Show resolved Hide resolved
src/L1/L1Resolver.sol Outdated Show resolved Hide resolved
cb-elileers
cb-elileers previously approved these changes Jul 29, 2024
Copy link
Collaborator

@cb-elileers cb-elileers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of small typos in comments, otherwise looks good to me. The assembly revert message code is interesting, I'll have to look into it more.

@cb-heimdall cb-heimdall dismissed cb-elileers’s stale review July 29, 2024 18:20

Approved review 2205674558 from cb-elileers is now dismissed due to new commit. Re-request for approval.

src/L1/L1Resolver.sol Outdated Show resolved Hide resolved
@stevieraykatz stevieraykatz changed the title Fix resolver method on L1Resolver Fix resolve method on L1Resolver Jul 29, 2024
Comment on lines +220 to +230
function _resolve(bytes memory, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory result) = rootResolver.staticcall(data);
if (success) {
return result;
} else {
// Revert with the reason provided by the call
assembly {
revert(add(result, 0x20), mload(result))
}
}
}

Check warning

Code scanning / Slither

Assembly usage Warning

Comment on lines +220 to +230
function _resolve(bytes memory, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory result) = rootResolver.staticcall(data);
if (success) {
return result;
} else {
// Revert with the reason provided by the call
assembly {
revert(add(result, 0x20), mload(result))
}
}
}

Check warning

Code scanning / Slither

Low-level calls Warning

@stevieraykatz stevieraykatz merged commit 39d8539 into main Jul 30, 2024
5 of 7 checks passed
@stevieraykatz stevieraykatz deleted the fix-resolver-l1-resolver branch July 30, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants