testing

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// e2eProfile after deploy contracts, with hardcoded ethgw etc
	// serialized json will be saved as outRootDir/profile.json
	// tests wish to use a different profile can overrides fields like svrRpc
	// and keep contract addresses etc
	E2eProfile *profile.ProfileJSON
)

Functions

func AddAmtStr

func AddAmtStr(base string, amts ...string) string

func AdvanceBlock

func AdvanceBlock() error

func AdvanceBlocks

func AdvanceBlocks(blockCount uint64) error

func AdvanceBlocksUntilDone

func AdvanceBlocksUntilDone(done chan bool)

func CreateAccountsWithBalance

func CreateAccountsWithBalance(num int, amount string) ([]string, []string, error)

CreateAccountsWithBalance creates Ethereum accounts with balances.

func FundAccountsWithErc20

func FundAccountsWithErc20(erc20Addr string, addrs []string, amount string) error

func FundAddr

func FundAddr(amt string, recipients []*common.Address) error

func GetAddressFromKeystore

func GetAddressFromKeystore(ksBytes []byte) (common.Address, error)

func GetNextClientPort

func GetNextClientPort() string

func KillProcess

func KillProcess(process *os.Process)

func RegisterRouters

func RegisterRouters(ksfiles []string) error

func SetEnvDir

func SetEnvDir(dir string)

func SetOutRootDir

func SetOutRootDir(dir string)

func StartProcess

func StartProcess(name string, args ...string) *os.Process

func UnregisterRouter

func UnregisterRouter(ksfile string, registryAddr string) error

func UpdateShadowStorage

func UpdateShadowStorage(storeDir, shadowDir string)

UpdateShadowStorage updates the shadow directory for database storage

Types

type ClientController

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

func StartC1WithoutProxy

func StartC1WithoutProxy(
	keystorePath string, extraArgs ...string) (*ClientController, error)

func StartC2WithoutProxy

func StartC2WithoutProxy(
	keystorePath string, extraArgs ...string) (*ClientController, error)

func StartClientController

func StartClientController(
	listenPort string,
	keystorePath string,
	configPath string,
	dataPath string,
	logPrefix string,
	extraArgs ...string) (*ClientController, error)

func StartClientWithoutProxy

func StartClientWithoutProxy(
	keystorePath string, profileFileName string, clientID string, extraArgs ...string) (*ClientController, error)

func (*ClientController) ApplyAppChannelAction

func (cc *ClientController) ApplyAppChannelAction(cid string, action []byte) error

func (*ClientController) AssertBalance

func (cc *ClientController) AssertBalance(
	tokenAddr string, expectedFree string, expectedLocked string, expectedReceiveCap string) error

func (*ClientController) ConfirmBooleanPay

func (cc *ClientController) ConfirmBooleanPay(paymentID string) error

func (*ClientController) ConfirmOnChainResolvedPays

func (cc *ClientController) ConfirmOnChainResolvedPays(
	tokenType entity.TokenType, tokenAddr string) error

func (*ClientController) ConfirmSettlePaymentChannel

func (cc *ClientController) ConfirmSettlePaymentChannel(
	tokenType entity.TokenType, tokenAddr string) error

func (*ClientController) ConfirmWithdraw

func (cc *ClientController) ConfirmWithdraw(
	tokenType entity.TokenType,
	tokenAddr string) error

func (*ClientController) CooperativeWithdraw

func (cc *ClientController) CooperativeWithdraw(
	tokenType entity.TokenType,
	tokenAddr string,
	withdrawAmount string) (*rpc.DepositOrWithdrawJob, error)

func (*ClientController) CooperativeWithdrawNonBlocking

func (cc *ClientController) CooperativeWithdrawNonBlocking(
	tokenType entity.TokenType,
	tokenAddr string,
	withdrawAmount string) (*rpc.DepositOrWithdrawJob, error)

func (*ClientController) DeleteAppChannel

func (cc *ClientController) DeleteAppChannel(cid string) error

func (*ClientController) Deposit

