Skip to content

Commit

Permalink
fix fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nkitlabs committed Nov 28, 2024
1 parent 0d96cb9 commit c83777b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
17 changes: 6 additions & 11 deletions flusher/flusher/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 5 additions & 3 deletions flusher/flusher/tss_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
26 changes: 13 additions & 13 deletions hooks/emitter/tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
}

Expand Down

0 comments on commit c83777b

Please sign in to comment.