Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch auth register cdc #5892

Merged
merged 12 commits into from
Mar 30, 2020
3 changes: 1 addition & 2 deletions x/auth/types/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/tendermint/tendermint/crypto"
yaml "gopkg.in/yaml.v2"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/exported"
)
Expand Down Expand Up @@ -61,7 +60,7 @@ func (acc BaseAccount) GetPubKey() (pk crypto.PubKey) {
return nil
}

codec.Cdc.MustUnmarshalBinaryBare(acc.PubKey, &pk)
amino.MustUnmarshalBinaryBare(acc.PubKey, &pk)
return pk
}

Expand Down
8 changes: 7 additions & 1 deletion x/auth/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterConcrete(StdTx{}, "cosmos-sdk/StdTx", nil)
}

// RegisterAccountTypeCodec registers an external account type defined in
// another module for the internal ModuleCdc.
func RegisterAccountTypeCodec(o interface{}, name string) {
amino.RegisterConcrete(o, name, nil)
ModuleCdc = codec.NewHybridCodec(amino)
}

var (
amino = codec.New()

Expand All @@ -41,5 +48,4 @@ var (
func init() {
RegisterCodec(amino)
codec.RegisterCrypto(amino)
amino.Seal()
}
2 changes: 1 addition & 1 deletion x/auth/types/stdtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (ss StdSignature) GetPubKey() (pk crypto.PubKey) {
return nil
}

codec.Cdc.MustUnmarshalBinaryBare(ss.PubKey, &pk)
amino.MustUnmarshalBinaryBare(ss.PubKey, &pk)
return pk
}

Expand Down