func (cc *ClientController) Deposit(
	tokenType entity.TokenType, tokenAddr, amt string) (*rpc.DepositOrWithdrawJob, error)

func (*ClientController) DepositNonBlocking

func (cc *ClientController) DepositNonBlocking(
	tokenType entity.TokenType, tokenAddr, amt string) (*rpc.DepositOrWithdrawJob, error)

func (*ClientController) FinalizeAppChannelOnActionTimeout

func (cc *ClientController) FinalizeAppChannelOnActionTimeout(cid string) error

func (*ClientController) GetAccountBalance

func (cc *ClientController) GetAccountBalance(
	tokenAddr string, ownerAddr string, conn *ethclient.Client) (*big.Int, error)

func (*ClientController) GetAppChannelActionDeadline

func (cc *ClientController) GetAppChannelActionDeadline(cid string) (uint64, error)

func (*ClientController) GetAppChannelBooleanOutcome

func (cc *ClientController) GetAppChannelBooleanOutcome(
	cid string, query []byte) (bool, bool, error)

func (*ClientController) GetAppChannelSettleFinalizedTime

func (cc *ClientController) GetAppChannelSettleFinalizedTime(cid string) (uint64, error)

func (*ClientController) GetAppChannelState

func (cc *ClientController) GetAppChannelState(cid string, key int64) ([]byte, error)

func (*ClientController) GetBalance

func (cc *ClientController) GetBalance(tokenAddress string) (string, string, string, error)

func (*ClientController) GetCurrentBlockNumber

func (cc *ClientController) GetCurrentBlockNumber() (uint64, error)

func (*ClientController) GetIncomingPaymentStatus

func (cc *ClientController) GetIncomingPaymentStatus(paymentID string) (int, error)

func (*ClientController) GetOutgoingPaymentStatus

func (cc *ClientController) GetOutgoingPaymentStatus(paymentID string) (int, error)

func (*ClientController) GetPayHistory

func (cc *ClientController) GetPayHistory(fromStart bool, itemsPerPage int32) ([]*msgrpc.OneHistoricalPay, bool, error)

GetPayHistory returns paginated historical pays. The returned boolean is true if there is more result to fetch.

func (*ClientController) GetSettleFinalizedTime

func (cc *ClientController) GetSettleFinalizedTime(
	tokenType entity.TokenType, tokenAddr string) (uint64, error)

func (*ClientController) InstantiateChannel

func (cc *ClientController) InstantiateChannel(
	tokenType entity.TokenType,
	tokenAddr string) (*rpc.ChannelID, error)

func (*ClientController) IntendSettlePaymentChannel

func (cc *ClientController) IntendSettlePaymentChannel(
	tokenType entity.TokenType, tokenAddr string) error

func (*ClientController) IntendWithdraw

func (cc *ClientController) IntendWithdraw(
	tokenType entity.TokenType,
	tokenAddr string,
	withdrawAmount string) error

func (*ClientController) IsConnectedToCeler

func (cc *ClientController) IsConnectedToCeler(
	tokenAddress string, address string) (string, error)

func (*ClientController) Kill

func (cc *ClientController) Kill()

func (*ClientController) KillAndRemoveDB

func (cc *ClientController) KillAndRemoveDB()

KillAndRemoveDB kill process and delete the dataPath/xxxx folder keystore is kept so we can test same eth start from scratch case Note this depends on cnode/kvstore init logic that creates eth address folder

func (*ClientController) KillWithoutRemovingKeystore

func (cc *ClientController) KillWithoutRemovingKeystore()

func (*ClientController) MonitorCooperativeWithdrawJob

func (cc *ClientController) MonitorCooperativeWithdrawJob(jobID string) (*rpc.DepositOrWithdrawJob, error)

func (*ClientController) MonitorDepositJob

func (cc *ClientController) MonitorDepositJob(jobID string) (*rpc.DepositOrWithdrawJob, error)

func (*ClientController) NewAppChannelOnDeployedContract

func (cc *ClientController) NewAppChannelOnDeployedContract(
	contractAddress string, nonce uint64, participants []string, timeout uint64) (string, error)

