testutil

package
v0.0.0-...-8cb8a38 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const TestPartyCount = 5
View Source
const TestThreshold = 3

Variables

View Source
var TestPeerIDs = []peer.ID{
	MustDecodePeerID("16Uiu2HAm9z3t15JpqBbPQJ1ZLHm6w1AXD6M2FXdCG3GLoY4iDcD9"),
	MustDecodePeerID("16Uiu2HAkwC5w1fC4xLL3hWjD6PGuk2qzGgsWdXfNeqMi8xDn2AT7"),
	MustDecodePeerID("16Uiu2HAmTdEddBdw1JVs5tHhqQGaFPkqq64TwppmL2G8fYbZeZei"),
	MustDecodePeerID("16Uiu2HAm48kushm1oCczim8L6adoCXV9A3npssbAFMM6Cgw3pYcS"),
	MustDecodePeerID("16Uiu2HAmR3sVyPwLtkemjCoU1XbZcjxcfRHzpopydvEEFbHKGiq4"),
}

Functions

func AreAllConnected

func AreAllConnected(t *testing.T, hosts []host.Host) bool

AreAllConnected returns true if all hosts are connected to one another

func Connect

func Connect(t *testing.T, a, b host.Host) error

func ConnectAll

func ConnectAll(t *testing.T, hosts []host.Host) error

func CreateHost

func CreateHost(t *testing.T, options ...libp2p.Option) host.Host

func CreateHosts

func CreateHosts(
	t *testing.T,
	ctx context.Context,
	n int,
	options ...libp2p.Option,
) []host.Host

func CreateHostsWithKeys

func CreateHostsWithKeys(
	t *testing.T,
	ctx context.Context,
	keys []crypto.PrivKey,
	options ...libp2p.Option,
) []host.Host

func GenerateNodeKeys

func GenerateNodeKeys(n int) ([]crypto.PrivKey, error)

GenerateNodeKeys returns a slice of private keys.

func GetTestKeys

func GetTestKeys(t *testing.T, numPeers int) (
	[]crypto.PrivKey,
	peer.IDSlice,
	[]keygen.LocalPartySaveData,
	tss.UnSortedPartyIDs,
)

func GetTestP2pNodeKeys

func GetTestP2pNodeKeys(count int) []crypto.PrivKey

func GetTestPartyIDs

func GetTestPartyIDs(count int) tss.UnSortedPartyIDs

GetTestPartyIDs returns a list of party IDs derived from fixture libp2p publickeys for testing.

func GetTestTssKeys

func GetTestTssKeys(count int) []keygen.LocalPartySaveData

func IsConnected

func IsConnected(t *testing.T, a, b host.Host) bool

IsConnected returns true if a and b hosts have a live, open connection in both directions

func KeyPath

func KeyPath(index int) string

func MustConnectAll

func MustConnectAll(t *testing.T, hosts []host.Host)

func MustDecodePeerID

func MustDecodePeerID(s string) peer.ID

func PartyIDsFromPeerIDs

func PartyIDsFromPeerIDs(peerIDs []peer.ID) tss.UnSortedPartyIDs

func PeerIDsFromHosts

func PeerIDsFromHosts(hosts []host.Host) []peer.ID

PeerIDsFromHosts returns a slice of peer IDs from a slice of hosts

func PeerIDsFromKeys

func PeerIDsFromKeys(keys []crypto.PrivKey) []peer.ID

PeerIDsFromKeys returns a slice of peer IDs from the given slice of private keys.

func ReadP2pNodeTestKey

func ReadP2pNodeTestKey(index int) crypto.PrivKey

func ReadTestKey

func ReadTestKey(index int) keygen.LocalPartySaveData

func TestLoadKey

func TestLoadKey(t *testing.T)

func WriteP2pNodeTestKey

func WriteP2pNodeTestKey(index int, key crypto.PrivKey)

func WriteTestKey

func WriteTestKey(index int, key keygen.LocalPartySaveData)

Types

This section is empty.

Jump to

Keyboard shortcuts

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