diff --git a/flusher/flusher/handler.py b/flusher/flusher/handler.py index feea5a89c..6277cb37b 100644 --- a/flusher/flusher/handler.py +++ b/flusher/flusher/handler.py @@ -844,23 +844,18 @@ def handle_new_tss_signing(self, msg): originator_obj = {} try: - content_info_text = b64.b64decode(msg["content_info"]).decode() - content_obj = convert_proto_str_to_object(content_info_text) - content_obj["content_type"] = b64.b64decode(msg["content_type"]).decode() + content_text = b64.b64decode(msg["content"]).decode() + content_obj = convert_proto_str_to_object(content_text) - originator_info_text = b64.b64decode(msg["originator_info"]).decode() - originator_obj = convert_proto_str_to_object(originator_info_text) - originator_obj["originator_type"] = b64.b64decode(msg["originator_type"]).decode() + originator_text = b64.b64decode(msg["originator"]).decode() + originator_obj = convert_proto_str_to_object(originator_text) - msg["content_info"] = b64.b64encode(json.dumps(content_obj).encode()).decode() - msg["originator_info"] = b64.b64encode(json.dumps(originator_obj).encode()).decode() + msg["content"] = content_obj + msg["originator"] = originator_obj except Exception as e: print("An error occurred:", e) - del msg["content_type"] - del msg["originator_type"] - self.conn.execute(tss_signings.insert(), msg) def handle_update_tss_signing(self, msg): diff --git a/flusher/flusher/tss_db.py b/flusher/flusher/tss_db.py index cc9292219..5a16c75a4 100644 --- a/flusher/flusher/tss_db.py +++ b/flusher/flusher/tss_db.py @@ -47,9 +47,11 @@ def process_bind_param(self, value, dialect): Column("id", sa.Integer, primary_key=True), Column("tss_group_id", sa.Integer, sa.ForeignKey("tss_groups.id")), Column("current_attempt", sa.Integer), - Column("content_info", CustomBase64), - Column("originator_info", CustomBase64), - Column("originator", CustomBase64), + Column("content_type", sa.String), + Column("content", sa.JSON), + Column("originator_type", sa.String), + Column("originator", sa.JSON), + Column("encoded_originator", CustomBase64), Column("message", CustomBase64), Column("group_pub_key", CustomBase64), Column("group_pub_nonce", CustomBase64), diff --git a/hooks/emitter/tss.go b/hooks/emitter/tss.go index 207ba8acd..dbc1da8b7 100644 --- a/hooks/emitter/tss.go +++ b/hooks/emitter/tss.go @@ -18,19 +18,19 @@ func (h *Hook) emitNewTssSigning( originator []byte, ) { h.Write("NEW_TSS_SIGNING", common.JsDict{ - "id": signing.ID, - "current_attempt": signing.CurrentAttempt, - "tss_group_id": signing.GroupID, - "originator": parseBytes(signing.Originator), - "message": parseBytes(signing.Message), - "group_pub_key": parseBytes(signing.GroupPubKey), - "group_pub_nonce": parseBytes(signing.GroupPubNonce), - "status": signing.Status, - "created_height": signing.CreatedHeight, - "content_type": parseBytes(contentType), - "content_info": parseBytes(content), - "originator_type": parseBytes(originatorType), - "originator_info": parseBytes(originator), + "id": signing.ID, + "current_attempt": signing.CurrentAttempt, + "tss_group_id": signing.GroupID, + "encoded_originator": parseBytes(signing.Originator), + "message": parseBytes(signing.Message), + "group_pub_key": parseBytes(signing.GroupPubKey), + "group_pub_nonce": parseBytes(signing.GroupPubNonce), + "status": signing.Status, + "created_height": signing.CreatedHeight, + "content_type": parseBytes(contentType), + "content": parseBytes(content), + "originator_type": parseBytes(originatorType), + "originator": parseBytes(originator), }) }