Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions crates/ciris-kernel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog — ciris-kernel

## [0.6.22]

Pins Constitution `v1.0-rc23-pre15` (tag object f549027, commit ee06cae, family_model sha256 69f1dbf0, 194 families), moved from pre14: it carries CC 5.1 "A reader's start" (the text of this release's rule) and moves the registry hash; no family cell changed. The text read is `v1.0-rc23-pre16` (tag object 142dc56, commit c0e88fe), whose ten pinned files are byte for byte pre15's: it states two sentences of "A reader's start" as the crate reads them (an ask answered by a Commit that stands by the reading that uses no start; applying a Welcome's group waits on its named rows as a device duty, not a reading). Does NOT read the charter `suites` member. The roll's kernel, frozen with pre15 (Eric reopened the freeze for this fix alone).

- **Fixed: a member's Welcome moved its head onto a Commit nobody else reads** (M13', CC 5.1 "A reader's start", 2026-12-05; `mls::branch_standing_from`, `commit_head_from`, `commit_delta_from`; `check_commit.py` Part 8). Two rules. (i) In `commit_head_from`, a Commit that stands for the reader only because it is a start shadows none of the Commits it names; one that stands by the recursion shadows as before. (ii) A counting Welcome for a key of `me`, citing C, makes a start where (a), (b) or (c) holds. (a) Joiner, both: the reader has signed no held Commit of C's group (`mls.gen` and `call`, absent equals absent) and has signed no held row whose causal past (inclusive) holds a Commit of that group that cites a key_package row signed by a key of `me`. (b) Asked: C's past holds a row signed by `me` that is its acceptance (placed as a row, `CommitRow::is_acceptance`) or its `withdraws` of its own leaf vouch for the room (no liveness read), and (b1) no Commit that cites a KeyPackage of `me` has the ask in its past, among those that stand for the reader by the full reading or are in C's past, and (b3) no held row signed by `me`, standing or not, has the ask in its past. (c) Acknowledged: some held row signed by `me`, other than C, has C in its past. Otherwise it makes no start and the reader reads by the full reading. The starts are found once per call. Added: `CommitRow::is_acceptance` (default false) and `pub fn mls::welcome_starts(.., me)` (the start set, asserted in the replay); the fixture `mls_m13.json` carries `starts`, `seated` and `seat_by` per case. Cases M13.11 to M13.30 (A, B, B2, the stranded world, A3, 18b with and without the reader's Update, the re-admitted member, the joined-by-start member with and without its ack, the second device, W1 and W3, the successor gen, the founder). Changed answers: M13.6 is a fork again (Carol has signed nothing). Plants `start_shadows`, `member_starts`, `joiner_by_full_reading`, `joiner_founder_unread`, `joiner_ack_unread`, `ack_unread`, `asked_unread`, `asked_any_signer`, `asked_reused`, `asked_answer_by_full_only`, `asked_own_row_unread`, `asked_own_row_standing`, `asked_acceptance_unread`.

## [0.6.21]

Pins Constitution `v1.0-rc23-pre14` (tag object 4bfa7f0, commit 4007c95, family_model sha256 b436228e, 194 families), moved from pre13: it carries the text of M11″ (CC 5.1, "The end of a vouch"), M12 (the KeyPackage paragraph) and M13 (the Welcome paragraph), and adds `holon:stake` (tables regenerated). Does NOT read the charter `suites` member. This is the roll's kernel, frozen with pre14.
Expand Down
2 changes: 1 addition & 1 deletion crates/ciris-kernel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ciris-kernel"
version = "0.6.21"
version = "0.6.22"
edition = "2021"
rust-version = "1.89"
description = "The CIRIS causal kernel as pure functions over an abstract row graph (no I/O, no clock, no crypto)"
Expand Down
2 changes: 1 addition & 1 deletion crates/ciris-kernel/VECTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ below that the schema cannot state is marked **(prose)**; a minter checks it and
```json
{
"form": "ciris-kernel-cases/1",
"constitution": "CIRISConstitution v1.0-rc23-pre14 4007c95",
"constitution": "CIRISConstitution v1.0-rc23-pre15 ee06cae",
"cases": [ ... ]
}
```
Expand Down
4 changes: 2 additions & 2 deletions crates/ciris-kernel/src/audience_table.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @generated by tools/family_placement.py from the Constitution's manifests/family_model.json
// (branch v1.0-rc23-pre14, commit 4007c95d5ec9d81f7bc6dd34b170758a720ada93, sha256 b436228eba502f0191c87f09f8ed48d424c5b566ed83fe6093fa2e71c5a07233). Do not edit: re-pin with that script.
// (branch v1.0-rc23-pre15, commit ee06cae20819c987c6572300b9513c62e1f0941c, sha256 69f1dbf0191c76aa8e2ab60388643c32132316446b72f19379826dcc1b6d4289). Do not edit: re-pin with that script.

