Skip to content

signer: Prevent state rollback across restarts - #769

Draft
ihordiachenko wants to merge 8 commits into
fix/926-one-shot-soft-modefrom
fix/924-state-watermark
Draft

ihordiachenko wants to merge 8 commits into
fix/926-one-shot-soft-modefrom
fix/924-state-watermark

Conversation

@ihordiachenko

Copy link
Copy Markdown
Collaborator

Refs GL #924. Depends on PR #766 for Hard mode and device storage.

After a restart, a signer can receive an older or incomplete snapshot whose entries still have valid signatures. That can roll back signer state or cause missing channel state to be treated as new.

  • Require persistent storage in Hard and Soft modes. Save a watermark with each signer-owned key’s version and value hash before returning signatures.
  • Reject startup snapshots with missing keys, older versions, or conflicting values at the same version. Include tombstones in the node’s initial snapshot.
  • Reject incomplete node records and restore VLS’s channel ID high-water mark while preserving legitimate retries.

Use one active signing device per node. A lost response or conflicting writes from two devices can block restart until the node supplies state that satisfies the watermark.

Expose DeviceStorage and an optional signer configuration hook for
metadata kept on the device. Provide a file-backed implementation for
glcli with atomic replacement and durable writes.

Distinguish absent records from storage failures, and keep record
encoding independent of the storage backend.
Default to Hard state signature checks and allow one successful Soft
migration per device and node. Save the migration marker before
publishing state or signatures. Processing failures leave migration
available; marker-write failures close the allowance.

Authorize and handle requests against scratch state, committing only
after handling and state signing succeed. Rejected input and changes
made during failed processing cannot be retained and signed later.
Allow Python and UniFFI SDK callers to opt into Soft mode with a
persistent device storage directory. Keep Hard as the default and
preserve signer configuration through authentication and NodeBuilder
creation paths.

Share FileDeviceStorage through the optional gl-client file-storage
feature. Update generated Python and Swift bindings and document the
migration APIs.
The node updates peers/ entries without a signer signature. Keep valid
addresses for channel backup recovery and skip malformed hints so a peer
update cannot block Hard mode. Keep peer hints out of signed responses.
The node advances its delta baseline when it sends a request. A signer
that discards a rejected request must reconnect to receive a full
snapshot. Back off before reconnecting to a node that keeps failing.
A synced file can still be lost if the directory that contains it was
just created. Sync the parent when creating a storage directory on Unix.
Check the startup snapshot against the last committed versions and value
hashes before restoring VLS state. Save the watermark before returning
signatures and stop the signer when a snapshot violates it.

Require complete node records, preserve signed tombstones, and restore
the VLS channel ID high-water mark while allowing retries for existing
channels.
@ihordiachenko
ihordiachenko force-pushed the fix/924-state-watermark branch from 4883996 to 28e2e10 Compare November 18, 2026 22:45
Make callers supply durable storage for production signers. Thread the
storage path through the bindings, CLIs, examples and test fixtures.

Reuse the signer and its loaded device state when applying credentials
after registration, recovery or standalone authentication.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant