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: migration of fuses to v2 #17

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hiddentao
Copy link
Contributor

@hiddentao hiddentao commented Feb 18, 2025

Notes:



  • I started out by putting incorporating the new flags into the existing flags architecture but things quickly got complicated so for now I’m just keeping it inside NameWrapperRegistry - will revisit later

  • The PARENT_CANNOT_CONTROL fuse is matched by locking the parent registry, meaning: If we migrate a v1 name wrapper where a few names are locked then in v2 the migrated version would be such that all the names are locked (i.e. the subregistry itself is locked and can’t be changed). I think this is reasonable.

  • CANNOT_CREATE_SUBDOMAIN can be handled by removing the registrar role

  • CANNOT_SET_RESOLER can be handled using the existing flags system


@hiddentao hiddentao marked this pull request as draft February 18, 2025 06:44
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13384803637

Details

  • 0 of 80 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-11.8%) to 46.171%

Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/src/registry/NameWrapperRegistry.sol 0 80 0.0%
Totals Coverage Status
Change from base Build 13351832110: -11.8%
Covered Lines: 193
Relevant Lines: 404

💛 - Coveralls

Copy link
Member

@Arachnid Arachnid left a comment

Choose a reason for hiding this comment

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

Can you provide a more detailed design rationale? I'm not really understanding why we need to have registrar-controlled settings (and is this intended to mean settings controlled by a third party designated as the registrar, or settings controlled by the owner of the parent name?

Comment on lines +25 to +26
address public parentRegistry;
uint256 public parentTokenId;
Copy link
Member

Choose a reason for hiding this comment

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

Generally we've avoided introducing these unless absolutely necessary.

uint256 public parentTokenId;

// TODO: uint32 for now whilst we iterate on the settings
mapping(uint256 tokenId => uint32 flags) public settings;
Copy link
Member

Choose a reason for hiding this comment

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

Let's call this flags instead of settings.

// TODO: uint32 for now whilst we iterate on the settings
mapping(uint256 tokenId => uint32 flags) public settings;
// Fuse: PARENT_CANNOT_CONTROL - the parent registry will have to lock this subregistry to its parent node + also set this setting here
uint32 public constant SETTING_REGISTRAR_OWNER_HAS_CONTROL = 0x1;
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be 'registry' not 'registrar'.

// Fuse: CANNOT_RENEW
uint32 public constant SETTING_OWNER_RENEWALS_LOCKED = 0x8;
// Fuse: CANNOT_TRANSFER
uint32 public constant SETTING_OWNER_TRANSFER_LOCKED = 0x16;
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
uint32 public constant SETTING_OWNER_TRANSFER_LOCKED = 0x16;
uint32 public constant SETTING_OWNER_TRANSFER_LOCKED = 0x10;

// Fuse: CANNOT_TRANSFER
uint32 public constant SETTING_OWNER_TRANSFER_LOCKED = 0x16;

uint32 public constant SETTINGS_OWNER_MASK = 0x28; // 11100
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
uint32 public constant SETTINGS_OWNER_MASK = 0x28; // 11100
uint32 public constant SETTINGS_OWNER_MASK = 0x1C; // 1 1100

}

function updateOwnerSettings(uint256 _tokenId, uint32 _settings) public onlyTokenOwner(_tokenId)
withSettings(_tokenId, SETTING_OWNER_SETTINGS_LOCKED, 0)
Copy link
Member

Choose a reason for hiding this comment

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

These can be combined into one check.

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.

3 participants