Skip to content

Commit 2d1608c

Browse files
committed
fix: group ixns skip unneeded approval check; OOBI resolve no longer re-escrows approved dip
Prior to this commit when performing OOBI resolution then any approved dip events were being re-added to the delegables escrow for another approval, which is incorrect because the dip was already approved. Adding a check during Kever.processEvent to look up the sequence number and digest of the seal fixes this. And group interaction events do not need delegation approval and thus should not be sent to the delegables escrow. This PR puts a type check for dip and drt around the logic that adds items to the delegables delegation approval escrow. There was also a third bug in the addition of dip and drt events to the delegables escrow. Only single sig events were being added to the escrow because the self.locallyDelegated() check was too restrictive and did not work for group multisig events. Adding the or self.locallyMembered(delpre) check loosened the check enough to work for group multisig events Signed-off-by: Kent Bull <[email protected]>
1 parent 14c9b8c commit 2d1608c

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

src/keri/app/cli/commands/delegate/confirm.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,10 @@ def confirmDo(self, tymth, tock=0.0):
121121
if ilk in (coring.Ilks.dip,):
122122
typ = "inception"
123123
delpre = eserder.sad["di"]
124-
125124
elif ilk in (coring.Ilks.drt,):
126125
typ = "rotation"
127126
dkever = self.hby.kevers[eserder.pre]
128127
delpre = dkever.delpre
129-
130128
else:
131129
continue
132130

@@ -170,11 +168,11 @@ def confirmDo(self, tymth, tock=0.0):
170168
saider = self.hby.db.cgms.get(keys=(prefixer.qb64, sner.qb64))
171169
if saider is not None:
172170
break
173-
174171
yield self.tock
175172

176-
print(f"Delegate {eserder.pre} {typ} event committed.")
173+
print(f"Delegate {typ} event {eserder.pre} committed.")
177174

175+
self.hby.db.delegables.rem(keys=(pre, sn), val=edig)
178176
self.remove(self.toRemove)
179177
return True
180178

@@ -211,27 +209,23 @@ def confirmDo(self, tymth, tock=0.0):
211209
while not witDoer.cues:
212210
_ = yield self.tock
213211

214-
print(f'Delegagtor Prefix {hab.pre}')
215-
print(f'\tDelegate {eserder.pre} {typ} Anchored at Seq. No. {hab.kever.sner.num}')
212+
print(f'Delegagtor Prefix {hab.pre}')
213+
print(f'\tDelegate {typ} event {eserder.pre} Anchored at Seq. No. {hab.kever.sner.num}')
216214

217215
# wait for confirmation of fully commited event
218216
if eserder.pre in self.hby.kevers:
219217
self.witq.query(src=hab.pre, pre=eserder.pre, sn=eserder.sn)
220-
221218
while eserder.sn < self.hby.kevers[eserder.pre].sn:
222219
yield self.tock
223-
224-
print(f"Delegate {eserder.pre} {typ} event committed.")
225220
else: # It should be an inception event then...
226221
wits = [werfer.qb64 for werfer in eserder.berfers]
227222
self.witq.query(src=hab.pre, pre=eserder.pre, sn=eserder.sn, wits=wits)
228-
229223
while eserder.pre not in self.hby.kevers:
230224
yield self.tock
231225

232-
print(f"Delegate {eserder.pre} {typ} event committed.")
226+
print(f"Delegate {typ} event {eserder.pre} committed.")
233227

234-
self.hby.db.delegables.rem(keys=(pre, sn))
228+
self.hby.db.delegables.rem(keys=(pre, sn), val=edig)
235229
self.remove(self.toRemove)
236230
return True
237231

src/keri/core/eventing.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2388,7 +2388,10 @@ def valSigsWigsDel(self, serder, sigers, verfers, tholder,
23882388
# seal in this case can't be malicious since sourced locally.
23892389
# Doesn't get to here until fully signed and witnessed.
23902390

2391-
if self.locallyDelegated(delpre) and not self.locallyOwned(): # local delegator
2391+
# should only run for delegated inception and rotation, not interaction. Ixn does not require approval.
2392+
if serder.ilk in (Ilks.dip, Ilks.drt) \
2393+
and (self.locallyDelegated(delpre) or self.locallyMembered(delpre)) \
2394+
and not self.locallyOwned(): # local delegator
23922395
# must be local if locallyDelegated or caught above as misfit
23932396
if delseqner is None or delsaider is None: # missing delegation seal
23942397
# so escrow delegable. So local delegator can approve OOB.
@@ -3786,6 +3789,19 @@ def processEvent(self, serder, sigers, *, wigers=None,
37863789

37873790
if pre not in self.kevers: # first seen event for pre
37883791
if ilk in (Ilks.icp, Ilks.dip): # first seen and inception so verify event keys
3792+
# check to see if the dip has already been approved and if so look up delseqner and delsaider
3793+
if ilk == Ilks.dip:
3794+
delpre = ked["di"]
3795+
seal = dict(i=serder.pre, s=serder.snh, d=serder.said)
3796+
# process dips as the delegator, not as the delegatee. Delegatee will not have the anchor dserder
3797+
dserder = self.db.fetchLastSealingEventByEventSeal(pre=delpre,
3798+
seal=seal)
3799+
if dserder is not None: # found seal in dserder
3800+
# only gets here for delegator
3801+
delseqner = coring.Seqner(sn=dserder.sn) # replace with found
3802+
delsaider = coring.Saider(qb64=dserder.said) # replace with found
3803+
# No need to do anything if processing dip as delegatee
3804+
37893805
# kever init verifies basic inception stuff and signatures
37903806
# raises exception if problem
37913807
# otherwise adds to KEL

0 commit comments

Comments
 (0)