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

adm: fix wrong nnsResolveKey() code #2296

Merged
merged 1 commit into from
Apr 10, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Changelog for NeoFS Node
- Storage ID update by write-cache (#2244)
- `neo-go` client deadlock on subscription (#2244, #2272)
- Possible panic during write-cache initialization (#2234)
- incorrect NNS resolve handling in neofs-adm (#2296)

### Removed
### Updated
Expand Down
10 changes: 7 additions & 3 deletions cmd/neofs-adm/internal/modules/morph/initialize_nns.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,17 @@ func nnsResolveKey(inv *invoker.Invoker, nnsHash util.Uint160, domain string) (*
if err != nil {
return nil, err
}
v, ok := item.Value().(stackitem.Null)
_, ok := item.Value().(stackitem.Null)
if ok {
return nil, errors.New("NNS record is missing")
}
bs, err := v.TryBytes()
arr, ok := item.Value().([]stackitem.Item)
if !ok || len(arr) < 1 {
return nil, errors.New("malformed response (not an array)")
}
bs, err := arr[0].TryBytes()
if err != nil {
return nil, errors.New("malformed response")
return nil, errors.New("malformed response (no bytes)")
}

return keys.NewPublicKeyFromString(string(bs))
Expand Down