func (*ClientController) NewAppChannelOnVirtualContract

func (cc *ClientController) NewAppChannelOnVirtualContract(
	byteCode []byte, constructor []byte, nonce uint64, timeout uint64) (string, error)

func (*ClientController) OpenChannel

func (cc *ClientController) OpenChannel(
	selfAddress string,
	tokenType entity.TokenType,
	tokenAddr string,
	selfAmt string,
	peerAmt string) (*rpc.ChannelID, error)

func (*ClientController) RejectBooleanPay

func (cc *ClientController) RejectBooleanPay(paymentID string) error

func (*ClientController) RunSQL

func (cc *ClientController) RunSQL(q string) ([]byte, error)

RunSQL calls sqlite3 query directly on db file q needs to quote args properly

func (*ClientController) SendPayment

func (cc *ClientController) SendPayment(
	destination string,
	amountWei string,
	tokenType entity.TokenType,
	tokenAddress string) (string, error)

func (*ClientController) SendPaymentWithBooleanConditions

func (cc *ClientController) SendPaymentWithBooleanConditions(
	destination string,
	amountWei string,
	tokenType entity.TokenType,
	tokenAddress string,
	conditions []*entity.Condition,
	timeout uint64) (string, error)

func (*ClientController) SetDelegation

func (cc *ClientController) SetDelegation(tokens []string, duration int64) error

func (*ClientController) SetMsgDropper

func (cc *ClientController) SetMsgDropper(dropRecv, dropSend bool) error

func (*ClientController) SettleAppChannel

func (cc *ClientController) SettleAppChannel(cid string, stateproof []byte) error

func (*ClientController) SettleAppChannelByInvalidState

func (cc *ClientController) SettleAppChannelByInvalidState(cid string, oracleProof []byte, cosignedStateProof []byte) error

func (*ClientController) SettleAppChannelByInvalidTurn

func (cc *ClientController) SettleAppChannelByInvalidTurn(cid string, oracleProof []byte, cosignedStateProof []byte) error

func (*ClientController) SettleAppChannelByMoveTimeout

func (cc *ClientController) SettleAppChannelByMoveTimeout(cid string, oracleProof []byte) error

func (*ClientController) SettleAppChannelBySigTimeout

func (cc *ClientController) SettleAppChannelBySigTimeout(cid string, oracleProof []byte) error

func (*ClientController) SettleConditionalPayOnChain

func (cc *ClientController) SettleConditionalPayOnChain(paymentID string) (string, uint64, error)

func (*ClientController) SettleExpiredPays

func (cc *ClientController) SettleExpiredPays(tokenType entity.TokenType, tokenAddr string) error

func (*ClientController) SettleOnChainResolvedPay

func (cc *ClientController) SettleOnChainResolvedPay(paymentID string) error

func (*ClientController) SignData

func (cc *ClientController) SignData(data []byte) ([]byte, error)

func (*ClientController) SignOutgoingState

func (cc *ClientController) SignOutgoingState(sessionID string, state []byte) ([]byte, error)

func (*ClientController) SubscribeIncomingPayments

func (cc *ClientController) SubscribeIncomingPayments(paymentChan chan string) error

func (*ClientController) SubscribeOutgoingPayments

func (cc *ClientController) SubscribeOutgoingPayments(
	completeChan chan string, errChan chan string) error

func (*ClientController) SyncOnChainChannelStates

func (cc *ClientController) SyncOnChainChannelStates(tokenType entity.TokenType, tokenAddr string) error

func (*ClientController) TcbOpenChannel

func (cc *ClientController) TcbOpenChannel(
	selfAddress string,
	tokenType entity.TokenType,
	tokenAddr string,
	peerAmt string) (*rpc.ChannelID, error)

func (*ClientController) WaitUntilDeadline

func (cc *ClientController) WaitUntilDeadline(deadline uint64) error

type ServerController

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

func StartServerController

func StartServerController(path string, args ...string) *ServerController

note address isn't used

func (*ServerController) Kill

func (sc *ServerController) Kill() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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