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

nns: Register pre-defined TLDs for the committee on deployment stage #344

Merged

Commits on Jun 10, 2023

  1. nns: Change domain name registration access control

    Previously, NNS contract required signature of the TLD owner to grant
    access for L2 domain name registration. This didn't allow to properly
    manage TLDs by committee (only) since it is multi-account and dynamic
    while all domains were owned by the single account. Also, such behavior
    made it almost impossible to register L2 domains in practice.
    
    To solve the described problems, the following changes are introduced to
    the access rules (`register` method of the NNS contract):
     * TLDs are managed only by the committee only;
     * free L2 domains are free-to-take;
     * all L3+ domains are managed by parent domain owner or administrator
       only.
    
    Refs nspcc-dev#334.
    
    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Jun 10, 2023
    Configuration menu
    Copy the full SHA
    1114452 View commit details
    Browse the repository at this point in the history
  2. nns: Allow to register pre-defined TLDs on deployment stage

    In order to register TLD, committee multi-signature must be gathered.
    It is not always easy. For example, on "fresh" network, committee
    members may not have a notary role, so they will not be able to use
    Notary service to collect a signature. At the same time, Notary service
    is the only convenient way to collect a multi-signature in a distributed
    mode. To simplify the solution of the described task, it would be
    convenient to be able to register pre-known TLDs at the NNS contract
    deployment stage (which is performed by the committee).
    
    Support list of (name, e-mail) pairs describing pre-defined TLDs as
    optional deployment parameters (passed into `_deploy` callback). Also
    make `migration.NewContract` to pre-register 'neofs' TLD.
    
    Refs nspcc-dev#334.
    
    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Jun 10, 2023
    Configuration menu
    Copy the full SHA
    1d68511 View commit details
    Browse the repository at this point in the history
  3. nns: Prevent users from accessing top-level domains

    Top-level domains aren't NFTs, therefore NNS contract must not treat
    them as such. At the same time, technically TLDs are valid domains (e.g.
    'org'), so nothing will prevent the user from performing operations with
    them. Based on this, the best approach would be treating TLDs as
    non-existent domains.
    
    Throw 'token not found' exception on TLD input of any method. The
    storage model is left the same: this allows us not to perform migration
    and implement the behavior logically.
    
    Refs 334.
    
    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Jun 10, 2023
    Configuration menu
    Copy the full SHA
    5758c84 View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2023

  1. nns: Add dedicated method for TLD registration

    Top-level domains are controlled by the committee. Previously, NNS
    contract provided `register` method that accepted fixed domain owner.
    After recent changes, TLDs were forbidden to be treated as regular
    tokens in terms of the NNS contract. According to this, `register`
    method is no longer well-suited for TLD registration, so, it's worth to
    provide dedicated method for this purpose.
    
    Add `registerTLD` method with signature similar to the `register` one
    but w/o owner parameter.
    
    Closes nspcc-dev#334.
    
    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    901d3d9 View commit details
    Browse the repository at this point in the history
  2. tests: Add test for roots method of the NNS contract

    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    ebbcbaf View commit details
    Browse the repository at this point in the history
  3. nns: Avoid double domain name fragmentation within one method

    After recent changes, some contract methods pre-calculate fragments of
    the requested domain name to process TLDs. In most cases, these methods
    call `getNameState` function in subsequent instructions which also
    performs fragmentation. In order to avoid resource costs for a
    duplicated action, an already calculated partition should be reused.
    
    Add `getFragmentedNameState` function which allows to pass
    pre-calculated fragments. The function is implemented with the
    possibility of a direct call from `getNameState` while maintaining the
    behavior of the latter.
    
    Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
    cthulhu-rider committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    ecf8270 View commit details
    Browse the repository at this point in the history