From 68a21f6f0ea873eef22f7028ea0a710a241776fd Mon Sep 17 00:00:00 2001 From: Marko Date: Fri, 6 Oct 2023 13:40:34 +0300 Subject: [PATCH] chore!: remove deprecated code (#17985) --- CHANGELOG.md | 2 + Makefile | 2 - simapp/params/amino.go | 27 ------------ simapp/params/proto.go | 27 ------------ x/auth/migrations/legacytx/stdtx_builder.go | 48 --------------------- 5 files changed, 2 insertions(+), 104 deletions(-) delete mode 100644 simapp/params/amino.go delete mode 100644 simapp/params/proto.go diff --git a/CHANGELOG.md b/CHANGELOG.md index de7274cfe386..77b0401c5261 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -156,6 +156,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * `RegisterLegacyAmino` was removed from `AppModuleBasic` * (x/staking) [#17655](https://github.com/cosmos/cosmos-sdk/pull/17655) `QueryHistoricalInfo` was adjusted to return `HistoricalRecord` and marked `Hist` as deprecated. * (types) [#17885](https://github.com/cosmos/cosmos-sdk/pull/17885) `InitGenesis` & `ExportGenesis` now take `context.Context` instead of `sdk.Context` +* (x/auth) [#17985](https://github.com/cosmos/cosmos-sdk/pull/17985) Remove `StdTxConfig` + * Remove depreacted `MakeTestingEncodingParams` from `simapp/params` ### CLI Breaking Changes diff --git a/Makefile b/Makefile index 6fe028d1a7be..7d4ab4b70840 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,6 @@ TEST_TARGETS := test-unit test-unit-amino test-unit-proto test-ledger-mock test- # a new rule, customise ARGS or TEST_PACKAGES ad libitum, and # append the new rule to the TEST_TARGETS list. test-unit: test_tags += cgo ledger test_ledger_mock norace -test-unit-amino: test_tags += ledger test_ledger_mock test_amino norace test-ledger: test_tags += cgo ledger norace test-ledger-mock: test_tags += ledger test_ledger_mock norace test-race: test_tags += cgo ledger test_ledger_mock @@ -215,7 +214,6 @@ $(TEST_TARGETS): run-tests # note: go test -c doesn't support multiple packages yet (https://github.com/golang/go/issues/15513) CHECK_TEST_TARGETS := check-test-unit check-test-unit-amino check-test-unit: test_tags += cgo ledger test_ledger_mock norace -check-test-unit-amino: test_tags += ledger test_ledger_mock test_amino norace $(CHECK_TEST_TARGETS): EXTRA_ARGS=-run=none $(CHECK_TEST_TARGETS): run-tests diff --git a/simapp/params/amino.go b/simapp/params/amino.go deleted file mode 100644 index 992f33cf9327..000000000000 --- a/simapp/params/amino.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build test_amino -// +build test_amino - -package params - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" -) - -// MakeTestEncodingConfig creates an EncodingConfig for an amino based test configuration. -// This function should be used only internally (in the SDK). -// App user should'nt create new codecs - use the app.AppCodec instead. -// Deprecated: -func MakeTestEncodingConfig() EncodingConfig { - cdc := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() - marshaler := codec.NewAminoCodec(cdc) - - return EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Marshaler: marshaler, - TxConfig: legacytx.StdTxConfig{Cdc: cdc}, - Amino: cdc, - } -} diff --git a/simapp/params/proto.go b/simapp/params/proto.go deleted file mode 100644 index 0eaf26585c03..000000000000 --- a/simapp/params/proto.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build !test_amino -// +build !test_amino - -package params - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/x/auth/tx" -) - -// MakeTestEncodingConfig creates an EncodingConfig for a non-amino based test configuration. -// This function should be used only internally (in the SDK). -// App user should'nt create new codecs - use the app.AppCodec instead. -// Deprecated: -func MakeTestEncodingConfig() EncodingConfig { - cdc := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() - codec := codec.NewProtoCodec(interfaceRegistry) - - return EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Codec: codec, - TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes), - Amino: cdc, - } -} diff --git a/x/auth/migrations/legacytx/stdtx_builder.go b/x/auth/migrations/legacytx/stdtx_builder.go index 3965c79cc723..904df0a01055 100644 --- a/x/auth/migrations/legacytx/stdtx_builder.go +++ b/x/auth/migrations/legacytx/stdtx_builder.go @@ -66,54 +66,6 @@ func (s *StdTxBuilder) AddAuxSignerData(_ tx.AuxSignerData) error { return sdkerrors.ErrLogic.Wrap("cannot use AuxSignerData with StdTxBuilder") } -// StdTxConfig is a context.TxConfig for StdTx -type StdTxConfig struct { - Cdc *codec.LegacyAmino -} - -// MarshalTx implements TxConfig.MarshalTx -func (s StdTxConfig) TxEncoder() sdk.TxEncoder { - return DefaultTxEncoder(s.Cdc) -} - -func (s StdTxConfig) TxJSONEncoder() sdk.TxEncoder { - return func(tx sdk.Tx) ([]byte, error) { - return s.Cdc.MarshalJSON(tx) - } -} - -func (s StdTxConfig) MarshalSignatureJSON(sigs []signing.SignatureV2) ([]byte, error) { - stdSigs := make([]StdSignature, len(sigs)) - for i, sig := range sigs { - stdSig, err := SignatureV2ToStdSignature(s.Cdc, sig) - if err != nil { - return nil, err - } - - stdSigs[i] = stdSig - } - return s.Cdc.MarshalJSON(stdSigs) -} - -func (s StdTxConfig) UnmarshalSignatureJSON(bz []byte) ([]signing.SignatureV2, error) { - var stdSigs []StdSignature - err := s.Cdc.UnmarshalJSON(bz, &stdSigs) - if err != nil { - return nil, err - } - - sigs := make([]signing.SignatureV2, len(stdSigs)) - for i, stdSig := range stdSigs { - sig, err := StdSignatureToSignatureV2(s.Cdc, stdSig) - if err != nil { - return nil, err - } - sigs[i] = sig - } - - return sigs, nil -} - // SignatureV2ToStdSignature converts a SignatureV2 to a StdSignature // [Deprecated] func SignatureV2ToStdSignature(cdc *codec.LegacyAmino, sig signing.SignatureV2) (StdSignature, error) {