ante

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const TestBlockTime = uint64(1600000000000) // sep 13 2020 12:26:40

Use nice number to make debugging easier

Variables

This section is empty.

Functions

func MakeTestEncodingConfig

func MakeTestEncodingConfig(modules ...module.AppModuleBasic) moduletestutil.TestEncodingConfig

Types

type AnteTestSuite

type AnteTestSuite struct {
	AnteHandler       sdk.AnteHandler
	Ctx               sdk.Context
	ClientCtx         client.Context
	TxBuilder         client.TxBuilder
	AccountKeeper     keeper.AccountKeeper
	AccountplusKeeper accountpluskeeper.Keeper
	BankKeeper        *authtestutil.MockBankKeeper
	TxBankKeeper      *txtestutil.MockBankKeeper
	FeeGrantKeeper    *antetestutil.MockFeegrantKeeper
	PerpetualsKeeper  perpetualskeeper.Keeper
	EncCfg            moduletestutil.TestEncodingConfig
}

AnteTestSuite is a test suite to be used with ante handler tests.

func SetupTestSuite

func SetupTestSuite(t testing.TB, isCheckTx bool) *AnteTestSuite

SetupTest setups a new test, with new app, context, and anteHandler.

func (*AnteTestSuite) CreateTestAccounts

func (suite *AnteTestSuite) CreateTestAccounts(numAccs int) []TestAccount

func (*AnteTestSuite) CreateTestTx

func (suite *AnteTestSuite) CreateTestTx(
	ctx sdk.Context, privs []cryptotypes.PrivKey,
	accNums, accSeqs []uint64,
	chainID string, signMode signing.SignMode,
) (xauthsigning.Tx, error)

CreateTestTx is a helper function to create a tx given multiple inputs.

func (*AnteTestSuite) DeliverMsgs

func (suite *AnteTestSuite) DeliverMsgs(
	t testing.TB,
	privs []cryptotypes.PrivKey,
	msgs []sdk.Msg,
	feeAmount sdk.Coins,
	gasLimit uint64,
	accNums, accSeqs []uint64,
	chainID string,
	simulate bool,
) (sdk.Context, error)

DeliverMsgs constructs a tx and runs it through the ante handler. This is used to set the context for a test case, for example to test for replay protection.

func (*AnteTestSuite) RunTestCase

func (suite *AnteTestSuite) RunTestCase(t testing.TB, tc TestCase, args TestCaseArgs)

type TestAccount

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

TestAccount represents an account used in the tests in x/auth/ante.

type TestCase

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

TestCase represents a test case used in test tables.

type TestCaseArgs

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

func (TestCaseArgs) WithAccountsInfo

func (t TestCaseArgs) WithAccountsInfo(accs []TestAccount) TestCaseArgs

Jump to

Keyboard shortcuts

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