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

ibc-go v5: cosmos-sdk 46 #1653

Merged
merged 88 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
800d530
begin changes needed for "real 46"
faddat Jul 5, 2022
0f64e06
46 updates
faddat Jul 5, 2022
8867120
46 updates
faddat Jul 5, 2022
30f7946
Delete .gitpod.yml
faddat Jul 5, 2022
0c77eab
46 updates
faddat Jul 5, 2022
1e79e0b
46 updates
faddat Jul 5, 2022
185adee
Update genesis_test.go
faddat Jul 5, 2022
11d96cb
update tests
faddat Jul 5, 2022
bdf7cc3
Merge branch 'real-46-branch' of https://github.com/notional-labs/ibc…
faddat Jul 5, 2022
ab06157
bring back the client client
faddat Jul 5, 2022
6704daf
fumpt
faddat Jul 5, 2022
42c1eac
genesis with val set
vuong177 Jul 5, 2022
78689e1
fix TestRandomizedGenState
nghuyenthevinh2000 Jul 5, 2022
32fa306
Merge branch 'main' into real-46-branch
faddat Jul 5, 2022
e300204
Merge branch 'main' into real-46-branch
faddat Jul 7, 2022
8e4f87e
use cosmos-sdk v0.46.0-rc2
faddat Jul 7, 2022
4b579fa
Merge branch 'main' into real-46-branch
faddat Jul 9, 2022
93cd207
Revert "Merge branch 'main' into real-46-branch"
faddat Jul 14, 2022
11e336c
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 16, 2022
b0b34cf
goimports
faddat Jul 16, 2022
ee64d56
fumpt
faddat Jul 16, 2022
06b8deb
Update testing/simapp/app.go
faddat Jul 19, 2022
8c2c541
Merge branch 'main' into real-46-branch
faddat Jul 19, 2022
df546ed
Update testing/simapp/simd/cmd/genaccounts.go
faddat Jul 19, 2022
eff83e2
make format
faddat Jul 19, 2022
626480f
tidy
faddat Jul 19, 2022
496a7f3
change import path
faddat Jul 19, 2022
d6ee5c9
remove gitpod artifact
faddat Jul 19, 2022
1f290e0
sdk.Int -> math.Int
faddat Jul 19, 2022
cf0997e
group sdk and tendermint imports
faddat Jul 19, 2022
869043d
Organize Governance Proposal Handlers
faddat Jul 19, 2022
802b1bc
Remove Extra line in msgs_test.go
faddat Jul 19, 2022
232cbb6
use test.yml from main branch
faddat Jul 19, 2022
1281e74
fix fee module ibc middleware
faddat Jul 19, 2022
8769f22
remove sdk_test.go and use Carlos' branch's antehandler
faddat Jul 20, 2022
2caf65f
various fixes
faddat Jul 20, 2022
8dc9b01
fix assignment to addr
faddat Jul 20, 2022
9f95dd5
revert change in misbehaviour_handle.go
vuong177 Jul 20, 2022
0c3b31f
Merge branch 'main' into real-46-branch
faddat Jul 20, 2022
6a063fe
e2e go.mod
faddat Jul 20, 2022
21cf683
e2e v4 module path
faddat Jul 20, 2022
55b166b
Merge branch 'main' into real-46-branch
faddat Jul 20, 2022
4bd8fdb
Merge branch 'main' into real-46-branch
faddat Jul 21, 2022
859eae7
Merge branch 'main' into real-46-branch
faddat Jul 21, 2022
374e043
fix import paths
faddat Jul 21, 2022
33be3d6
Merge branch 'main' into real-46-branch
faddat Jul 21, 2022
9441c40
Merge branch 'main' into real-46-branch
faddat Jul 22, 2022
d0ae698
goimports and gofumpt
faddat Jul 22, 2022
eb12e81
Merge branch 'main' into real-46-branch
faddat Jul 22, 2022
8afece8
Merge branch 'main' into real-46-branch
faddat Jul 26, 2022
4951539
Merge branch 'main' into real-46-branch
faddat Jul 26, 2022
2233d7b
46 final release
faddat Jul 26, 2022
a2d6e01
fix makefile
faddat Jul 26, 2022
e09af23
update proto file to v5
vuong177 Jul 26, 2022
0eb3fc0
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 27, 2022
771e422
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 27, 2022
0a11156
temp gitpod for protos
faddat Jul 27, 2022
8f3943d
work on protos
faddat Jul 27, 2022
92061fc
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 27, 2022
a6e2ce3
tidy
faddat Jul 27, 2022
272b708
Delete .gitpod.yml
faddat Jul 27, 2022
6f2e6df
Merge branch 'main' into real-46-branch
faddat Jul 28, 2022
cf43ee0
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 28, 2022
527d656
finish merge
faddat Jul 28, 2022
cbebf62
Merge branch 'main' into real-46-branch
faddat Jul 28, 2022
89e53d2
apply review suggestions, fix imports
colin-axner Jul 28, 2022
76ee58d
remove incorrect e2e import path
colin-axner Jul 28, 2022
2201809
fix incorrect import moving
colin-axner Jul 28, 2022
c4ca865
Merge pull request #75 from cosmos/colin/review-suggestions
faddat Jul 28, 2022
040aca9
Merge branch 'main' into real-46-branch
faddat Jul 28, 2022
acff013
refactor acknowledgement construction for SDK 0.46
crodriguezvega Jul 28, 2022
ad9241a
Merge branch 'main' into real-46-branch
catShaark Jul 28, 2022
e31ec28
Merge pull request #76 from crodriguezvega/carlos/refactor-acknowledg…
faddat Jul 28, 2022
db99001
46 upgrade
faddat Jul 28, 2022
148c020
fix ics27 changes, import fixes
colin-axner Jul 28, 2022
9bc1af7
Merge branch 'main' into real-46-branch
faddat Jul 28, 2022
d0b020b
Merge pull request #77 from cosmos/colin/self-review
faddat Jul 28, 2022
993ce8b
re add ibcclient proposal route
catShaark Jul 28, 2022
f300949
Merge branch 'main' into real-46-branch
catShaark Jul 28, 2022
d36576c
Merge branch 'main' into real-46-branch
catShaark Jul 29, 2022
053141f
fix for make proto-all
crodriguezvega Jul 30, 2022
7728fa1
Merge branch 'main' into real-46-branch
faddat Jul 30, 2022
70ee541
Merge pull request #79 from crodriguezvega/carlos/proto-fix
faddat Jul 30, 2022
d48007f
now both commands work, together!
faddat Jul 30, 2022
08f60a0
tidy
faddat Jul 30, 2022
171a81e
update swagger docs
faddat Aug 1, 2022
d11a462
appease codeql
faddat Aug 1, 2022
9af421e
update CONFIO_URL
faddat Aug 1, 2022
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
Prev Previous commit
Next Next commit
46 updates
  • Loading branch information
faddat committed Jul 5, 2022
commit 0c77eabd429405eab0701943759e569ac569882a
11 changes: 9 additions & 2 deletions modules/apps/27-interchain-accounts/host/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

Expand Down Expand Up @@ -41,7 +42,10 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() {
Description: "tokens for all!",
}

proposal, err := govtypes.NewProposal(testProposal, govtypes.DefaultStartingProposalID, time.Now(), time.Now().Add(time.Hour))
proposalMsg, err := govv1.NewLegacyContent(testProposal, interchainAccountAddr)
suite.Require().NoError(err)

proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, "test proposal", time.Now(), time.Now().Add(time.Hour))
suite.Require().NoError(err)

suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
Expand Down Expand Up @@ -204,7 +208,10 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() {
Description: "tokens for all!",
}

proposal, err := govtypes.NewProposal(testProposal, govtypes.DefaultStartingProposalID, time.Now(), time.Now().Add(time.Hour))
proposalMsg, err := govv1.NewLegacyContent(testProposal, interchainAccountAddr)
suite.Require().NoError(err)

proposal, err := govv1.NewProposal([]sdk.Msg{proposalMsg}, govtypes.DefaultStartingProposalID, "test proposal", time.Now(), time.Now().Add(time.Hour))
suite.Require().NoError(err)

suite.chainB.GetSimApp().GovKeeper.SetProposal(suite.chainB.GetContext(), proposal)
Expand Down
6 changes: 3 additions & 3 deletions modules/apps/29-fee/keeper/escrow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (suite *KeeperTestSuite) TestRefundFeesOnChannelClosure() {
suite.Require().NoError(err)

expEscrowBal = fee.Total()
expRefundBal = expRefundBal.Sub(fee.Total())
expRefundBal = expRefundBal.Sub(fee.Total()...)
}, true,
},
{
Expand Down Expand Up @@ -425,7 +425,7 @@ func (suite *KeeperTestSuite) TestRefundFeesOnChannelClosure() {
expIdentifiedPacketFees = []types.IdentifiedPacketFees{identifiedPacketFees}

expEscrowBal = fee.Total()
expRefundBal = expRefundBal.Sub(fee.Total())
expRefundBal = expRefundBal.Sub(fee.Total()...)
}, true,
},
{
Expand All @@ -446,7 +446,7 @@ func (suite *KeeperTestSuite) TestRefundFeesOnChannelClosure() {
expIdentifiedPacketFees = []types.IdentifiedPacketFees{identifiedPacketFees}

expEscrowBal = fee.Total()
expRefundBal = expRefundBal.Sub(fee.Total())
expRefundBal = expRefundBal.Sub(fee.Total()...)
}, true,
},
}
Expand Down
6 changes: 3 additions & 3 deletions modules/core/legacy/v100/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (suite *LegacyTestSuite) TestMigrateGenesisSolomachine() {
clientCtx := client.Context{}.
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxConfig(encodingConfig.TxConfig).
WithJSONCodec(encodingConfig.Marshaler)
WithCodec(encodingConfig.Marshaler)

// create multiple legacy solo machine clients
solomachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "06-solomachine-0", "testing", 1)
Expand Down Expand Up @@ -155,7 +155,7 @@ func (suite *LegacyTestSuite) TestMigrateGenesisSolomachine() {
ibcGenState := types.DefaultGenesisState()
ibcGenState.ClientGenesis = clientGenState
clientv100.RegisterInterfaces(clientCtx.InterfaceRegistry)
appState[host.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(ibcGenState)
appState[host.ModuleName] = clientCtx.Codec.MustMarshalJSON(ibcGenState)
genDoc := tmtypes.GenesisDoc{
ChainID: suite.chainA.ChainID,
GenesisTime: suite.coordinator.CurrentTime,
Expand All @@ -170,7 +170,7 @@ func (suite *LegacyTestSuite) TestMigrateGenesisSolomachine() {
expectedIBCGenState := types.DefaultGenesisState()
expectedIBCGenState.ClientGenesis = expectedClientGenState

bz, err := clientCtx.JSONCodec.MarshalJSON(expectedIBCGenState)
bz, err := clientCtx.Codec.MarshalJSON(expectedIBCGenState)
suite.Require().NoError(err)
expectedAppState[host.ModuleName] = bz

Expand Down
3 changes: 2 additions & 1 deletion testing/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
Expand Down Expand Up @@ -43,7 +44,7 @@ type TestingApp interface {
AppCodec() codec.Codec

// Implemented by BaseApp
LastCommitID() sdk.CommitID
LastCommitID() storetypes.CommitID
LastBlockHeight() int64
}

Expand Down
6 changes: 3 additions & 3 deletions testing/simapp/ante_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(),
ante.NewRejectExtensionOptionsDecorator(),
ante.NewMempoolFeeDecorator(),
// ante.NewExtensionOptionsDecorator(),
// ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
Expand Down
56 changes: 35 additions & 21 deletions testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
Expand All @@ -58,8 +59,11 @@ import (
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
Expand Down Expand Up @@ -93,15 +97,11 @@ import (
ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
ibcmock "github.com/cosmos/ibc-go/v4/testing/mock"
simappparams "github.com/cosmos/ibc-go/v4/testing/simapp/params"
storetypes "github.com/cosmos/cosmos-sdk/store/types"

authz "github.com/cosmos/cosmos-sdk/x/authz"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
Expand Down Expand Up @@ -134,8 +134,7 @@ var (
mint.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler,
[]govclient.ProposalHandler{paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler},
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
Expand Down Expand Up @@ -282,7 +281,7 @@ func NewSimApp(
app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])

// set the BaseApp's parameter store
bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()))
bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()))

// add capability keeper and ScopeToModule for ibc module
app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey])
Expand All @@ -303,7 +302,7 @@ func NewSimApp(
// SDK module keepers

app.AccountKeeper = authkeeper.NewAccountKeeper(
appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms,
appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, sdk.Bech32MainPrefix,
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show resolved Hide resolved
)
app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(),
Expand All @@ -317,7 +316,7 @@ func NewSimApp(
)
app.DistrKeeper = distrkeeper.NewKeeper(
appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
&stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(),
&stakingKeeper, authtypes.FeeCollectorName,
)
app.SlashingKeeper = slashingkeeper.NewKeeper(
appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName),
Expand All @@ -327,15 +326,15 @@ func NewSimApp(
)

app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper)
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp)
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String())

// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
app.StakingKeeper = *stakingKeeper.SetHooks(
stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()),
)

app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter())
app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper)

// IBC Keepers

Expand All @@ -344,15 +343,25 @@ func NewSimApp(
)

// register the proposal types
govRouter := govtypes.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
govRouter := govv1beta1.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))
faddat marked this conversation as resolved.
Show resolved Hide resolved
app.GovKeeper = govkeeper.NewKeeper(
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper))
govConfig := govtypes.DefaultConfig()
/*
Example of setting gov params:
govConfig.MaxMetadataLen = 10000
*/
govKeeper := govkeeper.NewKeeper(
appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
&stakingKeeper, govRouter,
&stakingKeeper, govRouter, app.MsgServiceRouter(), govConfig,
)

app.GovKeeper = *govKeeper.SetHooks(
govtypes.NewMultiGovHooks(
// register the governance hooks
),
)

// IBC Fee Module keeper
Expand Down Expand Up @@ -496,7 +505,7 @@ func NewSimApp(
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants),
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
Expand Down Expand Up @@ -780,7 +789,12 @@ func (app *SimApp) RegisterTxService(clientCtx client.Context) {

// RegisterTendermintService implements the Application.RegisterTendermintService method.
func (app *SimApp) RegisterTendermintService(clientCtx client.Context) {
tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry)
tmservice.RegisterTendermintService(
clientCtx,
app.BaseApp.GRPCQueryRouter(),
app.interfaceRegistry,
app.Query,
)
}

// RegisterSwaggerAPI registers swagger route with API Server
Expand Down Expand Up @@ -813,7 +827,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable())
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable())
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
Expand Down
28 changes: 24 additions & 4 deletions testing/simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"os"
"path/filepath"

tmcfg "github.com/tendermint/tendermint/config"

faddat marked this conversation as resolved.
Show resolved Hide resolved
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
Expand All @@ -17,6 +19,7 @@ import (
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/snapshots"
snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
Expand Down Expand Up @@ -71,8 +74,10 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
}

customAppTemplate, customAppConfig := initAppConfig()
customTMConfig := initTendermintConfig()

return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customTMConfig)

return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig)
},
}

Expand All @@ -81,6 +86,18 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
return rootCmd, encodingConfig
}

// initTendermintConfig helps to override default Tendermint Config values.
// return tmcfg.DefaultConfig if no custom configuration is required for the application.
func initTendermintConfig() *tmcfg.Config {
cfg := tmcfg.DefaultConfig()

// these values put a higher strain on node memory
// cfg.P2P.MaxNumInboundPeers = 100
// cfg.P2P.MaxNumOutboundPeers = 40

return cfg
}

// initAppConfig helps to override default appConfig template and configs.
// return "", nil if no custom configuration is required for the application.
func initAppConfig() (string, interface{}) {
Expand Down Expand Up @@ -255,6 +272,11 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a
panic(err)
}

snapshotOptions := snapshottypes.NewSnapshotOptions(
cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)),
cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)),
)

return simapp.NewSimApp(
logger, db, traceStore, true, skipUpgradeHeights,
cast.ToString(appOpts.Get(flags.FlagHome)),
Expand All @@ -269,9 +291,7 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a
baseapp.SetInterBlockCache(cache),
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))),
baseapp.SetSnapshotStore(snapshotStore),
baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval))),
baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent))),
baseapp.SetSnapshot(snapshotStore, snapshotOptions),
)
}

Expand Down
2 changes: 1 addition & 1 deletion testing/simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func SignAndDeliver(
require.NoError(t, err)

// Simulate a sending a transaction
gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx)
gInfo, res, err := app.SimDeliver(txCfg.TxEncoder(), tx)

if expPass {
require.NoError(t, err)
Expand Down