-
Notifications
You must be signed in to change notification settings - Fork 17
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
Expose node internals #445
Conversation
Signed-off-by: Roman Khimov <[email protected]>
60ec224
to
c4a3bf0
Compare
// all of the node structure to contract. | ||
type Node2 struct { | ||
// Addresses are to be used to connect to the node. | ||
Addresses []string |
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.
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.
That one is just an attribute, attribute it'll be. The structure obviously follows the data we have defined for nodes.
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.
what usecase then for this field if it is not full and every "good" client should see attributes too?
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.
Are you trying to tell me that it's never filled by nodes? This structure just follows protobuf, whatever is there we have here as well without thinking much about it.
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.
Are you trying to tell me that it's never filled by nodes?
of course, it is used but there is also more information that is called "external addresses" in our code. anyway, ok let it be
ctx := storage.GetContext() | ||
|
||
if n.State != nodestate.Online { | ||
panic("can't add non-online node") |
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.
in some of my PRs i tried to put more context in errors, however, it was reworked and not merged but still, is it a good practice to add more info to contracts panics?
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.
What kind of info do you want here?
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.
in the "can't add non-online node" log i would like to see what state i am trying to add. i may not even know where the bug is and believe that i am doing everything right. at least, this log is what almost all of us would add to the error in a pure go-code
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.
You don't have a lot of possibilities, really. Offline/maintenance.
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.
or unknown 1234
. ok not that critical
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.
very good to me in total
@@ -665,6 +780,32 @@ func filterNetmap(ctx storage.Context) []Node { | |||
return result | |||
} | |||
|
|||
func fourBytesBE(num int) []byte { |
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.
this is too specific and i see the only usage of it, so suggest to leave netmapNode2AtEpochPrefix() []byte
for now. But dont insist
c4a3bf0
to
f7cea37
Compare
This format is added in parallel to existing one because we can't migrate in the contract easily, it'd require complete protobuf parser in VM. Instead we provide a secondary map here that works similar to the old one (except it doesn't have any listing or duplication issues). The expection is that nodes will send _both_ transactions starting from some time, we'll monitor them and transition to using new map only in subsequent IR/SN release. Then contract could be updated to drop the old data. Signed-off-by: Roman Khimov <[email protected]>
Reuse standard code. Signed-off-by: Roman Khimov <[email protected]>
It uses alphabet multiaddress and it's well-known, no need to repeat the getter. Signed-off-by: Roman Khimov <[email protected]>
f7cea37
to
063870e
Compare
No description provided.