-
Notifications
You must be signed in to change notification settings - Fork 38
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
feature/add-netmapCandidates
-netmap-method
#647
feature/add-netmapCandidates
-netmap-method
#647
Conversation
Codecov Report
@@ Coverage Diff @@
## master #647 +/- ##
==========================================
- Coverage 43.23% 43.05% -0.19%
==========================================
Files 203 204 +1
Lines 8012 8072 +60
==========================================
+ Hits 3464 3475 +11
- Misses 4211 4256 +45
- Partials 337 341 +4
Continue to review full report at Codecov.
|
Use defined constant variable instead of hardcoded number in error message. Signed-off-by: Pavel Karpy <[email protected]>
pkg/morph/client/netmap/netmap.go
Outdated
// GetNetMapCandidatesValues groups the stack parameters | ||
// returned by get network map candidates test invoke. | ||
type GetNetMapCandidatesValues struct { | ||
NetmapNodes []*PeerWithState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls make it unexported, or it will be hard to keep code and logic compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made unexported and add getter to it
pkg/morph/client/netmap/netmap.go
Outdated
} | ||
|
||
func peerWithStateFromStackItem(prm stackitem.Item) (*PeerWithState, error) { | ||
if prm.Type() != stackitem.StructT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need explicit stackitem.StructT
which is supported by client.ArrayFromStackItem
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an additional layer of checks since there are too deep nesting of structures(there was no nested structs parsing before that PR)
pkg/morph/client/netmap/netmap.go
Outdated
var res PeerWithState | ||
|
||
// peer | ||
if prms[0].Type() != stackitem.StructT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as for stackitem.StructT
and below
pkg/morph/client/netmap/netmap.go
Outdated
|
||
func peersWithStateFromStackItems(stack []stackitem.Item, method string) (*GetNetMapCandidatesValues, error) { | ||
if ln := len(stack); ln != 1 { | ||
return nil, fmt.Errorf("unexpected stack intem count (%s): %d", method, ln) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("unexpected stack intem count (%s): %d", method, ln) | |
return nil, fmt.Errorf("unexpected stack item count (%s): %d", method, ln) |
and re-check if it caused by copy-paste.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed and checked
Add `netmapCandidates` method to `netmap` client wrapper. Method parses node storages candidates for the next epoch. Signed-off-by: Pavel Karpy <[email protected]>
Signed-off-by: Pavel Karpy <[email protected]>
Related to nspcc-dev/neo-exporter#12.