diff --git a/go.mod b/go.mod index c961f1f5e54..7f5ca4ebfb8 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.1-0.20240815194237-858ec2fcb897 + cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 @@ -20,6 +21,7 @@ require ( cosmossdk.io/x/group v0.0.0-00010101000000-000000000000 cosmossdk.io/x/mint v0.0.0-20240906090851-36d9b25e8981 cosmossdk.io/x/params v0.0.0-00010101000000-000000000000 + cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 cosmossdk.io/x/slashing v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.13.4 @@ -54,10 +56,12 @@ require ( cloud.google.com/go/iam v1.1.9 // indirect cloud.google.com/go/storage v1.42.0 // indirect cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab // indirect + cosmossdk.io/core/testing v0.0.0-20240906090851-36d9b25e8981 // indirect cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/schema v0.2.0 // indirect + cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 // indirect + cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 // indirect - cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -217,18 +221,28 @@ require ( replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 +replace github.com/cosmos/ibc-go/modules/capability => ./modules/capability //TODO: remove after capability is tagged + //TODO: remove everything below after tags are created replace ( cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main cosmossdk.io/client/v2 => cosmossdk.io/client/v2 v2.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240906083041-6033330182c7 // main cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main + cosmossdk.io/x/accounts => cosmossdk.io/x/accounts v0.0.0-20240905174638-8ce77cbb2450 + cosmossdk.io/x/accounts/defaults/lockup => cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240905174638-8ce77cbb2450 + cosmossdk.io/x/accounts/defaults/multisig => cosmossdk.io/x/accounts/defaults/multisig v0.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/x/authz => cosmossdk.io/x/authz v0.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/x/bank => cosmossdk.io/x/bank v0.0.0-20240905174638-8ce77cbb2450 + cosmossdk.io/x/circuit => cosmossdk.io/x/circuit v0.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/x/consensus => cosmossdk.io/x/consensus v0.0.0-20240905174638-8ce77cbb2450 + cosmossdk.io/x/evidence => cosmossdk.io/x/evidence v0.0.0-20240905174638-8ce77cbb2450 + cosmossdk.io/x/feegrant => cosmossdk.io/x/feegrant v0.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/x/gov => cosmossdk.io/x/gov v0.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/x/group => cosmossdk.io/x/group v0.0.0-20240905174638-8ce77cbb2450 + cosmossdk.io/x/mint => cosmossdk.io/x/mint v0.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/x/params => cosmossdk.io/x/params v0.0.0-20240905174638-8ce77cbb2450 + cosmossdk.io/x/protocolpool => cosmossdk.io/x/protocolpool v0.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/x/slashing => cosmossdk.io/x/slashing v0.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/x/staking => cosmossdk.io/x/staking v0.0.0-20240905174638-8ce77cbb2450 cosmossdk.io/x/tx => cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897 // main @@ -236,5 +250,5 @@ replace ( github.com/cometbft/cometbft => github.com/cometbft/cometbft v1.0.0-rc1 // pseudo version lower than the latest tag github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.52.0-alpha.1.0.20240905174638-8ce77cbb2450 - github.com/cosmos/ibc-go/modules/capability => ./modules/capability //TODO: remove after capability is tagged + github.com/decred/dcrd/dcrec/secp256k1/v4 => github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 ) diff --git a/go.sum b/go.sum index 0237399cdd5..b4fea18efb3 100644 --- a/go.sum +++ b/go.sum @@ -214,6 +214,12 @@ cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 h1:o024zaPHYtmUGL2BCX1ns9rfZmMc19U4hQ2CAPt2Xgg= cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897/go.mod h1:Ma4uny4RFegWTbU71fBmkSIoHrWHlLC/JwwgWgehZm4= +cosmossdk.io/x/accounts v0.0.0-20240905174638-8ce77cbb2450 h1:o3Bxw575J9xxPO9K0Dwu2YD7pyNmiRl3Bo8GB/GOsds= +cosmossdk.io/x/accounts v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:b6Hy5/JhCrfLeG07s9pOYkAxfq77E+MtACF86cgbcOQ= +cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240905174638-8ce77cbb2450 h1:sCmeisq+2MOXVX3ui4Xsau8fqq5WLrbPF+mas3+J5D4= +cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:+JMkw+jQZwgBxoP0jABxXAwFF27ghmmJBdPoFSj+0tk= +cosmossdk.io/x/accounts/defaults/multisig v0.0.0-20240905174638-8ce77cbb2450 h1:ViFFe92d4+XgTdSGqfSJAs21bG8YmlxBrXuvwaLgHro= +cosmossdk.io/x/accounts/defaults/multisig v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:btniDT7XoWHk/yzsQ09XNk9CZvIQsvMqLiT2UAgAP0U= cosmossdk.io/x/authz v0.0.0-20240905174638-8ce77cbb2450 h1:dIvjFGZiu+yOAdY0ru9BWuh3S9DTBXuTqdthjoZQJQ0= cosmossdk.io/x/authz v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:BL2cp28qWDibgmHgjClot6q8kSZEClSS4IOQtt9Tn9E= cosmossdk.io/x/bank v0.0.0-20240905174638-8ce77cbb2450 h1:7L3wLk36pJc9fEXzSj7MDoayUqTJyyEAqj5W3Ua4TAI= @@ -228,12 +234,12 @@ cosmossdk.io/x/gov v0.0.0-20240905174638-8ce77cbb2450 h1:4qpruZEf5JgMPmdQr2neXsc cosmossdk.io/x/gov v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:vxdu3r1+keQ0zugjZYwoaa0IcRscfqM/XQ8mw/MwFGc= cosmossdk.io/x/group v0.0.0-20240905174638-8ce77cbb2450 h1:6UP+BMaQIf12+Zdm50nHJzBd47Ue9pq+CvTRIhOM4q0= cosmossdk.io/x/group v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:SPQg4DfFURVX3xOLzOWzv30vxUj8mf5Ehm0OagfdMN8= -cosmossdk.io/x/mint v0.0.0-20240906090851-36d9b25e8981 h1:Vi6lYTUGUJ6wEUjGBNB9vwPXRBJU1LBULcMu0kvBnMI= -cosmossdk.io/x/mint v0.0.0-20240906090851-36d9b25e8981/go.mod h1:bh+3b2VLceLoi2QCxDkV6BHGmevg6GdNxkDcdjA0j3Y= +cosmossdk.io/x/mint v0.0.0-20240905174638-8ce77cbb2450 h1:v3zIaCX8qskFcMPvaAR5LCApI3B6s0cE1yv3SPp8Bx4= +cosmossdk.io/x/mint v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:Wkjv4vrA5xjk8dXEy/L6U4pCd433yVDInYJ7VY3RqKM= cosmossdk.io/x/params v0.0.0-20240905174638-8ce77cbb2450 h1:8LThIewMzM3xM7/iQv/LOO4hrC6Hg7yohFeCaLALeg4= cosmossdk.io/x/params v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:Zj4HqEipshPgZxUlCnUtQHJN/vIpzkqjmvi6V6iO13Y= -cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 h1:XQJj9Dv9Gtze0l2TF79BU5lkP6MkUveTUuKICmxoz+o= -cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190/go.mod h1:7WUGupOvmlHJoIMBz1JbObQxeo6/TDiuDBxmtod8HRg= +cosmossdk.io/x/protocolpool v0.0.0-20240905174638-8ce77cbb2450 h1:gxoZy8PwJQOy7PZ8pKOh9si3oWd36YRIM9oOy94vxvE= +cosmossdk.io/x/protocolpool v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:tNWmnHYYkHWJzZLlqq+mVbhThohAqEuF97GaL9xusIg= cosmossdk.io/x/slashing v0.0.0-20240905174638-8ce77cbb2450 h1:padUT7OMCH3gekVGhdAwisgDjF3aXM2W3aLWmTjSFn8= cosmossdk.io/x/slashing v0.0.0-20240905174638-8ce77cbb2450/go.mod h1:R51bRE6znRn4FQKf6Fwx1Ceddt7SZ3ERQ0P3T+3LqOY= cosmossdk.io/x/staking v0.0.0-20240905174638-8ce77cbb2450 h1:F0ivlDxBL/6dpBp7I/c9VeN9EN+OgGF2352KIQXZi48= @@ -379,10 +385,10 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= -github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs= github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak= github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index fb87dde0a73..f2aa34984e8 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -151,7 +151,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() { icaHostAccount := icatypes.GenerateAddress(suite.chainB.GetContext(), path.EndpointB.ConnectionID, path.EndpointA.ChannelConfig.PortID) err := suite.chainB.GetSimApp().BankKeeper.SendCoins(suite.chainB.GetContext(), suite.chainB.SenderAccount.GetAddress(), icaHostAccount, sdk.Coins{sdk.NewCoin("stake", sdkmath.NewInt(1))}) suite.Require().NoError(err) - suite.Require().True(suite.chainB.GetSimApp().AccountKeeper.HasAccount(suite.chainB.GetContext(), icaHostAccount)) + suite.Require().True(suite.chainB.GetSimApp().AuthKeeper.HasAccount(suite.chainB.GetContext(), icaHostAccount)) // ensure account registration is simulated in a separate block suite.chainB.NextBlock() diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go index 53279b724a0..2a8d6f1d58a 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go @@ -141,8 +141,8 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { addr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), path.EndpointB.ConnectionID, path.EndpointA.ChannelConfig.PortID) suite.Require().True(found) - acc := suite.chainB.GetSimApp().AccountKeeper.GetAccount(suite.chainB.GetContext(), sdk.MustAccAddressFromBech32(addr)) - suite.chainB.GetSimApp().AccountKeeper.RemoveAccount(suite.chainB.GetContext(), acc) + acc := suite.chainB.GetSimApp().AuthKeeper.GetAccount(suite.chainB.GetContext(), sdk.MustAccAddressFromBech32(addr)) + suite.chainB.GetSimApp().AuthKeeper.RemoveAccount(suite.chainB.GetContext(), acc) }, icatypes.ErrInvalidAccountReopening, }, @@ -159,13 +159,13 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { suite.Require().True(found) accAddress := sdk.MustAccAddressFromBech32(addr) - acc := suite.chainB.GetSimApp().AccountKeeper.GetAccount(suite.chainB.GetContext(), accAddress) + acc := suite.chainB.GetSimApp().AuthKeeper.GetAccount(suite.chainB.GetContext(), accAddress) icaAcc, ok := acc.(*icatypes.InterchainAccount) suite.Require().True(ok) // overwrite existing account with only base account type, not intercahin account type - suite.chainB.GetSimApp().AccountKeeper.SetAccount(suite.chainB.GetContext(), icaAcc.BaseAccount) + suite.chainB.GetSimApp().AuthKeeper.SetAccount(suite.chainB.GetContext(), icaAcc.BaseAccount) }, icatypes.ErrInvalidAccountReopening, }, @@ -175,7 +175,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), path.EndpointB.ConnectionID, path.EndpointA.ChannelConfig.PortID) err := suite.chainB.GetSimApp().BankKeeper.SendCoins(suite.chainB.GetContext(), suite.chainB.SenderAccount.GetAddress(), interchainAccAddr, sdk.Coins{sdk.NewCoin("stake", sdkmath.NewInt(1))}) suite.Require().NoError(err) - suite.Require().True(suite.chainB.GetSimApp().AccountKeeper.HasAccount(suite.chainB.GetContext(), interchainAccAddr)) + suite.Require().True(suite.chainB.GetSimApp().AuthKeeper.HasAccount(suite.chainB.GetContext(), interchainAccAddr)) }, icatypes.ErrAccountAlreadyExist, }, @@ -321,7 +321,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() { suite.Require().NoError(err) // Check if account is created - interchainAccount := suite.chainB.GetSimApp().AccountKeeper.GetAccount(suite.chainB.GetContext(), interchainAccAddr) + interchainAccount := suite.chainB.GetSimApp().AuthKeeper.GetAccount(suite.chainB.GetContext(), interchainAccAddr) suite.Require().Equal(interchainAccount.GetAddress().String(), storedAddr) expectedMetadata.Address = storedAddr diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go index 4a4e000bfd5..eb943ffe5f0 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go @@ -147,7 +147,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().AccountKeeper, + suite.chainA.GetSimApp().AuthKeeper, suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), @@ -177,7 +177,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().AccountKeeper, + suite.chainA.GetSimApp().AuthKeeper, suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), diff --git a/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go b/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go index 3868d836325..e02c190c4bc 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go @@ -36,7 +36,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateParams() { suite.chainA.GetSimApp().IBCFeeKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().AccountKeeper, + suite.chainA.GetSimApp().AuthKeeper, suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), diff --git a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go index 677bf715bc9..c1a5513b527 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/relay_test.go @@ -525,7 +525,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { suite.Require().NoError(err) // Check if account is created - interchainAccount := suite.chainB.GetSimApp().AccountKeeper.GetAccount(suite.chainB.GetContext(), icaAddr) + interchainAccount := suite.chainB.GetSimApp().AuthKeeper.GetAccount(suite.chainB.GetContext(), icaAddr) suite.Require().Equal(interchainAccount.GetAddress().String(), storedAddr) suite.fundICAWallet(suite.chainB.GetContext(), path.EndpointA.ChannelConfig.PortID, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1000000)))) diff --git a/modules/apps/29-fee/ibc_middleware_test.go b/modules/apps/29-fee/ibc_middleware_test.go index 059a7d28cff..1a6a8360a78 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -716,7 +716,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { { "success: fail to distribute recv fee (blocked address), returned to refund account", func() { - blockedAddr := suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() + blockedAddr := suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() // reassign ack.ForwardRelayerAddress to a blocked address ack = types.NewIncentivizedAcknowledgement(blockedAddr.String(), ibcmock.MockAcknowledgement.Acknowledgement(), true).Acknowledgement() @@ -954,7 +954,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { { "success: fail to distribute timeout fee (blocked address), returned to refund account", func() { - relayerAddr = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() + relayerAddr = suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() }, nil, func() {}, diff --git a/modules/apps/29-fee/keeper/escrow_test.go b/modules/apps/29-fee/keeper/escrow_test.go index c623cd11cdc..0736dc6959b 100644 --- a/modules/apps/29-fee/keeper/escrow_test.go +++ b/modules/apps/29-fee/keeper/escrow_test.go @@ -110,7 +110,7 @@ func (suite *KeeperTestSuite) TestDistributeFee() { // set the timeout fee to be greater than recv + ack fee so that the refund amount is non-zero fee.TimeoutFee = fee.Total().Add(ibctesting.TestCoin) - refundAcc = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(mock.ModuleName) + refundAcc = suite.chainA.GetSimApp().AuthKeeper.GetModuleAddress(mock.ModuleName) packetFee = types.NewPacketFee(fee, refundAcc.String(), []string{}) packetFees = []types.PacketFee{packetFee, packetFee} @@ -168,7 +168,7 @@ func (suite *KeeperTestSuite) TestDistributeFee() { packetFee = types.NewPacketFee(fee, refundAcc.String(), []string{}) packetFees = []types.PacketFee{packetFee, packetFee} - forwardRelayer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() + forwardRelayer = suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() }, func() { // check if the refund acc has been refunded the timeoutFee & recvFee @@ -183,7 +183,7 @@ func (suite *KeeperTestSuite) TestDistributeFee() { packetFee = types.NewPacketFee(fee, refundAcc.String(), []string{}) packetFees = []types.PacketFee{packetFee, packetFee} - reverseRelayer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() + reverseRelayer = suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() }, func() { // check if the refund acc has been refunded the ackFee @@ -201,8 +201,8 @@ func (suite *KeeperTestSuite) TestDistributeFee() { packetFee = types.NewPacketFee(fee, refundAcc.String(), []string{}) packetFees = []types.PacketFee{packetFee, packetFee} - packetFees[0].RefundAddress = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() - packetFees[1].RefundAddress = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() + packetFees[0].RefundAddress = suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() + packetFees[1].RefundAddress = suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() }, func() { // check if the module acc contains the timeoutFee @@ -328,7 +328,7 @@ func (suite *KeeperTestSuite) TestDistributePacketFeesOnTimeout() { { "invalid timeout relayer address: timeout fee returned to sender", func() { - timeoutRelayer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() + timeoutRelayer = suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() }, func() { // check if the refund acc has been refunded the all the fees @@ -345,8 +345,8 @@ func (suite *KeeperTestSuite) TestDistributePacketFeesOnTimeout() { packetFee = types.NewPacketFee(fee, refundAcc.String(), []string{}) packetFees = []types.PacketFee{packetFee, packetFee} - packetFees[0].RefundAddress = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() - packetFees[1].RefundAddress = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() + packetFees[0].RefundAddress = suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() + packetFees[1].RefundAddress = suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() }, func() { // check if the module acc contains the correct amount of fees @@ -531,7 +531,7 @@ func (suite *KeeperTestSuite) TestRefundFeesOnChannelClosure() { }, { "distributing to blocked address is skipped", func() { - blockedAddr := suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() + blockedAddr := suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress().String() // store the fee in state & update escrow account balance packetID := channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, uint64(1)) diff --git a/modules/apps/29-fee/keeper/migrations_test.go b/modules/apps/29-fee/keeper/migrations_test.go index 4158f1e0b7d..96b1ca823d9 100644 --- a/modules/apps/29-fee/keeper/migrations_test.go +++ b/modules/apps/29-fee/keeper/migrations_test.go @@ -172,7 +172,7 @@ func (suite *KeeperTestSuite) TestMigrate1to2() { refundAcc = suite.chainA.SenderAccount.GetAddress() packetFee = types.NewPacketFee(fee, refundAcc.String(), []string(nil)) - moduleAcc = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(types.ModuleName) + moduleAcc = suite.chainA.GetSimApp().AuthKeeper.GetModuleAddress(types.ModuleName) packetID = channeltypes.NewPacketID(suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID, 1) packetFees = nil diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index 6303fa4a865..129c19221e9 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -56,7 +56,7 @@ func (suite *KeeperTestSuite) TestRegisterPayee() { { "payee is a blocked address", func() { - msg.Payee = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(transfertypes.ModuleName).String() + msg.Payee = suite.chainA.GetSimApp().AuthKeeper.GetModuleAddress(transfertypes.ModuleName).String() }, ibcerrors.ErrUnauthorized, }, @@ -248,7 +248,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { "refund account is module account", func() { suite.chainA.GetSimApp().BankKeeper.SendCoinsFromAccountToModule(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), ibcmock.ModuleName, fee.Total()) //nolint:errcheck // ignore error for testing - msg.Signer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(ibcmock.ModuleName).String() + msg.Signer = suite.chainA.GetSimApp().AuthKeeper.GetModuleAddress(ibcmock.ModuleName).String() expPacketFee := types.NewPacketFee(fee, msg.Signer, nil) expFeesInEscrow = []types.PacketFee{expPacketFee} }, @@ -298,7 +298,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { { "refund account is a blocked address", func() { - blockedAddr := suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() + blockedAddr := suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() msg.Signer = blockedAddr.String() }, ibcerrors.ErrUnauthorized, @@ -528,7 +528,7 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { { "refund account is a blocked address", func() { - blockedAddr := suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() + blockedAddr := suite.chainA.GetSimApp().AuthKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() msg.PacketFee.RefundAddress = blockedAddr.String() }, ibcerrors.ErrUnauthorized, diff --git a/modules/apps/29-fee/transfer_test.go b/modules/apps/29-fee/transfer_test.go index 72284263714..aef236eb86e 100644 --- a/modules/apps/29-fee/transfer_test.go +++ b/modules/apps/29-fee/transfer_test.go @@ -162,7 +162,7 @@ func (suite *FeeTestSuite) TestTransferFeeUpgrade() { res, err := suite.chainA.SendMsgs(msgs...) suite.Require().NoError(err) // message committed - feeEscrowAddr := suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(types.ModuleName) + feeEscrowAddr := suite.chainA.GetSimApp().AuthKeeper.GetModuleAddress(types.ModuleName) escrowBalance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), feeEscrowAddr, sdk.DefaultBondDenom) suite.Require().Equal(escrowBalance.Amount, fee.Total().AmountOf(sdk.DefaultBondDenom)) diff --git a/modules/apps/transfer/keeper/keeper_test.go b/modules/apps/transfer/keeper/keeper_test.go index a4cd9fb66fb..d63d38af2b7 100644 --- a/modules/apps/transfer/keeper/keeper_test.go +++ b/modules/apps/transfer/keeper/keeper_test.go @@ -63,7 +63,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().AccountKeeper, + suite.chainA.GetSimApp().AuthKeeper, suite.chainA.GetSimApp().BankKeeper, suite.chainA.GetSimApp().ScopedTransferKeeper, suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(), @@ -91,7 +91,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().AccountKeeper, + suite.chainA.GetSimApp().AuthKeeper, suite.chainA.GetSimApp().BankKeeper, suite.chainA.GetSimApp().ScopedTransferKeeper, "", // authority @@ -400,7 +400,7 @@ func (suite *KeeperTestSuite) TestIsBlockedAddr() { }{ { "transfer module account address", - suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(types.ModuleName), + suite.chainA.GetSimApp().AuthKeeper.GetModuleAddress(types.ModuleName), false, }, { @@ -410,7 +410,7 @@ func (suite *KeeperTestSuite) TestIsBlockedAddr() { }, { "blocked address", - suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(minttypes.ModuleName), + suite.chainA.GetSimApp().AuthKeeper.GetModuleAddress(minttypes.ModuleName), true, }, } diff --git a/modules/apps/transfer/keeper/msg_server_test.go b/modules/apps/transfer/keeper/msg_server_test.go index 0e0eda314cf..82cff22e0a2 100644 --- a/modules/apps/transfer/keeper/msg_server_test.go +++ b/modules/apps/transfer/keeper/msg_server_test.go @@ -78,7 +78,7 @@ func (suite *KeeperTestSuite) TestMsgTransfer() { { "failure: sender is a blocked address", func() { - msg.Sender = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(minttypes.ModuleName).String() + msg.Sender = suite.chainA.GetSimApp().AuthKeeper.GetModuleAddress(minttypes.ModuleName).String() }, ibcerrors.ErrUnauthorized, }, diff --git a/modules/apps/transfer/keeper/relay_forwarding_test.go b/modules/apps/transfer/keeper/relay_forwarding_test.go index 585d6d7215e..f3756c34f95 100644 --- a/modules/apps/transfer/keeper/relay_forwarding_test.go +++ b/modules/apps/transfer/keeper/relay_forwarding_test.go @@ -1082,7 +1082,7 @@ func (suite *ForwardingTestSuite) TestOnTimeoutPacketForwarding() { suite.Require().True(found, "Chain B has no forwarded packet") suite.Require().Equal(packet, forwardedPacket, "ForwardedPacket stored in ChainB is not the same that was sent") - address := suite.chainB.GetSimApp().AccountKeeper.GetModuleAddress(types.ModuleName).String() + address := suite.chainB.GetSimApp().AuthKeeper.GetModuleAddress(types.ModuleName).String() data := types.NewFungibleTokenPacketDataV2( []types.Token{ { diff --git a/modules/apps/transfer/keeper/relay_test.go b/modules/apps/transfer/keeper/relay_test.go index 03925849296..7f39338236c 100644 --- a/modules/apps/transfer/keeper/relay_test.go +++ b/modules/apps/transfer/keeper/relay_test.go @@ -134,7 +134,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() { { "failure: sender account is blocked", func() { - sender = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(minttypes.ModuleName) + sender = suite.chainA.GetSimApp().AuthKeeper.GetModuleAddress(minttypes.ModuleName) }, ibcerrors.ErrUnauthorized, }, @@ -352,7 +352,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket_ReceiverIsNotSource() { { "failure: receiver is module account", func() { - packetData.Receiver = suite.chainB.GetSimApp().AccountKeeper.GetModuleAddress(minttypes.ModuleName).String() + packetData.Receiver = suite.chainB.GetSimApp().AuthKeeper.GetModuleAddress(minttypes.ModuleName).String() }, ibcerrors.ErrUnauthorized, }, @@ -501,7 +501,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket_ReceiverIsSource() { { "failure: receiver is module account", func() { - packetData.Receiver = suite.chainB.GetSimApp().AccountKeeper.GetModuleAddress(minttypes.ModuleName).String() + packetData.Receiver = suite.chainB.GetSimApp().AuthKeeper.GetModuleAddress(minttypes.ModuleName).String() }, ibcerrors.ErrUnauthorized, }, diff --git a/simapp/app.go b/simapp/app.go index 36ef1c9ed68..505d03f3e05 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -351,7 +351,7 @@ func NewSimApp( // SDK module keepers - // add keepers // add keepers + // add keepers accountsKeeper, err := accounts.NewKeeper( appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[accounts.StoreKey]), logger.With(log.ModuleKey, "x/accounts"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), diff --git a/testing/chain.go b/testing/chain.go index 0ce65d8f0e7..468edff6d3d 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -300,7 +300,7 @@ func (chain *TestChain) NextBlock() { chain.commitBlock(res) } -func (chain *TestChain) commitBlock(res *abci.FinalizeBlockRequest) { +func (chain *TestChain) commitBlock(res *abci.FinalizeBlockResponse) { _, err := chain.App.Commit() require.NoError(chain.TB, err) diff --git a/testing/mock/mock.go b/testing/mock/mock.go index 17055eda29e..ad8cce5840c 100644 --- a/testing/mock/mock.go +++ b/testing/mock/mock.go @@ -10,15 +10,13 @@ import ( "github.com/spf13/cobra" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/registry" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - abci "github.com/cometbft/cometbft/abci/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" feetypes "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" @@ -59,8 +57,7 @@ var ( ) var ( - _ module.AppModuleBasic = (*AppModuleBasic)(nil) - _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.AppModule = (*AppModule)(nil) _ porttypes.IBCModule = (*IBCModule)(nil) ) @@ -93,18 +90,18 @@ func (AppModule) IsOnePerModuleType() {} func (AppModule) IsAppModule() {} // RegisterLegacyAminoCodec implements AppModuleBasic interface. -func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} +func (AppModuleBasic) RegisterLegacyAminoCodec(registry.AminoRegistrar) {} // RegisterInterfaces implements AppModuleBasic interface. func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {} // DefaultGenesis implements AppModuleBasic interface. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { +func (AppModuleBasic) DefaultGenesis() json.RawMessage { return nil } // ValidateGenesis implements the AppModuleBasic interface. -func (AppModuleBasic) ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(json.RawMessage) error { return nil } @@ -142,7 +139,7 @@ func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} func (AppModule) RegisterServices(module.Configurator) {} // InitGenesis implements the AppModule interface. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { for _, ibcApp := range am.ibcApps { if ibcApp.PortID != "" && !am.portKeeper.IsBound(ctx, ibcApp.PortID) { // bind mock portID @@ -154,12 +151,12 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. } } - return []abci.ValidatorUpdate{} + return nil } // ExportGenesis implements the AppModule interface. -func (AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - return nil +func (AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) { + return nil, nil } // ConsensusVersion implements AppModule/ConsensusVersion. diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 7fae6a437ae..7c795d621da 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -14,14 +14,9 @@ import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "cosmossdk.io/client/v2/autocli" - "cosmossdk.io/core/appmodule" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/tx/signing" - "cosmossdk.io/x/upgrade" - upgradekeeper "cosmossdk.io/x/upgrade/keeper" - upgradetypes "cosmossdk.io/x/upgrade/types" - + "cosmossdk.io/x/accounts" "cosmossdk.io/x/authz" authzkeeper "cosmossdk.io/x/authz/keeper" authzmodule "cosmossdk.io/x/authz/module" @@ -35,23 +30,28 @@ import ( distrkeeper "cosmossdk.io/x/distribution/keeper" distrtypes "cosmossdk.io/x/distribution/types" "cosmossdk.io/x/gov" - govclient "cosmossdk.io/x/gov/client" govkeeper "cosmossdk.io/x/gov/keeper" govtypes "cosmossdk.io/x/gov/types" + govv1beta1 "cosmossdk.io/x/gov/types/v1beta1" "cosmossdk.io/x/group" "cosmossdk.io/x/mint" mintkeeper "cosmossdk.io/x/mint/keeper" minttypes "cosmossdk.io/x/mint/types" "cosmossdk.io/x/params" - paramsclient "cosmossdk.io/x/params/client" paramskeeper "cosmossdk.io/x/params/keeper" paramstypes "cosmossdk.io/x/params/types" + poolkeeper "cosmossdk.io/x/protocolpool/keeper" + pooltypes "cosmossdk.io/x/protocolpool/types" "cosmossdk.io/x/slashing" slashingkeeper "cosmossdk.io/x/slashing/keeper" slashingtypes "cosmossdk.io/x/slashing/types" "cosmossdk.io/x/staking" stakingkeeper "cosmossdk.io/x/staking/keeper" stakingtypes "cosmossdk.io/x/staking/types" + "cosmossdk.io/x/tx/signing" + "cosmossdk.io/x/upgrade" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -160,7 +160,8 @@ type SimApp struct { memKeys map[string]*storetypes.MemoryStoreKey // keepers - AccountKeeper authkeeper.AccountKeeper + AuthKeeper authkeeper.AccountKeeper + AccountKeeper accounts.Keeper BankKeeper bankkeeper.Keeper CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper @@ -176,6 +177,7 @@ type SimApp struct { ICAControllerKeeper icacontrollerkeeper.Keeper ICAHostKeeper icahostkeeper.Keeper TransferKeeper ibctransferkeeper.Keeper + PoolKeeper poolkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper // make scoped keepers public for test purposes @@ -194,8 +196,7 @@ type SimApp struct { FeeMockModule ibcmock.IBCModule // the module manager - ModuleManager *module.Manager - BasicModuleManager module.BasicManager + ModuleManager *module.Manager // simulation manager simulationManager *module.SimulationManager @@ -235,7 +236,8 @@ func NewSimApp( }) appCodec := codec.NewProtoCodec(interfaceRegistry) legacyAmino := codec.NewLegacyAmino() - txConfig := authtx.NewTxConfig(appCodec, authtx.DefaultSignModes) + signingCtx := interfaceRegistry.SigningContext() + txConfig := authtx.NewTxConfig(appCodec, signingCtx.AddressCodec(), signingCtx.ValidatorAddressCodec(), authtx.DefaultSignModes) std.RegisterLegacyAminoCodec(legacyAmino) std.RegisterInterfaces(interfaceRegistry) @@ -277,7 +279,7 @@ func NewSimApp( minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, - authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, + authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, pooltypes.StoreKey, accounts.StoreKey, ) // register streaming services @@ -299,10 +301,15 @@ func NewSimApp( memKeys: memKeys, } + govModuleAddr, err := signingCtx.AddressCodec().BytesToString(authtypes.NewModuleAddress(govtypes.ModuleName)) + if err != nil { + panic(err) + } + app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) + app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), logger.With(log.ModuleKey, "x/consensus")), govModuleAddr) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) // add capability keeper and ScopeToModule for ibc module @@ -328,25 +335,53 @@ func NewSimApp( // SDK module keepers // add keepers - app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + accountsKeeper, err := accounts.NewKeeper( + appCodec, + runtime.NewEnvironment(runtime.NewKVStoreService(keys[accounts.StoreKey]), logger.With(log.ModuleKey, "x/accounts"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), + signingCtx.AddressCodec(), + appCodec.InterfaceRegistry(), + ) + if err != nil { + panic(err) + } + app.AccountKeeper = accountsKeeper + + app.AuthKeeper = authkeeper.NewAccountKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), logger.With(log.ModuleKey, "x/auth")), appCodec, authtypes.ProtoBaseAccount, accountsKeeper, maccPerms, signingCtx.AddressCodec(), sdk.Bech32MainPrefix, govModuleAddr) + + blockedAddrs := BlockedAddresses() app.BankKeeper = bankkeeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), logger.With(log.ModuleKey, "x/bank")), appCodec, - runtime.NewKVStoreService(keys[banktypes.StoreKey]), - app.AccountKeeper, - BlockedAddresses(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - logger, + app.AuthKeeper, + blockedAddrs, + govModuleAddr, ) + + cometService := runtime.NewContextAwareCometInfoService() app.StakingKeeper = stakingkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), authcodec.NewBech32Codec(sdk.Bech32PrefixValAddr), authcodec.NewBech32Codec(sdk.Bech32PrefixConsAddr), + appCodec, + runtime.NewEnvironment( + runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), + logger.With(log.ModuleKey, "x/staking"), + runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), + runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), + app.AuthKeeper, + app.BankKeeper, + govModuleAddr, + signingCtx.ValidatorAddressCodec(), + authcodec.NewBech32Codec(sdk.Bech32PrefixConsAddr), + cometService, ) - app.MintKeeper = mintkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[minttypes.StoreKey]), app.StakingKeeper, app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - app.DistrKeeper = distrkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[distrtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.MintKeeper = mintkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[minttypes.StoreKey]), logger.With(log.ModuleKey, "x/mint")), app.StakingKeeper, app.AuthKeeper, app.BankKeeper, authtypes.FeeCollectorName, govModuleAddr) + + app.PoolKeeper = poolkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[pooltypes.StoreKey]), logger.With(log.ModuleKey, "x/protocolpool")), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, govModuleAddr) + + app.DistrKeeper = distrkeeper.NewKeeper(appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger.With(log.ModuleKey, "x/distribution")), app.AuthKeeper, app.BankKeeper, app.StakingKeeper, cometService, authtypes.FeeCollectorName, govModuleAddr) - app.SlashingKeeper = slashingkeeper.NewKeeper( - appCodec, legacyAmino, runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.SlashingKeeper = slashingkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), logger.With(log.ModuleKey, "x/slashing")), + appCodec, legacyAmino, app.StakingKeeper, govModuleAddr, ) // register the staking hooks @@ -355,7 +390,7 @@ func NewSimApp( stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) - app.AuthzKeeper = authzkeeper.NewKeeper(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.MsgServiceRouter(), app.AccountKeeper) + app.AuthzKeeper = authzkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), logger.With(log.ModuleKey, "x/authz"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), appCodec, app.AuthKeeper) // get skipUpgradeHeights from the app options skipUpgradeHeights := map[int64]bool{} @@ -364,21 +399,30 @@ func NewSimApp( } homePath := cast.ToString(appOpts.Get(flags.FlagHome)) // set the governance module account as the authority for conducting upgrades - app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.UpgradeKeeper = upgradekeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), logger.With(log.ModuleKey, "x/upgrade"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), skipUpgradeHeights, appCodec, homePath, app.BaseApp, govModuleAddr) app.IBCKeeper = ibckeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - govConfig := govtypes.DefaultConfig() + govRouter := govv1beta1.NewRouter() + govConfig := govkeeper.DefaultConfig() /* Example of setting gov params: govConfig.MaxMetadataLen = 10000 */ govKeeper := govkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[govtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, - app.StakingKeeper, app.DistrKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + appCodec, + runtime.NewEnvironment(runtime.NewKVStoreService(keys[govtypes.StoreKey]), logger.With(log.ModuleKey, "x/gov"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), + app.AuthKeeper, + app.BankKeeper, + app.StakingKeeper, + app.PoolKeeper, + govConfig, + govModuleAddr) + + // Set legacy router for backwards compatibility with gov v1beta1 + govKeeper.SetLegacyRouter(govRouter) app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( @@ -391,7 +435,7 @@ func NewSimApp( appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.IBCKeeper.PortKeeper, app.AuthKeeper, app.BankKeeper, ) // ICA Controller keeper @@ -407,7 +451,7 @@ func NewSimApp( app.ICAHostKeeper = icahostkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[icahosttypes.StoreKey]), app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, app.AccountKeeper, + app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, app.AuthKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -423,7 +467,7 @@ func NewSimApp( appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + app.AuthKeeper, app.BankKeeper, scopedTransferKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -528,29 +572,26 @@ func NewSimApp( // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. app.ModuleManager = module.NewManager( - genutil.NewAppModule( - app.AccountKeeper, app.StakingKeeper, app, - txConfig, - ), - auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), - vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), + genutil.NewAppModule(appCodec, app.AuthKeeper, app.StakingKeeper, app, txConfig, genutiltypes.DefaultMessageValidator), + auth.NewAppModule(appCodec, app.AuthKeeper, app.AccountKeeper, authsims.RandomGenesisAccounts, nil), + vesting.NewAppModule(app.AuthKeeper, app.BankKeeper), + bank.NewAppModule(appCodec, app.BankKeeper, app.AuthKeeper), capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), - gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), - distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), - upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), + gov.NewAppModule(appCodec, &app.GovKeeper, app.AuthKeeper, app.BankKeeper, app.PoolKeeper), + mint.NewAppModule(appCodec, app.MintKeeper, app.AuthKeeper, nil), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AuthKeeper, app.BankKeeper, app.StakingKeeper, app.interfaceRegistry, cometService), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AuthKeeper, app.BankKeeper, app.StakingKeeper), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AuthKeeper, app.BankKeeper), + upgrade.NewAppModule(app.UpgradeKeeper), params.NewAppModule(app.ParamsKeeper), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), // IBC modules - ibc.NewAppModule(app.IBCKeeper), - transfer.NewAppModule(app.TransferKeeper), - ibcfee.NewAppModule(app.IBCFeeKeeper), - ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), + ibc.NewAppModule(appCodec, app.IBCKeeper), + transfer.NewAppModule(appCodec, app.TransferKeeper), + ibcfee.NewAppModule(appCodec, app.IBCFeeKeeper), + ica.NewAppModule(appCodec, &app.ICAControllerKeeper, &app.ICAHostKeeper), mockModule, // IBC light clients @@ -558,23 +599,6 @@ func NewSimApp( solomachine.NewAppModule(smLightClientModule), ) - // BasicModuleManager defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration and genesis verification. - // By default it is composed of all the module from the module manager. - // Additionally, app module basics can be overwritten by passing them as argument. - app.BasicModuleManager = module.NewBasicManagerFromManager( - app.ModuleManager, - map[string]module.AppModuleBasic{ - genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - govtypes.ModuleName: gov.NewAppModuleBasic( - []govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }, - ), - }) - app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino) - app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) - // NOTE: upgrade module is required to be prioritized app.ModuleManager.SetOrderPreBlockers( upgradetypes.ModuleName, @@ -634,7 +658,7 @@ func NewSimApp( // app.ModuleManager.SetOrderMigrations(custom order) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - err := app.ModuleManager.RegisterServices(app.configurator) + err = app.ModuleManager.RegisterServices(app.configurator) if err != nil { panic(err) } @@ -655,7 +679,7 @@ func NewSimApp( // NOTE: this is not required apps that don't use the simulator for fuzz testing // transactions overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AuthKeeper, app.AccountKeeper, authsims.RandomGenesisAccounts, nil), } app.simulationManager = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) @@ -733,7 +757,7 @@ func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { anteHandler, err := NewAnteHandler( HandlerOptions{ ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, + AccountKeeper: app.AuthKeeper, BankKeeper: app.BankKeeper, SignModeHandler: txConfig.SignModeHandler(), SigGasConsumer: ante.DefaultSigVerificationGasConsumer, @@ -764,7 +788,7 @@ func (app *SimApp) setPostHandler() { func (app *SimApp) Name() string { return app.BaseApp.Name() } // PreBlocker application updates every pre block -func (app *SimApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { +func (app *SimApp) PreBlocker(ctx sdk.Context, _ *abci.FinalizeBlockRequest) error { return app.ModuleManager.PreBlock(ctx) } @@ -784,7 +808,7 @@ func (app *SimApp) Configurator() module.Configurator { } // InitChainer application update at chain initialization -func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { +func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.InitChainRequest) (*abci.InitChainResponse, error) { var genesisState GenesisState if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) @@ -792,7 +816,7 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*ab if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil { panic(err) } - return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) + return app.ModuleManager.InitGenesis(ctx, genesisState) } // LoadHeight loads a particular height @@ -828,25 +852,15 @@ func (app *SimApp) TxConfig() client.TxConfig { // AutoCliOpts returns the autocli options for the app. func (app *SimApp) AutoCliOpts() autocli.AppOptions { - modules := make(map[string]appmodule.AppModule, 0) - for _, m := range app.ModuleManager.Modules { - if moduleWithName, ok := m.(module.HasName); ok { - moduleName := moduleWithName.Name() - if appModule, ok := moduleWithName.(appmodule.AppModule); ok { - modules[moduleName] = appModule - } - } - } - return autocli.AppOptions{ - Modules: modules, + Modules: app.ModuleManager.Modules, ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.ModuleManager.Modules), } } // DefaultGenesis returns a default genesis from the registered AppModuleBasic's. func (app *SimApp) DefaultGenesis() map[string]json.RawMessage { - return app.BasicModuleManager.DefaultGenesis(app.appCodec) + return app.ModuleManager.DefaultGenesis() } // GetKey returns the KVStoreKey for the provided store key. @@ -893,7 +907,7 @@ func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICon nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // Register grpc-gateway routes for all modules. - app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + app.ModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // register swagger API from root so that other applications can override easily if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil {