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

Add dm3 name registrar #1

Merged
merged 39 commits into from
Apr 5, 2024
Merged

Add dm3 name registrar #1

merged 39 commits into from
Apr 5, 2024

Conversation

AlexNi245
Copy link
Collaborator

No description provided.

Copy link

@malteish malteish left a comment

Choose a reason for hiding this comment

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

please go through the comments and run prettier or something similar.
I enjoyed dm3-names/contracts/l2/Dm3NameRegistrar.sol and think you did, too.

Copy link

@malteish malteish left a comment

Choose a reason for hiding this comment

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

Good changes, but some more work is required. In particular I propose testing the full upgrade cycle in order to be sure it works.

// Event emitted when a name is removed
event NameRemoved(address indexed addr, string indexed name);

function initialize(bytes32 _parentNode) public initializer {

Choose a reason for hiding this comment

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

it is recommended to have a constructor that calls _disableInitializers() (or similar) to prevent logic contracts from being claimable at all (-> parity hack).

In the initializer, call initializers of all inherited contracts, like ownable (which needs the address of the new owner).

When using proxies without factories, there is a risk that someone can call the initializer of the new contract before you do. I suppose we can take that risk in this case, as a new proxy is not important yet. But calling initiliaze is crucial!!!

Copy link
Collaborator Author

@AlexNi245 AlexNi245 Mar 18, 2024

Choose a reason for hiding this comment

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

would making the initializer restricted to the owner mitigate the issue?

Copy link

@malteish malteish Mar 19, 2024

Choose a reason for hiding this comment

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

The proxy does not have an owner before it is initialized, so this is not possible.
Some hints:

OZ v5 might have changed some of these approaches, so it would be wise to do read the updated docs.

/// @param node The node to set the text for
/// @param key The key for the text
/// @param value The text to set
function setText(

Choose a reason for hiding this comment

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

The contract owner can register a name for a user, but not set a text record. Isn't that required to publish a profile? If so, maybe ownerRegister(name, address) should have a sibling ownerRegister(name, address, keys, values) or similar.

Choose a reason for hiding this comment

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

The constructor is missing. Is this on purpose?


function initialize(bytes32 _parentNode) public initializer {
PARENT_NODE = _parentNode;
__Ownable_init();

Choose a reason for hiding this comment

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

Is the deployer being the owner desired behavior? If not, we could call a function to set the owner right after this init.

expect(bobOwner).to.equal(bobSigner.address);
expect(bobName).to.equal('bob');
});
it('can use addr to retrieve address of node', async () => {

Choose a reason for hiding this comment

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

can use name ...

@AlexNi245 AlexNi245 merged commit 99c28d2 into main Apr 5, 2024
5 checks passed
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.

2 participants