-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat:attempt to implement L1ETHRegistry for ejected names #20
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 13589122509Details
💛 - Coveralls |
Feel free to take the ticket! |
event NameRenewed(uint256 indexed tokenId, uint64 newExpiration, address renewedBy); | ||
event NameRelinquished(uint256 indexed tokenId, address relinquishedBy); | ||
event NameMigratedToL2(uint256 indexed tokenId, address sendTo); | ||
event FallbackResolverSet(address resolver); |
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.
I don't think we need an event for this, since the registry will emit an event in any case.
event TokenObserverSet(uint256 indexed tokenId, address observer); | ||
|
||
// Address of the fallback resolver for names not found in this registry | ||
address public fallbackResolver; |
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.
This will be resolved via the parent registry's resolver field, no need to store it here.
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender); | ||
} | ||
|
||
function uri(uint256 /*tokenId*/ ) public pure override returns (string memory) { |
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.
Best add a TODO here.
* @param expires Expiration timestamp | ||
* @return tokenId The token ID of the ejected name | ||
*/ | ||
function ejectFromL2(string calldata label, address owner, IRegistry registry, uint96 flags, uint64 expires) |
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.
I think we should probably be using the label hash here, not the plaintext label.
flags = (flags & FLAGS_MASK) | (uint96(expires) << 32); | ||
|
||
// If there is a previous owner, burn the token | ||
address previousOwner = super.ownerOf(tokenId); |
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.
We need to check that the previous name is expired first, so that a malicious ejection controller can't override L1 names.
* @param expires Expiration timestamp | ||
* @return tokenId The token ID of the ejected name | ||
*/ | ||
function ejectFromL2(string calldata label, address owner, IRegistry registry, uint96 flags, uint64 expires) |
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.
Either we should accept only a uint32
of flags, or we should accept a combined flags+expiration as a single field. Accepting a uint96
of which 64 bits have to be zero seems odd.
* @dev Relinquish an ejected name | ||
* @param tokenId The token ID of the name to relinquish | ||
*/ | ||
function relinquish(uint256 tokenId) external onlyTokenOwner(tokenId) { |
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.
How does this differ from migrateToL2
?
* @param tokenId The token ID of the name to migrate | ||
* @param sendTo The address to send the name to on L2 | ||
*/ | ||
function migrateToL2(uint256 tokenId, address sendTo) |
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.
This needs to notify the ejection controller, so that control can be given back to the user on L2.
Using @hiddentao 's ETHRegistry as a reference I tried to implement L1ETHRegistry.
Note: Just now I see that the ticket is assigned today already. So feel free to skip if there is another effort.
The code implements L1-native renewals, based on the feedback, but open to discussion.
uri
function implementation, at the moment it returns emtpy string just as ETHRegistry, but I thoughtcould be also an approach.