use super::{Blind, FamilyPlacement, Follows, Placement};

/// The family model's sha256, the pin of [`FAMILIES`].
pub const FAMILY_MODEL_SHA256: &str = "b436228eba502f0191c87f09f8ed48d424c5b566ed83fe6093fa2e71c5a07233";
pub const FAMILY_MODEL_SHA256: &str = "69f1dbf0191c76aa8e2ab60388643c32132316446b72f19379826dcc1b6d4289";

/// The cohort scope a row states, with the placement it is (the table's `scopes`, CC 5.2), and `addressed`.
pub const SCOPES: &[(&str, Placement)] = &[
Expand Down
2 changes: 1 addition & 1 deletion crates/ciris-kernel/src/erasure_table.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @generated by tools/family_placement.py from the Constitution's manifests/family_model.json
// (branch v1.0-rc23-pre14, commit 4007c95d5ec9d81f7bc6dd34b170758a720ada93, sha256 b436228eba502f0191c87f09f8ed48d424c5b566ed83fe6093fa2e71c5a07233). Do not edit: re-pin with that script.
// (branch v1.0-rc23-pre15, commit ee06cae20819c987c6572300b9513c62e1f0941c, sha256 69f1dbf0191c76aa8e2ab60388643c32132316446b72f19379826dcc1b6d4289). Do not edit: re-pin with that script.

use super::{Descent, Route};

Expand Down
2 changes: 1 addition & 1 deletion crates/ciris-kernel/src/kept_table.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @generated by tools/family_placement.py from the Constitution's manifests/family_model.json
// (branch v1.0-rc23-pre14, commit 4007c95d5ec9d81f7bc6dd34b170758a720ada93, sha256 b436228eba502f0191c87f09f8ed48d424c5b566ed83fe6093fa2e71c5a07233). Do not edit: re-pin with that script.
// (branch v1.0-rc23-pre15, commit ee06cae20819c987c6572300b9513c62e1f0941c, sha256 69f1dbf0191c76aa8e2ab60388643c32132316446b72f19379826dcc1b6d4289). Do not edit: re-pin with that script.

use super::WithdrawCell;

Expand Down
119 changes: 109 additions & 10 deletions crates/ciris-kernel/src/mls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ pub trait CommitRow: LeafVouchRow {
fn is_key_package(&self) -> bool {
false
}
/// Whether the row is a `membership:acceptance` placed as a row (the ask of M13' (b)). Default: no.
fn is_acceptance(&self) -> bool {
false
}
/// On a KeyPackage: whether it states `last_resort` (literal true; M12). A last-resort KeyPackage is never spent:
/// several standing Commits may cite it ([`key_package_spent_by`] names none). Default: no.
fn key_package_last_resort(&self) -> bool {
Expand Down Expand Up @@ -739,19 +743,25 @@ where
S: CutSpec<R>,
{
let mut st = Stands::new(c, law, spec, who, room);
head_by(c, commits, |id| st.stands(id))
head_by(c, commits, |id| (st.stands(id), false))
}

// the heads of `commits`, standing read by `stands` ([`commit_head`], [`commit_head_from`])
// the heads of `commits`, standing read by `stands` ([`commit_head`], [`commit_head_from`]): the answer, and whether the
// Commit stands ONLY as a start (M13'), which shadows none of the Commits it names
fn head_by<R: CommitRow>(
c: &Concluded<'_, R>,
commits: &BTreeSet<R::Id>,
mut stands: impl FnMut(&R::Id) -> Result<bool, R::Id>,
mut stands: impl FnMut(&R::Id) -> (Result<bool, R::Id>, bool),
) -> CommitHead<R::Id> {
let mut up: Vec<&R::Id> = Vec::new();
let mut solo: BTreeSet<&R::Id> = BTreeSet::new();
let mut waits: BTreeSet<R::Id> = BTreeSet::new();
for id in commits {
match stands(id) {
let (res, only) = stands(id);
if only {
solo.insert(id);
}
match res {
Ok(true) => up.push(id),
Ok(false) => {}
Err(w) => {
Expand All @@ -766,7 +776,7 @@ fn head_by<R: CommitRow>(
};
}
let mut shadowed: BTreeSet<&R::Id> = BTreeSet::new();
for &id in &up {
for &id in up.iter().filter(|id| !solo.contains(**id)) {
let r = c.g.row(c.g.idx(id).expect("a standing Commit is held"));
shadowed.extend(r.commit_prev().into_iter().chain(r.commit_further_prev()));
}
Expand Down Expand Up @@ -990,6 +1000,7 @@ where
// the starts, found once per call: one pass over the held rows for the Welcomes of a key of `me`, then each such
// Welcome is read by [`welcome_counts`]; a wait makes no start
let mut starts = BTreeSet::new();
let mut base = Stands::new(c, law, spec, who, room);
for &w in c.cs() {
let row = c.g.row(w);
if row.is_welcome() && row.welcome_joiner().is_some_and(|j| me.contains(j)) {
Expand All @@ -1000,7 +1011,65 @@ where
}
}
}
StandsFrom { base: Stands::new(c, law, spec, who, room), starts, memo: BTreeMap::new() }
// M13' ("a member is not a joiner", CC ruling pending, 2026-12-05): a counting Welcome for a key of `me`, citing the
// Commit C, makes a start where (a) OR (b) OR (c). (a) Joiner, BOTH: the reader has signed no held Commit of C's
// group (the cited Commit's `mls.gen` and `call`, absent equals absent), and has signed no held row whose causal
// past (inclusive) holds a Commit of that group that CITES a key_package row signed by a key of `me`. (b) Asked: C's
// past holds a row signed by `me` that is its acceptance (placed as a row) or its `withdraws` of its own leaf vouch
// for this room (no liveness is read), AND (b1) no Commit that cites a KeyPackage of `me` has the ask in its past,
// among those that stand for the reader by the full reading or are in C's past (C excluded), and (b3) no held row
// signed by `me` (any family, standing or not) has the ask in its past. (c) Acknowledged: some held row signed by `me`
// other than C has C in its past (C itself not signed by `me`). Found once per call, and only where a Welcome counts.
if !starts.is_empty() {
let c = base.c;
let group = |r: &R| (r.commit_mls().map(|m| m.gen), r.commit_call());
let commits: Vec<usize> = c.cs().iter().copied().filter(|&q| c.g.row(q).is_commit()).collect();
let standing: BTreeSet<usize> =
commits.iter().copied().filter(|&q| base.stands(c.g.row(q).id()) == Ok(true)).collect();
let signed = |r: &R| me.contains(r.signer());
let own = |e: usize| me.contains(c.g.row(e).signer());
let mine: Vec<usize> = c.cs().iter().copied().filter(|&q| own(q)).collect();
let cites_mine = |e: usize| {
c.g.row(e).is_commit()
&& c.g.row(e).commit_cites().iter().any(|k| {
c.g.idx(k).is_some_and(|x| c.g.row(x).is_key_package() && me.contains(c.g.row(x).signer()))
})
};
let is_ask = |q: usize| {
let r = c.g.row(q);
(r.is_acceptance() && signed(r))
|| (signed(r)
&& r.vouch_withdraws().and_then(|t| c.g.idx(t)).is_some_and(|ti| {
let v = c.g.row(ti);
v.is_leaf_vouch() && v.vouch_room().as_ref() == Some(room) && signed(v)
}))
};
let asked = |ci: usize| {
c.cs().iter().copied().filter(|&a| a != ci && c.g.in_past(a, ci) && is_ask(a)).any(|a| {
let b1 = !commits.iter().any(|&e| {
e != ci && cites_mine(e) && c.g.in_past(a, e) && (c.g.in_past(e, ci) || standing.contains(&e))
});
let b3 = !mine.iter().any(|&y| c.g.in_past(a, y));
b1 && b3
})
};
starts.retain(|s| {
let Some(ci) = c.g.idx(s) else { return false };
let grp = group(c.g.row(ci));
let founded = commits.iter().any(|&e| group(c.g.row(e)) == grp && own(e));
let acked = mine.iter().any(|&y| {
commits.iter().any(|&z| group(c.g.row(z)) == grp && cites_mine(z) && (z == y || c.g.in_past(z, y)))
});
let acknowledged = !own(ci) && mine.iter().any(|&y| y != ci && c.g.in_past(ci, y));
(!founded && !acked) || acknowledged || asked(ci)
});
}
StandsFrom { base, starts, memo: BTreeMap::new() }
}

// whether the Commit stands for the reader ONLY because it is a start (the full reading does not give true)
fn only_start(&mut self, id: &R::Id) -> bool {
self.starts.contains(id) && self.base.stands(id) != Ok(true)
}

fn stands(&mut self, id: &R::Id) -> Result<bool, R::Id> {
Expand Down Expand Up @@ -1039,13 +1108,41 @@ where
}
}

/// The starts of the reader holding the device keys `me` (M13'): the Commits cited by a held Welcome for one of its keys that
/// counts ([`welcome_counts`]) and for which (a), (b) or (c) holds (see [`branch_standing_from`]). Cost as there. The reference
/// is `mls.welcome_starts`.
pub fn welcome_starts<R, S>(
c: &Concluded<'_, R>,
law: &SeatLaw,
spec: &S,
who: &Parties<'_, R::Key, R::Id>,
room: &Obj<R::Id, R::Key>,
me: &[R::Key],
) -> BTreeSet<R::Id>
where
R: WelcomeRow + Dated<Instant = <R as KeyEndRow>::T>,
S: CutSpec<R>,
{
StandsFrom::new(c, law, spec, who, room, me).starts
}

/// [`branch_standing`] for a reader holding the device keys `me` (a SET: a node re-added under a new device key holds
/// Welcomes to two of its keys, and the starts are the union over all of them), M13. The starts are derived: the Commits cited
/// by a held Welcome whose joiner is one of `me` and for which [`welcome_counts`] is true (a wait makes no start); there may
/// be several. A Commit stands for the reader where it stands by the full reading, OR it is a start, OR it stands alone
/// ([`commit_stands_alone`]) and every Commit it names stands for the reader by this same rule, so recursion stops at a
/// start. **Cost:** one pass over the held rows for the candidate Welcomes, once per call; where none is a Welcome of a key
/// of `me`, exactly [`branch_standing`]. The reference is `mls.branch_standing_from`.
/// start. **M13' ("a member is not a joiner", CC ruling pending, 2026-12-05):** a counting Welcome for a key of `me`, citing
/// the Commit C, makes a start where (a) OR (b) OR (c). (a) Joiner, both: the reader has signed no held Commit of C's group
/// (the cited Commit's `mls.gen` and `call`, absent equals absent; this covers the founder), and has signed no held row whose
/// causal past (inclusive) holds a Commit of that group that cites a key_package row signed by a key of `me` (it has never
/// acknowledged a seat in the group). (b) Asked: C's past holds a row signed by `me` that is its acceptance of the seat at C's
/// roster head ([`CommitRow::is_acceptance`], placed as a row) or its `withdraws` of its own mls:leaf_vouch for this room (no
/// liveness is read); AND (b1) no Commit that cites a KeyPackage row signed by `me` has the ask in its own past, among the
/// Commits that stand for the reader by the full reading or are in C's past (C excluded); and (b3) no held row signed by `me`
/// (any family, standing or not) has the ask in its past. (c) Acknowledged: some held row signed by a key of `me`, other than
/// C, has C in its causal past (C itself not signed by `me`). Otherwise the reader reads by the full reading. **Cost:** one pass over the held rows for
/// the candidate Welcomes, once per call (the full standing of the held Commits only where a Welcome counts); where none is
/// a Welcome of a key of `me`, exactly [`branch_standing`]. The reference is `mls.branch_standing_from`.
pub fn branch_standing_from<R, S>(
c: &Concluded<'_, R>,
law: &SeatLaw,
Expand All @@ -1062,7 +1159,9 @@ where
StandsFrom::new(c, law, spec, who, room, me).stands(commit).map_err(Wait)
}

/// [`commit_head`] with standing for the reader holding `me` ([`branch_standing_from`]; M13). **Cost** as
/// [`commit_head`] with standing for the reader holding `me` ([`branch_standing_from`]; M13). A Commit that stands for the
/// reader ONLY because it is a start shadows none of the Commits it names (M13'); one that stands by the recursion shadows as
/// before. **Cost** as
/// [`branch_standing_from`]: the starts are found once per call. The reference is `mls.commit_head_from`.
pub fn commit_head_from<R, S>(
c: &Concluded<'_, R>,
Expand All @@ -1078,7 +1177,7 @@ where
S: CutSpec<R>,
{
let mut st = StandsFrom::new(c, law, spec, who, room, me);
head_by(c, commits, |id| st.stands(id))
head_by(c, commits, |id| (st.stands(id), st.only_start(id)))
}

/// [`commit_delta`] for the reader holding `me` (M13). A Commit that is a start whose `prev` is not held has no earlier
Expand Down
2 changes: 1 addition & 1 deletion crates/ciris-kernel/src/signers_table.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @generated by tools/family_placement.py from the Constitution's manifests/family_model.json
// (branch v1.0-rc23-pre14, commit 4007c95d5ec9d81f7bc6dd34b170758a720ada93, sha256 b436228eba502f0191c87f09f8ed48d424c5b566ed83fe6093fa2e71c5a07233). Do not edit: re-pin with that script.
// (branch v1.0-rc23-pre15, commit ee06cae20819c987c6572300b9513c62e1f0941c, sha256 69f1dbf0191c76aa8e2ab60388643c32132316446b72f19379826dcc1b6d4289). Do not edit: re-pin with that script.

use super::{SignerCell, SignerRule, Via, Who};

Expand Down
2 changes: 1 addition & 1 deletion crates/ciris-kernel/tests/fixtures/audience.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/ciris-kernel/tests/fixtures/mls_m13.json

Large diffs are not rendered by default.

21 changes: 19 additions & 2 deletions crates/ciris-kernel/tests/mls_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ mod common;
use ciris_kernel::layers::{conclude, kept};
use ciris_kernel::mls::{
branch_standing, branch_standing_from, commit_delta, commit_delta_from, commit_head, commit_head_from,
key_package_served, key_package_spent, key_package_spent_by, welcome_counts, CommitHead, CommitRow, Mls,
WelcomeRow, SUITE_CLASSICAL,
key_package_served, key_package_spent, key_package_spent_by, welcome_counts, welcome_starts, CommitHead, CommitRow,
Mls, WelcomeRow, SUITE_CLASSICAL,
};
use ciris_kernel::seat::Obj;
use ciris_kernel::withdraws::Parties;
Expand Down Expand Up @@ -79,6 +79,9 @@ impl CommitRow for TRow {
_ => Some(SUITE_CLASSICAL),
}
}
fn is_acceptance(&self) -> bool {
self.kind == "accept"
}
fn is_key_package(&self) -> bool {
self.kind == "key_package"
}
Expand Down Expand Up @@ -408,7 +411,17 @@ fn the_joiner_reads_from_its_welcome() {
eprintln!(" {}: got {got:?}, want {:?}", case.at("name").s(), case.at("want"));
}
});
// the derived start set, fixture and crate
let starts_ok = |case: &J, c: &ciris_kernel::layers::Concluded<'_, TRow>, room: &Obj<String, String>| {
let me = case.at("me").arr().iter().map(|k| k.s().to_string()).collect::<Vec<_>>();
let got = with_who(|who| welcome_starts(c, &law, &DictCut, who, room, &me));
got == case.at("starts").str_set()
};
each(fx.at("standing").arr(), |case, c, room| {
if !starts_ok(case, c, room) {
bad += 1;
eprintln!(" {}: starts differ", case.at("name").s());
}
let id = case.at("commit").s().to_string();
let me = me_of(case);
let got = with_who(|who| branch_standing_from(c, &law, &DictCut, who, room, &me, &id));
Expand All @@ -419,6 +432,10 @@ fn the_joiner_reads_from_its_welcome() {
}
});
each(fx.at("heads").arr(), |case, c, room| {
if !starts_ok(case, c, room) {
bad += 1;
eprintln!(" {}: starts differ", case.at("name").s());
}
let commits = case.at("commits").str_set();
let me = me_of(case);
let got = with_who(|who| commit_head_from(c, &law, &DictCut, who, room, &me, &commits));
Expand Down
2 changes: 1 addition & 1 deletion crates/ciris-kernel/tests/vectors/keyview.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"form": "ciris-kernel-cases/1",
"constitution": "CIRISConstitution v1.0-rc23-pre14 4007c95",
"constitution": "CIRISConstitution v1.0-rc23-pre15 ee06cae",
"cases": [
{
"id": "key.end.rotation_at_old_end",
Expand Down
2 changes: 1 addition & 1 deletion crates/ciris-kernel/tests/vectors/persons.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"form": "ciris-kernel-cases/1",
"constitution": "CIRISConstitution v1.0-rc23-pre14 4007c95",
"constitution": "CIRISConstitution v1.0-rc23-pre15 ee06cae",
"cases": [
{
"id": "persons.first_key",
Expand Down
2 changes: 1 addition & 1 deletion crates/ciris-kernel/tests/vectors/seats.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"form": "ciris-kernel-cases/1",
"constitution": "CIRISConstitution v1.0-rc23-pre14 4007c95",
"constitution": "CIRISConstitution v1.0-rc23-pre15 ee06cae",
"cases": [
{
"id": "seat.duty.three_founders",
Expand Down
Loading
Loading