verifier

package
v0.0.0-...-95bd726 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetworkStateVerifier

type NetworkStateVerifier struct {
	// contains filtered or unexported fields
}

NetworkStateVerifier contains logic for verifying the state of the network We attach these functions to a struct even though the struct doesn't have state to avoid a utils class (which inevitably becomes a mess of unconnected logic), and to categorize the functions around a common purpose.

func NewNetworkStateVerifier

func NewNetworkStateVerifier() NetworkStateVerifier

func (*NetworkStateVerifier) Ctx

func (NetworkStateVerifier) VerifyExpectedPeers

func (verifier NetworkStateVerifier) VerifyExpectedPeers(
	serviceID networks.ServiceID,
	client *apis.Client,
	acceptableNodeIDs map[string]bool,
	expectedNumPeers int,
	atLeast bool) error

VerifyExpectedPeers verifies that a node's actual peers match the expected value Args:

serviceID: Service ID of the node whose peers are being examined
client: camino client for the node being examined
acceptableNodeIDs: A "set" of acceptable node IDs where, if a peer doesn't have this ID, the test will be failed
expectedNumPeers: The number of peers we expect this node to have
atLeast: If true, indicates that the number of peers must be AT LEAST the expected number of peers; if false, must be exact

func (NetworkStateVerifier) VerifyNetworkFullyConnected

func (verifier NetworkStateVerifier) VerifyNetworkFullyConnected(
	allServiceIDs map[networks.ServiceID]bool,
	stakerServiceIDs map[networks.ServiceID]bool,
	allNodeIDs map[networks.ServiceID]string,
	allAvalalancheClients map[networks.ServiceID]*apis.Client,
) error

VerifyNetworkFullyConnected asserts that the network is fully connected Meaning:

  1. The stakers have all the other nodes in the network besides themselves in their peer list
  2. All non-stakers have all the stakers in their peer list

Args:

allServiceIDs: All the service IDs in the network, and the IDs that will be iterated over to check
stakerServiceIDs: The service IDs of nodes that we expect to be fully connected - i.e. any node that's actually
	staking. Most of the time this will be just the bootstrappers, but if we add more stakers then this set will
	expand beyond the bootstrappers.
allNodeIDs: The mapping of servcie_id -> node_id

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL