Skip to content

Commit

Permalink
Develop (#459)
Browse files Browse the repository at this point in the history
* fix(docs): move docs away from root folder to prevent errors, update scripts

* fix(upgrade): fix empty icq params upgrade panic, add liquidstake queries to wasm stargate whitelist
  • Loading branch information
Michael-Ixo authored Nov 29, 2024
1 parent 7e1e0f9 commit 5631a9c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
26 changes: 13 additions & 13 deletions app/upgrades/v4/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,19 @@ func CreateUpgradeHandler(
subspace.Set(ctx, stakingtypes.KeyGlobalLiquidStakingCap, ValidatorLiquidStakingCap)
subspace.Set(ctx, stakingtypes.KeyValidatorLiquidStakingCap, GlobalLiquidStakingCap)
}

// If the subspace is for icq, set the new icq params before migration
// otheriwse chain like ixo devnet with no AllowQueries throw error on emoty bytes decode
// during RunMigrations
if subspace.Name() == icqtypes.ModuleName {
ctx.Logger().Info("Set new icq params before migration")
icqparams := icqtypes.DefaultParams()
icqparams.AllowQueries = wasmbinding.GetStargateWhitelistedPaths()
// Adding SmartContractState query to allowlist
icqparams.AllowQueries = append(icqparams.AllowQueries, "/cosmwasm.wasm.v1.Query/SmartContractState")
subspace.Set(ctx, icqtypes.KeyAllowQueries, icqparams.AllowQueries)
subspace.Set(ctx, icqtypes.KeyHostEnabled, icqparams.HostEnabled)
}
}

// Migrate Tendermint consensus parameters from x/params module to a deprecated x/consensus module.
Expand Down Expand Up @@ -210,19 +223,6 @@ func CreateUpgradeHandler(
liquidStakeParams.FeeAccountAddress = LSMFeeAccountAddress
keepers.LiquidStakeKeeper.SetParams(ctx, liquidStakeParams)

// -------------------------------------------------
// Set the ICQ params in the store
// -------------------------------------------------
ctx.Logger().Info("Set ICQKeeper params")
icqparams := icqtypes.DefaultParams()
icqparams.AllowQueries = wasmbinding.GetStargateWhitelistedPaths()
// Adding SmartContractState query to allowlist
icqparams.AllowQueries = append(icqparams.AllowQueries, "/cosmwasm.wasm.v1.Query/SmartContractState")
err = keepers.ICQKeeper.SetParams(ctx, icqparams)
if err != nil {
return nil, err
}

// -------------------------------------------------
// Set the ICA Host params in the store
// -------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions wasmbinding/stargate_whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
entitytypes "github.com/ixofoundation/ixo-blockchain/v4/x/entity/types"
epochtypes "github.com/ixofoundation/ixo-blockchain/v4/x/epochs/types"
iidtypes "github.com/ixofoundation/ixo-blockchain/v4/x/iid/types"
liquidstaketypes "github.com/ixofoundation/ixo-blockchain/v4/x/liquidstake/types"
minttypes "github.com/ixofoundation/ixo-blockchain/v4/x/mint/types"
smartaccounttypes "github.com/ixofoundation/ixo-blockchain/v4/x/smart-account/types"
tokentypes "github.com/ixofoundation/ixo-blockchain/v4/x/token/types"
Expand Down Expand Up @@ -126,6 +127,11 @@ func init() {
// mint
setWhitelistedQuery("/ixo.mint.v1beta1.Query/Params", &minttypes.QueryParamsResponse{})
setWhitelistedQuery("/ixo.mint.v1beta1.Query/EpochProvisions", &minttypes.QueryEpochProvisionsResponse{})

// liquidstake
setWhitelistedQuery("/ixo.liquidstake.v1beta1.Query/Params", &liquidstaketypes.QueryParamsResponse{})
setWhitelistedQuery("/ixo.liquidstake.v1beta1.Query/LiquidValidators", &liquidstaketypes.QueryLiquidValidatorsResponse{})
setWhitelistedQuery("/ixo.liquidstake.v1beta1.Query/States", &liquidstaketypes.QueryStatesResponse{})
}

// IsWhitelistedQuery returns if the query is not whitelisted.
Expand Down

0 comments on commit 5631a9c

Please sign in to comment.