aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-18 11:51:31 +0000
committertv <tv@krebsco.de>2026-11-18 13:07:01 +0100
commit847b0f51b20e5a7a947f56123799e6c1166aeef0 (patch)
tree131b4908cc3ed15faa8de04c17c631b0aa732d22
parentacfbdf87dd346137b05f8b28d54068de1c77e0c2 (diff)
continuum-party propose: the proposal's hash, and --yes
`propose` says the proposal's hash, the version's, which `vote` takes; with `--yes`, it votes `true` on it too, by the record, as `vote` does.
-rw-r--r--docs/guides/federation/getting-started.md14
-rw-r--r--docs/guides/federation/proposing-and-voting.md5
-rw-r--r--src/federation/party.rs24
3 files changed, 30 insertions, 13 deletions
diff --git a/docs/guides/federation/getting-started.md b/docs/guides/federation/getting-started.md
index 6eebbd8..5dcff5b 100644
--- a/docs/guides/federation/getting-started.md
+++ b/docs/guides/federation/getting-started.md
@@ -171,20 +171,20 @@ and makefu goes in:
"rules": [ { "path": "home/{party}/**", "writer": "{party}" } ] }
```
-One of them proposes it; the node shows the proposal by its hash, the version's:
+One of them proposes it, and votes `true` on it (`--yes`); the client says the
+proposal's hash, the version's:
```sh
continuum-party --node http://tv:secret@localhost:3000 --key tv.key --record tv.record \
- propose second.json
-curl -s -u tv:secret localhost:3000/events/counts | jq '.proposals | keys'
-# ["8d02…"]
+ propose second.json --yes
+# c41e… taken
+# proposal 8d02…
+# 5a77… taken
```
-Both vote `true`, each through its own node:
+The other votes `true` too, through its own node:
```sh
-continuum-party --node http://tv:secret@localhost:3000 --key tv.key --record tv.record \
- vote 8d02… yes
continuum-party --node http://lass:secret@localhost:3000 --key lass.key \
--record lass.record vote 8d02… yes
```
diff --git a/docs/guides/federation/proposing-and-voting.md b/docs/guides/federation/proposing-and-voting.md
index 6ba2121..08fead9 100644
--- a/docs/guides/federation/proposing-and-voting.md
+++ b/docs/guides/federation/proposing-and-voting.md
@@ -47,8 +47,13 @@ is none: it can't pass, and a party's client backs none.
```sh
continuum-party --node http://tv:secret@localhost:3000 --key tv.key --record tv.record \
propose next.json
+# c41e… taken
+# proposal 8d02…
```
+With `--yes`, the client votes `true` on it too, as `vote 8d02… yes` does (Voting,
+below): a party whose node votes for it by itself votes through that node instead.
+
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
diff --git a/src/federation/party.rs b/src/federation/party.rs
index 99a95be..43b2cba 100644
--- a/src/federation/party.rs
+++ b/src/federation/party.rs
@@ -15,7 +15,8 @@
//! * `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), where it changes the
-//! current one as a version must (`Version::changes_validly`);
+//! current one as a version must (`Version::changes_validly`), and says the proposal's
+//! hash; with `--yes`, votes `true` on it too, as `vote` does;
//! * `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;
@@ -108,8 +109,14 @@ fn command() -> Command {
))
.subcommand(
Command::new("propose")
- .about("Proposes the version a file holds (JSON)")
- .arg(id("file")),
+ .about("Proposes the version a file holds (JSON), and says the proposal's hash")
+ .arg(id("file"))
+ .arg(
+ Arg::new("yes")
+ .long("yes")
+ .action(ArgAction::SetTrue)
+ .help("Votes true on it too, by the record, as vote does"),
+ ),
)
.subcommand(
Command::new("vote")
@@ -310,8 +317,8 @@ 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(&current)))
+ let proposed = Version::read(&version)
+ .and_then(|proposed| proposed.changes_validly(Some(&current)).map(|()| proposed))
.map_err(|why| {
anyhow!("not a version changing version {}: {why}", current.number)
})?;
@@ -322,7 +329,12 @@ pub(crate) async fn main() -> Result<()> {
&path,
event::proposal(&version),
)
- .await
+ .await?;
+ println!("proposal {}", proposed.hash);
+ if sub.get_flag("yes") {
+ vote(&node, &signer, &mut record, &path, proposed.hash, true).await?;
+ }
+ Ok(())
}
("vote", sub) => {
let proposal = Id::from_hex(sub.get_one::<String>("proposal").expect("required"))