Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

pex: update pex messages #352

Merged
merged 4 commits into from Oct 13, 2021
Merged

pex: update pex messages #352

merged 4 commits into from Oct 13, 2021

Conversation

cmwaters
Copy link
Contributor

@cmwaters cmwaters commented Oct 8, 2021

This PR proposes a p2p breaking change, cleaning up the PEX messages by removing the v1 version for the legacy p2p system and having a single pex receive and response message type.

@tac0turtle
Copy link
Contributor

this will be treated as a stop the node and restart type of upgrade?

@cmwaters
Copy link
Contributor Author

Yup. It would require a coordinated restart. But regardless of this change I think 0.36 will be coordinated upgrade anyway

string id = 1 [(gogoproto.customname) = "ID"];
string ip = 2 [(gogoproto.customname) = "IP"];
uint32 port = 3;
string url = 1 [(gogoproto.customname) = "URL"];
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend marking the removed field tags as reserved so we don't try to reuse them later.

Suggested change
string url = 1 [(gogoproto.customname) = "URL"];
string url = 1 [(gogoproto.customname) = "URL"];
reserved 2, 3; // See https://github.com/tendermint/spec/pull/352

message PexResponseV2 {
repeated PexAddressV2 addresses = 1 [(gogoproto.nullable) = false];
}

message PexMessage {
oneof sum {
PexRequest pex_request = 1;
PexResponse pex_response = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
PexResponse pex_response = 2;
PexResponse pex_response = 2;
reserved 3, 4; // See https://github.com/tendermint/spec/pull/352

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I wonder if we should reserve 1, 2, 3, and 4 and have 5 and 6 for the new pex_request/pex_response?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is something proto breaking if you rename it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is something proto breaking if you rename it?

It is a breaking change to the generated code, but as long as the structural type doesn't change it's wire-compatible. The main reason to reserve old field tags is for wire-compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, I wonder if we should reserve 1, 2, 3, and 4 and have 5 and 6 for the new pex_request/pex_response?

I didn't actually look at the history prior to this diff. I think it's generally a good idea to never reuse a field tag. A common trick is to keep a // next id: 25 comment in each message type so that you can tell what to use next quickly.

The temptation to try to keep the numbering compact and visually ordered is understandable, but probably not worthwhile: The intent of explicit field tags is so that newer messages don't blow up older software (they will simply ignore the unknown tags) and older messages can still be read by newer software. The "reserved" syntax just helps the proto compiler prevent us from re-using them.

Copy link
Contributor

Choose a reason for hiding this comment

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

what are your thoughts on versioning the proto files? seems like this could be a good first use case for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

what are your thoughts on versioning the proto files? seems like this could be a good first use case for this?

I'm ambivalent about versioning the file. I don't really see what problems adding another version marker would solve.

If we break the wire format, we'll have to update the software version anyway, and if we don't break the wire format, then the existing software should continue to work without changes. That's the original reason for the schema language having explicit field tags.

Of course, we might add new fields and need to update the software to take advantage of them, but at that point the version the client cares about is the version of the service it's talking to, not the schema file.

IMO wire-format changes are the only ones that matter. Even if the generated code changes, old versions of the library should continue to work as well as they ever did. If we want to change how the service interprets old messages (e.g., we cut out some feature and start reporting errors) then the client has to update because the service version changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I made some updates to this file. It seems like you can't use reserved within a oneof sum so I've just left a comment

Copy link
Contributor

Choose a reason for hiding this comment

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

The field tags inside a sum are in the same namespace as the enclosing message, so you can simply put the reserved clause outside the oneof declaration. (I wrote it wrong in my example)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok thanks!

@cmwaters cmwaters merged commit a524e95 into master Oct 13, 2021
@cmwaters cmwaters deleted the callum/pex branch October 13, 2021 15:20
mergify bot pushed a commit to tendermint/tendermint that referenced this pull request Oct 22, 2021
This PR implements the proto changes made in tendermint/spec#352, removing the legacy messages that were used in the pex reactor.
NexZhu pushed a commit to daotl/go-acei that referenced this pull request Oct 27, 2021
This PR implements the proto changes made in tendermint/spec#352, removing the legacy messages that were used in the pex reactor.
evan-forbes pushed a commit to celestiaorg/celestia-core that referenced this pull request Feb 2, 2022
This PR implements the proto changes made in tendermint/spec#352, removing the legacy messages that were used in the pex reactor.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants