Skip to content

Commit

Permalink
chore: migrate wasm version
Browse files Browse the repository at this point in the history
  • Loading branch information
soring323 committed Mar 20, 2024
1 parent 8e69efb commit b85dd47
Show file tree
Hide file tree
Showing 6 changed files with 76,732 additions and 14,835 deletions.
6 changes: 2 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ func New(
interfaceRegistry := encodingConfig.InterfaceRegistry
txConfig := encodingConfig.TxConfig

//bitcoincdc.RegisterInterfaces(interfaceRegistry)
//bitcoincdc.RegisterCrypto(cdc)
bApp := baseapp.NewBaseApp(
Name,
logger,
Expand Down Expand Up @@ -461,8 +459,8 @@ func (app *App) ModuleManager() *module.Manager {
return app.mm
}

func GetWasmOpts(appOpts servertypes.AppOptions) []wasm.Option {
var wasmOpts []wasm.Option
func GetWasmOpts(appOpts servertypes.AppOptions) []wasmkeeper.Option {
var wasmOpts []wasmkeeper.Option
if cast.ToBool(appOpts.Get("telemetry.enabled")) {
wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer))
}
Expand Down
24 changes: 11 additions & 13 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ import (
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

"github.com/sideprotocol/packet-forward-middleware/v7/packetforward"
packetforwardkeeper "github.com/sideprotocol/packet-forward-middleware/v7/packetforward/keeper"
packetforwardtypes "github.com/sideprotocol/packet-forward-middleware/v7/packetforward/types"
)
Expand Down Expand Up @@ -120,7 +119,7 @@ type AppKeepers struct {
FeeGrantKeeper feegrantkeeper.Keeper
GroupKeeper groupkeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper
WasmKeeper wasm.Keeper
WasmKeeper wasmkeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -178,7 +177,7 @@ func (appKeepers *AppKeepers) InitSpecialKeepers(
appKeepers.ScopedIBCKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
appKeepers.ScopedICAHostKeeper = appKeepers.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
appKeepers.ScopedTransferKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
appKeepers.scopedWasmKeeper = appKeepers.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
appKeepers.scopedWasmKeeper = appKeepers.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName)

// TODO: Make a SetInvCheckPeriod fn on CrisisKeeper.
// IMO, its bad design atm that it requires this in state machine initialization
Expand Down Expand Up @@ -445,20 +444,19 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
// wire up x/wasm to IBC
// Create static IBC router, add transfer route, then set and seal it

var ics101WasmStack ibcporttypes.IBCModule
ics101WasmStack = wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper)
ics101WasmStack = packetforward.NewIBCMiddleware(
ics101WasmStack,
appKeepers.PacketForwardKeeper,
0, // retries on timeout
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, // forward timeout
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, // refund timeout
)
ics101WasmStack := wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper)
// ics101WasmStack = packetforward.NewIBCMiddleware(
// ics101WasmStack,
// appKeepers.PacketForwardKeeper,
// 0, // retries on timeout
// packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, // forward timeout
// packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, // refund timeout
// )

ibcRouter := ibcporttypes.NewRouter()
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
ibcRouter.AddRoute(wasm.ModuleName, ics101WasmStack)
ibcRouter.AddRoute(wasmtypes.ModuleName, ics101WasmStack)
// this line is used by starport scaffolding # ibc/app/router
appKeepers.IBCKeeper.SetRouter(ibcRouter)
}
Expand Down
2 changes: 1 addition & 1 deletion app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var moduleAccountPermissions = map[string][]string{
govtypes.ModuleName: {authtypes.Burner},
ibcfeetypes.ModuleName: nil,
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
wasm.ModuleName: {authtypes.Burner},
wasmTypes.ModuleName: {authtypes.Burner},
gmmmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
yieldmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
}
Expand Down
1 change: 1 addition & 0 deletions app/upgrades/v2/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func CreateUpgradeHandler(
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := ctx.Logger().With("upgrade", UpgradeName)
logger.Debug("running module migrations ...")
_ = keepers
return mm.RunMigrations(ctx, configurator, vm)
}
}
4 changes: 0 additions & 4 deletions cmd/sided/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,13 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
}

addr, err := sdk.AccAddressFromBech32(args[0])

if err != nil {
inBuf := bufio.NewReader(cmd.InOrStdin())
keyringBackend, err := cmd.Flags().GetString(flags.FlagKeyringBackend)
if err != nil {
return err
}

// attempt to lookup address from Keybase if no address was provided
//registry := codectypes.NewInterfaceRegistry()
//codec.NewProtoCodec(registry)
kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf, cdc)
if err != nil {
return err
Expand Down
Loading

0 comments on commit b85dd47

Please sign in to comment.