testchain

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0, BSD-2-Clause Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockedConsensusJournalRegistry added in v0.3.0

func NewMockedConsensusJournalRegistry() journal.Registry

func NextState added in v0.3.0

Types

type MockedACSRunner

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

func NewMockedACSRunner

func NewMockedACSRunner(quorum uint16, log *logger.Logger) *MockedACSRunner

func (*MockedACSRunner) Close

func (acs *MockedACSRunner) Close()

func (*MockedACSRunner) RunACSConsensus

func (acs *MockedACSRunner) RunACSConsensus(value []byte, sessionID uint64, stateIndex uint32, callback func(sessionID uint64, acs [][]byte))

type MockedChainCore

type MockedChainCore struct {
	T *testing.T
	// contains filtered or unexported fields
}

func NewMockedChainCore

func NewMockedChainCore(t *testing.T, chainID *isc.ChainID, log *logger.Logger) *MockedChainCore

func (*MockedChainCore) EnqueueAliasOutput added in v0.3.0

func (m *MockedChainCore) EnqueueAliasOutput(chainOutput *isc.AliasOutputWithID)

func (*MockedChainCore) EnqueueDismissChain added in v0.2.3

func (m *MockedChainCore) EnqueueDismissChain(reason string)

func (*MockedChainCore) EnqueueMissingRequestIDsMsg added in v0.2.3

func (m *MockedChainCore) EnqueueMissingRequestIDsMsg(msg *messages.MissingRequestIDsMsgIn)

func (*MockedChainCore) EnqueueMissingRequestMsg added in v0.2.3

func (m *MockedChainCore) EnqueueMissingRequestMsg(msg *messages.MissingRequestMsg)

func (*MockedChainCore) EnqueueOffLedgerRequestMsg added in v0.2.3

func (m *MockedChainCore) EnqueueOffLedgerRequestMsg(msg *messages.OffLedgerRequestMsgIn)

func (*MockedChainCore) EnqueueTimerTick added in v0.2.3

func (m *MockedChainCore) EnqueueTimerTick(tick int)

func (*MockedChainCore) GetAnchorOutput added in v0.3.0

func (m *MockedChainCore) GetAnchorOutput() *isc.AliasOutputWithID

func (*MockedChainCore) GetCandidateNodes added in v0.2.4

func (m *MockedChainCore) GetCandidateNodes() []*governance.AccessNodeInfo

func (*MockedChainCore) GetChainNodes added in v0.2.4

func (m *MockedChainCore) GetChainNodes() []peering.PeerStatusProvider

func (*MockedChainCore) GetCommitteeInfo

func (m *MockedChainCore) GetCommitteeInfo() *chain.CommitteeInfo

func (*MockedChainCore) GetStateReader

func (m *MockedChainCore) GetStateReader() state.OptimisticStateReader

func (*MockedChainCore) GlobalStateSync

func (m *MockedChainCore) GlobalStateSync() coreutil.ChainStateSync

func (*MockedChainCore) ID

func (m *MockedChainCore) ID() *isc.ChainID

func (*MockedChainCore) Log

func (m *MockedChainCore) Log() *logger.Logger

func (*MockedChainCore) OnAliasOutput added in v0.3.0

func (m *MockedChainCore) OnAliasOutput(fun func(chainOutput *isc.AliasOutputWithID))

func (*MockedChainCore) OnDismissChain added in v0.2.3

func (m *MockedChainCore) OnDismissChain(fun func(reason string))

func (*MockedChainCore) OnGetStateReader

func (m *MockedChainCore) OnGetStateReader(f func() state.OptimisticStateReader)

func (*MockedChainCore) OnGlobalStateSync

func (m *MockedChainCore) OnGlobalStateSync(f func() coreutil.ChainStateSync)

func (*MockedChainCore) OnMissingRequest added in v0.2.3

func (m *MockedChainCore) OnMissingRequest(fun func(msg *messages.MissingRequestMsg))

func (*MockedChainCore) OnMissingRequestIDs added in v0.2.3

func (m *MockedChainCore) OnMissingRequestIDs(fun func(msg *messages.MissingRequestIDsMsgIn))

func (*MockedChainCore) OnOffLedgerRequest added in v0.2.3

func (m *MockedChainCore) OnOffLedgerRequest(fun func(msg *messages.OffLedgerRequestMsgIn))

func (*MockedChainCore) OnRequestProcessed

func (m *MockedChainCore) OnRequestProcessed(f func(id isc.RequestID))

func (*MockedChainCore) OnSendPeerMsg added in v0.2.3

func (m *MockedChainCore) OnSendPeerMsg(fun func(netID string, msgReceiver byte, msgType byte, msgData []byte))

func (*MockedChainCore) OnStateCandidate added in v0.2.3

func (m *MockedChainCore) OnStateCandidate(fun func(state state.VirtualStateAccess, outputID *iotago.UTXOInput))

func (*MockedChainCore) OnStateTransition

func (m *MockedChainCore) OnStateTransition(f func(data *chain.ChainTransitionEventData))

func (*MockedChainCore) OnTimerTick added in v0.2.3

