Skip to content

critical fix: #378 calculate ondex from prior est evt, not proposed one#379

Merged
kentbull merged 9 commits into
WebOfTrust:mainfrom
kentbull:ondex-on-rotation-pulled-from-last-est
May 26, 2026
Merged

critical fix: #378 calculate ondex from prior est evt, not proposed one#379
kentbull merged 9 commits into
WebOfTrust:mainfrom
kentbull:ondex-on-rotation-pulled-from-last-est

Conversation

@kentbull
Copy link
Copy Markdown
Collaborator

Problem

Failed multisig rotation where a new member is added and a new one is dropped during the same rotation. The root cause is the incorrect calculation of the ondex, the index of the prior next key digest, from the proposed rotation event, from rstates passed in to GroupIdentifierManager in the constructor. rstates is for the proposed event, not the prior establishment event.

Solution

Pull the n next keys (prerotated committed keys) from the prior establishment event and calculate the ondex values from that rather than the rstates from the proposed event.

Background

KERIpy validates ondexes, which are the pre-committed next key digest indexes, from the prior establishment event, not the new, proposed establishment event.

The reason we haven't hit this in the past is because all of the existing tests never swapped in a new member in the index/ondex of a prior member. We always had a clean addition of a new member and then a separate operation for the removal of the to-be-deleted member.

Essentially, we didn’t hit it because the existing tests never exercise departing-current-signer signs while absent from proposed rstates (the next set of pre-committments).

See #378 for an example rotation that reproduces this bug.

Signed-off-by: Kent Bull <kent@kentbull.com>
@kentbull kentbull requested review from iFergal, lenkan and m00sey May 12, 2026 03:07
@kentbull
Copy link
Copy Markdown
Collaborator Author

This also adds a fair bit of documentation to code that was poorly documented.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.53%. Comparing base (c87e99b) to head (0de697f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #379   +/-   ##
=======================================
  Coverage   97.53%   97.53%           
=======================================
  Files           1        1           
  Lines         325      325           
  Branches       24       24           
=======================================
  Hits          317      317           
  Misses          8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

kentbull added 3 commits May 11, 2026 21:10
Signed-off-by: Kent Bull <kent@kentbull.com>
Signed-off-by: Kent Bull <kent@kentbull.com>
Signed-off-by: Kent Bull <kent@kentbull.com>
Comment thread src/keri/core/keeping.ts Outdated
Comment thread src/keri/core/keeping.ts Outdated
Comment thread src/keri/core/keeping.ts Outdated
Comment thread test-integration/multisig-prior-next-ondex.test.ts Outdated
@kentbull kentbull changed the title fix: #378 calculate ondex from prior est evt, not proposed one critical fix: #378 calculate ondex from prior est evt, not proposed one May 12, 2026
Signed-off-by: Kent Bull <kent@kentbull.com>
Comment thread src/keri/core/keeping.ts Outdated
kentbull added 2 commits May 12, 2026 15:29
Signed-off-by: Kent Bull <kent@kentbull.com>
This is cleaner

Signed-off-by: Kent Bull <kent@kentbull.com>
Comment thread src/keri/core/keeping.ts Outdated
Comment thread src/keri/core/keeping.ts
Comment thread src/keri/core/manager.ts Outdated
Comment thread test-integration/modules/bip39_shim.ts
Comment thread src/keri/core/keeping.ts
Comment thread src/keri/core/keeping.ts Outdated
kentbull added 2 commits May 13, 2026 10:04
Signed-off-by: Kent Bull <kent@kentbull.com>
Signed-off-by: Kent Bull <kent@kentbull.com>
@kentbull kentbull added the bug Something isn't working label May 20, 2026
@kentbull kentbull merged commit 2eecd8c into WebOfTrust:main May 26, 2026
9 checks passed
@kentbull kentbull deleted the ondex-on-rotation-pulled-from-last-est branch May 26, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants