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: port changes from C# NNS #267

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
16aaaa6
[#266] nns: Add `admin` to properties
AnnaShaleva Sep 9, 2022
80e5bcb
[#266] nns: Return empty Array from `resolve` instead of Null
AnnaShaleva Sep 9, 2022
53e0e91
[#266] nns: Fix safe methods list
AnnaShaleva Sep 9, 2022
b584d5a
[#266] nns: Return empty Array from getRecords instead of Null
AnnaShaleva Sep 9, 2022
8213ba5
[#266] nns: Fix typo in the method description
AnnaShaleva Sep 9, 2022
b1f5864
[#266] nns: Restrict the maximum number of records with the same type
AnnaShaleva Sep 9, 2022
48c96ec
[#266] nns: Move common code to a separate method
AnnaShaleva Sep 9, 2022
f65bbc0
[#266] nns: Fix CNAME resolution rules
AnnaShaleva Sep 9, 2022
fe266fd
[#266] nns: Remove unused config file
AnnaShaleva Sep 12, 2022
22f2700
[#266] nns: Refactor record-related operations code
AnnaShaleva Sep 13, 2022
e5ad839
[#266] nns: Move common record checking code to a separate function
AnnaShaleva Sep 13, 2022
86d171e
[#266] nns: Accept token ID as an argument for storeRecord
AnnaShaleva Sep 13, 2022
b5d1b61
[#266] nns: Reuse storeRecord for storing SOA record
AnnaShaleva Sep 13, 2022
2d8ba9d
[#266] nns: Move token key creation to a separate function
AnnaShaleva Sep 13, 2022
c2e411c
[#266] nns: reuse existing context in tokenIDFromName
AnnaShaleva Sep 13, 2022
6f49a54
[#266] nns: Keep `isAvailable` in sync with `register`
AnnaShaleva Sep 14, 2022
37d5f56
[#266] nns: Use millisecondsInSeconds constant where appropriate
AnnaShaleva Sep 14, 2022
41b5f0c
[#267] nns: Make domain registration price dependant on length
AnnaShaleva Sep 15, 2022
0fe6360
[#267] common: Fix typo in the comment
AnnaShaleva Sep 15, 2022
6ab4a65
[#267] nns: Accept expiration period in `renew`
AnnaShaleva Sep 15, 2022
a21a6a8
[#267] nns: Add SetAdmin event
AnnaShaleva Sep 15, 2022
21bd76e
[#267] nns: Add Renew event
AnnaShaleva Sep 15, 2022
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
4 changes: 2 additions & 2 deletions common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import "github.com/nspcc-dev/neo-go/pkg/interop/native/std"
const (
major = 0
minor = 15
patch = 4
patch = 5

// Versions from which an update should be performed.
// These should be used in a group (so prevMinor can be equal to minor if there are
// any migration routines.
// any migration routines).
prevMajor = 0
prevMinor = 15
prevPatch = 1
Expand Down
8 changes: 4 additions & 4 deletions container/container_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ func checkNiceNameAvailable(nnsContractAddr interop.Hash160, domain string) bool
}

res := contract.Call(nnsContractAddr, "getRecords",
contract.ReadStates|contract.AllowCall, domain, 16 /* TXT */)
if res != nil {
contract.ReadStates|contract.AllowCall, domain, 16 /* TXT */).([]string)
if len(res) > 0 {
panic("name is already taken")
}

Expand Down Expand Up @@ -351,8 +351,8 @@ func Delete(containerID []byte, signature interop.Signature, token []byte) {
// by other means (expiration, manual), thus leading to failing `deleteRecord`
// and inability to delete a container. We should also check if we own the record in case.
nnsContractAddr := storage.Get(ctx, nnsContractKey).(interop.Hash160)
res := contract.Call(nnsContractAddr, "getRecords", contract.ReadStates|contract.AllowCall, domain, 16 /* TXT */)
if res != nil && std.Base58Encode(containerID) == string(res.([]interface{})[0].(string)) {
res := contract.Call(nnsContractAddr, "getRecords", contract.ReadStates|contract.AllowCall, domain, 16 /* TXT */).([]string)
if len(res) > 0 && std.Base58Encode(containerID) == res[0] {
contract.Call(nnsContractAddr, "deleteRecords", contract.All, domain, 16 /* TXT */)
}
}
Expand Down
18 changes: 18 additions & 0 deletions nns/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,25 @@ events:
type: Integer
- name: tokenId
type: ByteArray
- name: SetAdmin
parameters:
- name: name
type: String
- name: oldAdmin
type: Hash160
- name: newAdmin
type: Hash160
- name: Renew
parameters:
- name: name
type: String
- name: oldExpiration
type: Integer
- name: newExpiration
type: Integer
permissions:
- hash: fffdc93764dbaddd97c48f252a53ea4643faa3fd
methods: ["update"]
- methods: ["onNEP11Payment"]
overloads:
renewDefault: renew
20 changes: 0 additions & 20 deletions nns/nns.yml

This file was deleted.

Loading