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

feat: first attempt at v2 ETH registrar #15

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

hiddentao
Copy link
Contributor

No description provided.

@hiddentao hiddentao requested a review from Arachnid February 11, 2025 10:12
@hiddentao hiddentao requested a review from Arachnid February 11, 2025 10:37
@makoto
Copy link
Member

makoto commented Feb 12, 2025

Is this now obsolete? https://github.com/ensdomains/namechain/pull/7/files

@makoto
Copy link
Member

makoto commented Feb 12, 2025

Shouldn't EthRegistrar now be called EthRegistryController?
According to the design doc https://drive.google.com/file/d/1LoA-xboajzUuWwsWpxJ-h1-WqDEsRlkC/view

4.5.3 L2 .eth Registry Controller

ENS v2 Design Doc 16
Similar to the registrar controller in ENS v1, the .eth registry controller will exist
on L2 and facilitate registration and renewals of names by users. As in v1, this
division exists in order to ensure registration and renewal logic, including
pricing, can be updated, while allowing the .eth registry itself to be locked.
Multiple controllers can be authorised by the DAO as needed.

@coveralls
Copy link

coveralls commented Feb 13, 2025

Pull Request Test Coverage Report for Build 13645233447

Details

  • 71 of 74 (95.95%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+6.8%) to 65.419%

Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/test/ETHRegistrar.t.sol 9 10 90.0%
contracts/src/registry/ETHRegistry.sol 4 6 66.67%
Totals Coverage Status
Change from base Build 13540426288: 6.8%
Covered Lines: 268
Relevant Lines: 402

💛 - Coveralls

@hiddentao hiddentao marked this pull request as ready for review February 16, 2025 05:53
@hiddentao hiddentao requested a review from Arachnid February 16, 2025 08:20
@makoto
Copy link
Member

makoto commented Feb 26, 2025

Don't we need to implement commit & register on the registry controller?

@hiddentao
Copy link
Contributor Author

Don't we need to implement commit & register on the registry controller?

I'm not sure. @Arachnid ?

@Arachnid
Copy link
Member

Yes, the controller will still need to have a commit-reveal implementation.

@hiddentao
Copy link
Contributor Author

@Arachnid Got the commit-reveal in there. As for the v1 reverse resolver stuff, should I put that in too?

Comment on lines +21 to +22
error CommitmentTooNew(bytes32 commitment);
error CommitmentTooOld(bytes32 commitment);
Copy link
Member

Choose a reason for hiding this comment

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

These should probably include the commitment's actual age and the limit.

error CommitmentTooNew(bytes32 commitment);
error CommitmentTooOld(bytes32 commitment);
error NameNotAvailable(string name);
error InsufficientValue();
Copy link
Member

Choose a reason for hiding this comment

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

This should probably include the expected value and the actual value.


error MaxCommitmentAgeTooLow();
error UnexpiredCommitmentExists(bytes32 commitment);
error DurationTooShort(uint64 duration);
Copy link
Member

Choose a reason for hiding this comment

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

This should include the min duration.

Comment on lines +28 to +29
uint256 public immutable minCommitmentAge;
uint256 public immutable maxCommitmentAge;
Copy link
Member

Choose a reason for hiding this comment

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

We should consider making these mutable, since the contract already has an owner.

Comment on lines +61 to +62
address subregistry = address(registry.getSubregistry(name));
return subregistry == address(0);
Copy link
Member

Choose a reason for hiding this comment

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

We want to permit users to set their subregistry to 0 for valid names if they don't have subdomains. We should probably check the expiration date, instead.

if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {
revert UnexpiredCommitmentExists(commitment);
}
commitments[commitment] = block.timestamp;
Copy link
Member

Choose a reason for hiding this comment

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

We should emit an event when a commitment is recorded.

function register(
string calldata name,
address owner,
IRegistry subregistry,
Copy link
Member

Choose a reason for hiding this comment

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

It'd be useful to allow setting the resolver at the same time as registering.

IRegistry subregistry,
uint96 flags,
uint64 duration
) external payable onlyRole(CONTROLLER_ROLE) returns (uint256 tokenId) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
) external payable onlyRole(CONTROLLER_ROLE) returns (uint256 tokenId) {
) external payable returns (uint256 tokenId) {

I think we want this to be publicly callable now, right?

* @param name The name to renew.
* @param duration The duration of the renewal.
*/
function renew(string calldata name, uint64 duration) external payable onlyRole(CONTROLLER_ROLE) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
function renew(string calldata name, uint64 duration) external payable onlyRole(CONTROLLER_ROLE) {
function renew(string calldata name, uint64 duration) external payable {

payable(msg.sender).transfer(msg.value - totalPrice);
}

emit NameRenewed(name, duration, tokenId);
Copy link
Member

Choose a reason for hiding this comment

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

This should include the new expiration date.

@Arachnid
Copy link
Member

Arachnid commented Mar 4, 2025

As for the v1 reverse resolver stuff, should I put that in too?

No, we'll use batch calls and smart accounts to handle that.

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