[DRAFT] Baser→Suber Migration - Phase 1-6 Prep (Issue #1163)#1164
[DRAFT] Baser→Suber Migration - Phase 1-6 Prep (Issue #1163)#1164jaelliot wants to merge 5 commits intoWebOfTrust:mainfrom
Conversation
echo "Checking if rebase continued" POC: Migrate dtss and fels databases to Suber abstractions (WebOfTrust#1163) - Migrated dtss from raw LMDB to CesrSuber(klas=Dater) * getDts() now returns Dater objects with .dts and .datetime properties * putDts()/setDts() accept bytes for backward compat, auto-convert to Dater * Breaking change: consumers must use .dts property for ISO-8601 string - Migrated fels from raw LMDB to OnSuber() * Internal storage uses str qb64, maintains bytes API for backward compat * getFe() returns bytes, getFelItemPreIter() returns (bytes, int, bytes) * appendFe() accepts bytes, converts internally to str - Updated tests to check for correct Suber types - All test_baser tests passing (1/1) This is Phase 1 POC demonstrating low-risk migration path before tackling critical signature databases.
…ebOfTrust#1163) Successfully migrated 5 critical databases from raw LMDB to OnIoDupSuber: - kels: Key Event Log indices - pses: Partial Signed Escrow - pwes: Partial Witnessed Escrow - dels: Duplicitous Events Log - ldes: Likely Duplicitous Events Changes: - Migrated 40+ methods from raw LMDB API to Suber API - Updated database declarations to use OnIoDupSuber - Implemented backward compatibility layer (str→bytes conversion) - Added iterator format conversion (tuple→bytes) - Updated KEL iteration methods (forward, backward, last-only) Test Results: - 48/49 tests passing in tests/db/ (98% success rate) - All KEL replay operations validated - All escrow operations working correctly - Full backward compatibility maintained OnIoDupSuber chosen because these databases: - Use snKey(pre, sn) with ordinal sequence numbers - Require insertion-ordered duplicates - Need combined OnSuber + IoDupSuber capabilities Related: WebOfTrust#1163 Baser→Suber migration (Phase 3 of 4)
…ad of Dater Phase 4 integration testing revealed that getDts() returning Dater objects broke multiple consumers expecting bytes (ISO-8601 datetime strings). Changes: - getDts() now returns dater.dtsb (bytes) for backward compatibility - Internal storage remains CesrSuber(klas=Dater) - Consumers can continue using bytes(dtb) pattern - Zero breaking changes maintained Test Results: - All 157 core tests passing (was 140 passed, 17 failed) - All escrow tests passing (pses, pwes, ures) - All witness tests passing - All event processing tests passing Related: WebOfTrust#1163 Phase 4 integration testing
Updated dtss database tests to expect bytes instead of Dater objects from getDts() method, matching the backward compatibility change. Test Changes: - getDts() now returns bytes (was returning Dater objects) - Assertions updated to check bytes values directly - All 48 database tests passing Related: WebOfTrust#1163 Phase 4 integration testing
Baseline performance benchmark for sigs/wigs migration preparation.
Benchmark Script:
- Single signature operations (putSigs, getSigs, deserialization)
- Bulk operations (100 events × 3 signatures)
- Witness coordination (10 witnesses, threshold checks)
- Real-world workflow (full event validation cycle)
Purpose:
- Establish performance baseline before Phase 6 migration
- Validate <5% regression after migrating to CesrDupSuber
- Repeatable measurements for future optimizations
Usage:
python benchmark_signatures.py
Related: Phase 6 pre-work for Issue WebOfTrust#1163
1987d57 to
412e6a1
Compare
|
@jaelliot @SmithSamuelM |
Closing Draft PRClosing per @SmithSamuelM's directive to submit one database per PR for easier review and iterative feedback. This draft validated migration patterns across 7 databases (48/49 tests passing). Starting fresh with individual PRs for assigned databases: Status: Closing (not merging) Related: #1163 |
Migrate Baser subdbs to all use Suber
Part of #1163 - Remove technical debt. Upgrade all databases in Baser to use Suber subclasses.
Status: Draft / Work in Progress (7 of 18 databases complete)
This is a phased migration to reduce risk. This PR completes phases 1-6 (foundation + low-risk databases). Remaining phases planned with detailed prep work.
Progress
What's in this PR
Phase 1: LMDB Study & Documentation
Phase 2: POC Migration
dtss→CesrSuber(klas=Dater)- DateTime storage with ISO-8601 validationfels→OnSuber()- First-seen event log indicesPhase 3: KEL & Escrow Databases
kels→OnIoDupSuber()- Key event log indices (post-quantum safe via IoSet)pses→OnIoDupSuber()- Partial signed escrowpwes→OnIoDupSuber()- Partial witnessed escrowdels→OnIoDupSuber()- Duplicitous eventsldes→OnIoDupSuber()- Likely duplicitous eventsPhase 4: Integration Testing
getDts()breaking changePhase 5: Database Analysis
Phase 6 Prep: Signature Database Baseline
What's remaining
Next: Signature Databases (Phase 6)
sigs→CesrDupSuber(klas=Siger)wigs→CesrDupSuber(klas=Siger)Phase 7: Core Storage
evts→SerderSuber(klas=SerderKERI)- main event storageaess→CatCesrSuber(klas=(Prefixer, Cipher))- seal couplesPhase 8: Receipt Databases
rcts,ures,vrcs,vres→ variousCatCesrIoSetSuber(post-quantum safe)Phase 9: Investigation
imgs,iimgs- determine if active features or deprecatedNote:
ooesdeferred (Keanu working separately)Testing
Test results:
Validated:
Backward compatibility approach:
All migrations maintain external API compatibility while using Suber internally. Example:
This pattern was validated when Phase 4 testing caught the
getDts()breaking change - fixed immediately by adding this compatibility layer.Database migration map
dtssfelskelspsespwesdelsldessigswigsevtsaessrctsuresvrcsvresimgsiimgsooesPerformance
No performance-critical databases in this PR (only datetime storage, KEL indices, escrow).
Baseline established for Phase 6 signature databases:
Documentation
Created:
Updated:
Why draft?
This PR is 39% complete (7 of 18 databases). Remaining work estimated at 19-25h across 4 more phases.
Opening as draft to:
ooesseparately)Next steps depend on review feedback:
Questions for reviewers
Related: #1163
External documentation: keri-notes task folder