Skip to content

Commit d504fb6

Browse files
author
hard-nett
committed
wasmlc: use builtIncapabilities for light client contracts
1 parent 17302af commit d504fb6

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

app/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func NewBitsongApp(
251251

252252
ibcWasmConfig := wasmlctypes.WasmConfig{
253253
DataDir: filepath.Join(homePath, "ibc_08-wasm"),
254-
SupportedCapabilities: []string{"iterator", "stargate", "abort"},
254+
SupportedCapabilities: keepers.ExtendedBuiltInCapabilities(),
255255
ContractDebugMode: false,
256256
}
257257

app/keepers/keepers.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ import (
8585
)
8686

8787
func ExtendedBuiltInCapabilities() []string {
88-
originalCaps := wasmkeeper.BuiltInCapabilities()
89-
extendedCaps := append(originalCaps, "bitsong", "cosmwasm_3_0")
90-
return extendedCaps
88+
return append(wasmkeeper.BuiltInCapabilities(), "bitsong", "cosmwasm_3_0")
9189
}
9290

9391
// module account permissions
@@ -186,7 +184,6 @@ func NewAppKeepers(
186184
// & add capability keeper and ScopeToModule for ibc module
187185
appKeepers.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, appKeepers.keys[capabilitytypes.StoreKey], appKeepers.memKeys[capabilitytypes.MemStoreKey])
188186
appKeepers.ScopedIBCKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
189-
appKeepers.ScopedTransferKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
190187
appKeepers.ScopedWasmKeeper = appKeepers.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName)
191188

192189
invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod))
@@ -287,11 +284,10 @@ func NewAppKeepers(
287284
)
288285
appKeepers.SlashingKeeper = &slashKeeper
289286

290-
// https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/UPGRADING.md?plain=1#L192
291287
mintKeeper := mintkeeper.NewKeeper(
292288
appCodec, runtime.NewKVStoreService(appKeepers.keys[minttypes.StoreKey]), stakingKeeper,
293289
appKeepers.AccountKeeper, appKeepers.BankKeeper, authtypes.FeeCollectorName, govModAddress,
294-
// mintkeeper.WithMintFn(myCustomMintFunc), // Use custom minting function
290+
// mintkeeper.WithMintFn(myCustomMintFunc), // Use custom minting function: https://github.com/cosmos/cosmos-sdk/blob/v0.53.0/UPGRADING.md?plain=1#L192
295291
)
296292
appKeepers.MintKeeper = &mintKeeper
297293

@@ -436,16 +432,15 @@ func NewAppKeepers(
436432
// wire wasm to IBC
437433

438434
// Create static IBC router, add transfer route, then set and seal it
439-
ibcRouter := porttypes.NewRouter()
440-
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack).
435+
ibcRouter := porttypes.NewRouter().
436+
AddRoute(ibctransfertypes.ModuleName, transferStack).
441437
AddRoute(wasmtypes.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.TransferKeeper, appKeepers.IBCKeeper.ChannelKeeper))
442-
443-
// Seal the router
444438
appKeepers.IBCKeeper.SetRouter(ibcRouter)
445439

446440
clientKeeper := appKeepers.IBCKeeper.ClientKeeper
447441
storeProvider := appKeepers.IBCKeeper.ClientKeeper.GetStoreProvider()
448442

443+
// Add tendermint & ibcWasm light client routes
449444
tmLightClientModule := ibctm.NewLightClientModule(appCodec, storeProvider)
450445
ibcWasmLightClientModule := ibcwlc.NewLightClientModule(*appKeepers.IBCWasmClientKeeper, storeProvider)
451446
clientKeeper.AddRoute(ibctm.ModuleName, &tmLightClientModule)

app/upgrades/v024/upgrades.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ func CreateV024Upgrade(mm *module.Manager, configurator module.Configurator, bpm
3232
// retrieve config.toml
3333
appConfigPath := filepath.Join(homepath, "config", "config.toml")
3434
configBytes, err := os.ReadFile(appConfigPath)
35-
35+
if err != nil {
36+
return nil, err
37+
}
3638
// unmarshal file
3739
var config map[string]interface{}
3840
if err := toml.Unmarshal(configBytes, &config); err != nil {

cmd/bitsongd/cmd/root.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
257257
testnetserver.AddTestnetCreatorCommand(rootCmd, newTestnetApp, addModuleInitFlags)
258258
wasmcli.ExtendUnsafeResetAllCmd(rootCmd)
259259

260+
// TODO: spin up a streaming oracle
261+
260262
// add keybase, auxiliary RPC, query, and tx child commands
261263
rootCmd.AddCommand(
262264
server.StatusCommand(),
@@ -265,7 +267,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
265267
queryCommand(),
266268
txCommand(),
267269
keys.Commands(),
268-
server.ExportCmd(appExport, bitsong.DefaultNodeHome),
269270
)
270271
}
271272

tests/ict/setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var (
6969
GasAdjustment: 2.0,
7070
TrustingPeriod: "112h",
7171
NoHostMount: false,
72-
ConfigFileOverrides: nil,
72+
ConfigFileOverrides: nil, // TODO: use faster blocks
7373
EncodingConfig: btsgEncoding(),
7474
ModifyGenesis: cosmos.ModifyGenesis(defaultGenesisKV),
7575
}

0 commit comments

Comments
 (0)