From 087f62f464d0aad50643c2de83c5ded303f3f001 Mon Sep 17 00:00:00 2001 From: Philip Feairheller Date: Wed, 27 Dec 2023 12:55:20 -0800 Subject: [PATCH] Update to uses of seqno to ensure we are properly using hex string or int explicitly. (#162) Signed-off-by: pfeairheller --- src/keria/app/credentialing.py | 13 ++++++++++--- src/keria/app/grouping.py | 2 +- src/keria/app/ipexing.py | 10 +++++----- src/keria/peer/exchanging.py | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/keria/app/credentialing.py b/src/keria/app/credentialing.py index 21f6207d..d06c352a 100644 --- a/src/keria/app/credentialing.py +++ b/src/keria/app/credentialing.py @@ -13,7 +13,6 @@ from keri.app import signing from keri.app.habbing import SignifyGroupHab from keri.core import coring, scheming, serdering -from keri.core.eventing import SealEvent from keri.db import dbing from keria.core import httping, longrunning @@ -755,8 +754,6 @@ def issue(self, regk, iserder, anc): vcid = iserder.ked["i"] rseq = coring.Seqner(snh=iserder.ked["s"]) - rseal = SealEvent(vcid, rseq.snh, iserder.said) - rseal = dict(i=rseal.i, s=rseal.s, d=rseal.d) if not isinstance(hab, SignifyGroupHab): # not a multisig group seqner = coring.Seqner(sn=hab.kever.sner.num) @@ -822,6 +819,16 @@ def revoke(self, regk, rserder, anc): return vcid, rseq.sn def complete(self, pre, sn=0): + """ Determine if registry event (inception, issuance, revocation, etc.) is finished validation + + Parameters: + pre (str): qb64 identifier of registry event + sn (int): integer sequence number of regsitry event + + Returns: + bool: True means event has completed and is commited to database + """ + seqner = coring.Seqner(sn=sn) said = self.rgy.reger.ctel.get(keys=(pre, seqner.qb64)) return said is not None diff --git a/src/keria/app/grouping.py b/src/keria/app/grouping.py index 896ee97e..90ebd548 100644 --- a/src/keria/app/grouping.py +++ b/src/keria/app/grouping.py @@ -60,7 +60,7 @@ def on_post(req, rep, name): # create seal for the proper location to find the signatures kever = hab.mhab.kever - seal = eventing.SealEvent(i=hab.mhab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d) + seal = eventing.SealEvent(i=hab.mhab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d) ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal) ims.extend(atc.encode("utf-8")) # add the pathed attachments diff --git a/src/keria/app/ipexing.py b/src/keria/app/ipexing.py index 0aca9831..36d65f91 100644 --- a/src/keria/app/ipexing.py +++ b/src/keria/app/ipexing.py @@ -77,7 +77,7 @@ def sendAdmit(agent, hab, ked, sigs, rec): # Now create the stream to send, need the signer seal kever = hab.kever - seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d) + seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d) ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal) @@ -118,7 +118,7 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec): # Now create the stream to send, need the signer seal kever = hab.kever - seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d) + seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d) ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal) @@ -185,7 +185,7 @@ def sendGrant(agent, hab, ked, sigs, atc, rec): # Now create the stream to send, need the signer seal kever = hab.kever - seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d) + seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d) ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal) ims = ims + atc.encode("utf-8") @@ -213,7 +213,7 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec): holder = grant['a']['i'] serder = serdering.SerderKERI(sad=grant) sigers = [coring.Siger(qb64=sig) for sig in sigs] - seal = eventing.SealEvent(i=hab.pre, s=hex(hab.kever.lastEst.s), d=hab.kever.lastEst.d) + seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(hab.kever.lastEst.s), d=hab.kever.lastEst.d) ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal) ims = ims + atc.encode("utf-8") @@ -227,7 +227,7 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec): # Now create the stream to send, need the signer seal kever = hab.kever - seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d) + seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d) ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal) diff --git a/src/keria/peer/exchanging.py b/src/keria/peer/exchanging.py index 17f46606..07470d31 100644 --- a/src/keria/peer/exchanging.py +++ b/src/keria/peer/exchanging.py @@ -62,7 +62,7 @@ def on_post(req, rep, name): # Now create the stream to send, need the signer seal kever = hab.kever - seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d) + seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d) ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal)