Skip to content

Commit

Permalink
Merge pull request WebOfTrust#634 from SmithSamuelM/dev
Browse files Browse the repository at this point in the history
base code of delegating recursive recovery rotation
  • Loading branch information
SmithSamuelM authored Dec 21, 2023
2 parents 67eece0 + 4babaea commit 88cab47
Show file tree
Hide file tree
Showing 12 changed files with 342 additions and 169 deletions.
4 changes: 2 additions & 2 deletions src/keri/app/cli/commands/ipex/grant.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def grantDo(self, tymth, tock=0.0):
iserder = coring.Serder(raw=bytes(iss))
seqner = coring.Seqner(sn=iserder.sn)

serder = self.hby.db.findAnchoringEvent(creder.ked['i'],
anchor=dict(i=iserder.pre, s=seqner.snh, d=iserder.said))
serder = self.hby.db.findAnchoringSealEvent(creder.ked['i'],
seal=dict(i=iserder.pre, s=seqner.snh, d=iserder.said))
anc = self.hby.db.cloneEvtMsg(pre=serder.pre, fn=0, dig=serder.said)

exn, atc = protocoling.ipexGrantExn(hab=self.hab, recp=recp, message=self.message, acdc=acdc, iss=iss, anc=anc,
Expand Down
10 changes: 5 additions & 5 deletions src/keri/app/delegating.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from . import agenting, forwarding
from .habbing import GroupHab
from .. import kering
from ..core import coring, serdering
from ..core import coring, eventing, serdering
from ..db import dbing
from ..peer import exchanging

Expand Down Expand Up @@ -83,11 +83,11 @@ def delegation(self, pre, sn=None, proxy=None):

self.postman.send(hab=phab, dest=hab.kever.delegator, topic="delegate", serder=exn, attachment=atc)

srdr = coring.Serder(raw=evt)
srdr = serdering.SerderKERI(raw=evt)
del evt[:srdr.size]
self.postman.send(hab=phab, dest=delpre, topic="delegate", serder=srdr, attachment=evt)

anchor = dict(i=srdr.pre, s=srdr.sn, d=srdr.said)
anchor = dict(i=srdr.pre, s=srdr.snh, d=srdr.said)
self.witq.query(hab=phab, pre=dkever.prefixer.qb64, anchor=anchor)

self.hby.db.dune.pin(keys=(srdr.pre, srdr.said), val=srdr)
Expand Down Expand Up @@ -153,8 +153,8 @@ def processUnanchoredEscrow(self):
kever = self.hby.kevers[pre]
dkever = self.hby.kevers[kever.delegator]

anchor = dict(i=serder.pre, s=serder.sn, d=serder.said)
if dserder := self.hby.db.findAnchoringEvent(dkever.prefixer.qb64, anchor=anchor):
anchor = dict(i=serder.pre, s=serder.snh, d=serder.said)
if dserder := self.hby.db.findAnchoringSealEvent(dkever.prefixer.qb64, seal=anchor):
seqner = coring.Seqner(sn=dserder.sn)
couple = seqner.qb64b + dserder.saidb
dgkey = dbing.dgKey(kever.prefixer.qb64b, kever.serder.saidb)
Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def processDelegateEscrow(self):
self.hby.db.cgms.put(keys=(pre, seqner.qb64), val=saider)

else: # Not witnesser, we need to look for the anchor and then wait for receipts
if serder := self.hby.db.findAnchoringEvent(kever.delegator, anchor=anchor):
if serder := self.hby.db.findAnchoringSealEvent(kever.delegator, seal=anchor):
aseq = coring.Seqner(sn=serder.sn)
couple = aseq.qb64b + serder.saidb
dgkey = dbing.dgKey(pre, saider.qb64b)
Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/querying.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def recur(self, tyme, deeds=None):
return False

kever = self.hab.kevers[self.pre]
if self.hby.db.findAnchoringEvent(self.pre, anchor=self.anchor):
if self.hby.db.findAnchoringSealEvent(self.pre, seal=self.anchor):
self.remove([self.witq])
return True

Expand Down
33 changes: 31 additions & 2 deletions src/keri/core/coring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1643,15 +1643,44 @@ def numh(self):
"""
return f"{self.num:x}"


@property
def sn(self):
"""Sequence number, sn property getter to mimic Seqner interface
Returns:
sn (int): alias for num
"""
return self.num


@property
def snh(self):
"""Sequence number hex str, snh property getter to mimic Seqner interface
Returns:
snh (hex str): alias for numh
"""
return self.numh



@property
def positive(self):
"""
Returns True if .num is positive False otherwise.
Because valid number .num must be non-negative, positive False means
Returns True if .num is strictly positive non-zero False otherwise.
Because valid number .num must be non-negative, positive False also means
that .num is zero.
"""
return True if self.num > 0 else False

@property
def inceptive(self):
"""
Returns True if .num == 0 False otherwise.
Because valid number .num must be non-negative, positive False means
that .num is zero.
"""
return True if self.num == 0 else False


class Dater(Matter):
"""
Expand Down
Loading

0 comments on commit 88cab47

Please sign in to comment.