Skip to content

Commit

Permalink
Merge branch 'main' into julien/core-gas
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored May 21, 2024
2 parents 0479a71 + a2aaed6 commit 8be2ca3
Show file tree
Hide file tree
Showing 150 changed files with 6,121 additions and 1,048 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.31.0
- uses: bufbuild/buf-setup-action@v1.32.0
- uses: bufbuild/buf-lint-action@v1
with:
input: "proto"
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.31.0
- uses: bufbuild/buf-setup-action@v1.32.0
- uses: bufbuild/buf-breaking-action@v1
with:
input: "proto"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* Every module has the codec already, passing it created an unneeded dependency.
* Additionally, to reflect this change, the module manager does not take a codec either.
* (runtime) [#19747](https://github.com/cosmos/cosmos-sdk/pull/19747) `runtime.ValidatorAddressCodec` and `runtime.ConsensusAddressCodec` have been moved to `core`.
* [#19839](https://github.com/cosmos/cosmos-sdk/pull/19839) `Tx.GetMsgsV2` has been replaced with `Tx.GetReflectMessages`, and `Codec.GetMsgV1Signers` and `Codec.GetMsgV2Signers` have been replaced with `GetMsgSigners` and `GetReflectMsgSigners` respectively. These API changes clear up confusion as to the use and purpose of these methods.
* (baseapp) [#19993](https://github.com/cosmos/cosmos-sdk/pull/19993) Indicate pruning with error code "not found" rather than "invalid request".
* (x/consensus) [#20010](https://github.com/cosmos/cosmos-sdk/pull/20010) Move consensus module to be its own go.mod
* (server) [#20140](https://github.com/cosmos/cosmos-sdk/pull/20140) Remove embedded grpc-web proxy in favor of standalone grpc-web proxy. [Envoy Proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start)
Expand Down
14 changes: 7 additions & 7 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/gogoproto/proto"
"golang.org/x/exp/maps"
protov2 "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"

"cosmossdk.io/core/header"
errorsmod "cosmossdk.io/errors"
Expand Down Expand Up @@ -950,9 +950,9 @@ func (app *BaseApp) runTx(mode execMode, txBytes []byte) (gInfo sdk.GasInfo, res
// Attempt to execute all messages and only update state if all messages pass
// and we're in DeliverTx. Note, runMsgs will never return a reference to a
// Result if any single message fails or does not have a registered Handler.
msgsV2, err := tx.GetMsgsV2()
reflectMsgs, err := tx.GetReflectMessages()
if err == nil {
result, err = app.runMsgs(runMsgCtx, msgs, msgsV2, mode)
result, err = app.runMsgs(runMsgCtx, msgs, reflectMsgs, mode)
}

// Run optional postHandlers (should run regardless of the execution result).
Expand Down Expand Up @@ -998,7 +998,7 @@ func (app *BaseApp) runTx(mode execMode, txBytes []byte) (gInfo sdk.GasInfo, res
// and DeliverTx. An error is returned if any single message fails or if a
// Handler does not exist for a given message route. Otherwise, a reference to a
// Result is returned. The caller must not commit state if an error is returned.
func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, msgsV2 []protov2.Message, mode execMode) (*sdk.Result, error) {
func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, reflectMsgs []protoreflect.Message, mode execMode) (*sdk.Result, error) {
events := sdk.EmptyEvents()
msgResponses := make([]*codectypes.Any, 0, len(msgs))

Expand All @@ -1020,7 +1020,7 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, msgsV2 []protov2.Me
}

// create message events
msgEvents, err := createEvents(app.cdc, msgResult.GetEvents(), msg, msgsV2[i])
msgEvents, err := createEvents(app.cdc, msgResult.GetEvents(), msg, reflectMsgs[i])
if err != nil {
return nil, errorsmod.Wrapf(err, "failed to create message events; message index: %d", i)
}
Expand Down Expand Up @@ -1066,12 +1066,12 @@ func makeABCIData(msgResponses []*codectypes.Any) ([]byte, error) {
return proto.Marshal(&sdk.TxMsgData{MsgResponses: msgResponses})
}

func createEvents(cdc codec.Codec, events sdk.Events, msg sdk.Msg, msgV2 protov2.Message) (sdk.Events, error) {
func createEvents(cdc codec.Codec, events sdk.Events, msg sdk.Msg, reflectMsg protoreflect.Message) (sdk.Events, error) {
eventMsgName := sdk.MsgTypeURL(msg)
msgEvent := sdk.NewEvent(sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyAction, eventMsgName))

// we set the signer attribute as the sender
signers, err := cdc.GetMsgV2Signers(msgV2)
signers, err := cdc.GetReflectMsgSigners(reflectMsg)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions client/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
Expand All @@ -89,7 +89,7 @@ require (
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.5.3 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-plugin v1.6.1 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
Expand Down Expand Up @@ -154,7 +154,7 @@ require (
golang.org/x/tools v0.21.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
pgregory.net/rapid v1.1.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions client/v2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
Expand Down Expand Up @@ -280,8 +280,8 @@ github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJ
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE=
github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE=
github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A=
github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI=
github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI=
github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
Expand Down Expand Up @@ -652,8 +652,8 @@ google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUE
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo=
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4=
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 h1:AgADTJarZTBqgjiUzRgfaBchgYB3/WFTC80GPwsMcRI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
Expand Down
26 changes: 14 additions & 12 deletions codec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package codec
import (
"github.com/cosmos/gogoproto/proto"
"google.golang.org/grpc/encoding"
protov2 "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"

"github.com/cosmos/cosmos-sdk/codec/types"
)
Expand All @@ -24,17 +24,19 @@ type (
InterfaceRegistry() types.InterfaceRegistry

// GetMsgAnySigners returns the signers of the given message encoded in a protobuf Any
// as well as the decoded google.golang.org/protobuf/proto.Message that was used to
// extract the signers so that this can be used in other contexts.
GetMsgAnySigners(msg *types.Any) ([][]byte, protov2.Message, error)

// GetMsgV2Signers returns the signers of the given message.
GetMsgV2Signers(msg protov2.Message) ([][]byte, error)

// GetMsgV1Signers returns the signers of the given message plus the
// decoded google.golang.org/protobuf/proto.Message that was used to extract the
// signers so that this can be used in other contexts.
GetMsgV1Signers(msg proto.Message) ([][]byte, protov2.Message, error)
// as well as the decoded protoreflect.Message that was used to extract the
// signers so that this can be used in other context where proto reflection
// is needed.
GetMsgAnySigners(msg *types.Any) ([][]byte, protoreflect.Message, error)

// GetMsgSigners returns the signers of the given message plus the
// decoded protoreflect.Message that was used to extract the
// signers so that this can be used in other context where proto reflection
// is needed.
GetMsgSigners(msg proto.Message) ([][]byte, protoreflect.Message, error)

// GetReflectMsgSigners returns the signers of the given reflected proto message.
GetReflectMsgSigners(msg protoreflect.Message) ([][]byte, error)

// mustEmbedCodec requires that all implementations of Codec embed an official implementation from the codec
// package. This allows new methods to be added to the Codec interface without breaking backwards compatibility.
Expand Down
45 changes: 45 additions & 0 deletions codec/depinject.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package codec

import (
"fmt"

"github.com/cosmos/gogoproto/proto"

authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1"
stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1"
"cosmossdk.io/core/address"
"cosmossdk.io/core/legacy"
"cosmossdk.io/depinject"
"cosmossdk.io/x/tx/signing"

addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/codec/types"
)

Expand Down Expand Up @@ -45,3 +51,42 @@ func ProvideLegacyAmino() legacy.Amino {
func ProvideProtoCodec(interfaceRegistry types.InterfaceRegistry) *ProtoCodec {
return NewProtoCodec(interfaceRegistry)
}

type AddressCodecInputs struct {
depinject.In

AuthConfig *authmodulev1.Module `optional:"true"`
StakingConfig *stakingmodulev1.Module `optional:"true"`

AddressCodecFactory func() address.Codec `optional:"true"`
ValidatorAddressCodecFactory func() address.ValidatorAddressCodec `optional:"true"`
ConsensusAddressCodecFactory func() address.ConsensusAddressCodec `optional:"true"`
}

// ProvideAddressCodec provides an address.Codec to the container for any
// modules that want to do address string <> bytes conversion.
func ProvideAddressCodec(in AddressCodecInputs) (address.Codec, address.ValidatorAddressCodec, address.ConsensusAddressCodec) {
if in.AddressCodecFactory != nil && in.ValidatorAddressCodecFactory != nil && in.ConsensusAddressCodecFactory != nil {
return in.AddressCodecFactory(), in.ValidatorAddressCodecFactory(), in.ConsensusAddressCodecFactory()
}

if in.AuthConfig == nil || in.AuthConfig.Bech32Prefix == "" {
panic("auth config bech32 prefix cannot be empty if no custom address codec is provided")
}

if in.StakingConfig == nil {
in.StakingConfig = &stakingmodulev1.Module{}
}

if in.StakingConfig.Bech32PrefixValidator == "" {
in.StakingConfig.Bech32PrefixValidator = fmt.Sprintf("%svaloper", in.AuthConfig.Bech32Prefix)
}

if in.StakingConfig.Bech32PrefixConsensus == "" {
in.StakingConfig.Bech32PrefixConsensus = fmt.Sprintf("%svalcons", in.AuthConfig.Bech32Prefix)
}

return addresscodec.NewBech32Codec(in.AuthConfig.Bech32Prefix),
addresscodec.NewBech32Codec(in.StakingConfig.Bech32PrefixValidator),
addresscodec.NewBech32Codec(in.StakingConfig.Bech32PrefixConsensus)
}
12 changes: 6 additions & 6 deletions codec/proto_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (pc *ProtoCodec) InterfaceRegistry() types.InterfaceRegistry {
return pc.interfaceRegistry
}

func (pc ProtoCodec) GetMsgAnySigners(msg *types.Any) ([][]byte, proto.Message, error) {
func (pc ProtoCodec) GetMsgAnySigners(msg *types.Any) ([][]byte, protoreflect.Message, error) {
msgv2, err := anyutil.Unpack(&anypb.Any{
TypeUrl: msg.TypeUrl,
Value: msg.Value,
Expand All @@ -309,17 +309,17 @@ func (pc ProtoCodec) GetMsgAnySigners(msg *types.Any) ([][]byte, proto.Message,
}

signers, err := pc.interfaceRegistry.SigningContext().GetSigners(msgv2)
return signers, msgv2, err
return signers, msgv2.ProtoReflect(), err
}

func (pc *ProtoCodec) GetMsgV2Signers(msg proto.Message) ([][]byte, error) {
return pc.interfaceRegistry.SigningContext().GetSigners(msg)
func (pc *ProtoCodec) GetReflectMsgSigners(msg protoreflect.Message) ([][]byte, error) {
return pc.interfaceRegistry.SigningContext().GetSigners(msg.Interface())
}

func (pc *ProtoCodec) GetMsgV1Signers(msg gogoproto.Message) ([][]byte, proto.Message, error) {
func (pc *ProtoCodec) GetMsgSigners(msg gogoproto.Message) ([][]byte, protoreflect.Message, error) {
if msgV2, ok := msg.(proto.Message); ok {
signers, err := pc.interfaceRegistry.SigningContext().GetSigners(msgV2)
return signers, msgV2, err
return signers, msgV2.ProtoReflect(), err
}
a, err := types.NewAnyWithValue(msg)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions codec/proto_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ func TestGetSigners(t *testing.T) {
msgSendV1 := &countertypes.MsgIncreaseCounter{Signer: testAddrStr, Count: 1}
msgSendV2 := &counterv1.MsgIncreaseCounter{Signer: testAddrStr, Count: 1}

signers, msgSendV2Copy, err := cdc.GetMsgV1Signers(msgSendV1)
signers, msgSendV2Copy, err := cdc.GetMsgSigners(msgSendV1)
require.NoError(t, err)
require.Equal(t, [][]byte{testAddr}, signers)
require.True(t, protov2.Equal(msgSendV2, msgSendV2Copy))
require.True(t, protov2.Equal(msgSendV2, msgSendV2Copy.Interface()))

signers, err = cdc.GetMsgV2Signers(msgSendV2)
signers, err = cdc.GetReflectMsgSigners(msgSendV2.ProtoReflect())
require.NoError(t, err)
require.Equal(t, [][]byte{testAddr}, signers)

Expand All @@ -205,7 +205,7 @@ func TestGetSigners(t *testing.T) {
signers, msgSendV2Copy, err = cdc.GetMsgAnySigners(msgSendAny)
require.NoError(t, err)
require.Equal(t, [][]byte{testAddr}, signers)
require.True(t, protov2.Equal(msgSendV2, msgSendV2Copy))
require.True(t, protov2.Equal(msgSendV2, msgSendV2Copy.Interface()))
}

type testAddressCodec struct{}
Expand Down
9 changes: 9 additions & 0 deletions core/appmodule/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package appmodule

import (
"context"
"encoding/json"
"io"

"cosmossdk.io/core/appmodule/v2"
Expand Down Expand Up @@ -29,6 +30,14 @@ type HasGenesisAuto interface {
ExportGenesis(context.Context, GenesisTarget) error
}

// HasGenesisBasics is the legacy interface for stateless genesis methods.
type HasGenesisBasics interface {
HasName

DefaultGenesis() json.RawMessage
ValidateGenesis(json.RawMessage) error
}

// GenesisSource is a source for genesis data in JSON format. It may abstract over a
// single JSON object or separate files for each field in a JSON object that can
// be streamed over. Modules should open a separate io.ReadCloser for each field that
Expand Down
12 changes: 12 additions & 0 deletions core/appmodule/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"google.golang.org/grpc"

"cosmossdk.io/core/appmodule/v2"
"cosmossdk.io/core/legacy"
)

// AppModule is a tag interface for app module implementations to use as a basis
Expand Down Expand Up @@ -64,3 +65,14 @@ type HasPrecommit interface {
appmodule.AppModule
Precommit(context.Context) error
}

// HasName is an extension interface that must return the appmodule.AppModule's Name.
type HasName interface {
Name() string
}

// HasAminoCodec is an extension interface that module must implement to support JSON encoding and decoding of its types
// through amino. This is used in genesis & the CLI client.
type HasAminoCodec interface {
RegisterLegacyAminoCodec(legacy.Amino)
}
6 changes: 6 additions & 0 deletions core/appmodule/v2/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ type HasGenesis interface {
InitGenesis(ctx context.Context, data json.RawMessage) error
ExportGenesis(ctx context.Context) (json.RawMessage, error)
}

type HasABCIGenesis interface {
DefaultGenesis() json.RawMessage
InitGenesis(ctx context.Context, data json.RawMessage) ([]ValidatorUpdate, error)
}

type GenesisDecoder interface {
DecodeGenesisJSON(data json.RawMessage) ([]json.RawMessage, error)
}
5 changes: 3 additions & 2 deletions crypto/codec/proto.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package codec

import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"cosmossdk.io/core/registry"

"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
Expand All @@ -10,7 +11,7 @@ import (
)

// RegisterInterfaces registers the sdk.Tx interface.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
func RegisterInterfaces(registry registry.InterfaceRegistrar) {
var pk *cryptotypes.PubKey
registry.RegisterInterface("cosmos.crypto.PubKey", pk)
registry.RegisterImplementations(pk, &ed25519.PubKey{})
Expand Down
5 changes: 3 additions & 2 deletions crypto/keys/secp256r1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (
"crypto/elliptic"
"fmt"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"cosmossdk.io/core/registry"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
)

Expand All @@ -30,6 +31,6 @@ func init() {
}

// RegisterInterfaces adds secp256r1 PubKey to pubkey registry
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
func RegisterInterfaces(registry registry.InterfaceRegistrar) {
registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &PubKey{})
}
Loading

0 comments on commit 8be2ca3

Please sign in to comment.