func (m *MockedChainCore) OnTimerTick(fun func(tick int))

func (*MockedChainCore) Processors

func (m *MockedChainCore) Processors() *processors.Cache

func (*MockedChainCore) StateCandidateToStateManager added in v0.2.3

func (m *MockedChainCore) StateCandidateToStateManager(virtualState state.VirtualStateAccess, outputID *iotago.UTXOInput)

func (*MockedChainCore) TriggerChainTransition added in v0.2.3

func (m *MockedChainCore) TriggerChainTransition(data *chain.ChainTransitionEventData)

func (*MockedChainCore) VirtualStateAccess added in v0.3.0

func (m *MockedChainCore) VirtualStateAccess() state.VirtualStateAccess

type MockedLedger added in v0.3.0

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

func NewMockedLedger added in v0.3.0

func NewMockedLedger(stateAddress iotago.Address, log *logger.Logger) (*MockedLedger, *isc.ChainID)

func (*MockedLedger) GetLatestOutput added in v0.3.0

func (mlT *MockedLedger) GetLatestOutput() *isc.AliasOutputWithID

func (*MockedLedger) GetOriginOutput added in v0.3.0

func (mlT *MockedLedger) GetOriginOutput() *isc.AliasOutputWithID

func (*MockedLedger) GetOutputByID added in v0.3.0

func (mlT *MockedLedger) GetOutputByID(id *iotago.UTXOInput) *iotago.AliasOutput

func (*MockedLedger) PublishTransaction added in v0.3.2

func (mlT *MockedLedger) PublishTransaction(tx *iotago.Transaction) error

func (*MockedLedger) PullLatestOutput added in v0.3.0

func (mlT *MockedLedger) PullLatestOutput(nodeID string)

func (*MockedLedger) PullStateOutputByID added in v0.3.0

func (mlT *MockedLedger) PullStateOutputByID(nodeID string, outputID *iotago.UTXOInput)

func (*MockedLedger) PullTxInclusionState added in v0.3.0

func (mlT *MockedLedger) PullTxInclusionState(nodeID string, txID iotago.TransactionID)

func (*MockedLedger) Register added in v0.3.0

func (mlT *MockedLedger) Register(nodeID string, stateOutputHandler, outputHandler func(iotago.OutputID, iotago.Output))

func (*MockedLedger) SetPublishGovernanceTransactionAllowed added in v0.3.0

func (mlT *MockedLedger) SetPublishGovernanceTransactionAllowed(flag bool)

func (*MockedLedger) SetPublishGovernanceTransactionAllowedFun added in v0.3.0

func (mlT *MockedLedger) SetPublishGovernanceTransactionAllowedFun(fun func(tx *iotago.Transaction) bool)

func (*MockedLedger) SetPublishStateTransactionAllowed added in v0.3.0

func (mlT *MockedLedger) SetPublishStateTransactionAllowed(flag bool)

func (*MockedLedger) SetPublishStateTransactionAllowedFun added in v0.3.0

func (mlT *MockedLedger) SetPublishStateTransactionAllowedFun(fun func(tx *iotago.Transaction) bool)

func (*MockedLedger) SetPullLatestOutputAllowed added in v0.3.0

func (mlT *MockedLedger) SetPullLatestOutputAllowed(flag bool)

func (*MockedLedger) SetPullOutputByIDAllowed added in v0.3.0

func (mlT *MockedLedger) SetPullOutputByIDAllowed(flag bool)

func (*MockedLedger) SetPullOutputByIDAllowedFun added in v0.3.0

func (mlT *MockedLedger) SetPullOutputByIDAllowedFun(fun func(outputID *iotago.UTXOInput) bool)

func (*MockedLedger) SetPullTxInclusionStateAllowed added in v0.3.0

func (mlT *MockedLedger) SetPullTxInclusionStateAllowed(flag bool)

func (*MockedLedger) SetPullTxInclusionStateAllowedFun added in v0.3.0

func (mlT *MockedLedger) SetPullTxInclusionStateAllowedFun(fun func(txID iotago.TransactionID) bool)

func (*MockedLedger) SetPushOutputToNodesNeeded added in v0.3.0

func (mlT *MockedLedger) SetPushOutputToNodesNeeded(flag bool)

func (*MockedLedger) SetPushOutputToNodesNeededFun added in v0.3.0

func (mlT *MockedLedger) SetPushOutputToNodesNeededFun(fun func(tx *iotago.Transaction, outputID *iotago.UTXOInput, output iotago.Output) bool)

func (*MockedLedger) Unregister added in v0.3.0

func (mlT *MockedLedger) Unregister(nodeID string)

type MockedLedgers added in v0.3.0

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

func NewMockedLedgers added in v0.3.0

func NewMockedLedgers(log *logger.Logger) *MockedLedgers

func (*MockedLedgers) AttachMilestones added in v0.3.0

func (mlT *MockedLedgers) AttachMilestones(handler func(*nodebridge.Milestone)) *events.Closure

func (*MockedLedgers) DetachMilestones added in v0.3.0

func (mlT *MockedLedgers) DetachMilestones(attachID *events.Closure)

func (*MockedLedgers) GetLedger added in v0.3.0

func (mlT *MockedLedgers) GetLedger(chainID *isc.ChainID) *MockedLedger

func (*MockedLedgers) InitLedger added in v0.3.0

func (mlT *MockedLedgers) InitLedger(stateAddress iotago.Address) *isc.ChainID

func (*MockedLedgers) SetPushMilestonesToNodesNeeded added in v0.3.0

func (mlT *MockedLedgers) SetPushMilestonesToNodesNeeded(flag bool)

func (*MockedLedgers) SetPushOutputToNodesNeeded added in v0.3.0

func (mlT *MockedLedgers) SetPushOutputToNodesNeeded(flag bool)

type MockedNodeConn

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

func NewMockedNodeConnection

func NewMockedNodeConnection(id string, ledgers *MockedLedgers, log *logger.Logger) *MockedNodeConn

func (*MockedNodeConn) AttachMilestones added in v0.3.0

func (mncT *MockedNodeConn) AttachMilestones(handler func(*nodebridge.Milestone)) *events.Closure

func (*MockedNodeConn) Close added in v0.2.3

func (mncT *MockedNodeConn) Close()

func (*MockedNodeConn) DetachMilestones added in v0.3.0

func (mncT *MockedNodeConn) DetachMilestones(attachID *events.Closure)

func (*MockedNodeConn) GetMetrics added in v0.2.3

func (*MockedNodeConn) ID

func (mncT *MockedNodeConn) ID() string

func (*MockedNodeConn) PublishTransaction added in v0.3.2

func (mncT *MockedNodeConn) PublishTransaction(chainID *isc.ChainID, tx *iotago.Transaction) error

func (*MockedNodeConn) PullLatestOutput added in v0.3.0

func (mncT *MockedNodeConn) PullLatestOutput(chainID *isc.ChainID)

func (*MockedNodeConn) PullStateOutputByID added in v0.3.0

func (mncT *MockedNodeConn) PullStateOutputByID(chainID *isc.ChainID, id *iotago.UTXOInput)

func (*MockedNodeConn) RegisterChain added in v0.3.0

func (mncT *MockedNodeConn) RegisterChain(
	chainID *isc.ChainID,
	stateOutputHandler,
	outputHandler func(iotago.OutputID, iotago.Output),
	milestoneHandler func(*nodebridge.Milestone),
)

func (*MockedNodeConn) SetMetrics added in v0.3.0

func (mncT *MockedNodeConn) SetMetrics(metrics nodeconnmetrics.NodeConnectionMetrics)

func (*MockedNodeConn) SetPublishGovernanceTransactionAllowed added in v0.3.0

func (mncT *MockedNodeConn) SetPublishGovernanceTransactionAllowed(flag bool)

func (*MockedNodeConn) SetPublishGovernanceTransactionAllowedFun added in v0.3.0

func (mncT *MockedNodeConn) SetPublishGovernanceTransactionAllowedFun(fun func(chainID *isc.ChainID, tx *iotago.Transaction) bool)

func (*MockedNodeConn) SetPublishStateTransactionAllowed added in v0.3.0

func (mncT *MockedNodeConn) SetPublishStateTransactionAllowed(flag bool)

func (*MockedNodeConn) SetPublishStateTransactionAllowedFun added in v0.3.0

func (mncT *MockedNodeConn) SetPublishStateTransactionAllowedFun(fun func(chainID *isc.ChainID, tx *iotago.Transaction) bool)

func (*MockedNodeConn) SetPullLatestOutputAllowed added in v0.3.0

func (mncT *MockedNodeConn) SetPullLatestOutputAllowed(flag bool)

func (*MockedNodeConn) SetPullOutputByIDAllowed added in v0.3.0

func (mncT *MockedNodeConn) SetPullOutputByIDAllowed(flag bool)

func (*MockedNodeConn) SetPullOutputByIDAllowedFun added in v0.3.0

func (mncT *MockedNodeConn) SetPullOutputByIDAllowedFun(fun func(chainID *isc.ChainID, outputID *iotago.UTXOInput) bool)

func (*MockedNodeConn) SetPullTxInclusionStateAllowed added in v0.3.0

func (mncT *MockedNodeConn) SetPullTxInclusionStateAllowed(flag bool)

func (*MockedNodeConn) SetPullTxInclusionStateAllowedFun added in v0.3.0

func (mncT *MockedNodeConn) SetPullTxInclusionStateAllowedFun(fun func(chainID *isc.ChainID, txID iotago.TransactionID) bool)

func (*MockedNodeConn) UnregisterChain added in v0.3.0

func (mncT *MockedNodeConn) UnregisterChain(chainID *isc.ChainID)

type MockedVMRunner

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

func NewMockedVMRunner

func NewMockedVMRunner(t *testing.T, log *logger.Logger) *MockedVMRunner

func (*MockedVMRunner) Run

func (r *MockedVMRunner) Run(task *vm.VMTask) error

Jump to

Keyboard shortcuts

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