diff --git a/hooks/emitter/tss.go b/hooks/emitter/tss.go index 5f2b0bffe..207ba8acd 100644 --- a/hooks/emitter/tss.go +++ b/hooks/emitter/tss.go @@ -130,9 +130,9 @@ func (h *Hook) handleInitTssModule(ctx sdk.Context) { func (h *Hook) handleTssEventCreateSigning(ctx sdk.Context, evMap common.EvMap) { sids := evMap[types.EventTypeCreateSigning+"."+types.AttributeKeySigningID] contentTypes := evMap[types.EventTypeCreateSigning+"."+types.AttributeKeyContentType] - contentInfos := evMap[types.EventTypeCreateSigning+"."+types.AttributeKeyContentInfo] + contentInfos := evMap[types.EventTypeCreateSigning+"."+types.AttributeKeyContent] originatorTypes := evMap[types.EventTypeCreateSigning+"."+types.AttributeKeyOriginatorType] - originatorInfos := evMap[types.EventTypeCreateSigning+"."+types.AttributeKeyOriginatorInfo] + originatorInfos := evMap[types.EventTypeCreateSigning+"."+types.AttributeKeyOriginator] for i, sid := range sids { id := tss.SigningID(common.Atoi(sid)) diff --git a/x/tss/keeper/keeper_signing.go b/x/tss/keeper/keeper_signing.go index 58f7b36d7..4dbd72558 100644 --- a/x/tss/keeper/keeper_signing.go +++ b/x/tss/keeper/keeper_signing.go @@ -51,15 +51,16 @@ func (k Keeper) RequestSigning( return 0, err } - contentType := fmt.Sprintf("%s/%s", content.OrderRoute(), content.OrderType()) ctx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeCreateSigning, sdk.NewAttribute(types.AttributeKeySigningID, fmt.Sprintf("%d", signingID)), sdk.NewAttribute(types.AttributeKeyGroupID, fmt.Sprintf("%d", groupID)), - sdk.NewAttribute(types.AttributeKeyContentType, contentType), - sdk.NewAttribute(types.AttributeKeyContentInfo, content.String()), - sdk.NewAttribute(types.AttributeKeyOriginatorType, originator.Type()), - sdk.NewAttribute(types.AttributeKeyOriginatorInfo, originator.String()), + sdk.NewAttribute(types.AttributeKeyContentType, sdk.MsgTypeURL(content)), + sdk.NewAttribute(types.AttributeKeyContent, content.String()), + sdk.NewAttribute(types.AttributeKeyOriginatorType, sdk.MsgTypeURL(originator)), + sdk.NewAttribute(types.AttributeKeyOriginator, originator.String()), + sdk.NewAttribute(types.AttributeKeyEncodedOriginator, hex.EncodeToString(originatorBz)), + sdk.NewAttribute(types.AttributeKeyMessage, hex.EncodeToString(contentMsg)), )) // initiate new signing round diff --git a/x/tss/types/codec.go b/x/tss/types/codec.go index 59d0fdfae..f1de88026 100644 --- a/x/tss/types/codec.go +++ b/x/tss/types/codec.go @@ -19,6 +19,11 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgSubmitSignature{}, "tss/MsgSubmitSignature") legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "tss/MsgUpdateParams") + cdc.RegisterInterface((*Originator)(nil), nil) + cdc.RegisterInterface((*Content)(nil), nil) + + cdc.RegisterConcrete(&DirectOriginator{}, "tss/DirectOriginator", nil) + cdc.RegisterConcrete(&TunnelOriginator{}, "tss/TunnelOriginator", nil) cdc.RegisterConcrete(&TextSignatureOrder{}, "tss/TextSignatureOrder", nil) cdc.RegisterConcrete(Params{}, "tss/Params", nil) } @@ -36,6 +41,12 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgUpdateParams{}, ) + registry.RegisterInterface( + "tss.v1beta1.Originator", + (*Originator)(nil), + &DirectOriginator{}, &TunnelOriginator{}, + ) + registry.RegisterInterface( "tss.v1beta1.Content", (*Content)(nil), diff --git a/x/tss/types/events.go b/x/tss/types/events.go index 5127e18ea..a91757d9b 100644 --- a/x/tss/types/events.go +++ b/x/tss/types/events.go @@ -18,33 +18,34 @@ const ( EventTypeSigningFailed = "signing_failed" EventTypeSubmitSignature = "submit_signature" - AttributeKeyGroupID = "group_id" - AttributeKeyMemberID = "member_id" - AttributeKeyAddress = "address" - AttributeKeySize = "size" - AttributeKeyThreshold = "threshold" - AttributeKeyPubKey = "pub_key" - AttributeKeyStatus = "status" - AttributeKeyDKGContext = "dkg_context" - AttributeKeyModuleOwner = "module_owner" - AttributeKeyRound1Info = "round1_info" - AttributeKeyRound2Info = "round2_info" - AttributeKeyComplainantID = "complainant_id" - AttributeKeyRespondentID = "respondent_id" - AttributeKeyKeySym = "key_sym" - AttributeKeySignature = "signature" - AttributeKeyOwnPubKeySig = "own_pub_key_sig" - AttributeKeySigningID = "signing_id" - AttributeKeyReason = "reason" - AttributeKeyMessage = "message" - AttributeKeyGroupPubNonce = "group_pub_nonce" - AttributeKeyAttempt = "attempt" - AttributeKeyPubNonce = "pub_nonce" - AttributeKeyBindingFactor = "binding_factor" - AttributeKeyPubD = "pub_d" - AttributeKeyPubE = "pub_e" - AttributeKeyContentInfo = "content_info" - AttributeKeyContentType = "content_type" - AttributeKeyOriginatorInfo = "originator_info" - AttributeKeyOriginatorType = "originator_type" + AttributeKeyGroupID = "group_id" + AttributeKeyMemberID = "member_id" + AttributeKeyAddress = "address" + AttributeKeySize = "size" + AttributeKeyThreshold = "threshold" + AttributeKeyPubKey = "pub_key" + AttributeKeyStatus = "status" + AttributeKeyDKGContext = "dkg_context" + AttributeKeyModuleOwner = "module_owner" + AttributeKeyRound1Info = "round1_info" + AttributeKeyRound2Info = "round2_info" + AttributeKeyComplainantID = "complainant_id" + AttributeKeyRespondentID = "respondent_id" + AttributeKeyKeySym = "key_sym" + AttributeKeySignature = "signature" + AttributeKeyOwnPubKeySig = "own_pub_key_sig" + AttributeKeySigningID = "signing_id" + AttributeKeyReason = "reason" + AttributeKeyMessage = "message" + AttributeKeyGroupPubNonce = "group_pub_nonce" + AttributeKeyAttempt = "attempt" + AttributeKeyPubNonce = "pub_nonce" + AttributeKeyBindingFactor = "binding_factor" + AttributeKeyPubD = "pub_d" + AttributeKeyPubE = "pub_e" + AttributeKeyContent = "content" + AttributeKeyContentType = "content_type" + AttributeKeyOriginator = "originator" + AttributeKeyOriginatorType = "originator_type" + AttributeKeyEncodedOriginator = "encoded_originator" ) diff --git a/x/tss/types/originator.go b/x/tss/types/originator.go index 94195fae6..afd879920 100644 --- a/x/tss/types/originator.go +++ b/x/tss/types/originator.go @@ -27,7 +27,6 @@ type Originator interface { Encode() ([]byte, error) Validate(p Params) error - Type() string } // ==================================== @@ -72,11 +71,6 @@ func (o DirectOriginator) Encode() ([]byte, error) { return bz, nil } -// Type returns the type of the originator. -func (o DirectOriginator) Type() string { - return "DirectOriginator" -} - // ==================================== // TunnelOriginator // ==================================== @@ -129,7 +123,3 @@ func (o TunnelOriginator) Encode() ([]byte, error) { return bz, nil } - -func (o TunnelOriginator) Type() string { - return "TunnelOriginator" -}