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

[Extra/rest] fix tss member #521

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions hooks/emitter/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ func (h *Hook) handleMsgEvent(ctx sdk.Context, txHash []byte, event abci.Event)
h.handleTunnelEventTypeActivateTunnel(ctx, evMap)
case tunneltypes.EventTypeDeactivateTunnel:
h.handleTunnelEventTypeDeactivateTunnel(ctx, evMap)
case tsstypes.EventTypeSetMemberIsActive:
h.handleTSSSetMember(ctx, evMap)
}
}

Expand Down Expand Up @@ -237,6 +239,8 @@ func (h *Hook) handleBeginBlockEndBlockEvent(
for _, gid := range groupIDs {
h.handleTSSSetGroup(ctx, tss.GroupID(common.Atoi(gid)))
}
case tsstypes.EventTypeSetMemberIsActive:
h.handleTSSSetMember(ctx, evMap)
case tunneltypes.EventTypeProducePacketSuccess:
h.handleTunnelEventTypeProducePacketSuccess(ctx, evMap)
case tunneltypes.EventTypeActivateTunnel:
Expand Down
13 changes: 13 additions & 0 deletions hooks/emitter/tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package emitter

import (
"encoding/hex"
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"

Expand Down Expand Up @@ -210,6 +211,18 @@ func (h *Hook) handleTSSSetGroup(ctx sdk.Context, gid tss.GroupID) {
}
}

func (h *Hook) handleTSSSetMember(ctx sdk.Context, evMap common.EvMap) {
groupID := tss.GroupID(common.Atoui(evMap[types.EventTypeSetMemberIsActive+"."+types.AttributeKeyGroupID][0]))
memberID := tss.MemberID(common.Atoui(evMap[types.EventTypeSetMemberIsActive+"."+types.AttributeKeyMemberID][0]))

member, err := h.tssKeeper.GetMember(ctx, groupID, memberID)
if err != nil {
panic(fmt.Sprintf("invalid member; groupID: %d, memberID: %d", groupID, memberID))
}

h.emitSetTSSMember(member)
}

// handleTSSEventSubmitSignature implements emitter handler for SubmitSignature event.
func (h *Hook) handleTSSEventSubmitSignature(ctx sdk.Context, evMap common.EvMap) {
sids := evMap[types.EventTypeSubmitSignature+"."+types.AttributeKeySigningID]
Expand Down
Loading