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

Implement eventmanager and deprecate withdrawalWaitgroup #1397

Closed
wants to merge 14 commits into from
Closed
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 @@ -390,6 +392,7 @@ func (appKeepers *AppKeepers) InitKeepers(
appKeepers.IBCKeeper,
appKeepers.TransferKeeper,
appKeepers.ClaimsManagerKeeper,
appKeepers.EventManagerKeeper,
appKeepers.GetSubspace(interchainstakingtypes.ModuleName),
)

Expand All @@ -408,6 +411,7 @@ func (appKeepers *AppKeepers) InitKeepers(
&appKeepers.InterchainQueryKeeper,
appKeepers.InterchainstakingKeeper,
appKeepers.ClaimsManagerKeeper,
appKeepers.EventManagerKeeper,
authtypes.FeeCollectorName,
proofOpsFn,
selfProofOpsFn,
Expand All @@ -417,12 +421,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 @@ -534,6 +544,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.V010700UpgradeName:
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{emtypes.ModuleName},
}
default:
// no-op
}
Expand Down
1 change: 1 addition & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
V010504UpgradeName = "v1.5.4"
V010505UpgradeName = "v1.5.5"
V010601UpgradeName = "v1.6.1"
V010700UpgradeName = "v1.7.0"
)

// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal
Expand Down
26 changes: 13 additions & 13 deletions 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,19 +121,19 @@ services:
- icq-relayer
- run
restart: always
relayer:
image: quicksilverzone/relayer:v2.3.0
build:
context: .
dockerfile: Dockerfile.relayer
volumes:
- ./data/rly:/rly/.relayer
command:
- rly
- start
- demo
#relayer:
# image: quicksilverzone/relayer:v2.3.0
# build:
# context: .
# dockerfile: Dockerfile.relayer
# volumes:
# - ./data/rly:/rly/.relayer
# command:
# - rly
# - start
# - demo
#- -p
#- events
#- -b
#- "100"
restart: always
# restart: always
58 changes: 58 additions & 0 deletions proto/quicksilver/eventmanager/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
syntax = "proto3";
package quicksilver.eventmanager.v1;

import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";

option go_package = "github.com/quicksilver-zone/quicksilver/x/eventmanager/types";

message Event {
string chain_id = 1;
int32 event_type = 2;
string identifier = 3;
int32 event_status = 4;
string module = 5;
string callback = 6;
bytes payload = 7;
google.protobuf.Any execute_condition = 8 [(cosmos_proto.accepts_interface) = "quicksilver.interchainstaking.ConditionI"];
int64 emitted_height = 9;
}

// GenesisState defines the eventmanager module's genesis state.
message GenesisState {}

enum FieldOperator {
UNSPECIFIED = 0;
EQUAL = 1;
CONTAINS = 2;
BEGINSWITH = 3;
ENDSWITH = 4;
}

message FieldValue {
string field = 1;
string value = 2;
FieldOperator operator = 3;
bool negate = 4;
}

message ConditionAny {
repeated FieldValue fields = 1;
bool negate = 2;
}

message ConditionAll {
repeated FieldValue fields = 1;
bool negate = 2;
}

message ConditionAnd {
google.protobuf.Any condition1 = 1 [(cosmos_proto.accepts_interface) = "quicksilver.interchainstaking.ConditionI"];
google.protobuf.Any condition2 = 2 [(cosmos_proto.accepts_interface) = "quicksilver.interchainstaking.ConditionI"];
}

message ConditionOr {
google.protobuf.Any condition1 = 1 [(cosmos_proto.accepts_interface) = "quicksilver.interchainstaking.ConditionI"];
google.protobuf.Any condition2 = 2 [(cosmos_proto.accepts_interface) = "quicksilver.interchainstaking.ConditionI"];
}
27 changes: 27 additions & 0 deletions proto/quicksilver/eventmanager/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax = "proto3";
package quicksilver.eventmanager.v1;

import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "quicksilver/eventmanager/v1/genesis.proto";

option go_package = "github.com/quicksilver-zone/quicksilver/x/eventmanager/types";

// Query defines the gRPC querier service.
service Query {
// Events query events
rpc Events(QueryEventsRequest) returns (QueryEventsResponse) {
option (google.api.http).get = "/quicksilver/eventmanager/v1/events/{chain_id}";
}
}

message QueryEventsRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
string chain_id = 2;
}

message QueryEventsResponse {
repeated Event events = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
6 changes: 0 additions & 6 deletions scripts/simple-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ $HERMES_RUN create channel --a-chain $CHAINID_0 --b-chain $CHAINID_1 --a-port tr
#$HERMES_RUN create channel --port-a transfer --port-b transfer $CHAINID_0 connection-0
echo "Tranfer channel created"
docker-compose up --force-recreate -d hermes
RLY_ADDRESS_3=$($RLY_RUN keys show qstest-1 testkey)
RLY_ADDRESS_4=$($RLY_RUN keys show lstest-1 testkey)
$QS1_EXEC tx bank send val1 $RLY_ADDRESS_3 1000uqck --chain-id $CHAINID_0 -y --keyring-backend=test
$TZ1_1_EXEC tx bank send val2 $RLY_ADDRESS_4 1000uatom --chain-id $CHAINID_1 -y --keyring-backend=test

docker-compose up --force-recreate -d relayer

rm -rf ./icq/keys
echo "Launch and configure interchain query daemon"
Expand Down
Loading
Loading