Background
Per Sam's review (2026-02-26 dev call), the cdel database in src/keri/db/basing.py (line ~1341) uses CesarSuber but should use CesarOnSuber.
# Current (basing.py)
self.cdel = subing.CesarSuber(db=self, subkey='cdel.', klas=coring.Diger)
Problem
The key space for cdel uses a sequence number (via Seqner.qb64/Number.qb64). When stored with a CESR code prefix, the base64 encoding is not guaranteed to be lexicographically ordered if the code ever changes. This means:
- Database iteration methods won't return entries in numerical order
- The behavior is fragile — changing from
Seqner to Number without huge could silently break ordering
Proposed Fix
- Change
CesarSuber → CesarOnSuber for the cdel database
- The key space would then use a hex string ordinal (no CESR code), guaranteeing lexicographic = numeric ordering
- Callers would pass the integer sequence number directly instead of constructing a
Seqner/Number instance for the key
Current callers in src/keri/app/delegating.py:
- Line ~96:
cdiger = self.hby.db.cdel.get(keys=(prefixer.qb64, seqner.qb64))
- Line ~234:
self.hby.db.cdel.put(keys=(pre, coring.Seqner(sn=serder.sn).qb64), val=coring.Diger(qb64=serder.said))
These would need to change to pass sn as an integer to the OnSuber-style key builder.
Context
References
subing.CesarOnSuber — the target DB class (uses hex ordinals in key space)
- Sam's direction from 2026-02-26 dev call transcript
Background
Per Sam's review (2026-02-26 dev call), the
cdeldatabase insrc/keri/db/basing.py(line ~1341) usesCesarSuberbut should useCesarOnSuber.Problem
The key space for
cdeluses a sequence number (viaSeqner.qb64/Number.qb64). When stored with a CESR code prefix, the base64 encoding is not guaranteed to be lexicographically ordered if the code ever changes. This means:SeqnertoNumberwithouthugecould silently break orderingProposed Fix
CesarSuber→CesarOnSuberfor thecdeldatabaseSeqner/Numberinstance for the keyCurrent callers in
src/keri/app/delegating.py:cdiger = self.hby.db.cdel.get(keys=(prefixer.qb64, seqner.qb64))self.hby.db.cdel.put(keys=(pre, coring.Seqner(sn=serder.sn).qb64), val=coring.Diger(qb64=serder.said))These would need to change to pass
snas an integer to theOnSuber-style key builder.Context
cdelbut does NOT change the DB type toCesarOnSuberReferences
subing.CesarOnSuber— the target DB class (uses hex ordinals in key space)