Skip to content

Commit

Permalink
feat: remove intertx
Browse files Browse the repository at this point in the history
  • Loading branch information
emidev98 committed Aug 18, 2023
1 parent d497900 commit 9aa1e74
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 29 deletions.
25 changes: 4 additions & 21 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ import (
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/strangelove-ventures/packet-forward-middleware/v7/router"

intertx "github.com/cosmos/interchain-accounts/x/inter-tx"
intertxkeeper "github.com/cosmos/interchain-accounts/x/inter-tx/keeper"
intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"

routerkeeper "github.com/strangelove-ventures/packet-forward-middleware/v7/router/keeper"
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types"

Expand Down Expand Up @@ -252,7 +248,6 @@ var (
vesting.AppModuleBasic{},
ica.AppModuleBasic{},
ibcfee.AppModuleBasic{},
intertx.AppModuleBasic{},
router.AppModuleBasic{},
authzmodule.AppModuleBasic{},
tokenfactory.AppModuleBasic{},
Expand Down Expand Up @@ -330,7 +325,6 @@ type TerraApp struct {
FeeGrantKeeper feegrantkeeper.Keeper
ICAControllerKeeper icacontrollerkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
InterTxKeeper intertxkeeper.Keeper
IBCFeeKeeper ibcfeekeeper.Keeper
RouterKeeper routerkeeper.Keeper
TokenFactoryKeeper tokenfactorykeeper.Keeper
Expand All @@ -347,7 +341,6 @@ type TerraApp struct {
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedInterTxKeeper capabilitykeeper.ScopedKeeper

wasmKeeper wasm.Keeper
scopedWasmKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -387,7 +380,7 @@ func NewTerraApp(
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
intertxtypes.StoreKey, authzkeeper.StoreKey, feegrant.StoreKey, icahosttypes.StoreKey,
authzkeeper.StoreKey, feegrant.StoreKey, icahosttypes.StoreKey,
icacontrollertypes.StoreKey, routertypes.StoreKey, consensusparamtypes.StoreKey, tokenfactorytypes.StoreKey, wasm.StoreKey,
ibcfeetypes.StoreKey, ibchookstypes.StoreKey, alliancetypes.StoreKey,
)
Expand Down Expand Up @@ -417,7 +410,6 @@ func NewTerraApp(
// grant capabilities for the ibc and ibc-transfer modules
scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedInterTxKeeper := app.CapabilityKeeper.ScopeToModule(intertxtypes.ModuleName)
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)

Expand Down Expand Up @@ -599,11 +591,10 @@ func NewTerraApp(
app.MsgServiceRouter(),
)

app.InterTxKeeper = intertxkeeper.NewKeeper(appCodec, keys[intertxtypes.StoreKey], app.ICAControllerKeeper, scopedInterTxKeeper)
interTxIBCModule := intertx.NewIBCModule(app.InterTxKeeper)
var icaControllerStack porttypes.IBCModule
icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, app.ICAControllerKeeper)
icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper)

icaControllerIBCModule := icacontroller.NewIBCMiddleware(interTxIBCModule, app.ICAControllerKeeper)
icaControllerStack := ibcfee.NewIBCMiddleware(icaControllerIBCModule, app.IBCFeeKeeper)
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)
icaHostStack := ibcfee.NewIBCMiddleware(icaHostIBCModule, app.IBCFeeKeeper)

Expand Down Expand Up @@ -666,7 +657,6 @@ func NewTerraApp(

// Create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter().
AddRoute(intertxtypes.ModuleName, icaControllerStack).
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icahosttypes.SubModuleName, icaHostStack).
AddRoute(ibctransfertypes.ModuleName, hooksTransferStack).
Expand Down Expand Up @@ -722,7 +712,6 @@ func NewTerraApp(
ibctransfer.NewAppModule(app.TransferKeeper),
ibcfee.NewAppModule(app.IBCFeeKeeper),
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
intertx.NewAppModule(appCodec, app.InterTxKeeper),
router.NewAppModule(&app.RouterKeeper),
wasm.NewAppModule(appCodec, &app.wasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ibchooks.NewAppModule(app.AccountKeeper),
Expand Down Expand Up @@ -756,7 +745,6 @@ func NewTerraApp(
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
intertxtypes.ModuleName,
routertypes.ModuleName,
ibchookstypes.ModuleName,
wasm.ModuleName,
Expand Down Expand Up @@ -787,7 +775,6 @@ func NewTerraApp(
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
intertxtypes.ModuleName,
routertypes.ModuleName,
ibchookstypes.ModuleName,
wasm.ModuleName,
Expand Down Expand Up @@ -822,7 +809,6 @@ func NewTerraApp(
ibctransfertypes.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
intertxtypes.ModuleName,
routertypes.ModuleName,
tokenfactorytypes.ModuleName,
ibchookstypes.ModuleName,
Expand Down Expand Up @@ -874,7 +860,6 @@ func NewTerraApp(
if upgradeInfo.Name == terraappconfig.Upgrade2_3_0 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{
intertxtypes.StoreKey,
icacontrollertypes.StoreKey,
tokenfactorytypes.StoreKey,
ibcfeetypes.StoreKey,
Expand Down Expand Up @@ -905,7 +890,6 @@ func NewTerraApp(
app.ScopedICAControllerKeeper = scopedICAControllerKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper
app.scopedWasmKeeper = scopedWasmKeeper
app.ScopedInterTxKeeper = scopedInterTxKeeper

return app
}
Expand Down Expand Up @@ -1217,7 +1201,6 @@ func (app *TerraApp) SimulationManager() *module.SimulationManager {
tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper),
alliance.NewAppModule(appCodec, app.AllianceKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
// does not implement simulation
// intertx.NewAppModule(appCodec, app.InterTxKeeper),
// ibchooks.NewAppModule(app.AccountKeeper),
)

Expand Down
5 changes: 2 additions & 3 deletions app/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app_test

import (
"encoding/json"
"fmt"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -182,7 +183,6 @@ func TestNewGenesis(t *testing.T) {
}
}
},
"intertx": null,
"mint": {
"minter": {
"inflation": "0.130000000000000000",
Expand Down Expand Up @@ -278,6 +278,7 @@ func TestNewGenesisWithBondDenom(t *testing.T) {
genesisState.ConfigureBondDenom(encCfg.Marshaler, "uluna")

jsonGenState, err := json.Marshal(genesisState)
fmt.Println(string(jsonGenState))
require.Nil(t, err)

expectedState := `{
Expand Down Expand Up @@ -447,7 +448,6 @@ func TestNewGenesisWithBondDenom(t *testing.T) {
}
}
},
"intertx": null,
"mint": {
"minter": {
"inflation": "0.130000000000000000",
Expand Down Expand Up @@ -736,7 +736,6 @@ func TestNewGenesisConfigureICA(t *testing.T) {
}
}
},
"intertx": null,
"mint": {
"minter": {
"inflation": "0.130000000000000000",
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ require (
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230803181732-7c8f814d3b79
github.com/cosmos/ibc-go/v7 v7.2.0
github.com/cosmos/interchain-accounts v0.5.1
github.com/golang/mock v1.6.0
github.com/gorilla/mux v1.8.0
github.com/pkg/errors v0.9.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ github.com/cosmos/ibc-go/v7 v7.2.0 h1:dx0DLUl7rxdyZ8NiT6UsrbzKOJx/w7s+BOaewFRH6c
github.com/cosmos/ibc-go/v7 v7.2.0/go.mod h1:OOcjKIRku/j1Xs1RgKK0yvKRrJ5iFuZYMetR1n3yMlc=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
github.com/cosmos/interchain-accounts v0.5.1 h1:J5ZaYsMc2u4DekKXbDPzv8nu4YD/RSmT0F8dmN7G1oM=
github.com/cosmos/interchain-accounts v0.5.1/go.mod h1:JB3gKbX8geQhxEIrBQtpDco0cyKMUDpVhugb78e5z6U=
github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
github.com/cosmos/ledger-go v0.9.3 h1:WGyZK4ikuLIkbxJm3lEr1tdQYDdTdveTwoVla7hqfhQ=
github.com/cosmos/ledger-go v0.9.3/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
Expand Down
4 changes: 2 additions & 2 deletions scripts/tests/ica/delegate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi
echo "Executing Delegation from test-1 to test-2 via ICA"
VAL_ADDR_1=$(cat $CHAIN_DIR/test-2/config/genesis.json | jq -r '.app_state.genutil.gen_txs[0].body.messages[0].validator_address')

$BINARY tx intertx submit \
$BINARY tx interchain-accounts controller send-tx connection-0 \
'{
"@type":"/cosmos.staking.v1beta1.MsgDelegate",
"delegator_address": "'"$ICS_TX_RESULT"'",
Expand All @@ -45,7 +45,7 @@ $BINARY tx intertx submit \
"denom": "uluna",
"amount": "'"$ICS_ACCOUNT_BALANCE"'"
}
}' --connection-id connection-0 --from $WALLET_1 --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 --broadcast-mode block --keyring-backend test -y &> /dev/null
}' --from $WALLET_1 --chain-id test-1 --home $CHAIN_DIR/test-1 --node tcp://localhost:16657 --broadcast-mode block --keyring-backend test -y &> /dev/null

VALIDATOR_DELEGATIONS=""
while [[ "$VALIDATOR_DELEGATIONS" != "$ICS_ACCOUNT_BALANCE" ]]; do
Expand Down

0 comments on commit 9aa1e74

Please sign in to comment.