Skip to content

Commit

Permalink
Merge pull request #532 from SmithSamuelM/dev
Browse files Browse the repository at this point in the history
Refactor ksn to use dataclass KeyStateRecord
  • Loading branch information
SmithSamuelM committed Jun 19, 2023
2 parents b03ccf2 + ade36ab commit 6d67fab
Show file tree
Hide file tree
Showing 9 changed files with 452 additions and 311 deletions.
10 changes: 5 additions & 5 deletions src/keri/app/cli/commands/local/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ def diffState(wit, preksn, witksn):

witstate = WitnessState()
witstate.wit = wit
mysn = preksn.sner.num
mydig = preksn.ked['d']
witstate.sn = coring.Number(num=witksn.ked["f"]).num
witstate.dig = witksn.ked['d']
mysn = int(preksn.s, 16)
mydig = preksn.d
witstate.sn = int(witksn.f, 16)
witstate.dig = witksn.d

# At the same sequence number, check the DIGs
if mysn == witstate.sn:
if mydig == witstate.dig:
Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/kiwiing.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def on_get(self, _, rep, prefix):

res = dict(
pre=pre,
state=kever.state().ked
state=kever.state()._asdict()
)

kel = []
Expand Down
12 changes: 6 additions & 6 deletions src/keri/app/querying.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def recur(self, tyme, deeds=None):
match cue['kin']:
case "keyStateSaved":
kcue = cue
ksn = kcue['serder']
match ksn.pre:
ksn = kcue['serder'] # key state notice dict
match ksn["i"]:
case self.pre:
if kever.sn < ksn.sn:
if kever.sn < int(ksn["s"], 16):
# Add new doer here instead of cueing to a while loop
self.extend([LogQuerier(hby=self.hby, hab=self.hab, ksn=ksn)])
self.remove([self.witq])
Expand All @@ -70,7 +70,7 @@ def __init__(self, hby, hab, ksn, **opts):
self.hab = hab
self.ksn = ksn
self.witq = agenting.WitnessInquisitor(hby=self.hby)
self.witq.query(src=self.hab.pre, pre=self.ksn.pre)
self.witq.query(src=self.hab.pre, pre=self.ksn["i"])
super(LogQuerier, self).__init__(doers=[self.witq], **opts)

def recur(self, tyme, deeds=None):
Expand All @@ -79,8 +79,8 @@ def recur(self, tyme, deeds=None):
Usage:
add result of doify on this method to doers list
"""
kever = self.hab.kevers[self.ksn.pre]
if kever.sn >= self.ksn.sn:
kever = self.hab.kevers[self.ksn["i"]]
if kever.sn >= int(self.ksn['s'], 16):
self.remove([self.witq])
return True

Expand Down
Loading

0 comments on commit 6d67fab

Please sign in to comment.