testutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UosmoDenom    = transfertypes.NewDenom("uosmo", transfertypes.NewHop(transfertypes.PortID, "channel-0"))
	UosmoIbcDenom = UosmoDenom.IBCDenom()

	UatomDenom    = transfertypes.NewDenom("uatom", transfertypes.NewHop(transfertypes.PortID, "channel-1"))
	UatomIbcDenom = UatomDenom.IBCDenom()

	UAtomDenom    = transfertypes.NewDenom("aatom", transfertypes.NewHop(transfertypes.PortID, "channel-0"))
	UAtomIbcDenom = UatomDenom.IBCDenom()

	UatomOsmoDenom = transfertypes.NewDenom(
		"uatom",
		transfertypes.NewHop(transfertypes.PortID, "channel-0"),
		transfertypes.NewHop(transfertypes.PortID, "channel-1"),
	)
	UatomOsmoIbcDenom = UatomOsmoDenom.IBCDenom()

	AatomDenom    = transfertypes.NewDenom("aatom", transfertypes.NewHop(transfertypes.PortID, "channel-0"))
	AatomIbcDenom = AatomDenom.IBCDenom()
)

Functions

func CheckEthereumTxFailed

func CheckEthereumTxFailed(ethRes *evmtypes.MsgEthereumTxResponse) (string, bool)

CheckEthereumTxFailed checks if there is a VM error in the transaction response and returns the reason.

func CheckLogs

func CheckLogs(logArgs LogCheckArgs) error

CheckLogs checks the logs for the given events and whether the transaction was successful or not.

func CheckVMError

func CheckVMError(res abci.ExecTxResult, expErrMsg string, args ...interface{}) error

CheckVMError is a helper function used to check if the transaction is reverted with the expected error message in the VmError field of the MsgEthereumResponse struct.

func CreateValidator

func CreateValidator(t *testing.T, ctx sdk.Context, pubKey cryptotypes.PubKey, sk stakingkeeper.Keeper, stakeAmt math.Int)

CreateValidator creates a validator with the given amount of staked tokens in the bond denomination set in the staking keeper.

func NewPrecompileContract

func NewPrecompileContract(t *testing.T, ctx sdk.Context, caller common.Address, precompile vm.ContractRef, gas uint64) (*vm.Contract, sdk.Context)

NewPrecompileContract creates a new precompile contract and sets the gas meter.

func ValidateWrites added in v0.2.0

func ValidateWrites(t *testing.T, ms *TrackingMultiStore, expWrites int)

ValidateWrites tests the number of writes to a tree of tracking multi stores, and that all the writes in a branching cache multistore/cascade upwards

Types

type LogCheckArgs

type LogCheckArgs struct {
	// ABIEvents is a map of available abi.Event corresponding to the corresponding event names,
	// which are available in the contract ABI.
	ABIEvents map[string]abi.Event
	// ErrContains is the error message that is expected to be contained in the transaction response.
	ErrContains string
	// ExpEvents are the events which are expected to be emitted.
	ExpEvents []string
	// ExpPass is whether the transaction is expected to pass or not.
	ExpPass bool
	// Res is the response of the transaction.
	//
	// NOTE: This does not have to be set when using contracts.CallContractAndCheckLogs.
	Res abci.ExecTxResult
}

LogCheckArgs is a struct that contains configuration for the log checking.

func (LogCheckArgs) WithABIEvents

func (l LogCheckArgs) WithABIEvents(abiEvents map[string]abi.Event) LogCheckArgs

WithABIEvents sets the ABIEvents field of LogCheckArgs.

func (LogCheckArgs) WithErrContains

func (l LogCheckArgs) WithErrContains(errContains string, printArgs ...interface{}) LogCheckArgs

WithErrContains sets the ErrContains field of LogCheckArgs. If any printArgs are provided, they are used to format the error message.

func (LogCheckArgs) WithExpEvents

func (l LogCheckArgs) WithExpEvents(expEvents ...string) LogCheckArgs

WithExpEvents sets the ExpEvents field of LogCheckArgs.

func (LogCheckArgs) WithExpPass

func (l LogCheckArgs) WithExpPass(expPass bool) LogCheckArgs

WithExpPass sets the ExpPass field of LogCheckArgs.

func (LogCheckArgs) WithRes

func (l LogCheckArgs) WithRes(res abci.ExecTxResult) LogCheckArgs

WithRes sets the Res field of LogCheckArgs.

type TrackingMultiStore added in v0.2.0

type TrackingMultiStore struct {
	// Store is the underlying CacheMultiStore being wrapped and tracked.
	Store storetypes.CacheMultiStore
	// Writes is the number of times Write() has been called on this store.
	Writes int
	// WriteTS is the timestamp of the last Write() call, used to determine write order.
	WriteTS *time.Time
	// HistoricalStores holds any CacheMultiStores created from this store via CacheMultiStore().
	// Each represents a new *branch* of the same logical root, not a hierarchical child.
	// Branches are tracked in order of creation, but have no implied depth or parent-child relationship.
	HistoricalStores []*TrackingMultiStore
}

TrackingMultiStore implements the CacheMultiStore interface, but tracks calls to the Write interface as well as the branches created via CacheMultiStore()

func (*TrackingMultiStore) CacheMultiStore added in v0.2.0

func (t *TrackingMultiStore) CacheMultiStore() storetypes.CacheMultiStore

func (*TrackingMultiStore) CacheMultiStoreWithVersion added in v0.2.0

func (t *TrackingMultiStore) CacheMultiStoreWithVersion(version int64) (storetypes.CacheMultiStore, error)

func (*TrackingMultiStore) CacheWrap added in v0.2.0

func (t *TrackingMultiStore) CacheWrap() storetypes.CacheWrap

func (*TrackingMultiStore) CacheWrapWithTrace added in v0.2.0

func (*TrackingMultiStore) GetKVStore added in v0.2.0

func (*TrackingMultiStore) GetStore added in v0.2.0

func (*TrackingMultiStore) GetStoreType added in v0.2.0

func (t *TrackingMultiStore) GetStoreType() storetypes.StoreType

func (*TrackingMultiStore) LatestVersion added in v0.2.0

func (t *TrackingMultiStore) LatestVersion() int64

func (*TrackingMultiStore) SetTracer added in v0.2.0

func (*TrackingMultiStore) SetTracingContext added in v0.2.0

func (t *TrackingMultiStore) SetTracingContext(context storetypes.TraceContext) storetypes.MultiStore

func (*TrackingMultiStore) TracingEnabled added in v0.2.0

func (t *TrackingMultiStore) TracingEnabled() bool

func (*TrackingMultiStore) Write added in v0.2.0

func (t *TrackingMultiStore) Write()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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