Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds ICQHost and Oracle Module #1643

Merged
merged 105 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
b9b70d4
Added protos for oracle module.
Jul 27, 2023
d76d082
Added simple implementation for the oracle module. No logic, tests, o…
Jul 27, 2023
f05b400
Fixed signature of OracleResult.
Jul 27, 2023
b01c9af
Added async-icq to provenance. Still need to hook up oracle module, a…
Jul 27, 2023
9a3a534
Added the oracle module app.go
Jul 27, 2023
2b97f26
Added empty Msg interface implementation for UpdateOracle.
Jul 27, 2023
210cb1d
Added ICQKeeper to OracleKeeper. Made the QueryOracle request a trans…
Jul 28, 2023
457dae2
Added some more stuff from the example ICQ Controller created by Quas…
Jul 28, 2023
204767e
Added some more functions from quasar and got the setup to build and …
Jul 31, 2023
32faa3e
I successfully hooked up interchain queries. I just need to tailor it…
Aug 1, 2023
13b308b
Disconnected example ICQ and started writing our own. Added some impl…
Aug 2, 2023
520eb71
Finished basic implementation of Chain1 -> Chain2 -> Contract impleme…
Aug 3, 2023
b2b16c5
Renamed queries and transactions. Added ExportGenesis logic. Fixed so…
Aug 3, 2023
2a20ade
Moved some functions around and renamed files.
Aug 3, 2023
3ec7d93
Removed the ibc events and made them query typed events.
Aug 3, 2023
0c59b77
Updated CHANGELOG.
Aug 3, 2023
1b678d1
Updated documentation for CLI and fixed command names.
Aug 3, 2023
ea5dcfe
More cleanup and removal of unused method.
Aug 3, 2023
f55f793
Added ValidateBasic logic and some error checks on the query server.
Aug 3, 2023
d562b07
Added more documentation and moved keys to single file.
Aug 4, 2023
1eaf2b8
Fixed module naming in comments.
Aug 4, 2023
20a124d
Updated genesis.go errors and added tests.
Aug 4, 2023
cbde82d
Added tests for keys and ensured all keys have getters.
Aug 4, 2023
4d6dbb4
Added tests for msgs.
Aug 4, 2023
a10304a
Removed references to contract, and used oracle instead. Updated docu…
Aug 4, 2023
16d1be9
Changed update oracle to be a proposal.
Aug 7, 2023
65ff1bb
Finished README and concepts.
Aug 7, 2023
f55974e
Added note about the ibc channel.
Aug 7, 2023
6586599
Added state to spec.
Aug 7, 2023
ccd7676
Added messages spec.
Aug 7, 2023
96f828b
Added queries spec.
Aug 7, 2023
15ec852
Finished documentation for events.
Aug 7, 2023
930a5c3
Finished documentation for genesis.
Aug 7, 2023
b52cc25
Fixed typo in documentation.
Aug 7, 2023
0c70023
Added table of contents to all spec files.
Aug 7, 2023
f2aad08
Updated proto comment.
Aug 8, 2023
f2116ed
Hooked up the simulation tests, but have not verified their correctness.
Aug 8, 2023
a331111
Added genesis tests for keeper.
Aug 8, 2023
8802a2c
Added oracle keeper tests.
Aug 8, 2023
2af9b51
Added tests for params.
Aug 8, 2023
f5ce91d
Updated comments in keeper.go
Aug 9, 2023
3d6415e
Added missing keeper_test for setup of previous committed tests.
Aug 9, 2023
3867562
Added tests for the query_server. Did not do QueryState since it's be…
Aug 9, 2023
e5f3605
Added tests for query.
Aug 9, 2023
2ff17e6
Added tests for message server, and added mocks to properly mock keep…
Aug 9, 2023
b695a8e
Added icq query tests. Updated channel keeper mock to have pointer re…
Aug 9, 2023
ce2cd36
Finished tests for relay.go
Aug 9, 2023
5afab1b
Removed storing query request and response in state and just have the…
Aug 9, 2023
cc57942
Updated spec with removal of query request response state. Updated ev…
Aug 10, 2023
6291d15
Updated the error for channel id validate basic.
Aug 10, 2023
a41e4c9
Added the oracle to the genesis state.
Aug 10, 2023
ba0b65c
Error is not thrown when oracle is not set. Empty address will just b…
Aug 10, 2023
739270f
Added cli queries test for oracle.
Aug 10, 2023
3478888
Updated link in genesis spec.
Aug 10, 2023
8492f30
Added cli tx test for oracle.
Aug 10, 2023
546e2c2
First attempt at simulation tets for oracle module.
Aug 10, 2023
ee54dbb
Linted files and fixed one sim test.
Aug 10, 2023
2759158
Updated sim_test.go to add app state for icq.
Aug 10, 2023
8e41674
Added saffron upgrade with oracle and icqhost configure.
Aug 11, 2023
723958d
Merged in main.
Aug 11, 2023
c4305c0
Did some linting on the code.
Aug 11, 2023
6429888
Fixed some more linting issues.
Aug 11, 2023
672e524
Ran lint fix on modules.
Aug 11, 2023
d65def2
Added error checking for emitted typed events.
Aug 11, 2023
1b3ff9f
Fixed some more linting issues.
Aug 11, 2023
be17d45
Fixed linting on file with gci.
Aug 11, 2023
14bd60d
Added saffron and saffron-rc1 release. Added upgrade tests for them.
Aug 11, 2023
42e2c44
Merged in main.
Aug 11, 2023
ee771cb
Added logic for testnet in upgrade handler.
Aug 11, 2023
e9f098e
Fixed comment.
Aug 11, 2023
653717c
Removed params.
Aug 11, 2023
d299eac
Updated comment for BindPort.
Aug 11, 2023
6822542
Split interface check on multiple lines.
Aug 11, 2023
83b87e8
Moved methods up.
Aug 11, 2023
deaeec0
Moved saffron-rc1 upgrade up 1.
Aug 11, 2023
f94ef41
Added removeInactiveValidatorDelegations.
Aug 11, 2023
3c71f15
Changed Equal(0) test to .Empty
Aug 11, 2023
0dc658c
Removed nil check.
Aug 11, 2023
bd2c0a0
Merged in main.
Aug 11, 2023
0bf7f23
Updated comments.
Aug 11, 2023
e8a202b
Removed unused error and fixed linting issue with unused param.
Aug 11, 2023
d352046
Merge branch 'main' into taztingo/1497-oracle-support
iramiller Aug 14, 2023
15048e6
Removed the LastSequenceNumber because it is no longer used.
Aug 28, 2023
644454d
Bump bufbuild/buf-setup-action from 1.26.0 to 1.26.1 (#1650)
dependabot[bot] Aug 15, 2023
fe82397
Bump golangci/golangci-lint-action from 3.6.0 to 3.7.0 (#1651)
dependabot[bot] Aug 15, 2023
2e1e7cb
Allow restricted coins to be quarantined (#1652)
SpicyLemon Aug 18, 2023
cc6ed00
Bump github.com/google/uuid from 1.3.0 to 1.3.1 (#1657)
dependabot[bot] Aug 22, 2023
f8ee015
Updated dependencies.
Aug 28, 2023
0cb4986
Updated specs for Oracle module.
Aug 28, 2023
a8ee7fe
Merged in main.
Aug 28, 2023
a2995ba
Simplified tx and removed useless gov flag.
Aug 28, 2023
f0ba896
Removed multiple decoders.
Aug 28, 2023
4ed48ad
Removed pointer arg since it was only needed for tests. Updated tests…
Aug 28, 2023
5c4c6be
Merge branch 'main' into taztingo/1497-oracle-support
Aug 28, 2023
ed6eba5
Removed 99designs keyring dependency and replaced it with cosmos keyr…
Aug 29, 2023
0247454
Merge branch 'main' into taztingo/1497-oracle-support
Aug 31, 2023
721797b
Merged in main.
Aug 31, 2023
a7bd8ad
Remove remaining references to LastQuerySequence.
Sep 1, 2023
0876fc4
Add decoder test that was missing.
Sep 1, 2023
e999a92
Add genesis_tests for simulation.
Sep 1, 2023
82937f4
Removed paramspace.
Sep 5, 2023
3782a95
Fix test name.
Sep 5, 2023
2903377
Move tested pieces into variables.
Sep 5, 2023
42b0c72
Remove State from TOC.
Sep 5, 2023
521674f
Merge branch 'main' into taztingo/1497-oracle-support
Sep 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Features

* Allow marker's transfer authority to prevent transfer of restricted coin with deny list on send [#1518](https://github.com/provenance-io/provenance/issues/1518).
* Add ICQHost and Oracle module to allow cross chain oracle queries [#1497](https://github.com/provenance-io/provenance/issues/1497).
* New `GetByAddr` metadata query [#1443](https://github.com/provenance-io/provenance/issues/1443).
* Add Trigger module queries to stargate whitelist for smart contracts [#1636](https://github.com/provenance-io/provenance/issues/1636)
* Added the saffron upgrade handlers [PR 1648](https://github.com/provenance-io/provenance/pull/1648).
Expand Down
55 changes: 54 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import (
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"
"github.com/spf13/viper"
icq "github.com/strangelove-ventures/async-icq/v6"
icqkeeper "github.com/strangelove-ventures/async-icq/v6/keeper"
icqtypes "github.com/strangelove-ventures/async-icq/v6/types"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
Expand Down Expand Up @@ -153,6 +156,9 @@ import (
namekeeper "github.com/provenance-io/provenance/x/name/keeper"
nametypes "github.com/provenance-io/provenance/x/name/types"
namewasm "github.com/provenance-io/provenance/x/name/wasm"
oraclekeeper "github.com/provenance-io/provenance/x/oracle/keeper"
oraclemodule "github.com/provenance-io/provenance/x/oracle/module"
oracletypes "github.com/provenance-io/provenance/x/oracle/types"
rewardkeeper "github.com/provenance-io/provenance/x/reward/keeper"
rewardmodule "github.com/provenance-io/provenance/x/reward/module"
rewardtypes "github.com/provenance-io/provenance/x/reward/types"
Expand Down Expand Up @@ -207,6 +213,7 @@ var (
ibc.AppModuleBasic{},
ibctransfer.AppModuleBasic{},
ica.AppModuleBasic{},
icq.AppModuleBasic{},
ibchooks.AppModuleBasic{},

marker.AppModuleBasic{},
Expand All @@ -217,6 +224,7 @@ var (
msgfeesmodule.AppModuleBasic{},
rewardmodule.AppModuleBasic{},
triggermodule.AppModuleBasic{},
oraclemodule.AppModuleBasic{},
holdmodule.AppModuleBasic{},
)

Expand All @@ -238,6 +246,7 @@ var (
wasm.ModuleName: {authtypes.Burner},
rewardtypes.ModuleName: nil,
triggertypes.ModuleName: nil,
oracletypes.ModuleName: nil,
}
)

Expand Down Expand Up @@ -295,11 +304,13 @@ type App struct {
QuarantineKeeper quarantinekeeper.Keeper
SanctionKeeper sanctionkeeper.Keeper
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

MarkerKeeper markerkeeper.Keeper
MetadataKeeper metadatakeeper.Keeper
Expand All @@ -313,6 +324,8 @@ type App struct {
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedICQKeeper capabilitykeeper.ScopedKeeper
ScopedOracleKeeper capabilitykeeper.ScopedKeeper

TransferStack *ibchooks.IBCMiddleware
Ics20WasmHooks *ibchooks.WasmHooks
Expand Down Expand Up @@ -370,6 +383,7 @@ func New(
ibchost.StoreKey,
ibctransfertypes.StoreKey,
icahosttypes.StoreKey,
icqtypes.StoreKey,
ibchookstypes.StoreKey,

metadatatypes.StoreKey,
Expand All @@ -382,6 +396,7 @@ func New(
quarantine.StoreKey,
sanction.StoreKey,
triggertypes.StoreKey,
oracletypes.StoreKey,
hold.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -417,6 +432,8 @@ 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)
scopedOracleKeeper := app.CapabilityKeeper.ScopeToModule(oracletypes.ModuleName)

// capability keeper must be sealed after scope to module registrations are completed.
app.CapabilityKeeper.Seal()
Expand Down Expand Up @@ -558,6 +575,14 @@ func New(
icaModule := ica.NewAppModule(nil, app.ICAHostKeeper)
icaHostIBCModule := icahost.NewIBCModule(*app.ICAHostKeeper)

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

// Init CosmWasm module
wasmDir := filepath.Join(homePath, "data", "wasm")

Expand Down Expand Up @@ -617,6 +642,19 @@ func New(
app.Ics20WasmHooks.ContractKeeper = app.WasmKeeper // app.ContractKeeper -- this changes in the next version of wasm to a permissioned keeper
app.IBCHooksKeeper.ContractKeeper = app.ContractKeeper

app.ScopedOracleKeeper = scopedOracleKeeper
app.OracleKeeper = *oraclekeeper.NewKeeper(
appCodec,
keys[oracletypes.StoreKey],
keys[oracletypes.MemStoreKey],
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
scopedOracleKeeper,
wasmkeeper.Querier(app.WasmKeeper),
)
oracleModule := oraclemodule.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper, app.IBCKeeper.ChannelKeeper)

unsanctionableAddrs := make([]sdk.AccAddress, 0, len(maccPerms)+1)
for mName := range maccPerms {
unsanctionableAddrs = append(unsanctionableAddrs, authtypes.NewModuleAddress(mName))
Expand Down Expand Up @@ -648,7 +686,9 @@ func New(
ibcRouter.
AddRoute(ibctransfertypes.ModuleName, app.TransferStack).
AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper)).
AddRoute(icahosttypes.SubModuleName, icaHostIBCModule)
AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(icqtypes.ModuleName, icqIBCModule).
AddRoute(oracletypes.ModuleName, oracleModule)
app.IBCKeeper.SetRouter(ibcRouter)

// Create evidence Keeper for to register the IBC light client misbehavior evidence route
Expand Down Expand Up @@ -699,12 +739,14 @@ func New(
wasm.NewAppModule(appCodec, app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
rewardmodule.NewAppModule(appCodec, app.RewardKeeper, app.AccountKeeper, app.BankKeeper),
triggermodule.NewAppModule(appCodec, app.TriggerKeeper, app.AccountKeeper, app.BankKeeper),
oracleModule,
holdmodule.NewAppModule(appCodec, app.HoldKeeper),

// IBC
ibc.NewAppModule(app.IBCKeeper),
ibchooks.NewAppModule(app.AccountKeeper, *app.IBCHooksKeeper),
ibctransfer.NewAppModule(*app.TransferKeeper),
icqModule,
icaModule,
)

Expand Down Expand Up @@ -739,9 +781,11 @@ func New(
paramstypes.ModuleName,
msgfeestypes.ModuleName,
metadatatypes.ModuleName,
oracletypes.ModuleName,
wasm.ModuleName,
ibchookstypes.ModuleName,
ibctransfertypes.ModuleName,
icqtypes.ModuleName,
nametypes.ModuleName,
vestingtypes.ModuleName,
quarantine.ModuleName,
Expand All @@ -764,11 +808,13 @@ func New(
distrtypes.ModuleName,
authz.ModuleName,
metadatatypes.ModuleName,
oracletypes.ModuleName,
nametypes.ModuleName,
genutiltypes.ModuleName,
ibchost.ModuleName,
ibchookstypes.ModuleName,
ibctransfertypes.ModuleName,
icqtypes.ModuleName,
msgfeestypes.ModuleName,
wasm.ModuleName,
slashingtypes.ModuleName,
Expand Down Expand Up @@ -818,12 +864,14 @@ func New(

ibchost.ModuleName,
ibctransfertypes.ModuleName,
icqtypes.ModuleName,
icatypes.ModuleName,
ibchookstypes.ModuleName,
// wasm after ibc transfer
wasm.ModuleName,
rewardtypes.ModuleName,
triggertypes.ModuleName,
oracletypes.ModuleName,

// no-ops
paramstypes.ModuleName,
Expand Down Expand Up @@ -856,6 +904,7 @@ func New(

ibchookstypes.ModuleName,
icatypes.ModuleName,
icqtypes.ModuleName,
wasm.ModuleName,

attributetypes.ModuleName,
Expand All @@ -865,6 +914,7 @@ func New(
nametypes.ModuleName,
rewardtypes.ModuleName,
triggertypes.ModuleName,
oracletypes.ModuleName,

// Last due to v0.44 issue: https://github.com/cosmos/cosmos-sdk/issues/10591
authtypes.ModuleName,
Expand Down Expand Up @@ -899,6 +949,7 @@ func New(
msgfeesmodule.NewAppModule(appCodec, app.MsgFeesKeeper, app.interfaceRegistry),
rewardmodule.NewAppModule(appCodec, app.RewardKeeper, app.AccountKeeper, app.BankKeeper),
triggermodule.NewAppModule(appCodec, app.TriggerKeeper, app.AccountKeeper, app.BankKeeper),
oraclemodule.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper, app.IBCKeeper.ChannelKeeper),
holdmodule.NewAppModule(appCodec, app.HoldKeeper),
provwasm.NewWrapper(appCodec, app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.NameKeeper),

Expand Down Expand Up @@ -991,6 +1042,7 @@ func New(

app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper
app.ScopedICQKeeper = scopedICQKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper

return app
Expand Down Expand Up @@ -1219,6 +1271,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(icqtypes.ModuleName)
paramsKeeper.Subspace(ibchookstypes.ModuleName)

return paramsKeeper
Expand Down
3 changes: 3 additions & 0 deletions app/params/weights.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ const (
// Trigger
DefaultWeightSubmitCreateTrigger int = 95
DefaultWeightSubmitDestroyTrigger int = 5
// Oracle
DefaultWeightUpdateOracle int = 25
DefaultWeightSendOracleQuery int = 75
)
21 changes: 21 additions & 0 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"testing"
"time"

icqtypes "github.com/strangelove-ventures/async-icq/v6/types"
"github.com/stretchr/testify/require"

abci "github.com/tendermint/tendermint/abci/types"
Expand Down Expand Up @@ -73,6 +74,7 @@ func ProvAppStateFn(cdc codec.JSONCodec, simManager *module.SimulationManager) s
return func(r *rand.Rand, accs []simtypes.Account, config simtypes.Config) (json.RawMessage, []simtypes.Account, string, time.Time) {
appState, simAccs, chainID, genesisTimestamp := sdksim.AppStateFn(cdc, simManager)(r, accs, config)
appState = appStateWithICA(appState, cdc)
appState = appStateWithICQ(appState, cdc)
return appState, simAccs, chainID, genesisTimestamp
}
}
Expand All @@ -96,6 +98,25 @@ func appStateWithICA(appState json.RawMessage, cdc codec.JSONCodec) json.RawMess
return appState
}

// appStateWithICA checks the given appState for an ica entry. If it's not found, it's populated with the defaults.
func appStateWithICQ(appState json.RawMessage, cdc codec.JSONCodec) json.RawMessage {
rawState := make(map[string]json.RawMessage)
err := json.Unmarshal(appState, &rawState)
if err != nil {
panic(fmt.Sprintf("error unmarshalling 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
}

func TestFullAppSimulation(t *testing.T) {
config, db, dir, logger, skip, err := sdksim.SetupSimulation("leveldb-app-sim", "Simulation")
if skip {
Expand Down
18 changes: 15 additions & 3 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package app
import (
"fmt"

icqtypes "github.com/strangelove-ventures/async-icq/v6/types"

"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -16,6 +18,7 @@ import (
"github.com/provenance-io/provenance/x/hold"
ibchookstypes "github.com/provenance-io/provenance/x/ibchooks/types"
msgfeetypes "github.com/provenance-io/provenance/x/msgfees/types"
oracletypes "github.com/provenance-io/provenance/x/oracle/types"
triggertypes "github.com/provenance-io/provenance/x/trigger/types"
)

Expand Down Expand Up @@ -106,12 +109,13 @@ var upgrades = map[string]appUpgrade{
app.IBCHooksKeeper.SetParams(ctx, ibchookstypes.DefaultParams())

removeInactiveValidatorDelegations(ctx, app)
setupICQ(ctx, app)

return vm, nil
},
Added: []string{hold.ModuleName, ibchookstypes.ModuleName},
Added: []string{icqtypes.ModuleName, oracletypes.ModuleName, ibchookstypes.ModuleName, hold.ModuleName},
},
"saffron": { // upgrade for v1.17.0
"saffron": { // upgrade for v1.17.0,
Handler: func(ctx sdk.Context, app *App, vm module.VersionMap) (module.VersionMap, error) {
var err error
vm, err = runModuleMigrations(ctx, app, vm)
Expand All @@ -123,10 +127,11 @@ var upgrades = map[string]appUpgrade{
app.IBCHooksKeeper.SetParams(ctx, ibchookstypes.DefaultParams())

removeInactiveValidatorDelegations(ctx, app)
setupICQ(ctx, app)

SpicyLemon marked this conversation as resolved.
Show resolved Hide resolved
return vm, nil
},
Added: []string{hold.ModuleName, ibchookstypes.ModuleName},
Added: []string{icqtypes.ModuleName, oracletypes.ModuleName, ibchookstypes.ModuleName, hold.ModuleName},
},
// TODO - Add new upgrade definitions here.
}
Expand Down Expand Up @@ -314,3 +319,10 @@ func fixNameIndexEntries(ctx sdk.Context, app *App) {
func setAccountDataNameRecord(ctx sdk.Context, accountK attributetypes.AccountKeeper, nameK attributetypes.NameKeeper) (err error) {
return attributekeeper.EnsureModuleAccountAndAccountDataNameRecord(ctx, accountK, nameK)
}

// setupICQ sets the correct default values for ICQKeeper
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"}))
ctx.Logger().Info("Done updating ICQ params")
}
4 changes: 4 additions & 0 deletions app/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ func (s *UpgradeTestSuite) TestSaffronRC1() {
expInLog := []string{
"INF Starting module migrations. This may take a significant amount of time to complete. Do not restart node.",
"INF removing all delegations from validators that have been inactive (unbonded) for 21 days",
"INF Updating ICQ params",
"INF Done updating ICQ params",
}

s.AssertUpgradeHandlerLogs("saffron-rc1", expInLog, nil)
Expand All @@ -434,6 +436,8 @@ func (s *UpgradeTestSuite) TestSaffron() {
expInLog := []string{
"INF Starting module migrations. This may take a significant amount of time to complete. Do not restart node.",
"INF removing all delegations from validators that have been inactive (unbonded) for 21 days",
"INF Updating ICQ params",
"INF Done updating ICQ params",
}

s.AssertUpgradeHandlerLogs("saffron", expInLog, nil)
Expand Down
Loading
Loading