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

refactor!: deprecate sdk.Msg.GetSigners #15284

Merged
merged 111 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from 108 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
ea8ed7e
refactor!: deprecate sdk.Msg.GetSigners
aaronc Mar 6, 2023
e45bc3e
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Mar 6, 2023
20615e7
reduce scope
aaronc Mar 6, 2023
f303a94
reduce scope
aaronc Mar 6, 2023
dae1e0b
WIP
aaronc Mar 6, 2023
4ee2bd2
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Mar 7, 2023
5f78ad0
refactoring
aaronc Mar 7, 2023
d3aa37c
refactoring
aaronc Mar 7, 2023
924c22d
refactoring
aaronc Mar 7, 2023
7828f38
refactoring
aaronc Mar 7, 2023
a1d35d2
tests compile
aaronc Mar 7, 2023
46d9580
interface registry serves proto files
aaronc Mar 7, 2023
ec48afd
WIP on moving to codec
aaronc Mar 7, 2023
43eab5f
refactor to codec-based API
aaronc Mar 7, 2023
e634695
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Mar 7, 2023
c262872
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Mar 13, 2023
a63d8b5
WIP update to anyutil
aaronc Mar 13, 2023
a33c098
WIP
aaronc Mar 13, 2023
a9d12bc
building
aaronc Mar 13, 2023
4c3e334
start removing GetSigners
aaronc Mar 13, 2023
d86f868
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Mar 15, 2023
5474a26
Revert "start removing GetSigners"
aaronc Mar 15, 2023
65050eb
fix
aaronc Mar 15, 2023
9541220
update CHANGELOG.md and remove some breakage
aaronc Mar 15, 2023
aa21cea
update CHANGELOG.md and update some breakage
aaronc Mar 15, 2023
c67dace
update runtime module
aaronc Mar 15, 2023
4b5de9e
updates
aaronc Mar 15, 2023
4d412da
fix
aaronc Mar 15, 2023
6c4cb00
test fix
aaronc Mar 15, 2023
8ac184a
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Mar 15, 2023
161ab16
update x/tx dep
aaronc Mar 15, 2023
1d0cabe
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Mar 28, 2023
840e106
update runtime
aaronc Mar 28, 2023
20e97d7
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Mar 28, 2023
1c91539
WIP
aaronc Mar 28, 2023
20d581d
WIP
aaronc Mar 28, 2023
c0ee235
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Mar 29, 2023
82ba59e
update x/tx
aaronc Mar 29, 2023
b124bd6
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Apr 3, 2023
e5b17aa
WIP on bug fixes
aaronc Apr 3, 2023
ad6af68
refactor sdk.AccAddress usages to string
aaronc Apr 3, 2023
b618ad4
refactor MsgCreateValidator.validator_address to use account address
aaronc Apr 3, 2023
843f04f
test fixes
aaronc Apr 3, 2023
4255b82
migrate MsgUnjail to use account bech32
aaronc Apr 3, 2023
1453302
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Apr 12, 2023
1b8cfe2
WIP on refactoring
aaronc Apr 12, 2023
ffbcb80
WIP on refactoring
aaronc Apr 12, 2023
46a5f38
refactor codec & interface registry
aaronc Apr 13, 2023
975cba0
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Apr 13, 2023
0c7fb0b
revert staking and slashing changes
aaronc Apr 13, 2023
11c37bd
building
aaronc Apr 17, 2023
5d8e489
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc Apr 18, 2023
edce178
revert
aaronc Apr 18, 2023
074e25e
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 1, 2023
c8de238
fixes
aaronc May 1, 2023
3160c6d
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 3, 2023
2415235
add codec testutil
aaronc May 3, 2023
b8e7e96
test fixes
aaronc May 3, 2023
6452dc0
fix test
aaronc May 3, 2023
b17adc2
test fixes
aaronc May 3, 2023
70c1a85
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 3, 2023
5e45f37
test fixes
aaronc May 3, 2023
2c038a9
test fixes
aaronc May 3, 2023
59dddfe
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 4, 2023
3bb3a14
fixes
aaronc May 4, 2023
641457c
fixes
aaronc May 4, 2023
50a6ec1
fixes
aaronc May 4, 2023
00205a5
fixes
aaronc May 4, 2023
15ff7e9
fix rosetta
aaronc May 4, 2023
d7781cd
Merge branch 'main' into aaronc/11275-deprecate-get-signers-2
aaronc May 4, 2023
f2bbf36
fixes
aaronc May 4, 2023
227a0a6
test fixes
aaronc May 4, 2023
0a216cc
make ante.HandlerOptions.SigningContext optional
aaronc May 4, 2023
5822abc
update CHANGELOG.md
aaronc May 4, 2023
53d93e8
return errors
aaronc May 4, 2023
9d69fa5
don't panic
aaronc May 4, 2023
0459d10
fixes
aaronc May 4, 2023
0b9432c
lint
aaronc May 4, 2023
9fe7984
lint
aaronc May 4, 2023
3ad191b
lint
aaronc May 4, 2023
8bf26db
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 8, 2023
195349e
Update baseapp/baseapp.go
aaronc May 9, 2023
cdc0d9c
address review comments
aaronc May 9, 2023
81faf2b
address review comments
aaronc May 9, 2023
2633439
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 11, 2023
136811a
add `AccountKeeper.AddressCodec()` method
aaronc May 11, 2023
e2d668a
fix tests
aaronc May 11, 2023
8c22d9a
add benchmark
aaronc May 16, 2023
9d16ef2
add dynamicpb bench
aaronc May 16, 2023
d01b0e8
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 16, 2023
e033c04
fix simapp tests (#16185)
kocubinski May 16, 2023
077e202
address review comments
aaronc May 16, 2023
7624c4e
Merge remote-tracking branch 'origin/aaronc/11275-deprecate-get-signe…
aaronc May 16, 2023
2002843
fix comment in linter
kocubinski May 17, 2023
a13f253
Register Tx with HasMsg interface
kocubinski May 17, 2023
04f8c52
Fix some e2e tests
kocubinski May 17, 2023
a3527c8
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 23, 2023
8538e0e
fix
aaronc May 24, 2023
ece6e65
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 24, 2023
72ccc72
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 24, 2023
5040e7e
fix test
aaronc May 24, 2023
4b8d176
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 24, 2023
d37b395
fix rosetta, simplify runtime
aaronc May 24, 2023
9b6be9f
fix amino
aaronc May 24, 2023
343c3ca
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 24, 2023
9b1be48
fix test
aaronc May 24, 2023
7c2b7cc
check error
aaronc May 24, 2023
bd63b84
fix acc_seq event
aaronc May 24, 2023
ddf4e73
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/11275…
aaronc May 25, 2023
b41ab3f
use address.Bech32Codec in simapp
aaronc May 25, 2023
85129fd
address review comment
aaronc May 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ Ref: https://keepachangelog.com/en/1.0.0/
* The field `OperationMsg.Msg` is now of type `[]byte` instead of `json.RawMessage`.
* (cli) [#16209](https://github.com/cosmos/cosmos-sdk/pull/16209) Add API `StartCmdWithOptions` to create customized start command.
* (x/distribution) [#16211](https://github.com/cosmos/cosmos-sdk/pull/16211) Use collections for params state management.
* [#15284](https://github.com/cosmos/cosmos-sdk/pull/15284)
* `sdk.Msg.GetSigners` was deprecated and is no longer supported. Use the `cosmos.msg.v1.signer` protobuf annotation instead.
aaronc marked this conversation as resolved.
Show resolved Hide resolved
* `sdk.Tx` now requires a new method `GetMsgsV2()`.
* `types/tx.Tx` no longer implements `sdk.Tx`.
* `TxConfig` has a new method `SigningContext() *signing.Context`.
* `AccountKeeper` now has an `AddressCodec() address.Codec` method and the expected `AccountKeeper` for `x/auth/ante` expects this method.
* `SigVerifiableTx.GetSigners()` now returns `([][]byte, error)` instead of `[]sdk.AccAddress`.
* (x/authx) [#15284](https://github.com/cosmos/cosmos-sdk/pull/15284) `NewKeeper` now requires `codec.Codec`.
* (x/gov) [#15284](https://github.com/cosmos/cosmos-sdk/pull/15284) `NewKeeper` now requires `codec.Codec`.

### Client Breaking Changes

Expand Down
25 changes: 16 additions & 9 deletions baseapp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ import (

errorsmod "cosmossdk.io/errors"
"cosmossdk.io/log"
pruningtypes "cosmossdk.io/store/pruning/types"
"cosmossdk.io/store/snapshots"
snapshottypes "cosmossdk.io/store/snapshots/types"
storetypes "cosmossdk.io/store/types"

abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/gogoproto/jsonpb"
"github.com/stretchr/testify/require"

pruningtypes "cosmossdk.io/store/pruning/types"
"cosmossdk.io/store/snapshots"
snapshottypes "cosmossdk.io/store/snapshots/types"
storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/baseapp"
baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil"
"github.com/cosmos/cosmos-sdk/testutil"
Expand Down Expand Up @@ -455,8 +457,9 @@ func TestABCI_FinalizeBlock_MultiMsg(t *testing.T) {

builder := suite.txConfig.NewTxBuilder()
msgs := tx.GetMsgs()
msgs = append(msgs, &baseapptestutil.MsgCounter2{Counter: 0})
msgs = append(msgs, &baseapptestutil.MsgCounter2{Counter: 1})
_, _, addr := testdata.KeyTestPubAddr()
msgs = append(msgs, &baseapptestutil.MsgCounter2{Counter: 0, Signer: addr.String()})
msgs = append(msgs, &baseapptestutil.MsgCounter2{Counter: 1, Signer: addr.String()})

builder.SetMsgs(msgs...)
builder.SetMemo(tx.GetMemo())
Expand Down Expand Up @@ -611,7 +614,8 @@ func TestABCI_InvalidTransaction(t *testing.T) {
// transaction with no known route
{
txBuilder := suite.txConfig.NewTxBuilder()
txBuilder.SetMsgs(&baseapptestutil.MsgCounter2{})
_, _, addr := testdata.KeyTestPubAddr()
txBuilder.SetMsgs(&baseapptestutil.MsgCounter2{Signer: addr.String()})
setTxSignature(t, txBuilder, 0)
unknownRouteTx := txBuilder.GetTx()

Expand All @@ -624,7 +628,10 @@ func TestABCI_InvalidTransaction(t *testing.T) {
require.EqualValues(t, sdkerrors.ErrUnknownRequest.ABCICode(), code, err)

txBuilder = suite.txConfig.NewTxBuilder()
txBuilder.SetMsgs(&baseapptestutil.MsgCounter{}, &baseapptestutil.MsgCounter2{})
txBuilder.SetMsgs(
&baseapptestutil.MsgCounter{Signer: addr.String()},
&baseapptestutil.MsgCounter2{Signer: addr.String()},
)
setTxSignature(t, txBuilder, 0)
unknownRouteTx = txBuilder.GetTx()

Expand Down Expand Up @@ -1247,7 +1254,7 @@ func TestABCI_PrepareProposal_ReachedMaxBytes(t *testing.T) {
}
resPrepareProposal, err := suite.baseApp.PrepareProposal(&reqPrepareProposal)
require.NoError(t, err)
require.Equal(t, 11, len(resPrepareProposal.Txs))
require.Equal(t, 8, len(resPrepareProposal.Txs))
aaronc marked this conversation as resolved.
Show resolved Hide resolved
}

func TestABCI_PrepareProposal_BadEncoding(t *testing.T) {
Expand Down
42 changes: 31 additions & 11 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ import (

errorsmod "cosmossdk.io/errors"
"cosmossdk.io/log"
"cosmossdk.io/store"
storemetrics "cosmossdk.io/store/metrics"
"cosmossdk.io/store/snapshots"
storetypes "cosmossdk.io/store/types"
"github.com/cockroachdb/errors"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/crypto/tmhash"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/gogoproto/proto"
"golang.org/x/exp/maps"
protov2 "google.golang.org/protobuf/proto"

"cosmossdk.io/store"
storemetrics "cosmossdk.io/store/metrics"
"cosmossdk.io/store/snapshots"
storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/telemetry"
Expand Down Expand Up @@ -174,6 +177,8 @@ type BaseApp struct {
streamingManager storetypes.StreamingManager

chainID string

cdc codec.Codec
}

// NewBaseApp returns a reference to an initialized BaseApp. It accepts a
Expand Down Expand Up @@ -222,6 +227,10 @@ func NewBaseApp(

app.runTxRecoveryMiddleware = newDefaultRecoveryMiddleware()

// Initialize with an empty interface registry to avoid nil pointer dereference.
// Unless SetInterfaceRegistry is called with an interface registry with proper address codecs base app will panic.
app.cdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
aaronc marked this conversation as resolved.
Show resolved Hide resolved

return app
}

Expand Down Expand Up @@ -633,7 +642,7 @@ func (app *BaseApp) getContextForTx(mode execMode, txBytes []byte) sdk.Context {
}
ctx := modeState.ctx.
WithTxBytes(txBytes)
// WithVoteInfos(app.voteInfos) // TODO: identify if this is needed
// WithVoteInfos(app.voteInfos) // TODO: identify if this is needed

ctx = ctx.WithConsensusParams(app.GetConsensusParams(ctx))

Expand Down Expand Up @@ -881,7 +890,10 @@ 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.
result, err = app.runMsgs(runMsgCtx, msgs, mode)
msgsV2, err := tx.GetMsgsV2()
if err == nil {
result, err = app.runMsgs(runMsgCtx, msgs, msgsV2, mode)
}
if err == nil {
// Run optional postHandlers.
//
Expand Down Expand Up @@ -921,7 +933,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, mode execMode) (*sdk.Result, error) {
func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, msgsV2 []protov2.Message, mode execMode) (*sdk.Result, error) {
events := sdk.EmptyEvents()
var msgResponses []*codectypes.Any

Expand All @@ -943,7 +955,7 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode execMode) (*sd
}

// create message events
msgEvents := createEvents(msgResult.GetEvents(), msg)
msgEvents := createEvents(app.cdc, msgResult.GetEvents(), msg, msgsV2[i])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we compare the two lengths of msgs and msgsV2 for preventing an out of bound?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, but could we also document that part of the contract of the methods creating msgsV2 is that it has the same length as msgs?


// append message events and data
//
Expand Down Expand Up @@ -988,13 +1000,21 @@ func makeABCIData(msgResponses []*codectypes.Any) ([]byte, error) {
return proto.Marshal(&sdk.TxMsgData{MsgResponses: msgResponses})
}

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

// we set the signer attribute as the sender
if len(msg.GetSigners()) > 0 && !msg.GetSigners()[0].Empty() {
msgEvent = msgEvent.AppendAttributes(sdk.NewAttribute(sdk.AttributeKeySender, msg.GetSigners()[0].String()))
signers, err := cdc.GetMsgV2Signers(msgV2)
if err != nil {
panic(err)
}
if len(signers) > 0 && signers[0] != nil {
addrStr, err := cdc.InterfaceRegistry().SigningContext().AddressCodec().BytesToString(signers[0])
Copy link
Member

@kocubinski kocubinski May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It seems kind of odd that address codecs are buried in interfaceRegistry.SigningContext.AddressCodec as they have use outside of signing. Not sure what the alternative here is though besides refactoring codec.Codec, so no action needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do some embedding maybe so that the call is not so long

if err != nil {
panic(err)
}
msgEvent = msgEvent.AppendAttributes(sdk.NewAttribute(sdk.AttributeKeySender, addrStr))
}

// verify that events have no module attribute set
Expand Down
17 changes: 10 additions & 7 deletions baseapp/baseapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@ import (

errorsmod "cosmossdk.io/errors"
"cosmossdk.io/log"
abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/stretchr/testify/require"

"cosmossdk.io/store/metrics"
pruningtypes "cosmossdk.io/store/pruning/types"
"cosmossdk.io/store/rootmulti"
"cosmossdk.io/store/snapshots"
snapshottypes "cosmossdk.io/store/snapshots/types"
storetypes "cosmossdk.io/store/types"
abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/baseapp"
baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
)
Expand Down Expand Up @@ -56,7 +58,7 @@ type (
)

func NewBaseAppSuite(t *testing.T, opts ...func(*baseapp.BaseApp)) *BaseAppSuite {
cdc := codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
cdc := codectestutil.CodecOptions{}.NewCodec()
baseapptestutil.RegisterInterfaces(cdc.InterfaceRegistry())

txConfig := authtx.NewTxConfig(cdc, authtx.DefaultSignModes)
Expand Down Expand Up @@ -107,6 +109,7 @@ func NewBaseAppSuiteWithSnapshots(t *testing.T, cfg SnapshotsConfig, opts ...fun

for height := int64(1); height <= int64(cfg.blocks); height++ {

_, _, addr := testdata.KeyTestPubAddr()
txs := [][]byte{}
for txNum := 0; txNum < cfg.blockTxs; txNum++ {
msgs := []sdk.Msg{}
Expand All @@ -117,7 +120,7 @@ func NewBaseAppSuiteWithSnapshots(t *testing.T, cfg SnapshotsConfig, opts ...fun
_, err := r.Read(value)
require.NoError(t, err)

msgs = append(msgs, &baseapptestutil.MsgKeyValue{Key: key, Value: value})
msgs = append(msgs, &baseapptestutil.MsgKeyValue{Key: key, Value: value, Signer: addr.String()})
keyCounter++
}

Expand Down
9 changes: 7 additions & 2 deletions baseapp/msg_service_router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,14 @@ func TestMsgService(t *testing.T) {
app.MsgServiceRouter(),
testdata.MsgServerImpl{},
)
app.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1})
_, err = app.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1})
require.NoError(t, err)

msg := testdata.MsgCreateDog{Dog: &testdata.Dog{Name: "Spot"}}
_, _, addr := testdata.KeyTestPubAddr()
msg := testdata.MsgCreateDog{
Dog: &testdata.Dog{Name: "Spot"},
Owner: addr.String(),
}

txBuilder := txConfig.NewTxBuilder()
txBuilder.SetFeeAmount(testdata.NewTestFeeAmount())
Expand Down
2 changes: 2 additions & 0 deletions baseapp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
storetypes "cosmossdk.io/store/types"
dbm "github.com/cosmos/cosmos-db"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/mempool"
Expand Down Expand Up @@ -256,6 +257,7 @@ func (app *BaseApp) SetInterfaceRegistry(registry types.InterfaceRegistry) {
app.interfaceRegistry = registry
app.grpcQueryRouter.SetInterfaceRegistry(registry)
app.msgServiceRouter.SetInterfaceRegistry(registry)
app.cdc = codec.NewProtoCodec(registry)
}

// SetTxDecoder sets the TxDecoder if it wasn't provided in the BaseApp constructor.
Expand Down
Loading