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

Expose node internals #445

Merged
merged 4 commits into from
Nov 26, 2024
Merged

Expose node internals #445

merged 4 commits into from
Nov 26, 2024

Conversation

roman-khimov
Copy link
Member

No description provided.

contracts/netmap/contract.go Outdated Show resolved Hide resolved
contracts/netmap/contract.go Show resolved Hide resolved
contracts/netmap/contract.go Show resolved Hide resolved
contracts/netmap/config.yml Show resolved Hide resolved
// all of the node structure to contract.
type Node2 struct {
// Addresses are to be used to connect to the node.
Addresses []string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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

contracts/netmap/contract.go Show resolved Hide resolved
ctx := storage.GetContext()

if n.State != nodestate.Online {
panic("can't add non-online node")
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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

contracts/netmap/contract.go Show resolved Hide resolved
contracts/netmap/contract.go Show resolved Hide resolved
Copy link
Contributor

@cthulhu-rider cthulhu-rider left a 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

contracts/netmap/contract.go Outdated Show resolved Hide resolved
contracts/netmap/contract.go Show resolved Hide resolved
@@ -665,6 +780,32 @@ func filterNetmap(ctx storage.Context) []Node {
return result
}

func fourBytesBE(num int) []byte {
Copy link
Contributor

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

contracts/netmap/contract.go Outdated Show resolved Hide resolved
contracts/netmap/contract.go Outdated Show resolved Hide resolved
contracts/netmap/contract.go Outdated Show resolved Hide resolved
contracts/netmap/contract.go Show resolved Hide resolved
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]>
@carpawell carpawell merged commit f6398fe into master Nov 26, 2024
8 checks passed
@carpawell carpawell deleted the expose-node-internals branch November 26, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants