testutil

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 56 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TestChainID = "integration_37-1"

	ValidatorCount = 10

	ValidatorSettlementIndex = ValidatorCount
	ReserveIndex             = ValidatorCount + 1
	TempIndex                = ValidatorCount + 2
	ProposerIndex            = ValidatorCount + 3

	TotalCount = ProposerIndex + 1
)
View Source
const DefaultEVMGasLimit = uint64(10_000_000)

DefaultEVMGasLimit is the gas budget for integration contract calls.

Variables

Functions

func EVMLogsForEvent added in v1.14.0

func EVMLogsForEvent(receipt *ethtypes.Receipt, address common.Address, topic common.Hash) []*ethtypes.Log

EVMLogsForEvent selects logs emitted by an address with the given event signature.

func NewMsgCreateValidator

func NewMsgCreateValidator(address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdkmath.Int) *stakingtypes.MsgCreateValidator

NewMsgCreateValidator test msg creator

func NewMsgDelegate

func NewMsgDelegate(delegatorAddress sdk.AccAddress, validatorAddress sdk.ValAddress, amt sdkmath.Int) *stakingtypes.MsgDelegate

NewMsgDelegate test msg creator

Types

type ContractArtifact added in v1.14.0

type ContractArtifact struct {
	ABI      json.RawMessage `json:"abi"`
	Bytecode string          `json:"bytecode"`
}

ContractArtifact contains a compiled contract's ABI and deployment bytecode.

type EVMReceiptRecorder added in v1.14.0

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

EVMReceiptRecorder collects receipts when explicitly installed as an EVM keeper hook.

func (*EVMReceiptRecorder) Len added in v1.14.0

func (r *EVMReceiptRecorder) Len() int

func (*EVMReceiptRecorder) PostTxProcessing added in v1.14.0

func (r *EVMReceiptRecorder) PostTxProcessing(
	_ sdk.Context,
	_ common.Address,
	_ core.Message,
	receipt *ethtypes.Receipt,
) error

PostTxProcessing records the outer transaction receipt and copies its log slice.

type EVMTransactionResult added in v1.14.0

type EVMTransactionResult struct {
	Response vmtypes.MsgEthereumTxResponse
	Receipt  *ethtypes.Receipt
	Events   []abci.Event
}

EVMTransactionResult contains the response, receipt and SDK events of a committed transaction.

type TestInput

type TestInput struct {
	App             *xplaApp.XplaApp
	Ctx             sdk.Context
	Cdc             *codec.LegacyAmino
	AccountKeeper   authkeeper.AccountKeeper
	BankKeeper      bankkeeper.Keeper
	RewardKeeper    rewardkeeper.Keeper
	StakingKeeper   *stakingkeeper.Keeper
	SlashingKeeper  slashingkeeper.Keeper
	DistrKeeper     distrkeeper.Keeper
	VolunteerKeeper volunteerkeeper.Keeper

	StakingHandler *stakingtestutil.Helper
}

TestInput nolint

func CreateTestInput

func CreateTestInput(t *testing.T) TestInput

CreateTestInput initializes keeper, EVM and IBC state with a proposer record. Signed transactions can start at block 1 without committing an empty block.

func (*TestInput) CommitEVMContractCall added in v1.14.0

func (ti *TestInput) CommitEVMContractCall(t *testing.T, key *ecdsa.PrivateKey, receipts *EVMReceiptRecorder, address common.Address, contractABI abi.ABI, method string, args ...interface{}) EVMTransactionResult

CommitEVMContractCall commits an ABI-encoded call and requires successful EVM execution.

func (*TestInput) CommitEVMTransaction added in v1.14.0

func (ti *TestInput) CommitEVMTransaction(t *testing.T, key *ecdsa.PrivateKey, receipts *EVMReceiptRecorder, to *common.Address, data []byte, gas uint64) EVMTransactionResult

CommitEVMTransaction signs and commits a transaction through the real block lifecycle. EVM execution failures are returned for rollback assertions; SDK failures fail the test.

func (*TestInput) CommitTransaction added in v1.14.0

func (ti *TestInput) CommitTransaction(t *testing.T, txBytes []byte) *abci.ExecTxResult

CommitTransaction executes one transaction in the next block and commits its state. Test block timestamps use the block height as Unix seconds.

func (*TestInput) CommitTransactionResult added in v1.14.0

func (ti *TestInput) CommitTransactionResult(t *testing.T, txBytes []byte) *abci.ExecTxResult

CommitTransactionResult executes and commits one transaction, returning SDK failures so callers can assert ante-handler rollback.

func (*TestInput) DeployEVMContract added in v1.14.0

func (ti *TestInput) DeployEVMContract(t *testing.T, key *ecdsa.PrivateKey, receipts *EVMReceiptRecorder, artifacts map[string]ContractArtifact, name string, args ...interface{}) (common.Address, abi.ABI)

DeployEVMContract commits a contract deployment and requires successful EVM execution.

func (*TestInput) EVMContext added in v1.14.0

func (ti *TestInput) EVMContext() sdk.Context

EVMContext reads the latest committed state with a fresh gas meter. Its synthetic timestamp matches CommitTransaction's block-height clock.

func (*TestInput) InitAccountWithCoins

func (ti *TestInput) InitAccountWithCoins(addr sdk.AccAddress, coins sdk.Coins) error

func (*TestInput) QueryEVMContract added in v1.14.0

func (ti *TestInput) QueryEVMContract(t *testing.T, from common.Address, address common.Address, contractABI abi.ABI, method string, args ...interface{}) []interface{}

QueryEVMContract executes and decodes a contract call without committing state changes.

Jump to

Keyboard shortcuts

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