diff options
| author | tv <tv@krebsco.de> | 2026-11-18 11:51:01 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-18 13:06:12 +0100 |
| commit | acfbdf87dd346137b05f8b28d54068de1c77e0c2 (patch) | |
| tree | f032122454b2c23c4369c4bd3b0d5434933b3057 | |
| parent | 1c0ad4202d971a3555157c2babc07999d166959d (diff) | |
continuum-party propose: only a version changing the current one
The client proposes a version only where it changes the current one as a
version must (its number, the hash it names, each `since`), and says why
it doesn't otherwise: no other can pass.
| -rw-r--r-- | docs/guides/federation/proposing-and-voting.md | 6 | ||||
| -rw-r--r-- | src/federation/party.rs | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/docs/guides/federation/proposing-and-voting.md b/docs/guides/federation/proposing-and-voting.md index 7293fba..6ba2121 100644 --- a/docs/guides/federation/proposing-and-voting.md +++ b/docs/guides/federation/proposing-and-voting.md @@ -49,8 +49,10 @@ continuum-party --node http://tv:secret@localhost:3000 --key tv.key --record tv. propose next.json ``` -The proposal is on the current version, and its hash is the version's: the node shows it -under that hash (`proposals` in `GET /events/counts`), with the events proposing it. +The client proposes only a version changing the current one, as a version must (its +`number`, `changes`, and each `since`), and says why it doesn't otherwise. The proposal +is on the current version, and its hash is the version's: the node shows it under that +hash (`proposals` in `GET /events/counts`), with the events proposing it. Several parties proposing the same version make one proposal. The key a party proposes and votes with is one the current version names for it, not one of its key set. diff --git a/src/federation/party.rs b/src/federation/party.rs index bc10a10..99a95be 100644 --- a/src/federation/party.rs +++ b/src/federation/party.rs @@ -14,7 +14,8 @@ //! each one argument, their comments left out) or node list (node IDs); //! * `next`: the version after the current one, to change and propose: the current one //! numbered on, naming its hash, without its checkpoint (JSON), to standard output; -//! * `propose FILE`: proposes the version `FILE` holds (JSON); +//! * `propose FILE`: proposes the version `FILE` holds (JSON), where it changes the +//! current one as a version must (`Version::changes_validly`); //! * `vote PROPOSAL yes|no`: votes on the proposal of hash `PROPOSAL` on the current //! version, by the record; with `--through`, through the node that votes for the //! party by itself and keeps its record, as such a party votes by hand; @@ -308,6 +309,12 @@ pub(crate) async fn main() -> Result<()> { } ("propose", sub) => { let version = version_in(sub.get_one::<String>("file").expect("required"))?; + let current = node.current().await?; + Version::read(&version) + .and_then(|proposed| proposed.changes_validly(Some(¤t))) + .map_err(|why| { + anyhow!("not a version changing version {}: {why}", current.number) + })?; sign( &node, &signer, |
