common

package
v0.23.3 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROVIDER string = "provider"
	CONSUMER string = "consumer"
)

Variables

This section is empty.

Functions

func BuildRelayRequest

func BuildRelayRequest(ctx context.Context, provider string, contentHash []byte, cuSum uint64, spec string, qos *types.QualityOfServiceReport) *types.RelaySession

func BuySubscription

func BuySubscription(t *testing.T, ctx context.Context, keepers testkeeper.Keepers, servers testkeeper.Servers, acc Account, plan string)

func CreateMockPlan

func CreateMockPlan() plantypes.Plan

func CreateMockPolicy

func CreateMockPolicy() plantypes.Policy

func CreateMockSpec

func CreateMockSpec() spectypes.Spec

func CreateMsgDetectionTest

func CreateMsgDetectionTest(ctx context.Context, consumer, provider0, provider1 Account, spec spectypes.Spec) (detectionMsg *conflicttypes.MsgDetection, reply1, reply2 *types.RelayReply, errRet error)

func NewCoin

func NewCoin(amount int64) sdk.Coin

func NewCoins

func NewCoins(amount ...int64) []sdk.Coin

func StakeAccount

func StakeAccount(t *testing.T, ctx context.Context, keepers testkeeper.Keepers, servers testkeeper.Servers, acc Account, spec spectypes.Spec, stake int64)

Types

type Account added in v0.4.3

type Account struct {
	SK   *btcSecp256k1.PrivateKey
	Addr sdk.AccAddress
}

func CreateNewAccount

func CreateNewAccount(ctx context.Context, keepers testkeeper.Keepers, balance int64) (acc Account)

type Tester

type Tester struct {
	T *testing.T

	GoCtx   context.Context
	Ctx     sdk.Context
	Servers *testkeeper.Servers
	Keepers *testkeeper.Keepers
	// contains filtered or unexported fields
}

func NewTester

func NewTester(t *testing.T) *Tester

func NewTesterRaw

func NewTesterRaw(t *testing.T) *Tester

func (*Tester) Account

func (ts *Tester) Account(name string) (Account, string)

func (*Tester) AccountByAddr

func (ts *Tester) AccountByAddr(addr string) (Account, string)

func (*Tester) Accounts

func (ts *Tester) Accounts(name string) []Account

func (*Tester) AddAccount

func (ts *Tester) AddAccount(kind string, idx int, balance int64) (Account, string)

func (*Tester) AddPlan

func (ts *Tester) AddPlan(name string, plan planstypes.Plan) *Tester

func (*Tester) AddPolicy

func (ts *Tester) AddPolicy(name string, policy planstypes.Policy) *Tester

func (*Tester) AddProjectData

func (ts *Tester) AddProjectData(name string, pd projectstypes.ProjectData) *Tester

func (*Tester) AddSpec

func (ts *Tester) AddSpec(name string, spec spectypes.Spec) *Tester

func (*Tester) AdvanceBlock

func (ts *Tester) AdvanceBlock(delta ...time.Duration) *Tester

func (*Tester) AdvanceBlockUntilStale

func (ts *Tester) AdvanceBlockUntilStale(delta ...time.Duration) *Tester

func (*Tester) AdvanceBlocks

func (ts *Tester) AdvanceBlocks(count uint64, delta ...time.Duration) *Tester

func (*Tester) AdvanceEpoch

func (ts *Tester) AdvanceEpoch(delta ...time.Duration) *Tester

func (*Tester) AdvanceEpochUntilStale

func (ts *Tester) AdvanceEpochUntilStale(delta ...time.Duration) *Tester

func (*Tester) AdvanceEpochs

func (ts *Tester) AdvanceEpochs(count uint64, delta ...time.Duration) *Tester

func (*Tester) AdvanceMonths

func (ts *Tester) AdvanceMonths(months int) *Tester

AdvanceMonth advanced blocks by given months, like AdvanceMonthsFrom, starting from the current block's timestamp

func (*Tester) AdvanceMonthsFrom

func (ts *Tester) AdvanceMonthsFrom(from time.Time, months int) *Tester

AdvanceMonthFrom advanced blocks by given months, i.e. until block times exceeds at least that many months since the from argument (minus 5 seconds, so caller can control when to cross the desired time).

func (*Tester) AdvanceToBlock

func (ts *Tester) AdvanceToBlock(block uint64)

func (*Tester) BlockHeight

func (ts *Tester) BlockHeight() uint64

func (*Tester) BlockTime

func (ts *Tester) BlockTime() time.Time

func (*Tester) BlocksToSave

func (ts *Tester) BlocksToSave() uint64

func (*Tester) EpochBlocks

func (ts *Tester) EpochBlocks(block ...uint64) uint64

func (*Tester) EpochStart

func (ts *Tester) EpochStart(block ...uint64) uint64

func (*Tester) EpochsToSave

func (ts *Tester) EpochsToSave(block ...uint64) uint64

func (*Tester) FindPlan

func (ts *Tester) FindPlan(index string, block uint64) (planstypes.Plan, bool)

func (*Tester) GetAccount

func (ts *Tester) GetAccount(kind string, idx int) (Account, string)

func (*Tester) GetBalance

func (ts *Tester) GetBalance(accAddr sdk.AccAddress) int64

func (*Tester) GetNextEpoch

func (ts *Tester) GetNextEpoch() uint64

func (*Tester) GetPlanFromSubscription

func (ts *Tester) GetPlanFromSubscription(addr string) (planstypes.Plan, error)

func (*Tester) GetProjectDeveloperData

func (ts *Tester) GetProjectDeveloperData(devkey string, block uint64) (projectstypes.ProtoDeveloperData, error)

func (*Tester) GetProjectForBlock

func (ts *Tester) GetProjectForBlock(projectID string, block uint64) (projectstypes.Project, error)

func (*Tester) GetProjectForDeveloper

func (ts *Tester) GetProjectForDeveloper(devkey string, block uint64) (projectstypes.Project, error)

func (*Tester) Plan

func (ts *Tester) Plan(name string) planstypes.Plan

func (*Tester) Policy

func (ts *Tester) Policy(name string) planstypes.Policy

func (*Tester) ProjectData

func (ts *Tester) ProjectData(name string) projectstypes.ProjectData

func (*Tester) QueryDualstakingDelegatorProviders

func (ts *Tester) QueryDualstakingDelegatorProviders(delegator string, withPending bool) (*dualstakingtypes.QueryDelegatorProvidersResponse, error)

QueryPairingVerifyPairing implements 'q dualstaking delegator-providers'

func (*Tester) QueryDualstakingProviderDelegators

func (ts *Tester) QueryDualstakingProviderDelegators(provider string, withPending bool) (*dualstakingtypes.QueryProviderDelegatorsResponse, error)

QueryDualstakingProviderDelegators implements 'q dualstaking provider-delegators'

func (*Tester) QueryPairingGetPairing

func (ts *Tester) QueryPairingGetPairing(chainID, client string) (*pairingtypes.QueryGetPairingResponse, error)

QueryPairingGetPairing implements 'q pairing get-pairing'

func (*Tester) QueryPairingListEpochPayments

func (ts *Tester) QueryPairingListEpochPayments() (*pairingtypes.QueryAllEpochPaymentsResponse, error)

QueryPairingListEpochPayments implements 'q pairing list-epoch-payments'

func (*Tester) QueryPairingProviders

func (ts *Tester) QueryPairingProviders(chainID string, frozen bool) (*pairingtypes.QueryProvidersResponse, error)

QueryPairingProviders: implement 'q pairing providers'

func (*Tester) QueryPairingVerifyPairing

func (ts *Tester) QueryPairingVerifyPairing(chainID, client, provider string, block uint64) (*pairingtypes.QueryVerifyPairingResponse, error)

QueryPairingVerifyPairing implements 'q pairing verfy-pairing'

func (*Tester) QueryProjectDeveloper

func (ts *Tester) QueryProjectDeveloper(devkey string) (*projectstypes.QueryDeveloperResponse, error)

QueryProjectDeveloper implements 'q project developer'

func (*Tester) QueryProjectInfo

func (ts *Tester) QueryProjectInfo(projectID string) (*projectstypes.QueryInfoResponse, error)

QueryProjectInfo implements 'q project info'

func (*Tester) QuerySubscriptionCurrent

func (ts *Tester) QuerySubscriptionCurrent(subkey string) (*subscriptiontypes.QueryCurrentResponse, error)

QuerySubscriptionCurrent: implement 'q subscription current'

func (*Tester) QuerySubscriptionListProjects

func (ts *Tester) QuerySubscriptionListProjects(subkey string) (*subscriptiontypes.QueryListProjectsResponse, error)

QuerySubscriptionListProjects: implement 'q subscription list-projects'

func (*Tester) SetChainID

func (ts *Tester) SetChainID(chainID string)

func (*Tester) SetupAccounts

func (ts *Tester) SetupAccounts(numSub, numAdm, numDev int) *Tester

func (*Tester) Spec

func (ts *Tester) Spec(name string) spectypes.Spec

func (*Tester) StakeProvider

func (ts *Tester) StakeProvider(addr string, spec spectypes.Spec, amount int64) error

func (*Tester) StakeProviderExtra

func (ts *Tester) StakeProviderExtra(
	addr string,
	spec spectypes.Spec,
	amount int64,
	endpoints []epochstoragetypes.Endpoint,
	geoloc int32,
	moniker string,
) error

func (*Tester) TxDualstakingDelegate

func (ts *Tester) TxDualstakingDelegate(
	creator string,
	provider string,
	chainID string,
	amount sdk.Coin,
) (*dualstakingtypes.MsgDelegateResponse, error)

TxDualstakingDelegate: implement 'tx dualstaking delegate'

func (*Tester) TxDualstakingRedelegate

func (ts *Tester) TxDualstakingRedelegate(
	creator string,
	fromProvider string,
	toProvider string,
	fromChainID string,
	toChainID string,
	amount sdk.Coin,
) (*dualstakingtypes.MsgRedelegateResponse, error)

TxDualstakingDelegate: implement 'tx dualstaking delegate'

func (*Tester) TxDualstakingUnbond

func (ts *Tester) TxDualstakingUnbond(
	creator string,
	provider string,
	chainID string,
	amount sdk.Coin,
) (*dualstakingtypes.MsgUnbondResponse, error)

TxDualstakingUnbond: implement 'tx dualstaking unbond'

func (*Tester) TxPairingFreezeProvider

func (ts *Tester) TxPairingFreezeProvider(addr, chainID string) (*pairingtypes.MsgFreezeProviderResponse, error)

TxPairingFreezeProvider: implement 'tx pairing freeze'

func (*Tester) TxPairingRelayPayment

func (ts *Tester) TxPairingRelayPayment(addr string, rs ...*pairingtypes.RelaySession) (*pairingtypes.MsgRelayPaymentResponse, error)

TxPairingRelayPayment: implement 'tx pairing relay-payment'

func (*Tester) TxPairingStakeProvider

func (ts *Tester) TxPairingStakeProvider(
	addr string,
	chainID string,
	amount sdk.Coin,
	endpoints []epochstoragetypes.Endpoint,
	geoloc int32,
	moniker string,
) (*pairingtypes.MsgStakeProviderResponse, error)

TxPairingStakeProvider: implement 'tx pairing stake-provider'

func (*Tester) TxPairingUnfreezeProvider

func (ts *Tester) TxPairingUnfreezeProvider(addr, chainID string) (*pairingtypes.MsgUnfreezeProviderResponse, error)

TxPairingUnfreezeProvider: implement 'tx pairing unfreeze'

func (*Tester) TxPairingUnstakeProvider

func (ts *Tester) TxPairingUnstakeProvider(
	addr string,
	chainID string,
) (*pairingtypes.MsgUnstakeProviderResponse, error)

TxPairingUnstakeProvider: implement 'tx pairing unstake-provider'

func (*Tester) TxProjectAddKeys

func (ts *Tester) TxProjectAddKeys(projectID, creator string, projectKeys ...projectstypes.ProjectKey) error

TxProjectAddKeys: implement 'tx project add-keys'

func (*Tester) TxProjectDelKeys

func (ts *Tester) TxProjectDelKeys(projectID, creator string, projectKeys ...projectstypes.ProjectKey) error

TxProjectDelKeys: implement 'tx project del-keys'

func (*Tester) TxProjectSetPolicy

func (ts *Tester) TxProjectSetPolicy(projectID, subkey string, policy planstypes.Policy) (*projectstypes.MsgSetPolicyResponse, error)

TxProjectSetPolicy: implement 'tx project set-policy'

func (*Tester) TxProjectSetSubscriptionPolicy

func (ts *Tester) TxProjectSetSubscriptionPolicy(projectID, subkey string, policy planstypes.Policy) (*projectstypes.MsgSetSubscriptionPolicyResponse, error)

TxProjectSetSubscriptionPolicy: implement 'tx project set-subscription-policy'

func (*Tester) TxProposalAddPlans

func (ts *Tester) TxProposalAddPlans(plans ...planstypes.Plan) error

func (*Tester) TxProposalAddSpecs

func (ts *Tester) TxProposalAddSpecs(specs ...spectypes.Spec) error

func (*Tester) TxProposalChangeParam

func (ts *Tester) TxProposalChangeParam(module, paramKey, paramVal string) error

func (*Tester) TxProposalDelPlans

func (ts *Tester) TxProposalDelPlans(indices ...string) error

func (*Tester) TxSubscriptionAddProject

func (ts *Tester) TxSubscriptionAddProject(creator string, pd projectstypes.ProjectData) error

TxSubscriptionAddProject: implement 'tx subscription add-project'

func (*Tester) TxSubscriptionBuy

func (ts *Tester) TxSubscriptionBuy(creator, consumer, plan string, months int) (*subscriptiontypes.MsgBuyResponse, error)

TxSubscriptionBuy: implement 'tx subscription buy'

func (*Tester) TxSubscriptionDelProject

func (ts *Tester) TxSubscriptionDelProject(creator, projectID string) error

TxSubscriptionAddProject: implement 'tx subscription del-project'

func (*Tester) VotePeriod

func (ts *Tester) VotePeriod() uint64

Jump to

Keyboard shortcuts

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