Skip to content

chore(node): prove an upgrade keeps its key store - #654

Open
LKSNDRTMLKV wants to merge 1 commit into
mainfrom
chore/600-upgrade-fixture-keystore
Open

LKSNDRTMLKV wants to merge 1 commit into
mainfrom
chore/600-upgrade-fixture-keystore

Conversation

@LKSNDRTMLKV

Copy link
Copy Markdown
Member

Part of #600, the last of its three pull requests. It proves checks 2 and 3 of the 2026-11-19 comment. #600 can close once #648, #650 and this one have merged.

No changelog: test and fixture tooling only. No shipped behaviour changes.

What was unproven

  • A draft stored before the upgrade publishes after it. The draft arm of upgrade_from sent the publish and dropped the answer, so only a 5xx failed it.
  • An upgraded node opens the key store the previous release wrote. dpp-core 0.24.0 refuses a version-4 key store with no integrity tag. 0.23.0's only writer, persist_envelope, always writes the tag, so a v0.16.0 store should open. Nothing tested it:
    • every upgrade test started its node with a fresh key store;
    • the capture script wrote a keystore.enc and then threw it away.

What changes

  • The draft arm asserts 200, then status active, then a jwsSignature, for every draft in every fixture. All the drafts in v0.14.0, v0.15.0 and v0.16.0 publish: a stored determination carries no inputHash, and publish computes it again over the content it signs.
  • scripts/capture-upgrade-fixture.sh keeps the key store. It writes it into the fixture as keystore.enc, with its passphrase beside it in keystore.passphrase.
    • The passphrase is committed on purpose. The store holds only the throwaway key of a fixture node whose DID is a localhost URL and which never served anyone.
    • .gitignore gains one negation, for crates/dpp-node/tests/fixtures/upgrade/*/keystore.enc only, with that reason beside it. Every other *.enc is still refused.
  • The v0.16.0 fixture is re-captured with the changed script, from the tag's own binaries. Its dump.sql and public.json are rewritten as a capture does. v0.14.0 and v0.15.0 are not re-captured and keep a fresh store.
  • upgrade_from uses a fixture's key store when it has one.
    • The store is copied into the node's own tempfile::tempdir() before the node opens it, so no test can rewrite the committed file.
    • The node gets the capture's did:web host, read from the stored signatures' kid, as an operator upgrading in place would have it.
    • What the test then checks:
      • the node starts on the old store;
      • every signature the release stored verifies against the DID document the upgraded node serves, using dpp_crypto::jws::resolve_verification_key and verify_jws, the pair the resolver uses;
      • all of those signatures name one key;
      • each draft published after the upgrade is signed with that same key.
  • upgrade_fixture_coverage: the store is optional, but a fixture with keystore.enc must carry a non-empty keystore.passphrase, and the reverse.

Checked

  • The gate: just check green on this branch (1931 tests passed, 3 skipped, audit included). operator_paths and upgrade_fixture_coverage pass 12 of 12, with all three fixtures upgrading.
  • Clippy with the full feature set is clean, as are cargo fmt --check, bash -n and shellcheck on the script. The script's one shellcheck note, SC2015, is on a line this pull request does not touch.
  • Bite tests:
    • The draft arm made to expect suspended: it fails with left: "active".
    • A fresh key store in place of the fixture's: it fails with "the DID document the upgraded node serves names no key for the stored signature of …".
    • A different key compared, for a published draft and for the stored signatures: both fail, naming the passport.
    • keystore.passphrase removed: the coverage test fails with "keystore.enc has no keystore.passphrase beside it".

For whoever re-captures

On a machine whose /tmp is a RAM-backed tmpfs, building a release under the default mktemp -d can exhaust memory. A TMPDIR on a filesystem that does not keep Unix permissions also fails: the v0.16.0 node cannot create its local seal directory there. A TMPDIR on an ordinary Linux filesystem works, as does passing a built <bin-dir>.

@LKSNDRTMLKV LKSNDRTMLKV added this to the v0.17.0 milestone Nov 19, 2026
@LKSNDRTMLKV LKSNDRTMLKV added type/defect Something published or encoded here is wrong or unbackable now urgency/next Blocks work already scheduled epic/product-coverage Product groups, passport content and the rules behind them no-changelog Needs no CHANGELOG entry; the body says why on a 'No changelog:' line labels Nov 19, 2026
@LKSNDRTMLKV

Copy link
Copy Markdown
Member Author

@greptileai

@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This test-only PR appears safe to merge.

Summary

This PR strengthens upgrade tests to check that saved drafts publish and that an upgraded node keeps using the previous release's signing key. No shipped behavior changes.

  • Upgrade checks require stored drafts to publish with signatures.
  • Upgrade tests reopen a release's saved key store.

LKSNDRTMLKV explicitly intends the throwaway localhost fixture key and passphrase to be public. Older fixtures intentionally keep using fresh stores.

No actionable issues found.

Reviews (1) · Last reviewed commit: "chore(node): prove an upgrade keeps its ..." · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

epic/product-coverage Product groups, passport content and the rules behind them no-changelog Needs no CHANGELOG entry; the body says why on a 'No changelog:' line type/defect Something published or encoded here is wrong or unbackable now urgency/next Blocks work already scheduled

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant