Skip to content

Commit

Permalink
todo async-icq
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Feb 28, 2024
1 parent 0c9bcfb commit f61d6cd
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 177 deletions.
53 changes: 27 additions & 26 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ import (
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"

// icq "github.com/cosmos/ibc-apps/modules/async-icq/v7" // TODO[1760]: async-icq
// icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v7/keeper" // TODO[1760]: async-icq
// icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types" // TODO[1760]: async-icq
icq "github.com/cosmos/ibc-apps/modules/async-icq/v8"
icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v8/keeper"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v8/types"

// "github.com/cosmos/cosmos-sdk/x/quarantine" // TODO[1760]: quarantine
// quarantinekeeper "github.com/cosmos/cosmos-sdk/x/quarantine/keeper" // TODO[1760]: quarantine
// quarantinemodule "github.com/cosmos/cosmos-sdk/x/quarantine/module" // TODO[1760]: quarantine
Expand Down Expand Up @@ -214,7 +215,7 @@ var (
ibc.AppModuleBasic{},
ibctransfer.AppModuleBasic{},
ica.AppModuleBasic{},
// icq.AppModuleBasic{}, // TODO[1760]: async-icq
icq.AppModuleBasic{},
ibchooks.AppModuleBasic{},
ibcratelimitmodule.AppModuleBasic{},

Expand Down Expand Up @@ -309,11 +310,11 @@ type App struct {
TriggerKeeper triggerkeeper.Keeper
OracleKeeper oraclekeeper.Keeper

IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
IBCHooksKeeper *ibchookskeeper.Keeper
ICAHostKeeper *icahostkeeper.Keeper
TransferKeeper *ibctransferkeeper.Keeper
// ICQKeeper icqkeeper.Keeper // TODO[1760]: async-icq
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
IBCHooksKeeper *ibchookskeeper.Keeper
ICAHostKeeper *icahostkeeper.Keeper
TransferKeeper *ibctransferkeeper.Keeper
ICQKeeper icqkeeper.Keeper
RateLimitingKeeper *ibcratelimitkeeper.Keeper

MarkerKeeper markerkeeper.Keeper
Expand Down Expand Up @@ -391,7 +392,7 @@ func New(
// ibchost.StoreKey, // TODO[1760]: ibc-host
ibctransfertypes.StoreKey,
icahosttypes.StoreKey,
// icqtypes.StoreKey, // TODO[1760]: async-icq
icqtypes.StoreKey,
ibchookstypes.StoreKey,
ibcratelimit.StoreKey,

Expand Down Expand Up @@ -444,7 +445,7 @@ func New(
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
// scopedICQKeeper := app.CapabilityKeeper.ScopeToModule(icqtypes.ModuleName) // TODO[1760]: async-icq
scopedICQKeeper := app.CapabilityKeeper.ScopeToModule(icqtypes.ModuleName)
scopedOracleKeeper := app.CapabilityKeeper.ScopeToModule(oracletypes.ModuleName)

// capability keeper must be sealed after scope to module registrations are completed.
Expand Down Expand Up @@ -600,17 +601,17 @@ func New(
app.AccountKeeper, scopedICAHostKeeper, pioMessageRouter, govAuthority,
)
app.ICAHostKeeper = &icaHostKeeper
// TODO[1760]: ica-host
// icaModule := ica.NewAppModule(nil, app.ICAHostKeeper)
// icaHostIBCModule := icahost.NewIBCModule(*app.ICAHostKeeper)

// TODO[1760]: async-icq
// app.ICQKeeper = icqkeeper.NewKeeper(
// appCodec, keys[icqtypes.StoreKey], app.GetSubspace(icqtypes.ModuleName),
// app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
// scopedICQKeeper, app.BaseApp.GRPCQueryRouter(),
//)
// icqModule := icq.NewAppModule(app.ICQKeeper)
// icqIBCModule := icq.NewIBCModule(app.ICQKeeper)
app.ICQKeeper = icqkeeper.NewKeeper(
appCodec, keys[icqtypes.StoreKey],
app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper,
scopedICQKeeper, app.BaseApp.GRPCQueryRouter(), govAuthority,
)
icqModule := icq.NewAppModule(app.ICQKeeper, app.GetSubspace(icqtypes.ModuleName))
icqIBCModule := icq.NewIBCModule(app.ICQKeeper)

// Init CosmWasm module
wasmDir := filepath.Join(homePath, "data", "wasm")
Expand Down Expand Up @@ -728,7 +729,7 @@ func New(
AddRoute(ibctransfertypes.ModuleName, app.TransferStack).
AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper)).
// AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). // TODO[1760]: ica-host
// AddRoute(icqtypes.ModuleName, icqIBCModule). // TODO[1760]: async-icq
AddRoute(icqtypes.ModuleName, icqIBCModule).
AddRoute(oracletypes.ModuleName, oracleModule)
app.IBCKeeper.SetRouter(ibcRouter)

Expand Down Expand Up @@ -789,7 +790,7 @@ func New(
ibcratelimitmodule.NewAppModule(appCodec, *app.RateLimitingKeeper, app.AccountKeeper, app.BankKeeper),
ibchooks.NewAppModule(app.AccountKeeper, *app.IBCHooksKeeper),
ibctransfer.NewAppModule(*app.TransferKeeper),
// icqModule, // TODO[1760]: async-icq
icqModule,
// icaModule, // TODO[1760]: ica-host
)

Expand Down Expand Up @@ -847,7 +848,7 @@ func New(
ibcratelimit.ModuleName,
ibchookstypes.ModuleName,
ibctransfertypes.ModuleName,
// icqtypes.ModuleName, // TODO[1760]: async-icq
icqtypes.ModuleName,
nametypes.ModuleName,
vestingtypes.ModuleName,
// quarantine.ModuleName, // TODO[1760]: quarantine
Expand Down Expand Up @@ -878,7 +879,7 @@ func New(
ibcratelimit.ModuleName,
ibchookstypes.ModuleName,
ibctransfertypes.ModuleName,
// icqtypes.ModuleName, // TODO[1760]: async-icq
icqtypes.ModuleName,
msgfeestypes.ModuleName,
wasm.ModuleName,
slashingtypes.ModuleName,
Expand Down Expand Up @@ -930,7 +931,7 @@ func New(

// ibchost.ModuleName, // TODO[1760]: ibc-host
ibctransfertypes.ModuleName,
// icqtypes.ModuleName, // TODO[1760]: async-icq
icqtypes.ModuleName,
icatypes.ModuleName,
ibcratelimit.ModuleName,
ibchookstypes.ModuleName,
Expand Down Expand Up @@ -973,7 +974,7 @@ func New(
ibcratelimit.ModuleName,
ibchookstypes.ModuleName,
icatypes.ModuleName,
// icqtypes.ModuleName, // TODO[1760]: async-icq
icqtypes.ModuleName,
wasm.ModuleName,

attributetypes.ModuleName,
Expand Down Expand Up @@ -1115,7 +1116,7 @@ func New(

app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper
// app.ScopedICQKeeper = scopedICQKeeper // TODO[1760]: async-icq
app.ScopedICQKeeper = scopedICQKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper

return app
Expand Down
21 changes: 10 additions & 11 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
storetypes "cosmossdk.io/store/types"
evidencetypes "cosmossdk.io/x/evidence/types"

// icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types" // TODO[1760]: async-icq
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v8/types"
// "github.com/cosmos/cosmos-sdk/x/quarantine" // TODO[1760]: quarantine
// "github.com/cosmos/cosmos-sdk/x/sanction" // TODO[1760]: sanction

Expand Down Expand Up @@ -107,16 +107,15 @@ func appStateWithICQ(appState json.RawMessage, cdc codec.JSONCodec) json.RawMess
if err != nil {
panic(fmt.Sprintf("error unmarshalling appstate: %v", err))
}
// TODO[1760]: async-icq
// icqGenJSON, icqGenFound := rawState[icqtypes.ModuleName]
// if !icqGenFound || len(icqGenJSON) == 0 {
// icqGenState := icqtypes.DefaultGenesis()
// rawState[icqtypes.ModuleName] = cdc.MustMarshalJSON(icqGenState)
// appState, err = json.Marshal(rawState)
// if err != nil {
// panic(fmt.Sprintf("error marshalling appstate: %v", err))
// }
// }
icqGenJSON, icqGenFound := rawState[icqtypes.ModuleName]
if !icqGenFound || len(icqGenJSON) == 0 {
icqGenState := icqtypes.DefaultGenesis()
rawState[icqtypes.ModuleName] = cdc.MustMarshalJSON(icqGenState)
appState, err = json.Marshal(rawState)
if err != nil {
panic(fmt.Sprintf("error marshalling appstate: %v", err))
}
}
return appState
}

Expand Down
8 changes: 4 additions & 4 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

// icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types" // TODO[1760]: async-icq
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v8/types"

"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -124,7 +124,7 @@ var upgrades = map[string]appUpgrade{

return vm, nil
},
Added: []string{ /* icqtypes.ModuleName, // TODO[1760]: async-icq */ oracletypes.ModuleName, ibchookstypes.StoreKey, hold.ModuleName, exchange.ModuleName},
Added: []string{icqtypes.ModuleName, oracletypes.ModuleName, ibchookstypes.StoreKey, hold.ModuleName, exchange.ModuleName},
},
"saffron-rc2": { // upgrade for v1.17.0-rc2
Handler: func(ctx sdk.Context, app *App, vm module.VersionMap) (module.VersionMap, error) {
Expand Down Expand Up @@ -174,7 +174,7 @@ var upgrades = map[string]appUpgrade{

return vm, nil
},
Added: []string{ /* icqtypes.ModuleName, // TODO[1760]: async-icq */ oracletypes.ModuleName, ibchookstypes.StoreKey, hold.ModuleName, exchange.ModuleName},
Added: []string{icqtypes.ModuleName, oracletypes.ModuleName, ibchookstypes.StoreKey, hold.ModuleName, exchange.ModuleName},
},
"tourmaline-rc1": { // upgrade for v1.18.0-rc1
Added: []string{ibcratelimit.ModuleName},
Expand Down Expand Up @@ -421,7 +421,7 @@ func setAccountDataNameRecord(ctx sdk.Context, accountK attributetypes.AccountKe
// TODO: Remove with the saffron handlers.
func setupICQ(ctx sdk.Context, app *App) {
ctx.Logger().Info("Updating ICQ params")
// app.ICQKeeper.SetParams(ctx, icqtypes.NewParams(true, []string{"/provenance.oracle.v1.Query/Oracle"})) // TODO[1760]: async-icq
app.ICQKeeper.SetParams(ctx, icqtypes.NewParams(true, []string{"/provenance.oracle.v1.Query/Oracle"}))

Check failure on line 424 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Error return value of `app.ICQKeeper.SetParams` is not checked (errcheck)
ctx.Logger().Info("Done updating ICQ params")
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ require (
github.com/cosmos/cosmos-sdk v0.50.4
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.11
github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0
github.com/cosmos/ibc-go/modules/capability v1.0.0
// github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.1.1 // TODO[1760]: async-icq: Need a v0.50 compatible version.
github.com/cosmos/ibc-go/v8 v8.0.0
// github.com/cosmos/rosetta v0.50.2 // TODO[1760]: rosetta
github.com/ghodss/yaml v1.0.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR
github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y=
github.com/cosmos/iavl v1.0.1 h1:D+mYbcRO2wptYzOM1Hxl9cpmmHU1ZEt9T2Wv5nZTeUw=
github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY=
github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0 h1:nKP2+Rzlz2iyvTosY5mvP+aEBPe06oaDl3G7xLGBpNI=
github.com/cosmos/ibc-apps/modules/async-icq/v8 v8.0.0/go.mod h1:D3Q380FpWRFtmUQWLosPxachi6w24Og2t5u/Tww5wtY=
github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE=
github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco=
github.com/cosmos/ibc-go/v8 v8.0.0 h1:QKipnr/NGwc+9L7NZipURvmSIu+nw9jOIWTJuDBqOhg=
Expand Down
Loading

0 comments on commit f61d6cd

Please sign in to comment.