Documentation
¶
Index ¶
- Variables
- func CreateNestedMsgExec(a sdk.AccAddress, nestedLvl int, lastLvlMsgs []sdk.Msg) *authz.MsgExec
- func CreateTx(ctx context.Context, txCfg client.TxConfig, priv cryptotypes.PrivKey, ...) (sdk.Tx, error)
- func DecodeRevertReason(evmRes evmtypes.MsgEthereumTxResponse) error
- func FundAccount(ctx sdk.Context, bankKeeper bankkeeper.Keeper, addr sdk.AccAddress, ...) error
- func FundAccountWithBaseDenom(ctx sdk.Context, bankKeeper bankkeeper.Keeper, addr sdk.AccAddress, ...) error
- func FundModuleAccount(ctx sdk.Context, bankKeeper bankkeeper.Keeper, recipientMod string, ...) error
- func GeneratePrivKeyAddressPairs(accCount int) ([]*ethsecp256k1.PrivKey, []sdk.AccAddress, error)
- func GetVoucherDenomFromPacketData(data transfertypes.InternalTransferRepresentation, destPort string, ...) string
- func NewHeader(height int64, blockTime time.Time, chainID string, proposer sdk.ConsAddress, ...) tmproto.Header
- func NewMsgExec(grantee sdk.AccAddress, msgs []sdk.Msg) *authz.MsgExec
- func NewMsgGrant(granter sdk.AccAddress, grantee sdk.AccAddress, a authz.Authorization, ...) *authz.MsgGrant
- func NewStateDB(ctx sdk.Context, evmKeeper anteinterfaces.EVMKeeper) *statedb.StateDB
- func NoOpNextFn(ctx sdk.Context, _ sdk.Tx, _ bool) (sdk.Context, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ExampleMinGasPrices defines 20B related to atto units as the minimum gas price value on the fee market module. // See https://commonwealth.im/evmos/discussion/5073-global-min-gas-price-value-for-cosmos-sdk-and-evm-transaction-choosing-a-value for reference ExampleMinGasPrices = big.NewInt(20_000_000_000) // ExampleMinGasMultiplier defines the min gas multiplier value on the fee market module. // 50% of the leftover gas will be refunded ExampleMinGasMultiplier = math.LegacyNewDecWithPrec(5, 1) )
Functions ¶
func CreateNestedMsgExec ¶ added in v0.4.0
func DecodeRevertReason ¶ added in v0.4.0
func DecodeRevertReason(evmRes evmtypes.MsgEthereumTxResponse) error
DecodeRevertReason extracts and decodes the human-readable revert reason from an EVM transaction response. It processes the raw return data (Ret field) from a failed EVM transaction and attempts to decode any ABI-encoded revert messages into readable error strings.
Returns:
- error: A formatted error containing either:
- "tx failed with VmError: <vmError>: <decoded_reason>" for successfully decoded reverts
- "tx failed with VmError: <vmError>: <hex_data>" for non-decodable data
- "failed to decode revert data: <decode_error>" if decoding fails
Example usage:
res, err := executeTransaction(...) if res.VmError != "" { decodedErr := DecodeRevertReason(res) // decodedErr might be: "tx failed with VmError: execution reverted: ERC20: insufficient allowance" }
func FundAccount ¶
func FundAccount(ctx sdk.Context, bankKeeper bankkeeper.Keeper, addr sdk.AccAddress, amounts sdk.Coins) error
FundAccount is a utility function that funds an account by minting and sending the coins to the address.
func FundAccountWithBaseDenom ¶
func FundAccountWithBaseDenom(ctx sdk.Context, bankKeeper bankkeeper.Keeper, addr sdk.AccAddress, amount int64) error
FundAccountWithBaseDenom is a utility function that uses the FundAccount function to fund an account with the default Cosmos EVM denomination.
func FundModuleAccount ¶
func FundModuleAccount(ctx sdk.Context, bankKeeper bankkeeper.Keeper, recipientMod string, amounts sdk.Coins) error
FundModuleAccount is a utility function that funds a module account by minting and sending the coins to the address.
func GeneratePrivKeyAddressPairs ¶ added in v0.3.0
func GeneratePrivKeyAddressPairs(accCount int) ([]*ethsecp256k1.PrivKey, []sdk.AccAddress, error)
func GetVoucherDenomFromPacketData ¶ added in v0.2.0
func GetVoucherDenomFromPacketData( data transfertypes.InternalTransferRepresentation, destPort string, destChannel string, ) string
func NewHeader ¶
func NewHeader( height int64, blockTime time.Time, chainID string, proposer sdk.ConsAddress, appHash, validatorHash []byte, ) tmproto.Header
NewHeader creates a new CometBFT header for testing purposes.
func NewMsgExec ¶ added in v0.4.0
func NewMsgGrant ¶ added in v0.4.0
func NewMsgGrant(granter sdk.AccAddress, grantee sdk.AccAddress, a authz.Authorization, expiration *time.Time) *authz.MsgGrant
func NewStateDB ¶
NewStateDB returns a new StateDB for testing purposes.
func NoOpNextFn ¶
NoOpNextFn is a no-op function that returns the context and no error in order to mock the next function in the AnteHandler chain.
It can be used in unit tests when calling a decorator's AnteHandle method, e.g. `dec.AnteHandle(ctx, tx, false, NoOpNextFn)`
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
This file contains the variables, constants, and default values used in the testing package and commonly defined in tests.
|
This file contains the variables, constants, and default values used in the testing package and commonly defined in tests. |