From b0f75fa6e72969a8130d7107503a17a99aaac645 Mon Sep 17 00:00:00 2001 From: Ehsan-saradar Date: Wed, 27 Sep 2023 00:43:18 +0300 Subject: [PATCH] feat: rename Marshaler to Codec (#3658) * Rename Marshaler to Codec * Upgrade golangci to latest version * Update changelog * Rename Marshaler field in other places * Revert "Upgrade golangci to latest version" This reverts commit 7e4f23a6596268f0adb8ba41a98a104a86e43b6e. --------- Co-authored-by: Danilo Pantani --- changelog.md | 1 + ignite/templates/app/files/app/encoding.go.plush | 6 +++--- ignite/templates/app/files/app/params/encoding.go.plush | 2 +- .../app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush | 2 +- .../testutil/files/testutil/network/network.go.plush | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index 3d4c238c88..d7039492ae 100644 --- a/changelog.md +++ b/changelog.md @@ -14,6 +14,7 @@ - [#3559](https://github.com/ignite/cli/pull/3559) Bump network plugin version to `v0.1.1` - [#3522](https://github.com/ignite/cli/pull/3522) Remove indentation from `chain serve` output - [#3601](https://github.com/ignite/cli/pull/3601) Update ts-relayer version to `0.10.0` +- [#3658](https://github.com/ignite/cli/pull/3658) Rename Marshaler to Codec in EncodingConfig - [#3653](https://github.com/ignite/cli/pull/3653) Add "app" extension to plugin binaries - [#3656](https://github.com/ignite/cli/pull/3656) Disable Go toolchain download diff --git a/ignite/templates/app/files/app/encoding.go.plush b/ignite/templates/app/files/app/encoding.go.plush index a376774363..ab4dc16f89 100644 --- a/ignite/templates/app/files/app/encoding.go.plush +++ b/ignite/templates/app/files/app/encoding.go.plush @@ -13,12 +13,12 @@ import ( func makeEncodingConfig() params.EncodingConfig { amino := codec.NewLegacyAmino() interfaceRegistry := types.NewInterfaceRegistry() - marshaler := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) + cdc := codec.NewProtoCodec(interfaceRegistry) + txCfg := tx.NewTxConfig(cdc, tx.DefaultSignModes) return params.EncodingConfig{ InterfaceRegistry: interfaceRegistry, - Marshaler: marshaler, + Codec: cdc, TxConfig: txCfg, Amino: amino, } diff --git a/ignite/templates/app/files/app/params/encoding.go.plush b/ignite/templates/app/files/app/params/encoding.go.plush index 3d634abf16..8ff9ea04b3 100644 --- a/ignite/templates/app/files/app/params/encoding.go.plush +++ b/ignite/templates/app/files/app/params/encoding.go.plush @@ -10,7 +10,7 @@ import ( // This is provided for compatibility between protobuf and amino implementations. type EncodingConfig struct { InterfaceRegistry types.InterfaceRegistry - Marshaler codec.Codec + Codec codec.Codec TxConfig client.TxConfig Amino *codec.LegacyAmino } diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush index c8183e85c9..8e4c0b9308 100644 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush @@ -38,7 +38,7 @@ import ( func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { encodingConfig := app.MakeEncodingConfig() initClientCtx := client.Context{}. - WithCodec(encodingConfig.Marshaler). + WithCodec(encodingConfig.Codec). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). WithTxConfig(encodingConfig.TxConfig). WithLegacyAmino(encodingConfig.Amino). diff --git a/ignite/templates/testutil/files/testutil/network/network.go.plush b/ignite/templates/testutil/files/testutil/network/network.go.plush index 1307ebbda4..2536d92ca6 100644 --- a/ignite/templates/testutil/files/testutil/network/network.go.plush +++ b/ignite/templates/testutil/files/testutil/network/network.go.plush @@ -54,7 +54,7 @@ func DefaultConfig() network.Config { chainID = "chain-" + tmrand.NewRand().Str(6) ) return network.Config{ - Codec: encoding.Marshaler, + Codec: encoding.Codec, TxConfig: encoding.TxConfig, LegacyAmino: encoding.Amino, InterfaceRegistry: encoding.InterfaceRegistry, @@ -71,7 +71,7 @@ func DefaultConfig() network.Config { baseapp.SetChainID(chainID), ) }, - GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler), + GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Codec), TimeoutCommit: 2 * time.Second, ChainID: chainID, NumValidators: 1,