ante

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 73 Imported by: 0

Documentation

Index

Constants

View Source
const TestGasLimit uint64 = 100000

Variables

This section is empty.

Functions

func PrepareAccountsForDelegationRewards

func PrepareAccountsForDelegationRewards(t *testing.T, ctx sdk.Context, app evm.EvmApp, addr sdk.AccAddress, balance sdkmath.Int, rewards ...sdkmath.Int) (sdk.Context, error)

PrepareAccountsForDelegationRewards prepares the test suite for testing to withdraw delegation rewards.

Balance is the amount of tokens that will be left in the account after the setup is done. For each defined reward, a validator is created and tokens are allocated to it using the distribution keeper, such that the given amount of tokens is outstanding as a staking reward for the account.

The setup is done in the following way:

  • Fund the account with the given address with the given balance.
  • If the given balance is zero, the account will be created with zero balance.

For every reward defined in the rewards argument, the following steps are executed:

  • Set up a validator with zero commission and delegate to it -> the account delegation will be 50% of the total delegation.
  • Allocate rewards to the validator.

The function returns the updated context along with a potential error.

func RunBenchmarkAnteHandler added in v0.5.0

func RunBenchmarkAnteHandler(b *testing.B, create network.CreateEvmApp, options ...network.ConfigOption)

func RunBenchmarkEthGasConsumeDecorator

func RunBenchmarkEthGasConsumeDecorator(b *testing.B, create network.CreateEvmApp, options ...network.ConfigOption)

func RunValidateHandlerOptionsTest added in v0.5.0

func RunValidateHandlerOptionsTest(t *testing.T, create network.CreateEvmApp, options ...network.ConfigOption)

func StdSignBytes

func StdSignBytes(cdc *codec.LegacyAmino, chainID string, accnum uint64, sequence uint64, timeout uint64, fee legacytx.StdFee, msgs []sdk.Msg, memo string) []byte

StdSignBytes returns the bytes to sign for a transaction.

func TestIntegrationAnteHandler

func TestIntegrationAnteHandler(t *testing.T, create network.CreateEvmApp, options ...network.ConfigOption)

Types

type AnteTestSuite

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

func NewAnteTestSuite

func NewAnteTestSuite(create network.CreateEvmApp, options ...network.ConfigOption) *AnteTestSuite

func (*AnteTestSuite) CreateTestCosmosTxBuilder

func (s *AnteTestSuite) CreateTestCosmosTxBuilder(gasPrice sdkmath.Int, denom string, msgs ...sdk.Msg) client.TxBuilder

func (*AnteTestSuite) CreateTestCosmosTxBuilderWithFees

func (s *AnteTestSuite) CreateTestCosmosTxBuilderWithFees(fees sdk.Coins, msgs ...sdk.Msg) client.TxBuilder

func (*AnteTestSuite) GetAnteHandler

func (s *AnteTestSuite) GetAnteHandler() sdk.AnteHandler

func (*AnteTestSuite) GetClientCtx

func (s *AnteTestSuite) GetClientCtx() client.Context

func (*AnteTestSuite) GetKeyring

func (s *AnteTestSuite) GetKeyring() keyring.Keyring

func (*AnteTestSuite) GetNetwork

func (s *AnteTestSuite) GetNetwork() *network.UnitTestNetwork

func (*AnteTestSuite) GetTxFactory

func (s *AnteTestSuite) GetTxFactory() factory.TxFactory

func (*AnteTestSuite) ResetEvmParamsOptions

func (s *AnteTestSuite) ResetEvmParamsOptions()

func (*AnteTestSuite) SetupTest

func (s *AnteTestSuite) SetupTest()

func (*AnteTestSuite) TestMinGasPriceDecorator

func (s *AnteTestSuite) TestMinGasPriceDecorator()

func (*AnteTestSuite) TestRejectMsgsInAuthz

func (suite *AnteTestSuite) TestRejectMsgsInAuthz()

func (*AnteTestSuite) WithBaseFee

func (s *AnteTestSuite) WithBaseFee(baseFee *sdkmath.LegacyDec)

func (*AnteTestSuite) WithEvmParamsOptions

func (s *AnteTestSuite) WithEvmParamsOptions(evmParamsOpts func(*evmtypes.Params))

func (*AnteTestSuite) WithFeemarketEnabled

func (s *AnteTestSuite) WithFeemarketEnabled(enabled bool)

func (*AnteTestSuite) WithLondonHardForkEnabled

func (s *AnteTestSuite) WithLondonHardForkEnabled(enabled bool)

