-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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.
please go through the comments and run prettier or something similar.
I enjoyed dm3-names/contracts/l2/Dm3NameRegistrar.sol and think you did, too.
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 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 { |
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.
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!!!
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.
would making the initializer restricted to the owner mitigate the issue?
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.
The proxy does not have an owner before it is initialized, so this is not possible.
Some hints:
- how to call the inherited initializers
- you can inherit UUPS upgradeable, and then have to override this function
- disable initializers in constructor
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( |
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.
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.
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.
The constructor is missing. Is this on purpose?
|
||
function initialize(bytes32 _parentNode) public initializer { | ||
PARENT_NODE = _parentNode; | ||
__Ownable_init(); |
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.
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 () => { |
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.
can use name ...
No description provided.