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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion container/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "NeoFS Container"
safemethods: ["count", "containersOf", "get", "owner", "list", "eACL", "getContainerSize", "listContainerSizes", "iterateContainerSizes", "iterateAllContainerSizes", "version"]
permissions:
- methods: ["update", "addKey", "transferX",
"register", "addRecord", "deleteRecords"]
"register", "registerTLD", "addRecord", "deleteRecords"]
events:
- name: PutSuccess
parameters:
Expand Down
9 changes: 3 additions & 6 deletions container/container_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,9 @@ func registerNiceNameTLD(addrNNS interop.Hash160, nnsRoot string) {
return
}

res := contract.Call(addrNNS, "register", contract.All,
nnsRoot, runtime.GetExecutingScriptHash(), "[email protected]",
defaultRefresh, defaultRetry, defaultExpire, defaultTTL).(bool)
if !res {
panic("can't register NNS TLD")
}
contract.Call(addrNNS, "registerTLD", contract.All,
nnsRoot, "[email protected]",
defaultRefresh, defaultRetry, defaultExpire, defaultTTL)
}

// Update method updates contract source code and manifest. It can be invoked
Expand Down
5 changes: 5 additions & 0 deletions nns/namestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

// NameState represents domain name state.
type NameState struct {
// Domain name owner. Nil if owned by the committee.
Owner interop.Hash160
Name string
Expiration int64
Expand All @@ -22,6 +23,10 @@ func (n NameState) ensureNotExpired() {

// checkAdmin panics if script container is not signed by the domain name admin.
func (n NameState) checkAdmin() {
if len(n.Owner) == 0 {
checkCommittee()
return
}
if runtime.CheckWitness(n.Owner) {
return
}
Expand Down
Loading