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 borsh support for PeerMessage::DistanceVector #9348

Merged
merged 2 commits into from
Jul 26, 2023

Conversation

saketh-are
Copy link
Collaborator

@saketh-are saketh-are commented Jul 26, 2023

In #9187 we introduced the first new PeerMessage variant in a long time, called DistanceVector.

I got a little over-zealous about our plans to deprecate borsh and skipped implementing borsh support for the new message variant.

However, it turns out we have some test infrastructure still reliant on borsh-encoded connections:

# TODO(CP-85): when removing borsh support, fix this to use protobufs,
# (or preferably reimplement the test in rust).

In particular, the nayduck test pytest/tests/sanity/sync_chunks_from_archival.py makes use of the proxy tool and is failing after #9187.

This PR implements borsh support for DistanceVector as an immediate fix for the failing test.

In the long run we aim to deprecate borsh entirely, at which time this code (and a bunch of other code much like it) will be removed.

@saketh-are
Copy link
Collaborator Author

As a sidenote, there is a different PeerMessage variant called Tier1Handshake which does not have borsh support implemented:

mem::PeerMessage::Tier1Handshake(_) => {
panic!("Tier1Handshake is not supported in Borsh encoding")
}

It does not pose the same issue because Tier1Handshake is only sent over TIER1 connections, and there is some special handling which forces TIER1 connections to use protobuf encoding (and not borsh):

// Override force_encoding for outbound Tier1 connections,
// since Tier1Handshake is supported only with proto encoding.

@saketh-are saketh-are requested review from nikurt, robin-near and a user July 26, 2023 00:21
@saketh-are saketh-are marked this pull request as ready for review July 26, 2023 00:21
@saketh-are saketh-are requested a review from a team as a code owner July 26, 2023 00:21
@near-bulldozer near-bulldozer bot merged commit 134793f into near:master Jul 26, 2023
nikurt pushed a commit to nikurt/nearcore that referenced this pull request Jul 26, 2023
In near#9187 we introduced the first new PeerMessage variant in a long time, called DistanceVector.

I got a little over-zealous about our plans to deprecate borsh and [skipped implementing borsh support for the new message variant](https://github.com/saketh-are/nearcore/blob/2093819d414bd38c73574c681715e3a544daa945/chain/network/src/network_protocol/borsh_conv.rs#L180-L182).

However, it turns out we have some test infrastructure still reliant on borsh-encoded connections:
https://github.com/near/nearcore/blob/6cdee7cc123bdeb00f0d9029b10f8c1448eab54f/pytest/lib/proxy.py#L89-L90

In particular, the nayduck test `pytest/tests/sanity/sync_chunks_from_archival.py` makes use of the proxy tool and [is failing]( https://nayduck.near.org/#/test/497500) after near#9187. 

This PR implements borsh support for DistanceVector as an immediate fix for the failing test.

In the long run we aim to deprecate borsh entirely, at which time this code (and a bunch of other code much like it) will be removed.
nikurt pushed a commit that referenced this pull request Aug 24, 2023
In #9187 we introduced the first new PeerMessage variant in a long time, called DistanceVector.

I got a little over-zealous about our plans to deprecate borsh and [skipped implementing borsh support for the new message variant](https://github.com/saketh-are/nearcore/blob/2093819d414bd38c73574c681715e3a544daa945/chain/network/src/network_protocol/borsh_conv.rs#L180-L182).

However, it turns out we have some test infrastructure still reliant on borsh-encoded connections:
https://github.com/near/nearcore/blob/6cdee7cc123bdeb00f0d9029b10f8c1448eab54f/pytest/lib/proxy.py#L89-L90

In particular, the nayduck test `pytest/tests/sanity/sync_chunks_from_archival.py` makes use of the proxy tool and [is failing]( https://nayduck.near.org/#/test/497500) after #9187. 

This PR implements borsh support for DistanceVector as an immediate fix for the failing test.

In the long run we aim to deprecate borsh entirely, at which time this code (and a bunch of other code much like it) will be removed.
nikurt pushed a commit to nikurt/nearcore that referenced this pull request Aug 24, 2023
In near#9187 we introduced the first new PeerMessage variant in a long time, called DistanceVector.

I got a little over-zealous about our plans to deprecate borsh and [skipped implementing borsh support for the new message variant](https://github.com/saketh-are/nearcore/blob/2093819d414bd38c73574c681715e3a544daa945/chain/network/src/network_protocol/borsh_conv.rs#L180-L182).

However, it turns out we have some test infrastructure still reliant on borsh-encoded connections:
https://github.com/near/nearcore/blob/6cdee7cc123bdeb00f0d9029b10f8c1448eab54f/pytest/lib/proxy.py#L89-L90

In particular, the nayduck test `pytest/tests/sanity/sync_chunks_from_archival.py` makes use of the proxy tool and [is failing]( https://nayduck.near.org/#/test/497500) after near#9187. 

This PR implements borsh support for DistanceVector as an immediate fix for the failing test.

In the long run we aim to deprecate borsh entirely, at which time this code (and a bunch of other code much like it) will be removed.
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.

2 participants