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

Add ping version 2 description. #526

Merged
merged 2 commits into from
Apr 25, 2024
Merged

Add ping version 2 description. #526

merged 2 commits into from
Apr 25, 2024

Conversation

mitchelli
Copy link
Contributor

This PR is supported by Æternity Foundation and Æternity Crypto Foundation

@mitchelli mitchelli linked an issue Mar 7, 2024 that may be closed by this pull request
### Version 2

- `Versions :: list`
- `Protocol :: binary` - type of message.
Copy link
Member

Choose a reason for hiding this comment

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

Could you please elaborate a bit more on this field? It's name is protocol, it's description is "type of message".

In general I'd like to see somewhere documented how this "Versions" field should work and what is used for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the moment, the only protocol is ping. It specifies the node supports v1 and v2 pings. It will be used to decide which version of a message should be used. I'll add an explanation.

- `Difficulty :: int` - the total difficulty of the chain.
- `TopHash :: byte_array`
- `sync_allowed :: bool` - if the sender of this ping message is accepting
- `SyncAllowed :: bool` - if the sender of this ping message is accepting
Copy link
Member

Choose a reason for hiding this comment

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

Since we have a capability field now, isn't it appropriate to move this there? Sounds like a capability to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could be, the current example capability is more complicated though, it is for a sync capability "chain_poi", which is:

{height, int}
{root_hash, binary}
{genesis, binary}
{top, binary}
{poi, binary} 

A downside would be that it increases the size of the ping.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, maybe a misunderstand "capabilities"

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we are sure that is how capabilities should be used, let's see when we actually find a use-case for them. My idea was that the capabilities should signal what additional messages that the node will understand and react to 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ulf wanted to use it for additional methods of sync. aeternity/aeternity#4189

- `GenesisHash :: byte_array`
- `Height :: int` - current height.
Copy link
Member

Choose a reason for hiding this comment

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

Isn't height kind of "per database" (node) field? Why is it shared? If you know the remote TopHash isn't it possible to derive its height as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I asked Ulf and this is his response, "It's true that the height can be derived, but only by first downloading headers. While working on fast synch strategies, I felt that getting the height up front was a convenience at fairly low cost."

- `Difficulty :: int` - the total difficulty of the chain.
- `TopHash :: byte_array`
- `sync_allowed :: bool` - if the sender of this ping message is accepting
- `SyncAllowed :: bool` - if the sender of this ping message is accepting
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we are sure that is how capabilities should be used, let's see when we actually find a use-case for them. My idea was that the capabilities should signal what additional messages that the node will understand and react to 🤔

@mitchelli mitchelli merged commit d634e7a into master Apr 25, 2024
@mitchelli mitchelli deleted the 525-document-ping-v2 branch April 25, 2024 12:42
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.

Document ping v2
4 participants