Since a keyed room can demote an admin and an admin can step down, a founder
missing from the policy is often the group's decision, and the card's repair
offers to undo it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in a keyed room's step-down by request (bb35d73c) and keyed rooms
born needing the group's signature, with the switch gone (1ccd8c7f).
Resolved: AdminGovernance keeps giza's canAskToStepDown and
stepDownProposer beside the policy-backed memberActions; the
repositories keep memberActionOptions and lose requireSignatures; the
loader no longer asks GovernanceSupport whose devices a room waits on.
Reconciled: the policy offers your own row Step down as admin in a keyed
room on canAskToStepDown's terms -- governed, rotation on, above the
floor, another admin to ask -- so the menu matches the request giza
added. SignaturesNotRequired carries no data and says the group was made
before signed changes and keeps its admins, since nothing switches the
rule on any more.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An admin's own row had no menu in a keyed room: stepping down was not
offered, because a demotion's proposer starts the rotation that takes
the demoted admin's share away, and a rotation's proposer has to keep a
share.
Step down as admin now sends a request into the room
(PromotionEvents.STEP_DOWN, 30377) and commits nothing. The remaining
admin in the lowest leaf (AdminGovernance.stepDownProposer) -- one
device, named the same everywhere, so two never propose at one epoch --
takes it up in GovernanceFollowThrough and runs the same demote its own
Remove as admin would. A request is used once, and dropped by every
device once its requester is no longer an admin. Offered only above the
floor and while another admin is there to ask.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The note's status, a table of the build's departures from the plan --
the route carries the action by name, an unavailable item's state rather
than a second click label, the only admin as one reason -- the README
entry, and a pointer from member-admin-promotion's Phase 11. The unused
"See why" string goes with the click label it was for.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rule that a keyed room's changes need the group's signature was
switched on after founding, once every member's device had said it could
follow signed commits. That protected Bennu members and older Giza
builds from being left behind by the first signed change. Giza is in
development and keeps compatibility with neither, so the switch
protected nobody, and it kept an invited member from ever being made an
admin.
MarmotGroupCreation.createFor now writes GovernanceMarker's line, with
the floor the ceremony's quorum sets, into the room's epoch-0
description. Founding still needs no signature: the founding invite is
the creator's commit while it is the only member, which no other device
processes.
Removed: GovernanceSupport and its event (30372), the announcements on
joining, at start and in answer, the automatic switch and
requireSignatures, and the screen's waiting and ready states.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Requiring the group's signature for changes was a button an admin had
to find on the room's screen. Nothing about it was a decision: the two
conditions it waits on -- every member's device can follow, enough of
them are admins -- were already checked in code. The button is gone.
One device switches it on: the admin in the room's lowest leaf, which
in a room as made is its creator (GovernanceSupport.switcherOf). Not
every admin's, because two commits at one epoch are not settled for
their authors (docs/marmot-v2.md, Phase 8); every device reads the same
leaf, so they agree on one without talking. GovernanceFollowThrough
runs the switch whenever a member says it follows signed commits, and
on start.
Not at creation: a Bennu or older-Giza founder would be cut off without
anyone knowing, and a founding invite finished later is a bare commit a
governed room refuses. The room switches seconds after its founders
join instead. The screen names whose device it is waiting on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An invited member of a robust group could never be made an admin. Making
one needs the room to require the group's signature, which waits until
every member's device has said it follows signed commits. A device said
so when the room's screen was opened, or back when it heard another say
it -- but the founders said it before the invite, at an epoch the new
member cannot read, so it heard nothing, nobody said it again, and the
room waited on a screen the member had no reason to open.
A device now says it on joining (the Welcome path) and once each start
(GovernanceSupport.announceAll), for members who joined before this.
The waiting notice names who the room waits on and what for, instead of
"X need to update Giza".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
remove-convenient-groups' new test makes its phones with Phone(profile);
since the legacy KeyPackage slot was retired every phone publishes the one
package the app does, so it is Phone().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two files this branch deleted were changed on giza:
- SelectChatRoomTypeViewModel: giza added a reconcileAdmins call to the
convenient path, which this branch removed. The robust path
(MarmotGroupCreation) and direct messages (MarmotOutboundDao) already
reconcile, so the deletion stands.
- ChatRoomType: giza added minimumAdmins(threshold) for the admin floor.
It moves to Quorum.minimumAdmins beside the other quorum rules (D6);
AdminGovernance and AdminChangesJvmTest call it there.
docs/member-admin-promotion.md now notes where the names it cites went.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robust-group-admins built the same thing as this branch's Phase 1: a single
writer for Participant.adminAt, run at creation, on the Welcome, on every
commit and once at start. Its AdminFlags is kept as that writer; this
branch's MarmotInboundManager.reconcileAdmins and adminFlagChanges are
gone, and the direct-message and convenient-room creation sites and the
detail screen's catch-up call AdminFlags instead. The admin captions stay,
on top of it.
Both sides added to the room's details: the founding-admin repair and
invite beside the member menu, admin labels and governance section. The
member row keeps one label line -- Admin from adminAt, Holds a share
beside it -- and the removal message now has three cases: proposed for the
group's signature, rotation held, or sent. The rotation offer waits for
both: a rotation available, and the removal not still awaiting signatures.
addAdmins, the founding-admin repair, proposes its commit for the group's
signature in a governed room instead of committing it bare.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A one-to-one chat, or a group its creator runs alone, grown by one more
person would be a group run by one person. The invite screen refuses such
a room and the detail screen no longer offers the invite there. The plan
gains D7, since D1 had assumed no such invite path existed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
giza brought rotation-waits-for-key-state, built in parallel from the
same base, and robust-group-admins. The first overlaps this branch, and
the two agreed on not asking the proposer. Where they met:
- The proposer's dialog is this branch's, read from the proposal's own
plan with its refusal, under giza's title and caveat; giza's dialog,
which listed stale members from the summary, went. The preview's
refusal carries rotationHold's reason, and ChatRoomDetailSharesJvmTest
asks its question of the kept dialog.
- The proposer is approved to take part only; giza also set
confirmApprovedAt, which nothing reads.
- The Shares section keeps both: giza's held button, its reason and
'Ask the group to sign', and this branch's running card and abandon.
- giza's hold tests left the new key state unsigned by not signing it.
It signs itself now, so they hold the signing messages after the
proposal (signingHeldOpen). This branch's test of two rotations opened
at once gave way to giza's, which asserts more.
jvmTest 1281/1281, compileDebugKotlinAndroid, m3Audit at its budgets,
brand and wallet audits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first draft's Phase 0 changed mls-kmp and marmot-kmp so that a device
could refuse an unsigned commit. Instead the group signs an event whose
content is the complete kind:445 commit, published as an application
message; every device checks it on a throwaway copy of the group and hands
the inner event to the engine, and drops a bare commit at the one inbound
door. The rule is a marker in the room's profile description, switched on
once every member has said it can follow it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every founding member of a robust group is its admin, phases 0-7
(docs/robust-group-admins.md). Two conflicts, both adjacent additions:
the detail screen's strings read outside the click handlers, and the
view model's companion constants. Both sides kept. jvmTest 1261/1261,
compileDebugKotlinAndroid, audits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plan is marked built, with a table of the nine places the build
chose differently -- among them that Phase 4 acts on a room at epoch 0
rather than on rows that were never written, since rows are hard-deleted,
and that it also fixed the current-profile routing bug Phase 0 found.
The README row says built; automatic-key-ceremony.md gains step 4 and
subgroups.md the repository taking the ceremony instead of a list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plan gets a Built header and a table of where the build chose
differently: the proposer was asked twice not three times; two rotations
opened at once never reach the write-once rule; the stall-clock test had
to backdate its messages to catch anything; one full run died on a
SQLite SIGSEGV unrelated to this change. frost-share-refresh.md's gate
table shrinks to one row with the history of CONFIRM, its key-state step
names the rule that now signs it, and README says both notes are built.
automatic-key-ceremony.md points here for the second automated key
state.
Not done: the emulator session. Nothing here has run on a device.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three rules: every admin holds a share, every commit in a keyed room is a
proposal until the group's threshold signature is on it (a member's own
leave and key update excepted), and a robust group keeps at least three
admins. Phase 0 is upstream work in mls-kmp and marmot-kmp.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
frost-share-refresh.md records the new refusal (the proposer's own
check only), strikes "the proposer is auto-approved for nothing" for
the rule that replaced it, and gives the work a row. The plan is marked
built, with where the build chose differently.
./gradlew check: jvmTest 1240/1240, testDebugUnitTest 496/496, lint,
audits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A recipient is asked three times today: to deal, to store the new share,
and to sign the new generation's key state. Only the first is a decision.
The plan removes the other two in seven phases, and names what removing
them breaks: abandon lives only on an approval row, and nothing resumes a
rotation without a message.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A plan to hold Rotate shares while the key state the previous rotation
produced is still waiting on the group's signature, and to stop asking
the proposer to approve their own rotation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ShareGenerations.recover rebuilds a device's share of every generation
from its host secret key alone: ChillDKG's recovery data gives generation
0, and each refresh's recovery data, applied to the generation before,
gives the next. It stops at a generation the host key was withheld from,
since a repaired share leaves no recovery data. Nothing calls it yet.
Tested three refreshes on, against every device's live share and each
generation's table. With the release-build test, jvmTest 1200/1200,
compileDebugKotlinAndroid and the audits pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ShareRepairManager brings back a participant id a refresh left stale, with
FrostReducedEnrollment in repair mode, on kinds 30346-30349. t live helpers
approve and run it; their round-1.1 shares and round-1.2 sums are raw
additive shares, so each goes NIP-44-encrypted between the two parties'
ChillDKG host keys. The target checks the result against the public share
the group signed -- never one the helpers supply -- stores it, and proves
it with a Schnorr signature by the share, which every device checks before
marking the id live. The share is a point of the new polynomial that the
old device never had.
10b: a new identity at an id -- a lost device, a compromised account -- is
bound by a group-signed key state first (frost_member, GroupKeyState
.memberBindings, schema 40), applied only to an id that is not live. Until
then its request waits, with nothing sent. A key state amending one at the
same generation is stamped a second later, so a binding can never tie with
the state it adds to.
jvmTest 1198/1198, compileDebugKotlinAndroid, audits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A removal takes a member out of the room, not out of the key: their share
still helps sign. After an admin removes a member who holds a live share,
the room screen offers to rotate without them -- a second act, never
folded into the removal, since it needs every remaining holder.
ShareRefreshManager.proposeWithout withholds them for good (RETIRED); the
refusals say when that would leave fewer than t holders (the group could
not sign at all) or not a majority (remove fewer at a time).
Tested in the ritual harness: in a 2-of-3, the other two sign at
generation 1 and the removed member's old share signs nothing with a new
one. jvmTest 1195/1195, compileDebugKotlinAndroid, audits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a refresh completes the coordinator asks the group to sign the key
state at the new generation -- the same room, key, path and parentage, plus
frost_generation, a hash of the public-share table, the refresh and any
retired ids. It is the new shares' first signature, and what D6 waits on:
a device that files that state, holds the generation active and agrees
with the group's table fails every signing session left at an older
generation, out loud, and deletes the older shares, the ceremony's
randomness that rebuilds generation 0's, and the WAL's page images of them.
A key state at a higher generation wins whatever its timestamp, in the
DAO and among signed events. A proposal at a generation this device has
confirmed and is still waiting on the certificate for waits instead of
declining, and resumes when the generation activates.
jvmTest 1193/1193, compileDebugKotlinAndroid, audits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ceremony note's approval section becomes 'Joining is the only
approval'; the subgroup note says which of its four steps anybody is
asked about; the plan records where the build chose differently and
that its device session has not been run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ShareRefreshManager runs a FROST share refresh in the Marmot room the key
derives, on kinds 30340-30345, in the image of ChillDkgRitualManager:
every inbound message stored, every step recomputed from stored inputs,
nothing of a member's own published before they approve, at two gates
(DEAL, CONFIRM). Recipients are at least t and a majority of the ids not
retired, and a device confirms one refresh per base generation --
ShareRefreshConfirmation, written in the same transaction as the pending
generation it confirms -- so two refreshes from one generation cannot both
complete. The certificate activates the new generation; a withheld device
learns its table from the recovery data and files it with no share.
Schema 39 (AutoMigration): ShareRefreshSession, ShareRefreshMessage,
ShareRefreshConfirmation. Transcript lines as system lines; dispatch in
the Marmot inbound path.
ShareRefreshRitualJvmTest: three devices with real host keys refresh
through bitcoin-kmp's FrostRefresh and then sign at generation 1 as the
same room. jvmTest 1190/1190, compileDebugKotlinAndroid, audits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e4779ff..3794eb8, every level on a local claude/frost-share-refresh branch:
lightning-kmp-app 3794eb8 (e4779ff + this bump)
lightning-kmp 2043f254 (df778bc4 + bump)
bitcoin-kmp 3cd82d1 (1982eba + bump + FrostRefresh)
secp256k1-kmp 0f5a710 (ce05021 + bump + frostRefresh* bindings + tests)
secp256k1-zkp 31ea015c (a04dc1ed + the frost_refresh module)
None of it is pushed; the pins are to local commits until it is. Giza
does not call the refresh yet (Phase 7).
compileDebugKotlinAndroid, jvmTest 1183/1183 and the M3, brand and wallet
audits pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Schema 38 (AutoMigration): KeyShareGeneration and KeyShareMember for every
generation a refresh makes, FrostSigningSession.generation, and
GroupKeyState.generation and publicSharesHash. Generation 0 has no row: it
stays where ChillDKG wrote it, with ids derived from the host keys as
before.
ShareGenerations is the one door signing reads a share through.
FrostSigningManager fixes a session to the generation the group signs with
when it is proposed, carries it as frost_generation from generation 1 (a
generation-0 proposal is byte for byte what it was), and a device holding
no share of the named generation declines out loud with
GENERATION_REFUSAL instead of waiting or signing with the wrong share.
ShareGenerationsJvmTest refreshes a 2-of-3 group's shares by hand with a
zero-constant polynomial; the new shares sign and the signature verifies
as the unchanged room. jvmTest 1183/1183, compileDebugKotlinAndroid, and
the M3, brand and wallet audits pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phased plan to make a key ceremony run by itself once a member has
joined: rounds 1 and 2 automatic, a resume sweep in place of the tap,
the coordinator's follow-up steps and the key state's signatures
automatic, and abandon kept for a member who goes quiet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every connection opens with PRAGMA secure_delete = ON (SecureDeleteDriver),
and GizaDatabase.scrubFreedPages truncates the write-ahead log, which keeps
whole page images of a share after its row is gone. Android backups and
device-to-device transfers carry none of the app's data: aux.db holds FROST
shares in plaintext, and a share copied somewhere the app cannot reach
cannot be rotated away from.
SecureDeleteJvmTest reads the database's files byte by byte; its two
controls find the share with secure_delete off and before the scrub.
jvmTest 1176/1176.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Enrollment evaluates the same polynomial, so it cannot rotate a share; a
zero-sum refresh can. Thirteen phases from a frost_refresh module in
secp256k1-zkp to the cutover, removal, repair and UI in Giza. D1-D8 are
decided as recommended.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 4 settled the blob and left the database alone, because there was nothing
to settle: the state is opaque to Room and its version is inside it. Phase 8 added
a table, and that turns "does an existing install still open?" from a question
about MLS into a question about Room. They fail differently. A blob the engine
cannot read costs one room; a migration Room cannot find costs the app, on every
device that has ever had it, on the first launch after the update.
That second one is also the easiest here to ship by accident, because a fresh
install never migrates anything. Measured rather than assumed: with
`AutoMigration(from = 36, to = 37)` commented out, 32 database tests ran and 4
failed -- all four of them the new ones.
ShippedProfileUpgradeJvmTest builds a v36 database on disk from the exported v36
schema, down to its indices, its room_master_table identity hash and its
user_version, puts a profile and two rooms in it with the Phase 4 blob in one, and
opens it with the app's own getRoomDatabase. Four claims: it reaches v37 with
Room's own identity hash stamped and every table's columns and indices equal to
37.json's; the legacy room's bytes come back unchanged and MarmotEngine.groupFor
restores a group with its 0xF2EE metadata and a 32-byte kind:445 key; opening the
profile rewrites nothing, which is asserted only after checking the restore held
the room; and the new table takes a row keyed to a ChatRoom that predates it.
Room opens lazily, so a test that builds a database and closes it migrates
nothing. The first version of this did that and failed on user_version still
reading 36.
The blob itself moves to OldEngineBlob in commonTest, read by both tests. The
only thing those bytes are worth is that they are old ones, and a blob living in
two files can be regenerated in one of them.
1171 tests across 157 classes, 0 failures; the four audits unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The piece Phase 7 deferred, in both directions, because they are one question:
a group's state is a few kilobytes of ratchet tree, group context and epoch
secrets, and the app was rewriting all of it to record things that moved a
counter.
Sending an application message advances exactly one thing -- this leaf's entry
in the secret tree (RFC 9420 §9) -- so the library carries the position as its
own record, `MlsGroupStateStore.saveSenderRatchet`, in the spirit of OpenMLS
keeping `message_secrets` apart from `group_state`. Giza defaulted that to
false, which sent the manager back to a full save per message. It is now a
`MarmotSenderRatchet` row, one per room, schema 36 -> 37 with an AutoMigration.
The bytes are stored as the library wrote them -- the `MarmotPublishObligation`
precedent, not the retained-epoch one -- because a record whose whole job is to
never go backwards is safest when nothing here re-encodes it; the epoch, leaf
and generation sit beside it, read off those same bytes, so they cannot drift.
The hazard this introduces is an ordering, and it is in the app's code, not the
library's. `MlsGroupManager.restoreAll` applies the record itself. A room joined
after the engine restored is loaded from its row by `MarmotEngine.groupFor`
instead, and that has to apply the record BEFORE `adoptGroup`, because adopting
persists and persisting rewrites the row from the group being adopted. The other
way round, the next restart re-emits generations already published, under AEAD
keys and nonces already used.
Finding the test that could tell the two orders apart took two goes. The first
asserted the row after a lazy load and passed with the order inverted: a state
saved before this leaf ever sent has no ratchet entry, `exportOwnSenderRatchet`
returns null, and the adopt writes nothing. The order cannot matter until the
stored state holds a position of its own behind the record's, and a received
message is what puts one there. With one receive in the middle the inverted
order fails with expected:<2> but was:<1>.
The receive side is a full save, from `MarmotEngine.processGroupEvent`, which
`NostrDao` now reads inbound events through so a second caller cannot forget it.
And a correction to Phase 5, which said an unwritten row still lost the late
message. It does not: mls-kmp writes the skipped keys beside the positions they
belong to, so an unwritten row is an older COHERENT state, and a position that
has not passed the late generation derives it forward. quartz's engine saved the
positions and dropped the keys -- that pair is what lost messages. The cost of
an unwritten row is the re-deriving, against SecretTree's thousand-step cap. The
reason the write lands now is the send side: until this change every send wrote
the whole state, so the row could not fall far behind inside an epoch.
1167 tests across 156 classes, 0 failures; Android and JVM compile clean; the
four audits unchanged. docs/mls-skipped-keys.md loses its mitigation claim and
gains the correction; docs/marmot-kmp.md gains Phase 8.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Phases 0 to 7, one commit each but for 5 and 6, which share one because the fork probe
produced no code. 1161 tests, 0 failures; compileDebugKotlinAndroid and compileKotlinJvm
clean; four audits green, the new one among them.
Three things it does not claim, said at the top rather than left to be discovered at the
end of a phase. No manual upgrade of a profile with real rooms has been done, and that is
the last check before a release -- a fixture is one member at epoch 0. The sender ratchet
record and the receive-side write are deferred together, because they are one decision
about how often this app persists a group and they want a schema change. And the authored
fork is still not settled; Phase 6 probed it and the gap is the library's, unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>