integration

package module
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Block

func Block(t *testing.T, chain *cosmos.CosmosChain, height int64) *rpctypes.ResultBlock

Block returns the block at the given height

func BuildInterchain

func BuildInterchain(t *testing.T, ctx context.Context, chain ibc.Chain) *interchaintest.Interchain

BuildInterchain creates a new Interchain testing env with the configured Block SDK CosmosChain

func ChainBuilderFromChainSpec

func ChainBuilderFromChainSpec(t *testing.T, spec *interchaintest.ChainSpec) ibc.Chain

ChainBuilderFromChainSpec creates an interchaintest chain builder factory given a ChainSpec and returns the associated chain

func QueryAccountBalance

func QueryAccountBalance(t *testing.T, chain ibc.Chain, address, denom string) int64

QueryAccountBalance queries a given account's balance on the chain

func QueryAccountSequence

func QueryAccountSequence(t *testing.T, chain *cosmos.CosmosChain, address string) uint64

QueryAccountSequence

func QueryAuctionParams

func QueryAuctionParams(t *testing.T, chain ibc.Chain) auctiontypes.Params

QueryAuctionParams queries the x/auction module's params

func QueryValidators

func QueryValidators(t *testing.T, chain *cosmos.CosmosChain) []sdk.ValAddress

QueryValidators queries for all of the network's validators

func TxHash

func TxHash(tx []byte) string

func VerifyBlock

func VerifyBlock(t *testing.T, block *rpctypes.ResultBlock, offset int, bidTxHash string, txs [][]byte)

VerifyBlock takes a Block and verifies that it contains the given bid at the 0-th index, and the bundled txs immediately after

func WaitForHeight

func WaitForHeight(t *testing.T, chain *cosmos.CosmosChain, height uint64)

WaitForHeight waits for the chain to reach the given height

Types

type IntegrationTestSuite

type IntegrationTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

IntegrationTestSuite runs the Block SDK integration test-suite against a given interchaintest specification

func NewIntegrationTestSuiteFromSpec

func NewIntegrationTestSuiteFromSpec(spec *interchaintest.ChainSpec) *IntegrationTestSuite

func (*IntegrationTestSuite) BroadcastTxs

func (s *IntegrationTestSuite) BroadcastTxs(ctx context.Context, chain *cosmos.CosmosChain, msgsPerUser []Tx) [][]byte

BroadcastTxs broadcasts the given messages for each user. This function returns the broadcasted txs. If a message is not expected to be included in a block, set SkipInclusionCheck to true and the method will not block on the tx's inclusion in a block, otherwise this method will block on the tx's inclusion

func (*IntegrationTestSuite) BroadcastTxsWithCallback

func (s *IntegrationTestSuite) BroadcastTxsWithCallback(
	ctx context.Context,
	chain *cosmos.CosmosChain,
	msgsPerUser []Tx,
	cb func(tx []byte, resp *rpctypes.ResultTx),
) [][]byte

BroadcastTxs broadcasts the given messages for each user. This function returns the broadcasted txs. If a message is not expected to be included in a block, set SkipInclusionCheck to true and the method will not block on the tx's inclusion in a block, otherwise this method will block on the tx's inclusion. The callback function is called for each tx that is included in a block.

func (*IntegrationTestSuite) CreateAuctionBidMsg

func (s *IntegrationTestSuite) CreateAuctionBidMsg(ctx context.Context, searcher cosmos.User, chain *cosmos.CosmosChain, bid sdk.Coin, txsPerUser []Tx) (*auctiontypes.MsgAuctionBid, [][]byte)

CreateAuctionBidMsg creates a new AuctionBid tx signed by the given user, the order of txs in the MsgAuctionBid will be determined by the contents + order of the MessageForUsers

func (*IntegrationTestSuite) CreateTx

func (s *IntegrationTestSuite) CreateTx(ctx context.Context, chain *cosmos.CosmosChain, user cosmos.User, seqIncrement, height uint64, GasPrice int64, msgs ...sdk.Msg) []byte

CreateTx creates a new transaction to be signed by the given user, including a provided set of messages

func (*IntegrationTestSuite) SetupSubTest

func (s *IntegrationTestSuite) SetupSubTest()

func (*IntegrationTestSuite) SetupSuite

func (s *IntegrationTestSuite) SetupSuite()

func (*IntegrationTestSuite) SimulateTx

func (s *IntegrationTestSuite) SimulateTx(ctx context.Context, chain *cosmos.CosmosChain, user cosmos.User, height uint64, expectFail bool, msgs ...sdk.Msg)

SimulateTx simulates the provided messages, and checks whether the provided failure condition is met

func (*IntegrationTestSuite) TearDownSuite

func (s *IntegrationTestSuite) TearDownSuite()

func (*IntegrationTestSuite) TestFreeLane

func (s *IntegrationTestSuite) TestFreeLane()

TestFreeLane tests that the application correctly handles free lanes. There are a few invariants that are tested:

1. Transactions that qualify as free should not be deducted any fees. 2. Transactions that do not qualify as free should be deducted the correct fees.

func (*IntegrationTestSuite) TestInvalidBids

func (s *IntegrationTestSuite) TestInvalidBids()

func (*IntegrationTestSuite) TestLanes

func (s *IntegrationTestSuite) TestLanes()

func (*IntegrationTestSuite) TestMultipleBids

func (s *IntegrationTestSuite) TestMultipleBids()

TestMultipleBids tests the execution of various valid auction bids in the same block. There are a few invariants that are tested:

  1. The order of transactions in a bundle is preserved when bids are valid.
  2. All transactions execute as expected.
  3. The balance of the escrow account should be updated correctly.
  4. Top of block bids will be included in block proposals before other transactions that are included in the same block.
  5. If there is a block that has multiple valid bids with timeouts that are sufficiently far apart, the bids should be executed respecting the highest bids until the timeout is reached.

func (*IntegrationTestSuite) TestQueryParams

func (s *IntegrationTestSuite) TestQueryParams()

func (*IntegrationTestSuite) TestValidBids

func (s *IntegrationTestSuite) TestValidBids()

TestValidBids tests the execution of various valid auction bids. There are a few invariants that are tested:

  1. The order of transactions in a bundle is preserved when bids are valid.
  2. All transactions execute as expected.
  3. The balance of the escrow account should be updated correctly.
  4. Top of block bids will be included in block proposals before other transactions

func (*IntegrationTestSuite) WithDenom

func (s *IntegrationTestSuite) WithDenom(denom string) *IntegrationTestSuite

func (*IntegrationTestSuite) WithKeyringOptions

func (s *IntegrationTestSuite) WithKeyringOptions(cdc codec.Codec, opts keyring.Option)

type KeyringOverride

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

type Tx

type Tx struct {
	User               cosmos.User
	Msgs               []sdk.Msg
	GasPrice           int64
	SequenceIncrement  uint64
	Height             uint64
	SkipInclusionCheck bool
	ExpectFail         bool
}

Jump to

Keyboard shortcuts

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