testpartition

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockchainContains

func BlockchainContains(t *testing.T, shard *Shard, criteria func(txr *types.TransactionRecord) bool) func() bool

func BlockchainContainsSuccessfulTx

func BlockchainContainsSuccessfulTx(t *testing.T, shard *Shard, tx *types.TransactionOrder) func() bool

BlockchainContainsSuccessfulTx checks if at least one shard node has successfully executed the given transaction.

func BlockchainContainsTx

func BlockchainContainsTx(t *testing.T, shard *Shard, tx *types.TransactionOrder) func() bool

BlockchainContainsTx checks if at least one shard node block contains the given transaction.

func ShardInitReady

func ShardInitReady(t *testing.T, shard *Shard) func() bool

ShardInitReady - all nodes are in normal state and return the latest block number

func WaitTxProof

func WaitTxProof(t *testing.T, shard *Shard, txOrder *types.TransactionOrder) (*types.TxRecordProof, error)

WaitTxProof - wait for proof from any validator in a shard. If one has the proof it does not mean all have processed the UC. Returns both transaction record and proof when tx has been executed and added to block

func WaitUnitProof

func WaitUnitProof(t *testing.T, shard *Shard, ID types.UnitID, txOrder *types.TransactionOrder) (*types.UnitStateWithProof, error)

Types

type RootChain

type RootChain struct {
	TrustBase types.RootTrustBase
	// contains filtered or unexported fields
}

type Shard

type Shard struct {
	Nodes []*shardNode
	// contains filtered or unexported fields
}

func (*Shard) BroadcastTx

func (n *Shard) BroadcastTx(tx *types.TransactionOrder) error

BroadcastTx sends transactions to all nodes.

func (*Shard) GetTxProof

func (n *Shard) GetTxProof(t *testing.T, tx *types.TransactionOrder) (*types.Block, *types.TxRecordProof, error)

func (*Shard) PartitionShardID

func (s *Shard) PartitionShardID() types.PartitionShardID

func (*Shard) SubmitTx

func (n *Shard) SubmitTx(tx *types.TransactionOrder) error

SubmitTx sends transactions to the first node.

type UnicityNetwork

type UnicityNetwork struct {
	RootChain *RootChain
	Shards    map[types.PartitionShardID]*Shard
	// contains filtered or unexported fields
}

UnicityNetwork for integration tests

func NewUnicityNetwork

func NewUnicityNetwork(t *testing.T, rootNodeCount int) *UnicityNetwork

func (*UnicityNetwork) AddShard

func (a *UnicityNetwork) AddShard(t *testing.T, shardConf *types.PartitionDescriptionRecord, nodeCount int, txSystemProvider txSystemProvider)

Adds a shard to a running UnicityNetwork instance

func (*UnicityNetwork) Close

func (a *UnicityNetwork) Close() (retErr error)

func (*UnicityNetwork) GetShard

func (a *UnicityNetwork) GetShard(psID types.PartitionShardID) (*Shard, error)

func (*UnicityNetwork) GetValidator

func (*UnicityNetwork) Start

func (a *UnicityNetwork) Start(t *testing.T) error

Start AB network, no bootstrap all id's and addresses are injected to peer store at start

func (*UnicityNetwork) WaitClose

func (a *UnicityNetwork) WaitClose(t *testing.T)

WaitClose closes the AB network and waits for all the nodes to stop. It fails the test "t" if nodes do not stop/exit within timeout.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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