encoding

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLegacyMsgEthereumTxDecodeErr

func IsLegacyMsgEthereumTxDecodeErr(err error) bool

IsLegacyMsgEthereumTxDecodeErr returns true when the error is from RejectUnknownFields failing on a legacy MsgEthereumTx payload (tag 1 = data). Used to trigger fallback decode. Checks the full error chain in case the error is wrapped.

func LegacyTxDecodeRegistry

func LegacyTxDecodeRegistry(wrapped *EthereumTxCompatRegistry) codectypes.InterfaceRegistry

LegacyTxDecodeRegistry returns an InterfaceRegistry that resolves MsgEthereumTx as legacy type. Use only for the fallback decode when the first decode fails on legacy (tag 1) payload.

Types

type EthereumTxCompatRegistry

type EthereumTxCompatRegistry struct {
	codectypes.InterfaceRegistry
}

EthereumTxCompatRegistry wraps an InterfaceRegistry and adds UnpackAny/Resolve behavior for pre-upgrade cosmos.evm.vm.v1.MsgEthereumTx (legacy payload).

func NewEthereumTxCompatRegistry

func NewEthereumTxCompatRegistry(inner codectypes.InterfaceRegistry) *EthereumTxCompatRegistry

NewEthereumTxCompatRegistry returns a registry that delegates to inner except for UnpackAny and Resolve, where it applies Ethereum tx compatibility (legacy ↔ new). MsgEthereumTx is resolved via inner (new type) so response display shows from/raw.

func (*EthereumTxCompatRegistry) Resolve

func (r *EthereumTxCompatRegistry) Resolve(typeURL string) (proto.Message, error)

Resolve implements AnyResolver (used by unknownproto.RejectUnknownFields and client tx decode).

  • For cosmos.evm.vm.v1.MsgEthereumTx we delegate to inner (new type) so that response display unmarshals correctly and shows from/raw. Legacy payloads (tag 1) fail first decode and are retried in TxDecoder with LegacyTxDecodeRegistry.
  • For cosmos.evm.vm.v1.LegacyTx/DynamicFeeTx/AccessListTx we return legacy TxData types so the client can resolve inner Anys when decoding pre-upgrade txs (payload uses ethermint schema).
  • All other type URLs are delegated to the inner registry as-is; the SDK stores type URLs with a leading slash (e.g. /cosmos.gov.v1beta1.MsgSubmitProposal), so we must not strip it.

func (*EthereumTxCompatRegistry) UnpackAny

func (r *EthereumTxCompatRegistry) UnpackAny(any *codectypes.Any, iface interface{}) error

UnpackAny implements AnyUnpacker. For cosmos.evm.vm.v1.MsgEthereumTx we try legacy unmarshal first; if it succeeds and has Data (pre-upgrade payload), convert to new with from/raw. For cosmos.evm.vm.v1.LegacyTx/DynamicFeeTx/AccessListTx unpacking into TxData we use legacy types so UnpackInterfaces on legacy MsgEthereumTx works (inner registry may not have cosmos.evm.vm.v1.* registered against ethermint TxData).

type TxConfigWrapper

type TxConfigWrapper struct {
	TxConfig client.TxConfig
	Codec    codec.Codec
}

TxConfigWrapper wraps the default TxConfig and provides a custom TxDecoder. TxConfig is a settable field so that the inner config can be replaced (e.g. with NewTxConfigWithOptions). Codec is used for the legacy MsgEthereumTx fallback decode path.

func NewTxConfig

func NewTxConfig(cdc codec.Codec, sigModes []signingtypes.SignMode) *TxConfigWrapper

NewTxConfig creates a new TxConfigWrapper containing a custom TxDecoder that converts legacy messages

func (*TxConfigWrapper) MarshalSignatureJSON

func (w *TxConfigWrapper) MarshalSignatureJSON(sigs []signingtypes.SignatureV2) ([]byte, error)

MarshalSignatureJSON delegates to the inner TxConfig

func (*TxConfigWrapper) NewTxBuilder

func (w *TxConfigWrapper) NewTxBuilder() client.TxBuilder

NewTxBuilder delegates to the inner TxConfig

func (*TxConfigWrapper) SignModeHandler

func (w *TxConfigWrapper) SignModeHandler() *txsigning.HandlerMap

SignModeHandler delegates to the inner TxConfig

func (*TxConfigWrapper) SigningContext

func (w *TxConfigWrapper) SigningContext() *txsigning.Context

SigningContext delegates to the inner TxConfig

func (*TxConfigWrapper) TxDecoder

func (w *TxConfigWrapper) TxDecoder() sdk.TxDecoder

TxDecoder returns a decoder that retries with LegacyTxDecodeRegistry when the first decode fails on legacy MsgEthereumTx (tag 1).

func (*TxConfigWrapper) TxEncoder

func (w *TxConfigWrapper) TxEncoder() sdk.TxEncoder

TxEncoder delegates to the inner TxConfig

func (*TxConfigWrapper) TxJSONDecoder

func (w *TxConfigWrapper) TxJSONDecoder() sdk.TxDecoder

TxJSONDecoder delegates to the inner TxConfig

func (*TxConfigWrapper) TxJSONEncoder

func (w *TxConfigWrapper) TxJSONEncoder() sdk.TxEncoder

TxJSONEncoder delegates to the inner TxConfig

func (*TxConfigWrapper) UnmarshalSignatureJSON

func (w *TxConfigWrapper) UnmarshalSignatureJSON(b []byte) ([]signingtypes.SignatureV2, error)

UnmarshalSignatureJSON delegates to the inner TxConfig

func (*TxConfigWrapper) WrapTxBuilder

func (w *TxConfigWrapper) WrapTxBuilder(tx sdk.Tx) (client.TxBuilder, error)

WrapTxBuilder delegates to the inner TxConfig

Jump to

Keyboard shortcuts

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