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

NameService: minor improvements, part 2 #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AnnaShaleva
Copy link
Member

The second part of NNS contract update, depends on #23, waiting for the first part to be merged.

Includes:

  1. Require admin signature for subdomain registration.
  2. Check domain expiration for read functions.

@AnnaShaleva
Copy link
Member Author

I'll rebase it to the current master in a few minutes to omit merged commits.

@AnnaShaleva
Copy link
Member Author

Ready for review.

ByteString buffer = nameMap[GetKey(name)];
if (buffer is null) return true;
NameState token = (NameState)StdLib.Deserialize(buffer);
if (Runtime.Time >= token.Expiration) return true;
Copy link
Member

Choose a reason for hiding this comment

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

Is not better to store the min expiration time into NameState, seems expensive to me the method getNameState

Copy link
Member Author

@AnnaShaleva AnnaShaleva Sep 19, 2022

Choose a reason for hiding this comment

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

Then on every Renew we have to iterate over the whole set of dependant token children and re-calculate minimum expiration time for each NameState which implies retrieving the whole set of parent domains. It can be rather expensive too.

Choose a reason for hiding this comment

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

I'd expect there to be ~2-3 iterations typically which doesn't seem to be a lot. Many of the affected methods are safe (OwnerOf, Properties, IsAvailable, etc.), so they'll be mostly invoked in test mode, not on-chain. Non-safe affected methods can have more problems with the alternative layout as with the Renew case above.

@superboyiii
Copy link
Member

superboyiii commented Sep 21, 2022

The second part of NNS contract update, depends on #23, waiting for the first part to be merged.

Includes:

  1. Require admin signature for subdomain registration.
  2. Check domain expiration for read functions.

I think NNS doesn't have a concept of subdomain, all domain will be xxx.neo

@roman-khimov
Copy link

roman-khimov commented Sep 21, 2022

IIUC currently you can have a.neo registered to someone and then someone else can register b.a.neo, this PR solves that. (not true, that's 60303e0 in subsequent PRs). And it allows to have subzones owned/managed by different entities.

@erikzhang
Copy link
Member

And it allows to have subzones owned/managed by different entities.

I think it's too complicated.

@roman-khimov
Copy link

roman-khimov commented Sep 21, 2022

Well, that's the way proper DNS is and it solves some real-world problems. At the same time, maybe we can move 1891f40 out of this set, because IIUC the second patch doesn't raise any questions?

@superboyiii
Copy link
Member

superboyiii commented Sep 21, 2022

IUC currently you can have a.neo registered to someone and then someone else can register b.a.neo, this PR solves that

No, he can't, because it's set as false here

string[] fragments = SplitAndCheck(name, false);
, xxx.neo.org will return format exception.

@superboyiii
Copy link
Member

I think these are improvement and rework of the structure, we need discuss it further more because design has been changed. I guess we can iterate these changes later after release first version. 4a769b1 This one is more critical, we can apply it ASAP.

@roman-khimov
Copy link

, xxx.neo.org will return format exception.

Yeah, that's also changed in #29, sorry, we've got three NNS contracts currently with a number of PRs.

Check out coredns/coredns@master...nspcc-dev:coredns:master also, this one works with NeoFS version of NNS.

And refactor GetRecords/GetAllRecords along the way, move commonly
used code to a separate function.

Originally introduced in
nspcc-dev/neofs-contract@432c02a.
@AnnaShaleva
Copy link
Member Author

Rebased onto the current master (8d72b92).

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.

5 participants