type EvmAnteTestSuite

type EvmAnteTestSuite struct {
	*AnteTestSuite
	UseLegacyEIP712TypedData bool
}

func NewEvmAnteTestSuite

func NewEvmAnteTestSuite(create network.CreateEvmApp, options ...network.ConfigOption) *EvmAnteTestSuite

func (*EvmAnteTestSuite) CreateTestCosmosTxBuilder

func (s *EvmAnteTestSuite) CreateTestCosmosTxBuilder(gasPrice sdkmath.Int, denom string, msgs ...sdk.Msg) client.TxBuilder

func (*EvmAnteTestSuite) CreateTestEIP712CosmosTxBuilder

func (s *EvmAnteTestSuite) CreateTestEIP712CosmosTxBuilder(
	priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins, msgs []sdk.Msg,
) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712GrantAllowance

func (s *EvmAnteTestSuite) CreateTestEIP712GrantAllowance(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MsgCreateValidator

func (s *EvmAnteTestSuite) CreateTestEIP712MsgCreateValidator(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MsgCreateValidator2

func (s *EvmAnteTestSuite) CreateTestEIP712MsgCreateValidator2(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MsgEditValidator

func (s *EvmAnteTestSuite) CreateTestEIP712MsgEditValidator(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MsgExec

func (s *EvmAnteTestSuite) CreateTestEIP712MsgExec(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MsgSubmitEvidence

func (s *EvmAnteTestSuite) CreateTestEIP712MsgSubmitEvidence(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MsgTransfer

func (s *EvmAnteTestSuite) CreateTestEIP712MsgTransfer(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MsgTransferWithoutMemo

func (s *EvmAnteTestSuite) CreateTestEIP712MsgTransferWithoutMemo(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MsgVoteV1

func (s *EvmAnteTestSuite) CreateTestEIP712MsgVoteV1(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MultipleDifferentMsgs

func (s *EvmAnteTestSuite) CreateTestEIP712MultipleDifferentMsgs(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MultipleMsgSend

func (s *EvmAnteTestSuite) CreateTestEIP712MultipleMsgSend(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712MultipleSignerMsgs

func (s *EvmAnteTestSuite) CreateTestEIP712MultipleSignerMsgs(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712SameMsgDifferentSchemas

func (s *EvmAnteTestSuite) CreateTestEIP712SameMsgDifferentSchemas(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712SingleMessageTxBuilder

func (s *EvmAnteTestSuite) CreateTestEIP712SingleMessageTxBuilder(
	priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins, msg sdk.Msg,
) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712SubmitProposal

func (s *EvmAnteTestSuite) CreateTestEIP712SubmitProposal(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins, deposit sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712SubmitProposalV1

func (s *EvmAnteTestSuite) CreateTestEIP712SubmitProposalV1(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712TxBuilderMsgDelegate

func (s *EvmAnteTestSuite) CreateTestEIP712TxBuilderMsgDelegate(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712TxBuilderMsgSend

func (s *EvmAnteTestSuite) CreateTestEIP712TxBuilderMsgSend(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712ZeroValueArray

func (s *EvmAnteTestSuite) CreateTestEIP712ZeroValueArray(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestEIP712ZeroValueNumber

func (s *EvmAnteTestSuite) CreateTestEIP712ZeroValueNumber(from sdk.AccAddress, priv cryptotypes.PrivKey, chainID string, evmChainID, gas uint64, gasAmount sdk.Coins) (client.TxBuilder, error)

func (*EvmAnteTestSuite) CreateTestSignedMultisigTx

func (s *EvmAnteTestSuite) CreateTestSignedMultisigTx(privKeys []cryptotypes.PrivKey, signMode signing.SignMode, msg sdk.Msg, chainID string, gas uint64, signType string) client.TxBuilder

CreateTestSignedMultisigTx creates and sign a multi-signed tx for the given message. `signType` indicates whether to use standard signing ("Standard"), EIP-712 signing ("EIP-712"), or a mix of the two ("mixed").

func (*EvmAnteTestSuite) CreateTestSingleSignedTx

func (s *EvmAnteTestSuite) CreateTestSingleSignedTx(privKey cryptotypes.PrivKey, signMode signing.SignMode, msg sdk.Msg, chainID string, gas uint64, signType string) client.TxBuilder

func (*EvmAnteTestSuite) CreateTxBuilder

func (s *EvmAnteTestSuite) CreateTxBuilder(privKey cryptotypes.PrivKey, txArgs evmtypes.EvmTxArgs, unsetExtensionOptions ...bool) client.TxBuilder

func (*EvmAnteTestSuite) GenerateMultipleKeys

func (s *EvmAnteTestSuite) GenerateMultipleKeys(n int) ([]cryptotypes.PrivKey, []cryptotypes.PubKey)

Generate a set of pub/priv keys to be used in creating multi-keys

func (*EvmAnteTestSuite) RegisterAccount

func (s *EvmAnteTestSuite) RegisterAccount(pubKey cryptotypes.PubKey, balance *uint256.Int)

RegisterAccount creates an account with the keeper and populates the initial balance

func (*EvmAnteTestSuite) RequireErrorForLegacyTypedData

func (s *EvmAnteTestSuite) RequireErrorForLegacyTypedData(err error)

func (*EvmAnteTestSuite) TestAnteHandler

func (s *EvmAnteTestSuite) TestAnteHandler()

func (*EvmAnteTestSuite) TestAnteHandlerWithDynamicTxFee

func (s *EvmAnteTestSuite) TestAnteHandlerWithDynamicTxFee()

func (*EvmAnteTestSuite) TestAnteHandlerWithParams

func (s *EvmAnteTestSuite) TestAnteHandlerWithParams()

func (*EvmAnteTestSuite) TestEthSetupContextDecorator

func (s *EvmAnteTestSuite) TestEthSetupContextDecorator()

func (*EvmAnteTestSuite) TestEthSigVerificationDecorator

func (s *EvmAnteTestSuite) TestEthSigVerificationDecorator()

func (*EvmAnteTestSuite) TestGasWantedDecorator

func (s *EvmAnteTestSuite) TestGasWantedDecorator()

func (*EvmAnteTestSuite) TestSignatures

func (s *EvmAnteTestSuite) TestSignatures()

func (*EvmAnteTestSuite) TxForLegacyTypedData

func (s *EvmAnteTestSuite) TxForLegacyTypedData(txBuilder client.TxBuilder) sdk.Tx

type EvmUnitAnteTestSuite

type EvmUnitAnteTestSuite struct {
	suite.Suite

	// To make sure that every tests is run with all the tx types
	EthTxType  int
	ChainID    string
	EvmChainID uint64
	// contains filtered or unexported fields
}

EvmUniAnteTestSuite aims to test all EVM ante handler unit functions. NOTE: the suite only holds properties related to global execution parameters (what type of tx to run the tests with) not independent tests values.

func NewEvmUnitAnteTestSuite

func NewEvmUnitAnteTestSuite(
	create network.CreateEvmApp,
) *EvmUnitAnteTestSuite

func (*EvmUnitAnteTestSuite) TestCanTransfer

func (s *EvmUnitAnteTestSuite) TestCanTransfer()

func (*EvmUnitAnteTestSuite) TestCheckGasWanted

func (s *EvmUnitAnteTestSuite) TestCheckGasWanted()

func (*EvmUnitAnteTestSuite) TestCheckTxFee

func (s *EvmUnitAnteTestSuite) TestCheckTxFee()

func (*EvmUnitAnteTestSuite) TestConsumeGasAndEmitEvent

func (s *EvmUnitAnteTestSuite) TestConsumeGasAndEmitEvent()

NOTE: claim rewards are not tested since there is an independent suite to test just that

func (*EvmUnitAnteTestSuite) TestGlobalFee

func (s *EvmUnitAnteTestSuite) TestGlobalFee()

func (*EvmUnitAnteTestSuite) TestIncrementSequence

func (s *EvmUnitAnteTestSuite) TestIncrementSequence()

func (*EvmUnitAnteTestSuite) TestMempoolFee

func (s *EvmUnitAnteTestSuite) TestMempoolFee()

func (*EvmUnitAnteTestSuite) TestUpdateCumulativeGasWanted

func (s *EvmUnitAnteTestSuite) TestUpdateCumulativeGasWanted()

func (*EvmUnitAnteTestSuite) TestValidateMsg

func (s *EvmUnitAnteTestSuite) TestValidateMsg()

func (*EvmUnitAnteTestSuite) TestVerifyAccountBalance

func (s *EvmUnitAnteTestSuite) TestVerifyAccountBalance()

type IntegrationTestSuite

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

func NewIntegrationTestSuite

func NewIntegrationTestSuite(create network.CreateEvmApp, options ...network.ConfigOption) *IntegrationTestSuite

func (*IntegrationTestSuite) SetupTest

func (s *IntegrationTestSuite) SetupTest()

Jump to

Keyboard shortcuts

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