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

chore: update events schema #75

Merged
merged 14 commits into from
Nov 29, 2024
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Revert "bump q client"
This reverts commit 193821a.
gusin13 committed Nov 29, 2024
commit 3d9a243b735c4e72f5e3dc928c51547b8d4bcf02
4 changes: 2 additions & 2 deletions consumer/event_consumer.go
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import (

type EventConsumer interface {
Start() error
PushActiveEventV2(ev *client.StakingEvent) error
PushUnbondingEventV2(ev *client.StakingEvent) error
PushStakingEvent(ev *client.StakingEvent) error
PushUnbondingEvent(ev *client.StakingEvent) error
Stop() error
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ go 1.23.1
require (
github.com/avast/retry-go/v4 v4.5.1
github.com/babylonlabs-io/babylon v0.17.1
github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241129063750-43b4edbaf089
github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241128065526-664aebdb9c1b
github.com/btcsuite/btcd v0.24.3-0.20241011125836-24eb815168f4
github.com/btcsuite/btcd/btcec/v2 v2.3.4
github.com/btcsuite/btcd/btcutil v1.1.6
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -286,8 +286,6 @@ github.com/babylonlabs-io/staking-queue-client v0.4.1 h1:AW+jtrNxZYN/isRx+njqjHb
github.com/babylonlabs-io/staking-queue-client v0.4.1/go.mod h1:n3fr3c+9LNiJlyETmcrVk94Zn76rAADhGZKxX+rVf+Q=
github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241128065526-664aebdb9c1b h1:kdBDqW+wm4fiBhEiUzos9TnhmRcf6//tWyUBiBkyoqQ=
github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241128065526-664aebdb9c1b/go.mod h1:n3fr3c+9LNiJlyETmcrVk94Zn76rAADhGZKxX+rVf+Q=
github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241129063750-43b4edbaf089 h1:+WMw6k4axLVulWSbYXrvp7LVXDSudNEYjiIh9omkLVA=
github.com/babylonlabs-io/staking-queue-client v0.4.7-0.20241129063750-43b4edbaf089/go.mod h1:n3fr3c+9LNiJlyETmcrVk94Zn76rAADhGZKxX+rVf+Q=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
8 changes: 4 additions & 4 deletions internal/services/consumer_events.go
Original file line number Diff line number Diff line change
@@ -29,27 +29,27 @@ func (s *Service) emitConsumerEvent(

// TODO: fix the queue event schema
func (s *Service) sendActiveDelegationEvent(ctx context.Context, delegation *model.BTCDelegationDetails) *types.Error {
stakingEvent := queuecli.NewActiveStakingEventV2(
stakingEvent := queuecli.NewActiveStakingEvent(
delegation.StakingTxHashHex,
delegation.StakerBtcPkHex,
delegation.FinalityProviderBtcPksHex,
delegation.StakingAmount,
)

if err := s.queueManager.PushActiveEventV2(&stakingEvent); err != nil {
if err := s.queueManager.PushStakingEvent(&stakingEvent); err != nil {
return types.NewInternalServiceError(fmt.Errorf("failed to push the staking event to the queue: %w", err))
}
return nil
}

func (s *Service) sendUnbondingDelegationEvent(ctx context.Context, delegation *model.BTCDelegationDetails) *types.Error {
ev := queuecli.NewUnbondingStakingEventV2(
ev := queuecli.NewUnbondingStakingEvent(
delegation.StakingTxHashHex,
delegation.StakerBtcPkHex,
delegation.FinalityProviderBtcPksHex,
delegation.StakingAmount,
)
if err := s.queueManager.PushUnbondingEventV2(&ev); err != nil {
if err := s.queueManager.PushUnbondingEvent(&ev); err != nil {
return types.NewInternalServiceError(fmt.Errorf("failed to push the unbonding event to the queue: %w", err))
}
return nil