Cosmos-sdk: Remove HybridCodec

Created on 24 Jul 2020  路  3Comments  路  Source: cosmos/cosmos-sdk

Motivation

HybridCodec provides hybrid protobuf binary marshaling and amino JSON marshaling in a single type. It seemed like a good idea to me when we first did the state migration because it allows queriers to still use amino JSON. But it's just messy in other ways because the CLI and genesis should use the same encoding as everything else (either proto or amino). And it just feels wrong.

So I propose we remove HybridCodec and just always pass an amino JSON marshaler into the legacy querier and REST endpoints and let everything else that is non-legacy (genesis and CLI) just use either ProtoCodec or AminoCodec.

Needed for #5917.

Details

  • [x] refactor AppModule NewQuerierHandler() sdk.Querier -> LegacyQuerierHandler(JSONMarshaler) sdk.Querier #6838
  • [x] create a BinaryMarshaler interface with just the MarshalBinary*** methods to be used in keepers so that legacy queriers don't accidentally try to use the keeper's codec #6838
  • use the JSONMarshaler from LegacyQuerierHandler in all queriers instead of the Marshaler on the keeper

    • [x] x/auth #6838

    • [x] x/bank #6838

    • [x] x/distribution #6838

    • [x] x/evidence #6843

    • [x] x/gov #6843

    • [x] x/ibc #6843

    • [x] x/ibc-transfer #6843

    • [x] x/mint #6843

    • [x] x/params #6843

    • [x] x/slashing #6843

    • [x] x/staking #6843

    • [x] x/upgrade #6843

  • [x] cleanup: address review comments from https://github.com/cosmos/cosmos-sdk/pull/6838
  • [ ] remove HybridCodec
encoding

Most helpful comment

We should also make sure to remove references to HybridCodec from ADR019, and make sure the changes here are reflected in the ADR.

All 3 comments

ACK

Ack

We should also make sure to remove references to HybridCodec from ADR019, and make sure the changes here are reflected in the ADR.

Was this page helpful?
0 / 5 - 0 ratings