testutil

package
v1.5.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Overview

Package testutil provides mock implementations of various wasp components. They are used for unit-testing different parts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DummyEVMRequest added in v1.1.0

func DummyEVMRequest(chainID isc.ChainID, gasPrice *big.Int) isc.OffLedgerRequest

func DummyOffledgerRequest added in v0.2.3

func DummyOffledgerRequest(chainID isc.ChainID) isc.OffLedgerRequest

func DummyOffledgerRequestForAccount added in v1.0.3

func DummyOffledgerRequestForAccount(chainID isc.ChainID, nonce uint64, kp *cryptolib.KeyPair) isc.OffLedgerRequest

func DummyStateMetadata added in v1.0.3

func DummyStateMetadata(commitment *state.L1Commitment) *transaction.StateMetadata

func NewConsensusStateRegistry added in v1.0.3

func NewConsensusStateRegistry() cmt_log.ConsensusStateRegistry

func NewTrustedNetworkManager added in v0.2.0

func NewTrustedNetworkManager() peering.TrustedNetworkManager

func RunHeavy added in v0.2.1

func RunHeavy(t *testing.T)

Types

type ChainRecordRegistryProvider added in v0.2.0

type ChainRecordRegistryProvider struct {
	DB map[isc.ChainID]*registry.ChainRecord
}

func NewChainRecordRegistryProvider added in v0.2.0

func NewChainRecordRegistryProvider() *ChainRecordRegistryProvider

func (*ChainRecordRegistryProvider) AddChainRecord added in v1.0.3

func (p *ChainRecordRegistryProvider) AddChainRecord(chainRecord *registry.ChainRecord) error

func (*ChainRecordRegistryProvider) LoadChainRecord added in v0.2.0

func (p *ChainRecordRegistryProvider) LoadChainRecord(chainID isc.ChainID) (*registry.ChainRecord, error)

type DkgRegistryProvider added in v0.1.0

type DkgRegistryProvider struct {
	DB map[string][]byte
	// contains filtered or unexported fields
}

DkgRegistryProvider stands for a mock for dkg.DKShareRegistryProvider.

func NewDkgRegistryProvider added in v0.1.0

func NewDkgRegistryProvider(nodePrivKey *cryptolib.PrivateKey) *DkgRegistryProvider

NewDkgRegistryProvider creates new mocked DKG registry provider.

func (*DkgRegistryProvider) LoadDKShare added in v0.1.0

func (p *DkgRegistryProvider) LoadDKShare(sharedAddress iotago.Address) (tcrypto.DKShare, error)

LoadDKShare implements dkg.DKShareRegistryProvider.

func (*DkgRegistryProvider) SaveDKShare added in v0.1.0

func (p *DkgRegistryProvider) SaveDKShare(dkShare tcrypto.DKShare) error

SaveDKShare implements dkg.DKShareRegistryProvider.

type PeeringNetBehavior added in v0.1.0

type PeeringNetBehavior interface {
	AddLink(inCh, outCh chan *peeringMsg, dstPubKey *cryptolib.PublicKey)
	Close()
}

An interface for all the network behaviors.

func NewPeeringNetReliable added in v0.1.0

func NewPeeringNetReliable(log *logger.Logger) PeeringNetBehavior

NewPeeringNetReliable constructs the PeeringNetBehavior.

func NewPeeringNetUnreliable added in v0.1.0

func NewPeeringNetUnreliable(deliverPct, repeatPct int, delayFrom, delayTill time.Duration, log *logger.Logger) PeeringNetBehavior

NewPeeringNetUnreliable constructs the PeeringNetBehavior.

type PeeringNetDynamic added in v0.2.0

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

peeringNetDynamic provides a behavior of a network with dynamically changeable working conditions. It works as peeringNetReliable without any handlers set.

func NewPeeringNetDynamic added in v0.2.0

func NewPeeringNetDynamic(log *logger.Logger) *PeeringNetDynamic

NewPeeringNetDynamic constructs the PeeringNetBehavior.

func (pndT *PeeringNetDynamic) AddLink(inCh, outCh chan *peeringMsg, dstPubKey *cryptolib.PublicKey)

AddLink implements PeeringNetBehavior.

func (*PeeringNetDynamic) Close added in v0.2.0

func (pndT *PeeringNetDynamic) Close()

Close implements PeeringNetBehavior.

func (*PeeringNetDynamic) RemoveHandler added in v0.2.0

func (pndT *PeeringNetDynamic) RemoveHandler(id string) bool

func (*PeeringNetDynamic) WithDelayingChannel added in v0.2.0

func (pndT *PeeringNetDynamic) WithDelayingChannel(id *string, delayFrom, delayTill time.Duration) *PeeringNetDynamic

func (*PeeringNetDynamic) WithLosingChannel added in v0.2.0

func (pndT *PeeringNetDynamic) WithLosingChannel(id *string, deliveryProbability int) *PeeringNetDynamic

func (*PeeringNetDynamic) WithPeerDisconnected added in v0.2.0

func (pndT *PeeringNetDynamic) WithPeerDisconnected(id *string, peerPubKey *cryptolib.PublicKey) *PeeringNetDynamic

func (*PeeringNetDynamic) WithRepeatingChannel added in v0.2.0

func (pndT *PeeringNetDynamic) WithRepeatingChannel(id *string, repeatProbability int) *PeeringNetDynamic

type PeeringNetwork added in v0.1.0

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

PeeringNetwork represents a global view of the mocked network.

func NewPeeringNetwork added in v0.1.0

func NewPeeringNetwork(
	peeringURLs []string,
	nodeIdentities []*cryptolib.KeyPair,
	bufSize int,
	behavior PeeringNetBehavior,
	log *logger.Logger,
) *PeeringNetwork

NewPeeringNetwork creates new test network, it can then be used to create network nodes.

func (*PeeringNetwork) Close added in v0.2.0

func (p *PeeringNetwork) Close() error

Close implements the io.Closer interface.

func (*PeeringNetwork) NetworkProviders added in v0.1.0

func (p *PeeringNetwork) NetworkProviders() []peering.NetworkProvider

NetworkProviders returns network providers for each of the nodes in the network.

Directories

Path Synopsis
privtangle is a cluster of HORNET nodes started for testing purposes.
privtangle is a cluster of HORNET nodes started for testing purposes.
Package utxodb provides tools to simulate an in-memory synchronous ledger, for testing purposes.
Package utxodb provides tools to simulate an in-memory synchronous ledger, for testing purposes.

Jump to

Keyboard shortcuts

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