Skip to content

Commit

Permalink
Merge branch 'release/v2.11' of https://github.com/terra-money/core i…
Browse files Browse the repository at this point in the history
…nto feat/v2.10/smartaccounts
  • Loading branch information
emidev98 committed Mar 25, 2024
2 parents f764d50 + b652921 commit 00969a1
Show file tree
Hide file tree
Showing 33 changed files with 2,216 additions and 1,111 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build/
integration-tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# OS
.testnets
.DS_Store
*.swp
*.swo
Expand Down
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,28 @@ format: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*statik*" -not -name '*.pb.go' | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*statik*" -not -name '*.pb.go' | xargs goimports -w -local github.com/cosmos/cosmos-sdk

.PHONY: lint lint-fix lint-docker format-tools format
.PHONY: lint lint-fix lint-docker format-tools format


###############################################################################
### Local Testnet (docker) ###
###############################################################################

localnet-rmi:
$(DOCKER) rmi terra-money/localnet-core 2>/dev/null; true

localnet-build-env: localnet-rmi
$(DOCKER) build --tag terra-money/localnet-core -f scripts/containers/Dockerfile \
$(shell git rev-parse --show-toplevel)

localnet-build-nodes:
$(DOCKER) run --rm -v $(CURDIR)/.testnets:/terra terra-money/localnet-core \
testnet init-files --v 3 -o /terra --starting-ip-address 192.168.15.20 --keyring-backend=test --chain-id=core-testnet-1
$(DOCKER) compose up -d

localnet-stop:
$(DOCKER) compose down

localnet-start: localnet-stop localnet-build-env localnet-build-nodes

.PHONY: localnet-stop localnet-start localnet-build-env localnet-build-nodes localnet-rmi
5 changes: 3 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"

"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"

ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee"
Expand Down Expand Up @@ -455,7 +456,7 @@ func (app *TerraApp) SimulationManager() *module.SimulationManager {
ibctransfer.NewAppModule(app.Keepers.TransferKeeper),
ibcfee.NewAppModule(app.Keepers.IBCFeeKeeper),
ica.NewAppModule(&app.Keepers.ICAControllerKeeper, &app.Keepers.ICAHostKeeper),
router.NewAppModule(&app.Keepers.RouterKeeper),
packetforward.NewAppModule(&app.Keepers.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)),
customwasmodule.NewAppModule(appCodec, &app.Keepers.WasmKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.BaseApp.MsgServiceRouter(), app.Keepers.GetSubspace(wasmtypes.ModuleName)),
alliance.NewAppModule(appCodec, app.Keepers.AllianceKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.interfaceRegistry, app.Keepers.GetSubspace(alliancetypes.ModuleName)),
feeshare.NewAppModule(app.Keepers.FeeShareKeeper, app.Keepers.AccountKeeper, app.GetSubspace(feesharetypes.ModuleName)),
Expand Down
1 change: 1 addition & 0 deletions app/config/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,5 @@ const (
Upgrade2_8 = "v2.8"
Upgrade2_9 = "v2.9"
Upgrade2_10 = "v2.10"
Upgrade2_11 = "v2.11"
)
7 changes: 4 additions & 3 deletions app/encoding_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package app_test

import (
"github.com/terra-money/core/v2/app"
"github.com/terra-money/core/v2/app/test_helpers"

banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/terra-money/core/v2/app"
"github.com/terra-money/core/v2/app/test_helpers"
)

