Skip to content

Commit f9316b2

Browse files
atheeshpankurdotbEengineer1
authored
fix: Added ICQ module to compliment fee-abstraction + automated tests (#861)
* fix tests * fix tests * integrate icq * make proto-gen * npm update * review * refactor * Pin to latest versions * Capture both output streams + balance adjustments * Restored logic + added dedicated workflow step * Ignore SC2034 * Added minor upgrade handler --------- Co-authored-by: Ankur Banerjee <[email protected]> Co-authored-by: Tasos Derisiotis <[email protected]>
1 parent ae5e5e7 commit f9316b2

21 files changed

+252
-160
lines changed

.github/workflows/test.yml

+10
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ jobs:
170170
name: report-integration.xml
171171
path: report-integration.xml
172172

173+
fee-abstraction-tests:
174+
name: "Fee Abstraction Tests"
175+
runs-on: ubuntu-24.04
176+
steps:
177+
- uses: actions/checkout@v4
178+
179+
- name: Execute fee-abstraction logic by paying in `uosmo`
180+
working-directory: ./tests/fee-abs
181+
run: bash fee-abs-test.sh
182+
173183
upgrade-tests:
174184
name: "Upgrade Tests"
175185
runs-on: ubuntu-24.04

app/app.go

+60
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package app
22

33
import (
4+
"errors"
45
"fmt"
56
"io"
67
"net/http"
@@ -102,6 +103,9 @@ import (
102103
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
103104
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
104105
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
106+
icq "github.com/cosmos/ibc-apps/modules/async-icq/v7"
107+
icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v7/keeper"
108+
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types"
105109
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
106110
icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller"
107111
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
@@ -175,6 +179,7 @@ var (
175179
transfer.AppModuleBasic{},
176180
ica.AppModuleBasic{},
177181
upgrade.AppModuleBasic{},
182+
icq.AppModuleBasic{},
178183
evidence.AppModuleBasic{},
179184
vesting.AppModuleBasic{},
180185
feegrantmodule.AppModuleBasic{},
@@ -193,6 +198,7 @@ var (
193198
authtypes.FeeCollectorName: nil,
194199
distrtypes.ModuleName: nil,
195200
icatypes.ModuleName: nil,
201+
icqtypes.ModuleName: nil,
196202
minttypes.ModuleName: {authtypes.Minter},
197203
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
198204
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
@@ -243,6 +249,7 @@ type App struct {
243249
IBCFeeKeeper ibcfeekeeper.Keeper
244250
ICAControllerKeeper icacontrollerkeeper.Keeper
245251
ICAHostKeeper icahostkeeper.Keeper
252+
ICQKeeper *icqkeeper.Keeper
246253
EvidenceKeeper evidencekeeper.Keeper
247254
TransferKeeper ibctransferkeeper.Keeper
248255
FeeGrantKeeper feegrantkeeper.Keeper
@@ -325,6 +332,7 @@ func New(
325332
ibctransfertypes.StoreKey,
326333
icacontrollertypes.StoreKey,
327334
icahosttypes.StoreKey,
335+
icqtypes.StoreKey,
328336
capabilitytypes.StoreKey,
329337
authzkeeper.StoreKey,
330338
group.StoreKey,
@@ -362,6 +370,7 @@ func New(
362370
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
363371
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
364372
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
373+
scopedICQKeeper := app.CapabilityKeeper.ScopeToModule(icqtypes.ModuleName)
365374
scopedResourceKeeper := app.CapabilityKeeper.ScopeToModule(resourcetypes.ModuleName)
366375
scopedFeeabsKeeper := app.CapabilityKeeper.ScopeToModule(feeabstypes.ModuleName)
367376

@@ -527,6 +536,25 @@ func New(
527536
// Create IBC Router
528537
ibcRouter := porttypes.NewRouter()
529538

539+
// ICQ Keeper
540+
icqKeeper := icqkeeper.NewKeeper(
541+
appCodec,
542+
app.keys[icqtypes.StoreKey],
543+
app.IBCKeeper.ChannelKeeper,
544+
app.IBCKeeper.ChannelKeeper,
545+
&app.IBCKeeper.PortKeeper,
546+
app.ScopedICQKeeper,
547+
bApp.GRPCQueryRouter(),
548+
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
549+
)
550+
app.ICQKeeper = &icqKeeper
551+
552+
// Create Async ICQ module
553+
icqModule := icq.NewIBCModule(*app.ICQKeeper)
554+
555+
// Add icq modules to IBC router
556+
ibcRouter.AddRoute(icqtypes.ModuleName, icqModule)
557+
530558
// Middleware Stacks
531559

532560
// Create Transfer Keeper and pass IBCFeeKeeper as expected Channel and PortKeeper
@@ -728,6 +756,7 @@ func New(
728756
didtypes.ModuleName,
729757
resourcetypes.ModuleName,
730758
consensusparamtypes.ModuleName,
759+
icqtypes.ModuleName,
731760
feemarkettypes.ModuleName,
732761
)
733762

@@ -758,6 +787,7 @@ func New(
758787
ibcfeetypes.ModuleName,
759788
consensusparamtypes.ModuleName,
760789
feemarkettypes.ModuleName,
790+
icqtypes.ModuleName,
761791
)
762792

763793
// NOTE: The genutils module must occur after staking so that pools are
@@ -782,6 +812,7 @@ func New(
782812
ibctransfertypes.ModuleName,
783813
feeabstypes.ModuleName,
784814
icatypes.ModuleName,
815+
icqtypes.ModuleName,
785816
ibcfeetypes.ModuleName,
786817
feegrant.ModuleName,
787818
group.ModuleName,
@@ -874,6 +905,7 @@ func New(
874905
app.ScopedTransferKeeper = scopedTransferKeeper
875906
app.ScopedICAControllerKeeper = scopedICAControllerKeeper
876907
app.ScopedICAHostKeeper = scopedICAHostKeeper
908+
app.ScopedICQKeeper = scopedICQKeeper
877909
app.ScopedResourceKeeper = scopedResourceKeeper
878910
app.ScopedFeeAbsKeeper = scopedFeeabsKeeper
879911

@@ -1154,6 +1186,11 @@ func (app *App) RegisterUpgradeHandlers() {
11541186
if err != nil {
11551187
return migrations, err
11561188
}
1189+
// remove the old host zone config and add the new one
1190+
err = ReplaceHostZoneConfig(ctx, &app.FeeabsKeeper)
1191+
if err != nil {
1192+
return migrations, err
1193+
}
11571194
return migrations, nil
11581195
},
11591196
)
@@ -1231,3 +1268,26 @@ func SetExplicitModuleAccountPermissions(ctx sdk.Context, accountKeeper authkeep
12311268
panic("failed to cast module account to *ModuleAccount")
12321269
}
12331270
}
1271+
1272+
func ReplaceHostZoneConfig(ctx sdk.Context, feeAbsKeeper *feeabskeeper.Keeper) error {
1273+
// disregard, if not mainnet
1274+
if ctx.ChainID() != "cheqd-mainnet-1" {
1275+
return nil
1276+
}
1277+
// remove the old host zone config and add the new one
1278+
err := feeAbsKeeper.DeleteHostZoneConfig(ctx, "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4")
1279+
// ignore error if not found
1280+
if err != nil && !errors.Is(err, feeabstypes.ErrHostZoneConfigNotFound) {
1281+
return err
1282+
}
1283+
err = feeAbsKeeper.SetHostZoneConfig(ctx, feeabstypes.HostChainFeeAbsConfig{
1284+
IbcDenom: "ibc/F5FABF52B54E65064B57BF6DBD8E5FAD22CEE9F4B8A57ADBB20CCD0173AA72A4",
1285+
OsmosisPoolTokenDenomIn: "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4",
1286+
PoolId: 1273,
1287+
MinSwapAmount: 0,
1288+
})
1289+
if err != nil {
1290+
return err
1291+
}
1292+
return nil
1293+
}

app/upgrades/v3/const.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package v3
22

33
const (
44
UpgradeName = "v3"
5-
MinorUpgradeName = "v3.1.5"
5+
MinorUpgradeName = "v3.1.9"
66
)

go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ require (
1313
github.com/cosmos/cosmos-proto v1.0.0-beta.5
1414
github.com/cosmos/cosmos-sdk v0.47.17
1515
github.com/cosmos/gogoproto v1.7.0
16+
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.1.1
1617
github.com/cosmos/ibc-go/v7 v7.10.0
1718
github.com/gabriel-vasile/mimetype v1.4.8
1819
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
@@ -235,7 +236,7 @@ replace (
235236
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
236237
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0
237238

238-
github.com/osmosis-labs/fee-abstraction/v7 => github.com/cheqd/fee-abstraction/v7 v7.0.3-0.20240919093501-645e58a8252d
239+
github.com/osmosis-labs/fee-abstraction/v7 => github.com/cheqd/fee-abstraction/v7 v7.0.3-0.20250402151959-20551574d865
239240

240241
github.com/skip-mev/feemarket => github.com/cheqd/feemarket v1.0.4-sdk47.0.20240919093317-104ec7d7b634
241242

go.sum

+4-2
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhD
286286
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
287287
github.com/cheqd/cosmos-sdk v0.47.17-height-mismatch-patched h1:dex69vrjCYT/yXaKu60xQdTV0rC+bPCPQ8O+3wd6C34=
288288
github.com/cheqd/cosmos-sdk v0.47.17-height-mismatch-patched/go.mod h1:6L16fRG0ZinyyYMclrVAGqTUyb5UGu/hlx5oZEI6NAY=
289-
github.com/cheqd/fee-abstraction/v7 v7.0.3-0.20240919093501-645e58a8252d h1:HEfYvzR6dO1ucjYz+5A5mSpGXQa3kcfql31U5eh4YeU=
290-
github.com/cheqd/fee-abstraction/v7 v7.0.3-0.20240919093501-645e58a8252d/go.mod h1:3ETAhKDNNgXFbLWqzQLbupK8k0yGQJeITiKZ7C3BQw8=
289+
github.com/cheqd/fee-abstraction/v7 v7.0.3-0.20250402151959-20551574d865 h1:6Cjm9z5/KjIeBAVk6qw5duVvKRa8lKJLdnes6mMg6gM=
290+
github.com/cheqd/fee-abstraction/v7 v7.0.3-0.20250402151959-20551574d865/go.mod h1:3ETAhKDNNgXFbLWqzQLbupK8k0yGQJeITiKZ7C3BQw8=
291291
github.com/cheqd/feemarket v1.0.4-sdk47.0.20240919093317-104ec7d7b634 h1:MlaUdJBL7kbeHu9QbcnZKctozWrup5OMgM4jfJhjQcA=
292292
github.com/cheqd/feemarket v1.0.4-sdk47.0.20240919093317-104ec7d7b634/go.mod h1:4y+Z0lf8SffiLdKnRFvWpLDyiFLvcEGhJgou5SAI8yE=
293293
github.com/cheqd/iavl v0.20.1-uneven-heights h1:9gN2bFd15Z7X0lYu/RfQCxVBpmbV38GxuaeA7QTjH/o=
@@ -356,6 +356,8 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr
356356
github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
357357
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.2 h1:6zjj+yIpMbCTRI2eJ2fXuflElENs3mrUSLH/TSWL8fk=
358358
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.2/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s=
359+
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.1.1 h1:02RCbih5lQ8aGdDMSvxhTnk5JDLEDitn17ytEE1Qhko=
360+
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.1.1/go.mod h1:LvVkEXTORVgd87W2Yu7ZY3acKKeTMq/txdTworn8EZI=
359361
github.com/cosmos/ibc-go/v7 v7.10.0 h1:/IUJ6wilNnGcpP5XMb7p74JnctKDrFSv30i7aoJRnVI=
360362
github.com/cosmos/ibc-go/v7 v7.10.0/go.mod h1:PiVSJhIPBq/rI+6UOfKPy4RKDCvQ2vR+Vdb6SaowETQ=
361363
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=

go.work.sum

+3
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8/go.mod h1:gakxgyXa
275275
github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+UIPD+Gww=
276276
github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E=
277277
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U=
278+
github.com/cheqd/fee-abstraction/v7 v7.0.3-0.20250402151959-20551574d865/go.mod h1:3ETAhKDNNgXFbLWqzQLbupK8k0yGQJeITiKZ7C3BQw8=
278279
github.com/chigopher/pathlib v0.12.0/go.mod h1:EJ5UtJ/sK8Nt6q3VWN+EwZLZ3g0afJiG8NegYiQQ/gQ=
279280
github.com/chigopher/pathlib v0.19.1/go.mod h1:tzC1dZLW8o33UQpWkNkhvPwL5n4yyFRFm/jL1YGWFvY=
280281
github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs=
@@ -851,6 +852,7 @@ github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHN
851852
github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
852853
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
853854
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
855+
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
854856
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
855857
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
856858
github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI=
@@ -1203,6 +1205,7 @@ google.golang.org/api v0.176.1/go.mod h1:j2MaSDYcvYV1lkZ1+SMW4IeF90SrEyFA+tluDYW
12031205
google.golang.org/api v0.177.0/go.mod h1:srbhue4MLjkjbkux5p3dw/ocYOSZTaIEvf7bCOnFQDw=
12041206
google.golang.org/api v0.178.0/go.mod h1:84/k2v8DFpDRebpGcooklv/lais3MEfqpaBLA12gl2U=
12051207
google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
1208+
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
12061209
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
12071210
google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
12081211
google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=

0 commit comments

Comments
 (0)