Skip to content

Commit

Permalink
Merge branch 'extra/rest-tss-full-db' of https://github.com/bandproto…
Browse files Browse the repository at this point in the history
…col/chain into extra/rest-tunnel-emitter
  • Loading branch information
RogerKSI committed Nov 28, 2024
2 parents d16b08a + 376faef commit e49bc97
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
12 changes: 4 additions & 8 deletions flusher/flusher/bandtss_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ def process_bind_param(self, value, dialect):
"bandtss_group_transitions",
metadata,
Column("proposal_id", sa.Integer, sa.ForeignKey("proposals.id"), primary_key=True),
Column(
"tss_signing_id", sa.Integer, sa.ForeignKey("tss_signings.id"), nullable=True
),
Column("tss_signing_id", sa.Integer, sa.ForeignKey("tss_signings.id"), nullable=True),
Column(
"current_tss_group_id",
sa.Integer,
Expand Down Expand Up @@ -60,8 +58,8 @@ def process_bind_param(self, value, dialect):
),
)

bandtss_current_groups = sa.Table(
"bandtss_current_groups",
bandtss_historical_current_groups = sa.Table(
"bandtss_historical_current_groups",
metadata,
Column(
"proposal_id",
Expand All @@ -88,9 +86,7 @@ def process_bind_param(self, value, dialect):
bandtss_members = sa.Table(
"bandtss_members",
metadata,
Column(
"tss_group_id", sa.Integer, sa.ForeignKey("tss_groups.id"), primary_key=True
),
Column("tss_group_id", sa.Integer, sa.ForeignKey("tss_groups.id"), primary_key=True),
Column("account_id", sa.Integer, sa.ForeignKey("accounts.id"), primary_key=True),
Column("is_active", sa.Boolean),
Column("since", CustomDateTime, nullable=True),
Expand Down
4 changes: 2 additions & 2 deletions flusher/flusher/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
)
from .restake_db import restake_vaults, restake_locks, restake_historical_stakes
from .bandtss_db import (
bandtss_current_groups,
bandtss_historical_current_groups,
bandtss_members,
bandtss_signings,
bandtss_group_transitions,
Expand Down Expand Up @@ -932,7 +932,7 @@ def handle_new_bandtss_current_group(self, msg):
if proposal_id is not None:
msg["proposal_id"] = proposal_id

self.conn.execute(bandtss_current_groups.insert(), msg)
self.conn.execute(bandtss_historical_current_groups.insert(), msg)

def handle_set_bandtss_member(self, msg):
msg["account_id"] = self.get_account_id(msg["address"])
Expand Down
7 changes: 6 additions & 1 deletion grogu/signaller/signaller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,14 @@ func (s *SignallerTestSuite) TestGetAllSignalIDs() {
// Update internal variables
s.TestUpdateInternalVariables()

expectedSignalIDs := []string{"signal1", "signal2"}

signalIDs = s.Signaller.getAllSignalIDs()
s.Require().NotEmpty(signalIDs)
s.Require().Equal("signal1", signalIDs[0])

// sort signalIDs to compare
sort.Strings(signalIDs)
s.Require().Equal(expectedSignalIDs, signalIDs)
}

func (s *SignallerTestSuite) TestGetNonPendingSignalIDs() {
Expand Down
4 changes: 2 additions & 2 deletions hooks/emitter/bandtss.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ func (h *Hook) handleBandtssMsgActivate(ctx sdk.Context, msg *types.MsgActivate)
h.handleBandtssUpdateMember(ctx, acc, msg.GroupID)
}

// handleBandtssEventInactiveStatuses implements emitter handler for inactive status event.
func (h *Hook) handleBandtssEventInactiveStatuses(ctx sdk.Context, evMap common.EvMap) {
// handleBandtssEventInactiveStatus implements emitter handler for inactive status event.
func (h *Hook) handleBandtssEventInactiveStatus(ctx sdk.Context, evMap common.EvMap) {
addresses := evMap[types.EventTypeInactiveStatus+"."+types.AttributeKeyAddress]
groupIDs := evMap[types.EventTypeInactiveStatus+"."+types.AttributeKeyGroupID]
if len(addresses) != len(groupIDs) {
Expand Down
2 changes: 1 addition & 1 deletion hooks/emitter/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (h *Hook) handleBeginBlockEndBlockEvent(
evMap := parseEvents([]abci.Event{event})
switch event.Type {
case bandtsstypes.EventTypeInactiveStatus:
h.handleBandtssEventInactiveStatuses(ctx, evMap)
h.handleBandtssEventInactiveStatus(ctx, evMap)
case bandtsstypes.EventTypeGroupTransition:
h.handleBandtssEventGroupTransition(ctx, eventIdx, eventQuerier)
case bandtsstypes.EventTypeGroupTransitionSuccess:
Expand Down

0 comments on commit e49bc97

Please sign in to comment.