type AppCodecsTestSuite struct {
Expand All @@ -16,7 +17,7 @@ func (acts *AppCodecsTestSuite) TestCodecs() {
// Setting up the app
acts.Setup()

// generating the encoding config to assert agains
// generating the encoding config to assert against
encCfg := app.MakeEncodingConfig()

// Validate the encoding config have been configured as expected for the App
Expand Down
10 changes: 6 additions & 4 deletions app/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (

abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
"github.com/terra-money/core/v2/app/test_helpers"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/terra-money/core/v2/app/test_helpers"

ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee"
"github.com/golang/mock/gomock"
Expand All @@ -28,7 +29,7 @@ import (
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
icq "github.com/cosmos/ibc-apps/modules/async-icq/v7"
ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
Expand Down Expand Up @@ -57,6 +58,7 @@ import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
tmtypes "github.com/cometbft/cometbft/types"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down Expand Up @@ -217,7 +219,7 @@ func (s *AppGenesisTestSuite) TestMigration() {
"ibchooks": ibchooks.AppModule{}.ConsensusVersion(),
"interchainaccounts": ica.AppModule{}.ConsensusVersion(),
"mint": mint.AppModule{}.ConsensusVersion(),
"packetfowardmiddleware": router.AppModule{}.ConsensusVersion(),
"packetfowardmiddleware": packetforward.AppModule{}.ConsensusVersion(),
"params": params.AppModule{}.ConsensusVersion(),
"slashing": slashing.AppModule{}.ConsensusVersion(),
"staking": staking.AppModule{}.ConsensusVersion(),
Expand Down Expand Up @@ -251,7 +253,7 @@ func (s *AppGenesisTestSuite) TestMigration() {
"interchainquery": 1,
"mint": 2,
"mock": 0,
"packetfowardmiddleware": 1,
"packetfowardmiddleware": 2,
"params": 1,
"slashing": 3,
"staking": 4,
Expand Down
26 changes: 12 additions & 14 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package keepers
import (
"path/filepath"

"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
ibctransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
Expand Down Expand Up @@ -52,8 +51,9 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

routerkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/keeper"
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"

icq "github.com/cosmos/ibc-apps/modules/async-icq/v7"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
Expand Down Expand Up @@ -105,8 +105,6 @@ import (
_ "github.com/terra-money/core/v2/client/docs/statik"
)

var wasmCapabilities = "iterator,staking,stargate,token_factory,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4"

// module account permissions
var maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
Expand Down Expand Up @@ -153,7 +151,7 @@ type TerraAppKeepers struct {
ICAControllerKeeper icacontrollerkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
IBCFeeKeeper ibcfeekeeper.Keeper
RouterKeeper routerkeeper.Keeper
PacketForwardKeeper packetforwardkeeper.Keeper
TokenFactoryKeeper tokenfactorykeeper.Keeper
AllianceKeeper alliancekeeper.Keeper
FeeShareKeeper feesharekeeper.Keeper
Expand Down Expand Up @@ -371,22 +369,22 @@ func NewTerraAppKeepers(
transferIBCModule := ibctransfer.NewIBCModule(keepers.TransferKeeper)

hooksTransferStack := ibchooks.NewIBCMiddleware(&transferIBCModule, &keepers.HooksICS4Wrapper)
keepers.RouterKeeper = *routerkeeper.NewKeeper(
keepers.PacketForwardKeeper = *packetforwardkeeper.NewKeeper(
appCodec,
keepers.keys[routertypes.StoreKey],
keepers.GetSubspace(routertypes.ModuleName),
keepers.keys[packetforwardtypes.StoreKey],
keepers.TransferKeeper,
keepers.IBCKeeper.ChannelKeeper,
keepers.DistrKeeper,
keepers.BankKeeper,
keepers.IBCKeeper.ChannelKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
keepers.TransferStack = router.NewIBCMiddleware(
keepers.TransferStack = packetforward.NewIBCMiddleware(
hooksTransferStack,
&keepers.RouterKeeper,
&keepers.PacketForwardKeeper,
5,
routerkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
routerkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)
keepers.ICQKeeper = icqkeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -571,7 +569,7 @@ func (app *TerraAppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legacyA
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(routertypes.ModuleName).WithKeyTable(routertypes.ParamKeyTable())
paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable())
paramsKeeper.Subspace(icqtypes.ModuleName)

// Custom Modules
Expand Down
4 changes: 2 additions & 2 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"

icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
Expand Down Expand Up @@ -59,7 +59,7 @@ func (keepers *TerraAppKeepers) GenerateKeys() {
govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey,
upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey,
capabilitytypes.StoreKey, authzkeeper.StoreKey, feegrant.StoreKey,
icahosttypes.StoreKey, icacontrollertypes.StoreKey, routertypes.StoreKey,
icahosttypes.StoreKey, icacontrollertypes.StoreKey, packetforwardtypes.StoreKey,
consensusparamtypes.StoreKey, tokenfactorytypes.StoreKey, wasmtypes.StoreKey,
ibcfeetypes.StoreKey, ibchookstypes.StoreKey, crisistypes.StoreKey,
alliancetypes.StoreKey, feesharetypes.StoreKey, icqtypes.StoreKey,
Expand Down
14 changes: 7 additions & 7 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types"
ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
Expand Down Expand Up @@ -110,7 +110,7 @@ var ModuleBasics = module.NewBasicManager(
vesting.AppModuleBasic{},
ica.AppModuleBasic{},
ibcfee.AppModuleBasic{},
router.AppModuleBasic{},
packetforward.AppModuleBasic{},
authzmodule.AppModuleBasic{},
tokenfactory.AppModuleBasic{},
ibchooks.AppModuleBasic{},
Expand Down Expand Up @@ -150,7 +150,7 @@ func appModules(app *TerraApp, encodingConfig terrappsparams.EncodingConfig, ski
ibctransfer.NewAppModule(app.Keepers.TransferKeeper),
ibcfee.NewAppModule(app.Keepers.IBCFeeKeeper),
ica.NewAppModule(&app.Keepers.ICAControllerKeeper, &app.Keepers.ICAHostKeeper),
router.NewAppModule(&app.Keepers.RouterKeeper),
packetforward.NewAppModule(&app.Keepers.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)),
customwasmodule.NewAppModule(app.appCodec, &app.Keepers.WasmKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ibchooks.NewAppModule(app.Keepers.AccountKeeper),
tokenfactory.NewAppModule(app.Keepers.TokenFactoryKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)),
Expand Down Expand Up @@ -187,7 +187,7 @@ var initGenesisOrder = []string{
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
routertypes.ModuleName,
packetforwardtypes.ModuleName,
tokenfactorytypes.ModuleName,
ibchookstypes.ModuleName,
wasmtypes.ModuleName,
Expand Down Expand Up @@ -220,7 +220,7 @@ var beginBlockersOrder = []string{
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
routertypes.ModuleName,
packetforwardtypes.ModuleName,
ibchookstypes.ModuleName,
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
Expand Down Expand Up @@ -253,7 +253,7 @@ var endBlockerOrder = []string{
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
routertypes.ModuleName,
packetforwardtypes.ModuleName,
ibchookstypes.ModuleName,
wasmtypes.ModuleName,
tokenfactorytypes.ModuleName,
Expand Down
3 changes: 2 additions & 1 deletion app/post/mocks/post_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/terra-money/core/v2/app/keepers"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
simulationtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
Expand Down
22 changes: 20 additions & 2 deletions app/upgrade_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
alliancetypes "github.com/terra-money/alliance/x/alliance/types"
terraappconfig "github.com/terra-money/core/v2/app/config"
v2_10 "github.com/terra-money/core/v2/app/upgrades/v2.10"
v2_11 "github.com/terra-money/core/v2/app/upgrades/v2.11"
v2_2_0 "github.com/terra-money/core/v2/app/upgrades/v2.2.0"
v2_3_0 "github.com/terra-money/core/v2/app/upgrades/v2.3.0"
v2_4 "github.com/terra-money/core/v2/app/upgrades/v2.4"
Expand Down Expand Up @@ -89,16 +91,26 @@ func (app *TerraApp) RegisterUpgradeHandlers() {
app.GetModuleManager(),
app.GetConfigurator(),
app.GetAppCodec(),
app.Keepers.ICQKeeper,
),
)
app.Keepers.UpgradeKeeper.SetUpgradeHandler(
terraappconfig.Upgrade2_10,
v2_9.CreateUpgradeHandler(
v2_10.CreateUpgradeHandler(
app.GetModuleManager(),
app.GetConfigurator(),
app.GetAppCodec(),
),
)
app.Keepers.UpgradeKeeper.SetUpgradeHandler(
terraappconfig.Upgrade2_11,
v2_11.CreateUpgradeHandler(
app.GetModuleManager(),
app.GetConfigurator(),
app.Keepers.BankKeeper,
app.Keepers.TransferKeeper,
),
)
}

func (app *TerraApp) RegisterUpgradeStores() {
Expand Down Expand Up @@ -129,7 +141,13 @@ func (app *TerraApp) RegisterUpgradeStores() {
storeUpgrades := storetypes.StoreUpgrades{Added: []string{icqtypes.StoreKey}}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
} else if upgradeInfo.Name == terraappconfig.Upgrade2_9 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{Deleted: []string{"builder"}}
storeUpgrades := storetypes.StoreUpgrades{Deleted: []string{"builder"}, Added: []string{icqtypes.StoreKey}}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
} else if upgradeInfo.Name == terraappconfig.Upgrade2_10 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
} else if upgradeInfo.Name == terraappconfig.Upgrade2_11 && !app.Keepers.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{}
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}
Loading

0 comments on commit 00969a1

Please sign in to comment.