Skip to content

Commit

Permalink
event manager initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Bowman authored and joe-bowman committed Dec 13, 2024
1 parent a4b9d4d commit 77e7cda
Show file tree
Hide file tree
Showing 66 changed files with 6,582 additions and 953 deletions.
17 changes: 14 additions & 3 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ import (
claimsmanagertypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types"
epochskeeper "github.com/quicksilver-zone/quicksilver/x/epochs/keeper"
epochstypes "github.com/quicksilver-zone/quicksilver/x/epochs/types"
emkeeper "github.com/quicksilver-zone/quicksilver/x/eventmanager/keeper"
emtypes "github.com/quicksilver-zone/quicksilver/x/eventmanager/types"
interchainquerykeeper "github.com/quicksilver-zone/quicksilver/x/interchainquery/keeper"
interchainquerytypes "github.com/quicksilver-zone/quicksilver/x/interchainquery/types"
"github.com/quicksilver-zone/quicksilver/x/interchainstaking"
Expand Down Expand Up @@ -110,6 +112,7 @@ type AppKeepers struct {
ClaimsManagerKeeper claimsmanagerkeeper.Keeper
InterchainstakingKeeper *interchainstakingkeeper.Keeper
InterchainQueryKeeper interchainquerykeeper.Keeper
EventManagerKeeper emkeeper.Keeper
ParticipationRewardsKeeper *participationrewardskeeper.Keeper
AirdropKeeper *airdropkeeper.Keeper
SupplyKeeper supplykeeper.Keeper
Expand Down Expand Up @@ -376,8 +379,7 @@ func (appKeepers *AppKeepers) InitKeepers(
// claimsmanagerModule := claimsmanager.NewAppModule(appCodec, appKeepers.ClaimsManagerKeeper)

appKeepers.InterchainQueryKeeper = interchainquerykeeper.NewKeeper(appCodec, appKeepers.keys[interchainquerytypes.StoreKey], appKeepers.IBCKeeper)

// interchainQueryModule := interchainquery.NewAppModule(appCodec, appKeepers.InterchainQueryKeeper)
appKeepers.EventManagerKeeper = emkeeper.NewKeeper(appCodec, appKeepers.keys[emtypes.StoreKey])

appKeepers.InterchainstakingKeeper = interchainstakingkeeper.NewKeeper(
appCodec,
Expand All @@ -391,6 +393,7 @@ func (appKeepers *AppKeepers) InitKeepers(
appKeepers.IBCKeeper,
appKeepers.TransferKeeper,
appKeepers.ClaimsManagerKeeper,
appKeepers.EventManagerKeeper,
appKeepers.GetSubspace(interchainstakingtypes.ModuleName),
)

Expand All @@ -409,6 +412,7 @@ func (appKeepers *AppKeepers) InitKeepers(
&appKeepers.InterchainQueryKeeper,
appKeepers.InterchainstakingKeeper,
appKeepers.ClaimsManagerKeeper,
appKeepers.EventManagerKeeper,
authtypes.FeeCollectorName,
proofOpsFn,
selfProofOpsFn,
Expand All @@ -418,12 +422,18 @@ func (appKeepers *AppKeepers) InitKeepers(
panic(err)
}

// participationrewardsModule := participationrewards.NewAppModule(appCodec, appKeepers.ParticipationRewardsKeeper)
if err := appKeepers.EventManagerKeeper.SetCallbackHandler(interchainstakingtypes.ModuleName, appKeepers.InterchainstakingKeeper.EventCallbackHandler()); err != nil {
panic(err)
}

if err := appKeepers.InterchainQueryKeeper.SetCallbackHandler(participationrewardstypes.ModuleName, appKeepers.ParticipationRewardsKeeper.CallbackHandler()); err != nil {
panic(err)
}

if err := appKeepers.EventManagerKeeper.SetCallbackHandler(participationrewardstypes.ModuleName, appKeepers.ParticipationRewardsKeeper.EventCallbackHandler()); err != nil {
panic(err)
}

// Quicksilver Keepers
appKeepers.EpochsKeeper = epochskeeper.NewKeeper(appCodec, appKeepers.keys[epochstypes.StoreKey])
appKeepers.ParticipationRewardsKeeper.SetEpochsKeeper(appKeepers.EpochsKeeper)
Expand Down Expand Up @@ -535,6 +545,7 @@ func (*AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *cod
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(interchainstakingtypes.ModuleName)
paramsKeeper.Subspace(interchainquerytypes.ModuleName)
paramsKeeper.Subspace(emtypes.ModuleName)
paramsKeeper.Subspace(participationrewardstypes.ModuleName)
paramsKeeper.Subspace(airdroptypes.ModuleName)

Expand Down
2 changes: 2 additions & 0 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
airdroptypes "github.com/quicksilver-zone/quicksilver/x/airdrop/types"
claimsmanagertypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types"
epochstypes "github.com/quicksilver-zone/quicksilver/x/epochs/types"
emtypes "github.com/quicksilver-zone/quicksilver/x/eventmanager/types"
interchainquerytypes "github.com/quicksilver-zone/quicksilver/x/interchainquery/types"
interchainstakingtypes "github.com/quicksilver-zone/quicksilver/x/interchainstaking/types"
minttypes "github.com/quicksilver-zone/quicksilver/x/mint/types"
Expand Down Expand Up @@ -61,6 +62,7 @@ func KVStoreKeys() []string {
epochstypes.StoreKey,
interchainstakingtypes.StoreKey,
interchainquerytypes.StoreKey,
emtypes.StoreKey,
participationrewardstypes.StoreKey,
airdroptypes.StoreKey,
supplytypes.StoreKey,
Expand Down
10 changes: 9 additions & 1 deletion app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import (
claimsmanagertypes "github.com/quicksilver-zone/quicksilver/x/claimsmanager/types"
"github.com/quicksilver-zone/quicksilver/x/epochs"
epochstypes "github.com/quicksilver-zone/quicksilver/x/epochs/types"
"github.com/quicksilver-zone/quicksilver/x/eventmanager"
eventmanagertypes "github.com/quicksilver-zone/quicksilver/x/eventmanager/types"
"github.com/quicksilver-zone/quicksilver/x/interchainquery"
interchainquerytypes "github.com/quicksilver-zone/quicksilver/x/interchainquery/types"
"github.com/quicksilver-zone/quicksilver/x/interchainstaking"
Expand Down Expand Up @@ -107,6 +109,7 @@ var (
participationrewards.AppModuleBasic{},
airdrop.AppModuleBasic{},
supply.AppModuleBasic{},
eventmanager.AppModuleBasic{},
)

// module account permissions.
Expand Down Expand Up @@ -169,6 +172,7 @@ func appModules(
epochs.NewAppModule(appCodec, app.EpochsKeeper),
interchainstaking.NewAppModule(appCodec, app.InterchainstakingKeeper),
interchainquery.NewAppModule(appCodec, app.InterchainQueryKeeper),
eventmanager.NewAppModule(appCodec, app.EventManagerKeeper),
participationrewards.NewAppModule(appCodec, app.ParticipationRewardsKeeper),
airdrop.NewAppModule(appCodec, app.AirdropKeeper),
supply.NewAppModule(appCodec, app.SupplyKeeper),
Expand Down Expand Up @@ -207,6 +211,7 @@ func simulationModules(
epochs.NewAppModule(appCodec, app.EpochsKeeper),
interchainstaking.NewAppModule(appCodec, app.InterchainstakingKeeper),
interchainquery.NewAppModule(appCodec, app.InterchainQueryKeeper),
eventmanager.NewAppModule(appCodec, app.EventManagerKeeper),
participationrewards.NewAppModule(appCodec, app.ParticipationRewardsKeeper),
airdrop.NewAppModule(appCodec, app.AirdropKeeper),
// supply.NewAppModule(appCodec, app.SupplyKeeper),
Expand Down Expand Up @@ -237,7 +242,8 @@ func orderBeginBlockers() []string {
stakingtypes.ModuleName,
ibchost.ModuleName,
interchainstakingtypes.ModuleName,
interchainquerytypes.ModuleName, // check ordering here.
interchainquerytypes.ModuleName,
eventmanagertypes.ModuleName,
// no-op modules
ibctransfertypes.ModuleName,
icatypes.ModuleName,
Expand Down Expand Up @@ -297,6 +303,7 @@ func orderEndBlockers() []string {
participationrewardstypes.ModuleName,
airdroptypes.ModuleName,
supplytypes.ModuleName,
eventmanagertypes.ModuleName,
// currently no-op.
}
}
Expand Down Expand Up @@ -339,6 +346,7 @@ func orderInitBlockers() []string {
participationrewardstypes.ModuleName,
airdroptypes.ModuleName,
supplytypes.ModuleName,
eventmanagertypes.ModuleName,
// NOTE: crisis module must go at the end to check for invariants on each module
crisistypes.ModuleName,
}
Expand Down
5 changes: 5 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
v6 "github.com/cosmos/ibc-go/v6/testing/simapp/upgrades/v6" // nolint:revive

"github.com/quicksilver-zone/quicksilver/app/upgrades"
emtypes "github.com/quicksilver-zone/quicksilver/x/eventmanager/types"
supplytypes "github.com/quicksilver-zone/quicksilver/x/supply/types"
)

Expand Down Expand Up @@ -76,6 +77,10 @@ func (app *Quicksilver) setUpgradeStoreLoaders() {
storeUpgrades = &storetypes.StoreUpgrades{
Deleted: []string{wasmModuleName, tfModuleName},
}
case upgrades.V010900UpgradeName:
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{emtypes.ModuleName},
}
default:
// no-op
}
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const (
V010702UpgradeName = "v1.7.2"
V010704UpgradeName = "v1.7.4"
V010705UpgradeName = "v1.7.5"

V010900UpgradeName = "v1.9.0"
)

// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal
Expand Down
18 changes: 18 additions & 0 deletions app/upgrades/v1_9.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package upgrades

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/quicksilver-zone/quicksilver/app/keepers"
)

func V010900UpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
appKeepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, configurator, fromVM)
}
}
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ services:
- osmosisd
- start
hermes:
image: informalsystems/hermes:v1.8.0
image: informalsystems/hermes:v1.8.2
hostname: hermes
volumes:
- ./data/hermes:/home/hermes/.hermes
Expand All @@ -121,3 +121,4 @@ services:
- icq-relayer
- run
restart: always

9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/celestiaorg/go-square/v2 v2.0.0
github.com/celestiaorg/nmt v0.22.2
github.com/client9/misspell v0.3.4
github.com/cometbft/cometbft-db v0.12.0
github.com/cometbft/cometbft-db v1.0.1
github.com/confio/ics23/go v0.9.1
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.46.16
Expand Down Expand Up @@ -125,8 +125,9 @@ require (
github.com/denis-tingaikin/go-header v0.5.0 // indirect
github.com/desertbit/timer v1.0.1 // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/badger/v4 v4.3.0 // indirect
github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 // indirect
github.com/dgraph-io/badger/v4 v4.4.0 // indirect
github.com/dgraph-io/ristretto v0.2.0 // indirect
github.com/dgraph-io/ristretto/v2 v2.0.0 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand Down Expand Up @@ -210,7 +211,7 @@ require (
github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect
github.com/kisielk/errcheck v1.8.0 // indirect
github.com/kkHAIKE/contextcheck v1.1.5 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/kulti/thelper v0.6.3 // indirect
Expand Down
17 changes: 9 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,7 @@ github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONN
github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
github.com/cometbft/cometbft v0.34.33 h1:2nnMU8smD1fpkY4JP6GWSaWmxE4BhqL60LG+Sr+Ijzo=
github.com/cometbft/cometbft v0.34.33/go.mod h1:S1rXDQyGEJQVle3vneIHV570I1ulneWgF1ScGvUO+bI=
github.com/cometbft/cometbft-db v0.12.0 h1:v77/z0VyfSU7k682IzZeZPFZrQAKiQwkqGN0QzAjMi0=
github.com/cometbft/cometbft-db v0.12.0/go.mod h1:aX2NbCrjNVd2ZajYxt1BsiFf/Z+TQ2MN0VxdicheYuw=
github.com/cometbft/cometbft-db v1.0.1 h1:SylKuLseMLQKw3+i8y8KozZyJcQSL98qEe2CGMCGTYE=
github.com/confio/ics23/go v0.9.1 h1:3MV46eeWwO3xCauKyAtuAdJYMyPnnchW4iLr2bTw6/U=
github.com/confio/ics23/go v0.9.1/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak=
github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg=
Expand Down Expand Up @@ -476,11 +475,13 @@ github.com/desertbit/timer v1.0.1 h1:yRpYNn5Vaaj6QXecdLMPMJsW81JLiI1eokUft5nBmeo
github.com/desertbit/timer v1.0.1/go.mod h1:htRrYeY5V/t4iu1xCJ5XsQvp4xve8QulXXctAzxqcwE=
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk=
github.com/dgraph-io/badger/v4 v4.3.0 h1:lcsCE1/1qrRhqP+zYx6xDZb8n7U+QlwNicpc676Ub40=
github.com/dgraph-io/badger/v4 v4.3.0/go.mod h1:Sc0T595g8zqAQRDf44n+z3wG4BOqLwceaFntt8KPxUM=
github.com/dgraph-io/badger/v4 v4.4.0 h1:rA48XiDynZLyMdlaJl67p9+lqfqwxlgKtCpYLAio7Zk=
github.com/dgraph-io/badger/v4 v4.4.0/go.mod h1:sONMmPPfbnj9FPwS/etCqky/ULth6CQJuAZSuWCmixE=
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 h1:Pux6+xANi0I7RRo5E1gflI4EZ2yx3BGZ75JkAIvGEOA=
github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91/go.mod h1:swkazRqnUf1N62d0Nutz7KIj2UKqsm/H8tD0nBJAXqM=
github.com/dgraph-io/ristretto v0.2.0 h1:XAfl+7cmoUDWW/2Lx8TGZQjjxIQ2Ley9DSf52dru4WE=
github.com/dgraph-io/ristretto v0.2.0/go.mod h1:8uBHCU/PBV4Ag0CJrP47b9Ofby5dqWNh4FicAdoqFNU=
github.com/dgraph-io/ristretto/v2 v2.0.0 h1:l0yiSOtlJvc0otkqyMaDNysg8E9/F/TYZwMbxscNOAQ=
github.com/dgraph-io/ristretto/v2 v2.0.0/go.mod h1:FVFokF2dRqXyPyeMnK1YDy8Fc6aTe0IKgbcd03CYeEk=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
Expand Down Expand Up @@ -897,8 +898,8 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs
github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
Expand Down
Loading

0 comments on commit 77e7cda

Please sign in to comment.