diff --git a/app/legacy_test.go b/app/legacy_test.go index f5e048e8bc..a016c4d479 100644 --- a/app/legacy_test.go +++ b/app/legacy_test.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "testing" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" evmenc "github.com/evmos/ethermint/encoding" "github.com/stretchr/testify/require" ) @@ -27,3 +28,25 @@ func TestDecodeLegacyTx(t *testing.T) { _, err = encodingConfig.TxConfig.TxDecoder()(bz) require.NoError(t, err) } + +func TestDecodeAuthzLegacyTx(t *testing.T) { + // msg url: /cosmos.authz.v1beta1.MsgGrant + tx := "Cr0BCroBCh4vY29zbW9zLmF1dGh6LnYxYmV0YTEuTXNnR3JhbnQSlwEKKmNyYzF4N3g5cGtmeGYzM2w4N2Z0c3BrNWFldHdua3IwbHZsdjMzNDZjZBIqY3JjMTZ6MGhlcno5OTg5NDZ3cjY1OWxyODRjOGM1NTZkYTU1ZGMzNGhoGj0KOwomL2Nvc21vcy5iYW5rLnYxYmV0YTEuU2VuZEF1dGhvcml6YXRpb24SEQoPCghiYXNldGNybxIDMjAwEl8KVwpPCigvZXRoZXJtaW50LmNyeXB0by52MS5ldGhzZWNwMjU2azEuUHViS2V5EiMKIQNg/r8Tea2PYFq2XE07fpnN97ASePg32cuO4HmUkEGpFBIECgIIARIEEMCaDBpBekTx2LtLIFDODLVr1OqMUR9UYjZBv0KAr8eCacs7jTw/szr3jCvtvHGNraifkLfBEDatH3Rp/wqaNvxXgGjH4gA=" + + bz, err := base64.StdEncoding.DecodeString(tx) + require.NoError(t, err) + + encodingConfig := evmenc.MakeConfig() + + _, err = encodingConfig.TxConfig.TxDecoder()(bz) + require.Error(t, err, "") + require.Contains(t, err.Error(), "unable to resolve type URL /cosmos.authz.v1beta1.MsgGrant") + + RegisterLegacyCodec(encodingConfig.Amino) + RegisterLegacyInterfaces(encodingConfig.InterfaceRegistry) + banktypes.RegisterLegacyAminoCodec(encodingConfig.Amino) + banktypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + + _, err = encodingConfig.TxConfig.TxDecoder()(bz) + require.NoError(t, err) +}