Vss#17
Merged
Merged
Conversation
f5c9b3e to
7ca91a8
Compare
…n deps to UTEXO-Protocol/dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
VSS Cloud Backup
Overview
VSS (Versioned Storage Service) cloud backup lets a node replicate its state to a remote server so it can be recovered later on a different device. It is fully optional and opt-in: it must be compiled into the build and turned on at startup by pointing the node at a VSS server URL. With it off, the node behaves exactly as a node without the feature.
The goal is disaster recovery: if the machine running the node is lost, a new node initialized with the same wallet mnemonic can pull its state back from the VSS server and resume operation.
What gets backed up
Two independent streams are replicated to the VSS server:
Both streams share one VSS server but use separate, isolated namespaces so they never collide.
When backups are triggered
Configuring the node
VSS is controlled entirely by command-line flags on the standalone node.
--vss-url <URL>--vss-allow-httphttp://URL for non-loopback hosts (otherwise onlyhttps://and loopback HTTP are allowed).--vss-allow-empty-restoreBy default, only
https://URLs (or loopbackhttp://, e.g. a local dev server) are accepted, so channel state is never sent in plaintext over an untrusted network by mistake.Examples
Enable backup against a remote server:
Local development against the bundled regtest VSS server:
Recover on a new machine: initialize/unlock the node with the same mnemonic and the same
--vss-url. On unlock, the node detects the empty local state and restores from VSS automatically before coming online.HTTP API
When VSS is enabled, two endpoints are available:
A non-zero pending-writes count in
/vssbackupinfomeans some updates have not yet reached the server; monitoring can alert on this to detect a persistently unreachable VSS server.How concurrency and atomicity are handled
Local store is the source of truth
Every write goes to the local store first and must succeed there; only then is it replicated to VSS. If the local write fails, the operation fails. This means the node never depends on the network being up to make progress, and the local copy is always authoritative.
Backups are eventually consistent, not transactional
Replication to VSS is best-effort. If a write cannot reach the server, it is placed on an in-memory retry queue and re-sent opportunistically on the next successful write. The queue is bounded; if it overflows, the oldest entry is dropped (the authoritative local copy still holds it). The result is an eventually-consistent remote copy whose staleness is observable via
/vssbackupinfo.Single-writer ownership (preventing concurrent corruption)
Each VSS store is meant to be owned by exactly one running node at a time. Two nodes writing to the same store would interleave and corrupt each other's state. To prevent this:
To migrate a store to a new node after the previous owner is definitively gone, the ownership marker is cleared out-of-band (by hand) before starting the new node.
Atomicity of individual values
Each value is written and encrypted as a single self-contained unit, so a value on the server is either the old version or the new one — never a partial mix. Restores read each value independently (and in parallel for speed), so an interrupted restore can simply be retried.
Encryption
The key-value stream is always encrypted at rest on the server; there is no option to disable it. The encryption key is derived from the wallet mnemonic, so only a node initialized with the same mnemonic can read or restore the backup. This is also why recovery requires the original mnemonic, not just access to the server.
SDK support
VSS configuration is currently available only on the standalone node (via the command-line flags and HTTP endpoints above). The embedded SDK (UniFFI bindings) does not yet expose VSS configuration, so SDK-driven nodes run without cloud backup for now. Exposing VSS through the SDK is a possible future addition.
Operational summary
--vss-url; everything else is automatic./vssbackupinfoto confirm backups are current.