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

SoV networking support #2951

Merged
merged 86 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
17a8ae8
Add validator manager callbacks
StephenButtolph Apr 18, 2024
01aaf16
Add tests
StephenButtolph Apr 18, 2024
542ac26
Expose all validator sets to IP tracking
StephenButtolph Apr 18, 2024
4344233
merged
StephenButtolph Apr 18, 2024
ef31c90
Merge branch 'add-manager-validator-set-callbacks' into sov-networkin…
StephenButtolph Apr 18, 2024
16a245f
merged
StephenButtolph Apr 18, 2024
6d2c138
wip
StephenButtolph Apr 24, 2024
496426d
wip
StephenButtolph Apr 24, 2024
a849393
nit
StephenButtolph Apr 24, 2024
b9a10cd
wip
StephenButtolph Apr 26, 2024
0bb9d82
Remove subnet filter from Peer.TrackedSubnets()
StephenButtolph Apr 29, 2024
7c3b228
refactor test peer creation
StephenButtolph Apr 29, 2024
4a5cfaa
Add tracked subnets test
StephenButtolph Apr 29, 2024
824ea10
merged
StephenButtolph Apr 29, 2024
255a2c7
Update p2p messages
StephenButtolph Apr 29, 2024
9a3ee34
use network bool
StephenButtolph Apr 29, 2024
2ad3f0e
cleanup tests
StephenButtolph Apr 29, 2024
7512258
fix merge
StephenButtolph Apr 29, 2024
d6bdaa8
cleanup
StephenButtolph Apr 30, 2024
25b3c26
not obviously broken
StephenButtolph Apr 30, 2024
8a15984
nit
StephenButtolph May 13, 2024
4c9fc81
Standardize peer logging
StephenButtolph May 13, 2024
5a25bd1
nit
StephenButtolph May 13, 2024
66cae7a
nit
StephenButtolph May 13, 2024
ec069b7
nit
StephenButtolph May 13, 2024
f44b492
nit
StephenButtolph May 13, 2024
d6e99b5
nit
StephenButtolph May 13, 2024
4620366
merged
StephenButtolph May 13, 2024
40bb983
merged
StephenButtolph May 13, 2024
63a3e67
Merge branch 'track-peer-subnets' into sov-networking-support
StephenButtolph May 13, 2024
6f0b6f7
merged
StephenButtolph May 13, 2024
56aa31e
Merge branch 'standardize-peer-logs' into track-peer-subnets
StephenButtolph May 13, 2024
83cab97
Merge branch 'track-peer-subnets' into sov-networking-support
StephenButtolph May 13, 2024
85edf06
require both sides to think they are validators
StephenButtolph May 13, 2024
f668ea3
merged
StephenButtolph May 14, 2024
1a08def
nit
StephenButtolph May 14, 2024
f05b7b7
Merge branch 'track-peer-subnets' into sov-networking-support
StephenButtolph May 14, 2024
e740fe9
Delete empty subnets
StephenButtolph May 14, 2024
c6e4e4d
cleanup
StephenButtolph May 14, 2024
4fe32d7
add primary network to tracked subnets
StephenButtolph May 14, 2024
167f5d8
merged
StephenButtolph May 14, 2024
24cff08
nit
StephenButtolph May 14, 2024
4fe584b
nit
StephenButtolph May 14, 2024
f5d57e8
metrics
StephenButtolph May 14, 2024
9f2f84d
metrics
StephenButtolph May 14, 2024
5384f37
Add comments
StephenButtolph May 15, 2024
2b0d0d5
Fix tests + fix bugs
StephenButtolph May 16, 2024
5b47b11
lint
StephenButtolph May 16, 2024
80ca753
comment
StephenButtolph May 16, 2024
a783f03
nit
StephenButtolph May 16, 2024
9e1ad1a
nit
StephenButtolph May 16, 2024
20338ab
update readme
StephenButtolph May 16, 2024
ce6c08a
Merge branch 'master' into track-peer-subnets
StephenButtolph May 16, 2024
b8e2763
Merge branch 'track-peer-subnets' into sov-networking-support
StephenButtolph May 16, 2024
f7bb7e9
Merge branch 'master' into track-peer-subnets
StephenButtolph May 17, 2024
0cf01c8
merged
StephenButtolph May 17, 2024
0546523
1 less call
StephenButtolph May 17, 2024
a6e3bb9
Remove testing duplication
StephenButtolph May 20, 2024
c754543
nits
StephenButtolph May 20, 2024
2bf771f
nit
StephenButtolph May 20, 2024
934a64b
nit
StephenButtolph May 20, 2024
8d2a2cc
nit
StephenButtolph May 20, 2024
20e999d
Enable gossiping of newer IPs when connected to an older IP (#3035)
StephenButtolph May 21, 2024
a1ac017
Merge branch 'master' into sov-networking-support
StephenButtolph May 24, 2024
da4f9bd
merged
StephenButtolph May 24, 2024
564723e
merged
StephenButtolph Jun 3, 2024
f40337a
add comment
StephenButtolph Jun 3, 2024
7cb89fb
nit
StephenButtolph Jun 3, 2024
04bd5fd
Merge branch 'master' into sov-networking-support
StephenButtolph Jun 7, 2024
86e06cc
merged
StephenButtolph Jun 17, 2024
895376d
nit
StephenButtolph Jun 17, 2024
2b00ee7
nits
StephenButtolph Jun 17, 2024
cf3d60d
standardize name
StephenButtolph Jun 18, 2024
3ed23a8
nit
StephenButtolph Jun 18, 2024
a13ddf2
nit
StephenButtolph Jun 18, 2024
5df54eb
nit
StephenButtolph Jun 25, 2024
612e21c
nit
StephenButtolph Jun 25, 2024
053cb00
nit
StephenButtolph Jun 25, 2024
dbe32f6
nit
StephenButtolph Jun 25, 2024
8238d60
nit
StephenButtolph Jun 25, 2024
8e59560
nit
StephenButtolph Jun 25, 2024
be86c97
remove redundent graph
StephenButtolph Jun 25, 2024
009e445
nit
StephenButtolph Jun 25, 2024
3b13ca4
merged
StephenButtolph Jul 30, 2024
c572ea0
merged
StephenButtolph Aug 5, 2024
369a224
Merge branch 'master' into sov-networking-support
StephenButtolph Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions message/mock_outbound_message_builder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion message/outbound_msg_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ type OutboundMsgBuilder interface {
objectedACPs []uint32,
knownPeersFilter []byte,
knownPeersSalt []byte,
requestAllSubnetIPs bool,
) (OutboundMessage, error)

GetPeerList(
knownPeersFilter []byte,
knownPeersSalt []byte,
requestAllSubnetIPs bool,
) (OutboundMessage, error)

PeerList(
Expand Down Expand Up @@ -242,6 +244,7 @@ func (b *outMsgBuilder) Handshake(
objectedACPs []uint32,
knownPeersFilter []byte,
knownPeersSalt []byte,
requestAllSubnetIPs bool,
) (OutboundMessage, error) {
subnetIDBytes := make([][]byte, len(trackedSubnets))
encodeIDs(trackedSubnets, subnetIDBytes)
Expand Down Expand Up @@ -270,7 +273,8 @@ func (b *outMsgBuilder) Handshake(
Filter: knownPeersFilter,
Salt: knownPeersSalt,
},
IpBlsSig: ipBLSSig,
IpBlsSig: ipBLSSig,
AllSubnets: requestAllSubnetIPs,
},
},
},
Expand All @@ -282,6 +286,7 @@ func (b *outMsgBuilder) Handshake(
func (b *outMsgBuilder) GetPeerList(
knownPeersFilter []byte,
knownPeersSalt []byte,
requestAllSubnetIPs bool,
) (OutboundMessage, error) {
return b.builder.createOutbound(
&p2p.Message{
Expand All @@ -291,6 +296,7 @@ func (b *outMsgBuilder) GetPeerList(
Filter: knownPeersFilter,
Salt: knownPeersSalt,
},
AllSubnets: requestAllSubnetIPs,
},
},
},
Expand Down
17 changes: 9 additions & 8 deletions network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ A peer will then read the full message and attempt to parse it into either a net

Upon connection to a new peer, a handshake is performed between the node attempting to establish the outbound connection to the peer and the peer receiving the inbound connection.

When attempting to establish the connection, the first message that the node sends is a `Handshake` message describing the compatibility of the nodes. If the `Handshake` message is successfully received and the peer decides that it wants a connection with this node, it replies with a `PeerList` message that contains metadata about other peers that allows a node to connect to them. See [Peerlist Gossip](#peerlist-gossip).
When attempting to establish the connection, the first message that the node sends is a `Handshake` message describing configuration of the node. If the `Handshake` message is successfully received and the peer decides that it will allow a connection with this node, it replies with a `PeerList` message that contains metadata about other peers that allows a node to connect to them. See [PeerList Gossip](#peerlist-gossip).
StephenButtolph marked this conversation as resolved.
Show resolved Hide resolved

As an example, nodes that are attempting to connect with an incompatible version of AvalancheGo or a significantly skewed local clock are rejected.

Expand Down Expand Up @@ -127,10 +127,12 @@ It is expected for Avalanche nodes to allow inbound connections. If a validator

Avalanche nodes that have identified the `IP:Port` pair of a node they want to connect to will initiate outbound connections to this `IP:Port` pair. If the connection is not able to complete the [Peer Handshake](#peer-handshake), the connection will be re-attempted with an [Exponential Backoff](https://en.wikipedia.org/wiki/Exponential_backoff).

A node should initiate outbound connections to an `IP:Port` pair that is believed to belong to a node that is not connected and meets at least one of the following conditions:
- The node is in the initial bootstrapper set.
- The node is in the default bootstrapper set.
- The node in the current Primary Network validator set.
A node should initiate outbound connections to an `IP:Port` pair that is believed to belong to another node that is not connected and meets at least one of the following conditions:
- The peer is in the initial bootstrapper set.
- The peer is in the default bootstrapper set.
- The peer is a Primary Network validator.
- The peer is a validator of a tracked Subnet.
- The peer is a validator of a Subnet and the local node is a Primary Network validator.

#### IP Authentication

Expand All @@ -148,7 +150,7 @@ Once connected to an initial set of peers, a node can use these connections to d

Peers are discovered by receiving [`PeerList`](#peerlist) messages during the [Peer Handshake](#peer-handshake). These messages quickly provide a node with knowledge of peers in the network. However, they offer no guarantee that the node will connect to and maintain connections with every peer in the network.

To provide an eventual guarantee that all peers learn of one another, nodes periodically send a [`GetPeerList`](#getpeerlist) message to a randomly selected validator with the node's current [Bloom Filter](#bloom-filter) and `Salt`.
To provide an eventual guarantee that all peers learn of one another, nodes periodically send a [`GetPeerList`](#getpeerlist) message to a randomly selected Primary Network validator with the node's current [Bloom Filter](#bloom-filter) and `Salt`.

#### Bloom Filter

Expand All @@ -171,8 +173,7 @@ A `GetPeerList` message contains the Bloom Filter of the currently known peers a
`PeerList` messages are expected to contain `IP:Port` pairs that satisfy all of the following constraints:
- The Bloom Filter sent when requesting the `PeerList` message does not contain the node claiming the `IP:Port` pair.
- The node claiming the `IP:Port` pair is currently connected.
- The `IP:Port` pair the node shared during the `Handshake` message is the node's most recently known `IP:Port` pair.
- The node claiming the `IP:Port` pair is either in the default bootstrapper set or is a current Primary Network validator.
- The node claiming the `IP:Port` pair is either in the default bootstrapper set, is a current Primary Network validator, is a validator of a tracked Subnet, or is a validator of a Subnet and the peer is a Primary Network validator.

#### Example PeerList Gossip

Expand Down
Loading
Loading