-
Notifications
You must be signed in to change notification settings - Fork 37
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
Conversation
🟡 Heimdall Review Status
|
import "src/util/Constants.sol"; | ||
import "ens-contracts/resolvers/profiles/IAddrResolver.sol"; | ||
|
||
contract L1ResolverMainnet is Test { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
There was a problem hiding this 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.
Approved review 2205674558 from cb-elileers is now dismissed due to new commit. Re-request for approval.
resolver
method on L1Resolverresolve
method on L1Resolver
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
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
- (success,result) = rootResolver.staticcall(data)
The ENS team correctly identified that the deployed L1 Resolver at 0x480F8F2FfE823Dc70F499Cc2542C42a3a6aD3f20 expects that the
rootResolver
implements theresolve
method. However, the PublicResolver at 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41 (ourrootResolver
) does not implement theresolve
method. Thus, calling:will always revert.
This fix implements a new internal method
_resolve(bytes,bytes)
to correctly handle resolve requests inteded for thebase.eth
name. The implementation is identical to the ENS ExtendedResolver:resolve(bytes,bytes) with the exception thataddress(this)
has been replaced withrootResolver
.A new forking test file has been added to validate that this resolves the issue.