Commit Graph
795 Commits
Author SHA1 Message Date
Kgothatso NgakoandClaude Opus 5.5 ee40309e77 feat(lightning): a closing channel pays the group, not the node (Phase 3)
The fork's channel keys can take a group's payment and delayed-payment
basepoints, the node skips the claims it holds no key for, and
GroupHeldOutputs says where those outputs are and how to spend them. In
the app, GroupLightningDerivation derives the basepoints from the
group's threshold key, and a FROST quorum spends both kinds of output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:51:49 +02:00
Kgothatso NgakoandClaude Opus 5.5 a1e87d92e5 feat(lightning): a distributed key generation for Iceberg (Phase 1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:23:15 +02:00
Kgothatso NgakoandClaude Opus 5.5 cd385ec82d feat(lightning): reserve the group Lightning wallet's kinds (Phase 0)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:19:43 +02:00
Kgothatso Ngako 409be6db28 Merge remote-tracking branch 'origin/bennu' into claude/satoshi-amount-group-wallet-a12572
# Conflicts:
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/wallet/GroupOnchainWallet.kt
#	composeApp/src/jvmTest/kotlin/com/machankura/bennu/compose/wallet/GroupOnchainWalletJvmTest.kt
#	docs/README.md
2026-10-23 12:51:52 +02:00
Kgothatso NgakoandClaude Opus 5.5 c07a5a834f fix(wallet): the send form follows the room's spends while it is open
The form read which coins and change addresses open spends hold once,
when it opened. A spend another member proposed while it was open still
looked free, so sending everything would ask the group to sign a second
spend of coins only one spend can have. The form now combines the chain
state with observeGroupTransactions, as the wallet screen does, and
re-reads both reservations on every change, as one state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:44:48 +02:00
Kgothatso NgakoandClaude Opus 5.5 affb90be41 Merge branch 'claude/receive-address-rotation-4731b9' into bennu
The group wallet's address list: every paid receive address, the
current one and the two after it, any unused one handed out as a QR
code, and the used change addresses -- docs/group-wallet-addresses.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:34:28 +02:00
Kgothatso NgakoandClaude Opus 5.5 95962b724a test(wallet): a spend with change is described by its payment (Phase 5)
Every place a spend is described -- the proposal list and the wallet's
spend rows through ProposedSpend.summarize, the approval screen through
isChange, and the signed and confirmed transcript lines through
amountSent -- already reported the payment rather than payment plus
change. Nothing needed fixing; ProposedSpendTest and the end-to-end
spend test now hold each of them to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:33:38 +02:00
Kgothatso NgakoandClaude Opus 5.5 9a319e1ef1 feat(wallet): the amount field says what can be spent and what is wrong (Phase 4)
The amount field shows its unit, how many sats are confirmed and free to
spend, and on mainnet the cap; a problem with the amount -- not whole,
too large, more than the group has, too small, over the cap -- is said on
the field in its error state instead of under the form. The send-everything
row is one 48dp toggleable target, and turning it off again finds the
amount typed. The wording of every reason is one function shared by the
field and the preview.

GroupSendScreenJvmTest types into the form on regtest and mainnet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:31:00 +02:00
Kgothatso NgakoandClaude Opus 5.5 8e7782261f feat(wallet): send an amount from the group's wallet on every network (Phase 2)
SEND_AN_AMOUNT kept every network on send-all until a release had shipped
with no mislabelled change, which no release could do while the gate was
closed. It is removed: the send screen always offers the switch and the
amount, and on mainnet the existing 100,000 sat cap bounds what a change
bug could put at risk. Phase 3's end-to-end test is what stands in for
the release the gate was waiting for.

The view model test no longer branches on the constant, and a mainnet
test holds an amount to the cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:26:10 +02:00
Kgothatso NgakoandClaude Opus 5.5 b712d6d835 feat(wallet): the used change addresses, under the receive ones (Phase 4)
GroupWalletState.changeAddresses lists the change addresses that have
been used, newest first -- never a current or a next one, since change
is chosen by a spend. The address list shows them in a section of their
own once there are any, with copy and nothing else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:24:54 +02:00
Kgothatso NgakoandClaude Opus 5.5 eb1f126adf feat(wallet): hand out any unused address as a QR code (Phase 3)
Tapping the current or a next address on the list opens it in a sheet
-- the receive card's QR code, selectable text and copy, titled with the
index so a member can say which one they gave. A used address has copy
and nothing else: copying is for checking, a QR code is for being paid.

The sheet closes itself, with "Address N was just paid", when Electrum
reports a payment to the address it is showing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:23:05 +02:00
Kgothatso NgakoandClaude Opus 5.5 5c77853cfa feat(wallet): change goes to an address the group can find (Phase 3)
Two open spends with change both paid to the first unused change
address, since a spend waiting for signatures has not used it yet.
Change indices are now reserved like coins: reservedChangeIndices reads
the claims of every open spend, and the builder takes the lowest watched,
unused, unheld index. It chooses among generated addresses only, so
change never lands outside the window; CHANGE_LOOKAHEAD rises to 10 and
past it a spend with change returns TooManyOpen.

The change branch not having answered is FindingChange rather than
NothingToSpend, and change too small to send back is reported as
Built.absorbed and said in the preview.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:22:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 5b06c84401 feat(wallet): a screen listing the group wallet's addresses (Phase 2)
GroupWalletAddressesScreen, pushed from an "All addresses" button in the
wallet screen's receive card: index, address, and what each has been
used for, newest first, with the current address on the secondary
container and a copy button on every row. Its view model reads the
wallet GroupOnchainWallets already holds, so the list costs no
subscriptions and agrees with the wallet screen about which address is
current.

FakeElectrum moves out of GroupOnchainWalletJvmTest so the view model's
test can drive a chain too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:19:47 +02:00
Kgothatso NgakoandClaude Opus 5.5 de76311e1e feat(wallet): the group wallet's receive addresses, as a list (Phase 1)
GroupWalletState.receiveAddresses: every paid receive address, the
current one, and ADDRESSES_AHEAD (2) after it, newest first -- reaching
the highest paid address even when a watch-only wallet was paid past
that. Null until Electrum has answered, as receiveAddress is.

The test fake now reports a status over a script's history rather than
its unspents, as Electrum does, so an address spent from stays used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:15:48 +02:00
Kgothatso NgakoandClaude Opus 5.5 bc348419bc feat(wallet): read an amount as whole sats, or say why not (Phase 1)
The gated amount field read its text by dropping every non-digit, so
21000.5 became 210,005 sats and 0.0005 became 5. parseSats accepts
thousands grouping and refuses decimals, grouping that groups nothing,
non-ASCII digits and more sats than exist; the preview reports which.
The field shows plain digits grouped and keeps what was typed.

Also plans the rest in docs/group-send-an-amount.md: send-an-amount
opens on every network at once, held on mainnet by the existing cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 12:15:17 +02:00
Kgothatso NgakoandClaude Opus 5.5 96055da584 feat(wallet): call it the group onchain wallet
The wallet screen's title, the room's detail row, the button that opens
one and the proposal summary a member agrees to all said "group wallet".
They now say "group onchain wallet", which is what it holds, and agrees
with GroupOnchainWallet in the code. Sentence case, as every string is.
Resource keys are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 11:51:36 +02:00
Kgothatso NgakoandClaude Opus 5.5 707e1465e2 fix(wallet): escape the brace Android's regex engine refuses
DERIVATION_PAYLOAD closed its JSON object with a bare `}`. The JVM reads
that as a literal; ICU, which backs Regex on Android, rejects the
pattern. It was a private val of FrostSigningManager, so the throw came
from the class initialiser, which Android does not retry: every signing
session on the device failed with NoClassDefFoundError until restart.
The first symptom was a ceremony that "couldn't ask the group to agree
its signing key".

The JVM suite cannot ask ICU, so RegexPortabilityJvmTest reads every
Regex literal out of the main source sets and holds it to the stricter
rule: a `}` is escaped, inside a class, or the end of a quantifier. With
the old pattern restored it fails on FrostSigningManager.kt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 11:12:14 +02:00
Kgothatso NgakoandClaude Opus 5.5 cd7aa36cd0 Merge remote-tracking branch 'origin/bennu' into claude/group-chain-wallet-plan-93f0e1
Every conflict was the curated-lists removal on bennu meeting a wallet
line added beside it: the removal is taken and the wallet lines kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 10:04:53 +02:00
Kgothatso NgakoandClaude Opus 5.5 b8194a4ba3 refactor(wallet): GroupChainWallet is GroupOnchainWallet
And its registry, GroupChainWallets, is GroupOnchainWallets, with the
files, the test and the plan's references following.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 09:52:25 +02:00
Kgothatso NgakoandClaude Opus 5.5 f83fe35a45 feat(wallet): ship behind the rollout gates (Phase 10)
GroupWalletRollout holds the three gates, each with what lifts it. The
flag is on, its condition met. Send-an-amount is off, so the form sends
everything confirmed to one address and says so. A spend proposed from
this device on mainnet may send at most 100,000 sats; test networks
have no cap. The gates are on the composer and nothing else: a device
behind them still accepts, shows and signs what another member
proposes, through every check GroupSpend makes.

The plan is marked built, with its table of where the build chose
differently. Full JVM suite: 1474 tests, none failing; the Android
target compiles; every M3 budget is met.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:52:16 +02:00
Kgothatso NgakoandClaude Opus 5.5 0db1fe8fc8 feat(wallet): the group's spends on its wallet screen (Phase 9, part 2)
Every spend the room proposed, newest first, for every member whether
or not they have a node: what it sends and where it has got to --
waiting for signatures, abandoned, signed, sent (reported back by
Electrum, not merely broadcast), confirmed, or replaced by a later
spend. A signed spend Electrum has not reported can be sent again; a
signed, unconfirmed one can be bumped to twice its feerate, a new
session over the same coins that whichever confirms settles. Each row
opens its signing session.

Full JVM suite: 1473 tests, none failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:48:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 58da7c1285 feat(wallet): broadcast signed spends and settle what a confirmation decides (Phase 9, part 1)
GroupTransactionWatcher, one per identity beside its wallets: every
signed spend still on its way is sent from this device too, sent again
every ten minutes while Electrum has not reported it -- its broadcast
reports success whatever the server said -- and followed to a
confirmation. FrostSigningManager.recordConfirmed then settles every
other spend of the same coins: one still collecting is abandoned as
spent by another transaction, one already signed is marked replaced
rather than failed, and the room gets one line saying it confirmed.

GroupSpendBuilder.bump re-spends the same coins at a higher feerate,
the extra taken from the change or, for a send-all, the one payment.

The test caught a stale write: a pass followed each spend from the list
it started with, so settling one spend was undone by writing the next
back from its old copy. follow() reads its row again first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:43:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 b1d5963b53 feat(wallet): a form to propose a spend from the group's wallet (Phase 8, part 2)
GroupSendRoute and GroupSendScreen, behind a Send button on the wallet
screen for a member who holds a share and has a node to see the coins
with. Address, amount or send everything, and a feerate prefilled from
Electrum's six-block estimate. The preview is GroupSpendBuilder over the
same inputs the proposal is built from -- what leaves, the fee, what
comes back as change, or why it cannot be built -- and proposing moves
onto the signing session, replacing the form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:38:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 6d066e19c0 feat(wallet): build a spend and show it for approval (Phase 8, part 1)
GroupSpendBuilder: send-all, as Phoenix's final wallet does, and an
amount paid largest coin first with change to the next change address,
or to fees when it would be dust. Confirmed coins only, never one an
open spend already holds; the fee is exact before signing because every
witness is 64 bytes. Every built spend passes GroupSpend.check.

The signing screen draws a spend where it draws events: every output
with its address and amount, change labelled, the fee and feerate, and
the coins spent -- read from FrostSigningManager.checkedSpend, the
stored PSBT checked again, and unsignable when this device cannot check
it. The proposal list and the chat notice say "Spend from the group's
wallet". FrostSigningRepository gains proposeSpend, checkedSpend and
reservedOutPoints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:33:36 +02:00
Kgothatso NgakoandClaude Opus 5.5 a24c107b26 feat(wallet): the signing manager signs a spend from the group's wallet (Phase 7)
Kind 30332 opens a session over a PSBT, one item per input, each its own
FROST instance over that input's BIP341 sighash with its own nonce seed
and its own tweak cache. proposeSpend and acceptSpendProposal run the
same GroupSpend checks: every input derives under the account the
room's verified statement gives -- looked up under the ceremony's own
key -- default sighash only, no script-path fields, replaceable, change
only where its claim derives, and a fee under a ceiling. A second
proposal under one id is ignored. completeSpend checks each signature
against its coin's output key and the whole transaction with
correctlySpends before writing it.

An old build does not route 30332, so it never signs a transaction it
cannot show. Resend repeats the PSBT byte for byte. Two-device test:
a quorum spends two coins and both devices hold a transaction that
correctlySpends; each check refuses a hand-built proposal outright.
Full JVM suite: 1458 tests, none failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:28:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 f7a9e05bbc feat(wallet): schema v26 for spends from a group's wallet (Phase 6)
FrostSigningSession.subject, NOT NULL with a default of EVENTS, says
what a session's items are messages of; FrostSigningItem.inputIndex
names the input a transaction item signs, with message and payload as
getters over the existing columns. GroupTransaction holds a spend from
proposal on: the PSBT, written once with IGNORE, the txid fixed before
signing, and the signed transaction, broadcast, seen and confirmed.

AutoMigration(25, 26) is three ADD COLUMNs and a CREATE TABLE -- no
rebuild of either signing table, so no cascade fires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:15:00 +02:00
Kgothatso NgakoandClaude Opus 5.5 24d06d2eee feat(wallet): a screen to open a group's wallet and receive into it (Phase 5)
GroupWalletRoute and GroupWalletScreen, reached from a Group wallet row
on the group's screen. A group that has not opened a wallet gets an
empty state with, for a member who can sign, what opening one asks of
everybody -- including that shares are unencrypted at rest -- and the
button that proposes the statement. An open wallet shows the balance,
confirmed and on the way said apart, the next receive address as a
BIP21 QR code, selectable text and a copy button, the coins, and an
export of the two watch-only descriptors with what they give away.

The wallets are watched on the identity's own Electrum client and made
per PhoenixBusiness in BennuNavHost; a profile with no node sees the
wallet and is told it cannot watch the chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:11:47 +02:00
Kgothatso NgakoandClaude Opus 5.5 4ab47ba432 feat(wallet): watch a group's wallet on the identity's Electrum client (Phase 4)
GroupChainWallet is Phoenix's FinalWallet for a group: two
ElectrumMiniWallets, one per BIP44 branch since a mini-wallet holds one
generator, gap-limited at 10 for receive and 3 for change, on the shared
client. GroupWalletState gives the coins with the derivation that spends
each, the confirmed and pending balances, the next receive address and
change index, and derivationOf -- bounded by the addresses the wallet
has generated, which is how far a check of a claim will look.

Tested against a fake IElectrumClient: a payment moves the receive
address on, change is counted and never offered, and two groups on one
client see only their own coins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:05:28 +02:00
Kgothatso NgakoandClaude Opus 5.5 caddfdc107 feat(wallet): the group opens its wallet by signing a statement (Phase 3)
Kind 30331, inner only: the account xpub, the network, the account
number and both descriptors. A reader believes one only when the room
signed it and the room's threshold key rederives every value it
carries -- GroupWallet.of, used by the repository and by the transcript
arm alike. The broadcast screen refuses the kind twice, at the loader
and in sendToRelays, because the xpub on a relay is the whole balance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:00:59 +02:00
Kgothatso NgakoandClaude Opus 5.5 283e576a98 test(wallet): a ceremony's shares spend the group's coins (Phase 2)
Real ChillDKG, real FROST, no manager: two wallet inputs signed as two
independent instances, each over its own BIP341 sighash with its own
cache, judged by correctlySpends. The negatives are the ones a positive
cannot catch -- another input's cache, a cache missing the tail or the
key-path tweak, and a sighash over a lied-about amount all produce
signatures the script interpreter rejects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:56:14 +02:00
Kgothatso NgakoandClaude Opus 5.5 4330faacd7 feat(wallet): derive a group wallet's keys from its threshold key (Phase 1)
GroupWalletDerivation: a public account step -- a tagged HMAC over the
threshold key, the network and an account number -- gives a depth-0 xpub,
and below it BIP86's own unhardened tail, /<change>/<index>, with the
key-path tweak on top. Each address is computed twice, as points and as
tweaks on a FROST cache, and refused if the two disagree.

Tests: BIP86's published vectors through the cache prove the tail; a
pinned vector freezes the account step; a sweep covers both parities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 07:55:01 +02:00
Kgothatso NgakoandClaude Opus 5.5 56a942c610 Remove the curated-lists feature
Bennu no longer speaks curare.to's list protocol. The schemas, templates,
entries and the suggestion queue go, with their six screens, routes, view
models, strings and tests, and the hooks into the group screen, the paste
proposal, proposal summaries, broadcast relay seeding, the chat repository
and the transcript.

The two transcript message types stay as private legacy names so rows
already stored still render as system lines rather than chat bubbles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 11:45:45 +02:00
Kgothatso NgakoandClaude Opus 5.5 b75d4b427f Rebrand Curare to Bennu under com.machankura.bennu
Move the packages to com.machankura.bennu.{compose,android,desktop}, the
Android applicationId to com.machankura.bennu.android and the iOS bundle
id to com.machankura.bennu.ios. The root project, launcher label, iOS
product, desktop window, user-facing strings, client tags and the
Curare* classes all say Bennu now.

Left alone on purpose: the mantra/ derivation tags, the `curated` desktop
data directory, the mantra.press relay and the curare.to references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 13:53:45 +02:00
Kgothatso 80b7490de7 Make test run locally 2026-10-19 18:42:08 +02:00
Kgothatso NgakoandClaude Opus 5 72cfb561c4 feat(proposals): ask again about everything the filter is showing
The bulk control I argued against, built -- and the objection turned out to be
solvable rather than fatal, so it is worth recording what happened to it.

Half of it was already handled. Two resends in the same second do not collide
on the outbound row id: `broadcast` hashes that id over the session's own tags
and steps a second forward when it finds a collision rather than overwriting.
Different sessions were never at risk.

The other half was real. A resend publishes two messages, and `resend` keeps to
two deliberately because "publishing in bursts is what the skipped-keys bug
feeds on"; three proposals at once is six, in the same second that "two events
published in the same second race, and exactly one survives" was written about.
So the sessions are spaced rather than the budget quietly raised --
`resendAll` waits `RESEND_SPACING` between them, one second, which is the
resolution the protocol works in because `created_at` is stored to the second.

The pacing lives in the manager and not in the loop that wanted it, because
everything that justifies it does: MLS generations, relay ordering, outbound
ids. A caller that launched `resend` per session would put every burst into one
second, and the call site is the wrong place to know why that matters. There is
a test against the real manager that three sessions take longer than two
spacings and claim three different seconds.

What it acts on is `visible`, not the room: a bulk control reaching rows the
reader cannot see is its one unforgivable move. A cooling-down row is left out
of the count rather than included and skipped, because the count is what the
button says out loud and offering three while able to send two is a lie told
before the tap. Offered from two up: one is what the row's own button is for.

Every covered row goes quiet for the whole run rather than for its own turn --
a paced run means a row whose turn has not come is still about to publish, and
a row button offering to send it meanwhile would send it twice. A session
already in flight on its own is left out of the run for the same reason.

It is offered on any filter showing two it can act on, not only "being signed".
That filter is where it earns its place -- three rows stalled for one reason --
but the rule is about what is on screen, not about which chip put it there.

1419 jvm tests pass, the Android target compiles, all audit budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 16:04:13 -05:00
Kgothatso NgakoandClaude Opus 5 4330d718be feat(proposals): ask the quiet members again from the row
The offer the signing screen already makes, reached from the list. A
coordinator whose room has stalled should not have to open each proposal in
turn to find the button, and filtering to "being signed" now puts every stalled
one in front of them at once.

It is on the row and not on the chip, which is where it was asked for, for
three reasons. A chip is a selection control, and giving it a second action
would make the control that publishes the one you cannot undo. A chip stands
for several proposals while `resend` takes one session, so a chip-level button
means resending all of them -- and the manager caps itself at two messages per
resend precisely because "publishing in bursts is what the skipped-keys bug
feeds on", which three proposals at six messages would re-create. And the offer
is the coordinator's alone and only exists while somebody owes, so on a chip
standing for a mixed set it would be enabled for proposals it cannot act on.

It is called "ask again" rather than "re-broadcast" for the same reason the
list calls a review a review: somebody who found the button on the signing
screen and then found this one should not have to work out that two labels are
one button.

Whether to offer it is asked of `membersOwing`, not derived from the signature
count. Past the nonces a signer who refused has answered and is owed nothing
while the count is still short by one, so a row reading `have < need` would
offer to knock on a door that has already been shut. That is one query per row
and the only one on this screen, so it is asked for as few rows as possible:
not ours to send, nothing to send, and already ended all answer without
touching the database. An ended session is left out although the manager would
take it -- re-sending a completed one delivers the signature to a member who
never applied it, which is worth a button on the one proposal's screen rather
than a query per row on a list that only grows. The signing screen still offers
it.

Guarded per session rather than by one flag for the screen, because these rooms
have several proposals open at once and a coordinator working down the list
should not be locked out of the second by the first still publishing. The
cooldown disables rather than hides, as it does on the signing screen: a
control that vanishes after a tap reads as one that failed.

1396 jvm tests pass, the Android target compiles, all audit budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 15:45:58 -05:00
Kgothatso Ngako 1f82d66f57 Merge branch 'curated' into claude/proposal-state-filters-8cc06c 2026-10-08 14:56:24 -05:00
Kgothatso NgakoandClaude Opus 5 7c6e9b0a84 feat(proposals): say how far a proposal has got, not just what it is waiting for
A row said "waiting for 2 of 3 members to take part" on the day a proposal was
made and on the day before it completed. That is the rule, not the progress.
Now it says "1 of 3 members have offered to sign", and on the next stage "2 of
3 signatures are in" -- the fractions that actually move.

Nothing is counted once it has ended, which is both endings and not only the
happy one. A signed session has nothing left to gather; an abandoned one has
counts frozen where they stopped, and "2 of 3" beside a failure invites the
reader to wait for a third that is never coming. The failure reason is what
that row has to say.

The denominators are the ones the protocol gates on. `orderedNonces` returns
nothing until `threshold` nonces have arrived and then takes the first
`threshold` of them, so the threshold is both what is needed and what is used --
the room's size is a bigger number nothing waits for. Once the signer set
exists it is the set being waited on, which is the same count from the other
side.

The numerator is the part that had to be got right. A nonce or a partial
signature is recorded with no check on who sent it, unlike a refusal, and
`orderedNonces` drops the ones from members holding no share when it
aggregates. So the tally joins `DkgParticipantMessage` on HOST_KEY and counts
members rather than rows: a count including strangers would have a row read
ahead of the coordinator, saying the group has what it needs while the session
sits still. That is the one direction a progress figure must never be wrong in,
and there is a DAO test for it. A count that still runs ahead -- a nonce
landing before this device runs `advance` -- is clamped, because a fraction
over one reads as a bug rather than as a session about to move.

The counts travel as their own `GROUP BY` flow, combined with the sessions in
the view model. They change far more often than the rows do, and carrying the
messages themselves would carry every nonce payload the room has ever exchanged
to a screen that only wants to count them.

The progress is its own line rather than a clause, so a reader scanning for the
one that is nearly there does not have to read a sentence to find out. That
left `statusOf` saying only who the reader is in the proposal, and since this
adds user-facing text its remaining literals moved to the catalogue with it --
nine strings that had been raw in the screen since before the catalogue rule.

1367 jvm tests pass, the Android target compiles, all audit budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 14:53:59 -05:00
Kgothatso Ngako f0cbb2785b Merge branch 'curated' into claude/partial-signature-collection-d44dab 2026-10-08 14:38:13 -05:00
Kgothatso NgakoandClaude Opus 5 a9532ff115 fix(frost): resume a session whose own turn was cut short
Every step a session takes is driven by a message arriving, and a device
killed part way through its own pass is waiting on one that has already
been delivered. The signer set is recorded, so it will never be processed
again; the partial signature it would have produced was never made. The
coordinator asking again cannot reach past it either -- what a resend
asks a member for is the message this device believes it already sent --
so the session is a dead end on both sides, and in a room with several
open proposals it is the one that was mid-pass that stops.

So one sweep that no message drives: on opening a room, every session in
it that is not settled and whose owner has answered is handed to
`advance`, which does what it always does. It publishes nothing new --
each step asks whether its output exists rather than whether a stage says
it ran -- and only answered sessions are passed in, so the approval gate
is not approached, let alone reached past. A refusal counts as an answer
for the same reason: a device killed between deciding and publishing says
it on the next open rather than never.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 14:33:13 -05:00
Kgothatso NgakoandClaude Opus 5 1e59fd2334 fix(frost): a knock past the nonces is for the signers, not the quiet
A resend had one idea of who it was for at every stage -- the share
holders it had heard nothing at all from -- and that is a question only
the first stage can answer. A session reaches
COLLECTING_PARTIAL_SIGNATURES because enough members offered a nonce, so
every member who could be holding it up has been heard from: the set came
back holding the members who were never chosen and owe nothing, while the
chosen signer whose partial signature went missing was named nowhere.
Once the unchosen had answered or refused the set was empty, and the
control gave up before it reached the branch written for the stall it was
meant to repair.

So the set asks what the stage can answer. Of the signers the coordinator
chose, who has yet to send a partial signature -- which is the half of a
resend only they can carry out, since a partial signature is read by
nobody but the coordinator and no other device can repeat it. COMPLETE
keeps the old reading, and correctly: the signature is the coordinator's
own and nobody answers it.

The screen now asks the manager who is owed rather than deriving it from
the rows beside the button, the way it already asks about approvals: the
same reading decides whether a resend publishes anything, and two copies
of a rule that changes with the stage is a screen offering a knock the
manager would refuse. The transcript line and the notice say what the
members named are short of, since past the nonces they have answered once
already.

The test that looked like it covered this passed because it wrote the
stage into the row with no nonce on file anywhere -- a state the protocol
cannot produce, and exactly the state that hid the bug. It now reaches
the stage by offering a real nonce.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 14:32:09 -05:00
Kgothatso NgakoandClaude Opus 5 13ae0a1def feat(proposals): tell the two open stages apart, because they are not alike
"In progress" was one chip over two situations that ask different things of
the reader, and collapsing them was the wrong call.

Short of members, a proposal can still die of indifference: refusals are
counted against `declinesThatAbandon`, so one more may end it, and a member who
is offline is indistinguishable from one who has not looked. It is also the
only stage the coordinator's resend is for. These are the proposals somebody
may have to do something about.

Once the signer set is written, none of that is true. `signerIds` is written
once and never revised, so no further refusal is counted against it, and what
is left is arithmetic the chosen devices have already committed to. Where one
asks whether this will happen, the other says it is happening.

So: WAITING_ON_MEMBERS and BEING_SIGNED, named for what the reader is waiting
on rather than for the protocol step -- "collecting nonces" is true and says
nothing. The icons carry it as well as the labels, people against machinery,
which is the only signal a monochrome display has.

What is *not* split, and the comments say why: whether this device was picked
to sign, and whether the reader agreed or declined. Those are facts about the
reader rather than states of the proposal, so they stay a sentence on the row.
Splitting on them would be splitting every state by who is looking.

The classification is now the stage plus one, which is the shape it was always
going to take -- the one being NEEDS_YOU, which no stage can express.

Six chips means the last two now sit past the fold at phone widths, so the
screen test measures order only over what the viewport lays out and the full
lifecycle order is pinned on the enum, where no viewport is involved.

1342 jvm tests pass, the Android target compiles, all audit budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 14:26:25 -05:00
Kgothatso NgakoandClaude Opus 5 18c6245181 feat(proposals): open on the queue when that is what was asked for
The transcript's notice counts the proposals waiting on this member and says
so. A tap on it that then showed the room's whole signing history would have
the reader go and find the three it had just named for them, so the route
carries a filter and the notice asks for the queue.

`ProposalListRoute.filter` defaults to ALL, which is both the honest default
and what every caller predating it reads back as -- the group's own Proposals
row still means "show me the room".

The transcript's other way in turns out to be two ways, not one, and they
wanted different lists. A line too old to name its session could be about
anything the group has ever signed, so it opens the room. A tap held back
*because several decisions are waiting* was held back for those decisions, not
for the history -- so it opens on them. That decision now lives in
`proposalDestination` instead of in a condition nine levels down a LazyColumn,
which is the only way anything could be held to it.

Nine tests over the three branches, including that the queue is offered only
for the proposal actually tapped -- a line about something already signed is
history, and handing its reader the queue would invert what
`hidesOtherDecisions` is for. The filter's ride on a type-safe route is pinned
too: navigation reads an argument's NavType off the serial descriptor and takes
an ENUM as a string, so the test fails if the filter ever becomes a shape
navigation cannot place.

The notice's own one-line wiring is not itself covered -- it builds a route
inside the transcript's lambda -- so it rests on the route tests and on review.

1338 jvm tests pass, the Android target compiles, all audit budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 12:01:40 -05:00
Kgothatso NgakoandClaude Opus 5 ef2b461c5c feat(proposals): a chip row over the list, and four ways of being empty
Five chips under the app bar, each carrying its count, scrolling sideways. The
row is outside the list rather than its first item, because a control that
scrolls away is a control the reader has to scroll back for -- and the list it
filters is as long as the group's whole signing history. It scrolls rather than
wraps for the same reason from the other side: five counted chips do not fit
the sixty characters `readableContent` holds the column to at the largest text
size a reader can ask for, and a row reflowing to a second line moves the list
under the thumb about to tap it.

Unfiltered, the two sections stay. Filtered, they go: "waiting for you" against
"everything else" is a distinction the reader has already made by tapping, and
heading a single-state list with it would answer a question nobody asked.

A room with nothing in it gets no chips at all. Five chips reading 0 over an
empty screen would be five ways of saying what the empty state says once.

The screen also picks up the state widgets it never had -- `LoadingDataIndicator`,
`ErrorState` with an explicit `onRetry = null` because a room missing from this
device will not appear by looking again, and `EmptyState` with a message per
filter. That last one is the point: one shared default is how five different
absences here came to say one thing. A group never asked to sign and a queue
the reader has worked through are not the same fact, and the second is not an
absence at all -- it keeps the queue's own icon and reads as finished.

`initialFilter` reaches the screen and is applied in the view model's `init`,
so a `Loaded` handed in for a preview cannot open with its chips saying one
thing and its rows showing another. Nothing passes it yet.

Fourteen screen tests, and the audit's budgets all still met: 0 hardcoded
colours, 0 dp literals in spacing positions, 0 title-case strings, both floors
held. 1329 jvm tests pass; the Android target compiles.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 11:53:45 -05:00
Kgothatso NgakoandClaude Opus 5 f42f4913c4 feat(proposals): a filter over those states, that a busy room cannot clear
`Loaded` gains the selection, the rows it selects and a count per state. The
rows come from the selection and the numbers come from the room, on purpose: a
chip reading its own count off the filtered list would say 0 for every filter
but the one already chosen, which is the one number the reader does not need.

Every state gets a chip, zero included. A row that gains and loses chips as
sessions advance moves under the thumb of the person reading it -- and sessions
advance while this screen is open, because someone else signing is exactly when
a member comes to look.

The selection lives on the view model and not only on the state drawn from it,
which is the part worth the comment it carries. `observeSessionsForChatRoom`
re-emits whenever any member's message moves any session in the room, and the
collect block builds a whole new `Loaded` each time; one built with the field's
default would snap the chips back to "all" mid-scroll, most often in the
busiest rooms. Four of the seven view-model tests fail if that line goes, which
was checked by removing it.

`initialFilter` is threaded through the constructor and the factory so a caller
can land on a filter -- the first emission is then already filtered, and the
reader never sees the unfiltered list flash past. Nothing passes it yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 11:40:51 -05:00
Kgothatso NgakoandClaude Opus 5 6a55889676 feat(proposals): name the four states a proposal can be in
The list screen asks "where has this got to" in four places -- the section
split, the row's icon, that icon's description and its status line -- and each
worked it out for itself from the stage and the approval timestamps. A filter
over those states would have been a fifth derivation, and a fifth derivation is
how a chip comes to count a proposal the row beneath it describes differently.

So the question is asked once, on `Proposal`, and the four readers read it.

The classification deliberately is not `FrostSigningStage`. The one state
anybody opens this screen looking for -- waiting on me -- is not a stage at all:
an open session waiting on this member and one waiting on everybody else are
both COLLECTING_NONCES, and what separates them is `signApprovedAt` and
`signDeclinedAt` being null. `awaitsYou` is tried first and wins; the stage
decides only among the rest, exhaustively and with no `else`, so a stage added
later fails to compile here rather than landing quietly in IN_PROGRESS.

`statusOf` still switches on the stage, and has to: the three things it says
about an open session -- you agreed, you declined, you were picked to sign --
are exactly the distinctions IN_PROGRESS collapses.

Two behaviours are pinned rather than fixed, because both are parity with
`isAwaitingApproval` and the signing screen gates its buttons on that:

 - a session whose proposal has not arrived yet classifies NEEDS_YOU, although
   the card says there is nothing in it to read;
 - a batch the group finished without this member is IN_PROGRESS until
   `advance` closes it, which is also what the row already said.

The preview gains an in-progress and an abandoned sample, so the conformance
sweep renders every icon and every status line in all six schemes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 11:34:36 -05:00
Kgothatso NgakoandClaude Opus 5 e4657df08e test(frost): cover the transport every ordinary session actually uses
Nine tests for gaps found by auditing the suite against the branches rather than
by counting tests.

The big one: every existing resend test ran on a NIP-17 room, which is only a
group's *first* signature. Every ordinary session runs in the Marmot admin room,
and that path had never executed -- no coverage at all for the store it writes
to, the tags it omits, or the id guard on that store. Given the bug fixed in
daf8365a was transport-specific, this was the gap most likely to hide the next
one. Three tests now cover it: a resend is one group event naming nobody with
the silent tag still on it, a nudged member republishes the same bytes as an
inner event, and the id guard holds on that store too.

Also covered, each of them a branch that had never run:

 - resending while collecting partial signatures, which repeats the signer set.
   One of three arms of the stage table, and the arm a stalled signer needs: they
   have the proposal and their nonce is in, and the signer set that says what to
   sign against never arrived.
 - the same stage table sending no signer set before one is chosen.
 - republishing a partial signature -- the third kind `republishOwn` repeats, and
   the one whose loss stalls a session that has every other piece.
 - refusing a resend whose stored events will not parse.
 - ignoring a silent tag on anything but a proposal, so the nudge cannot be
   triggered by any message at all.
 - the singular transcript wording.

Two notes on what is still not covered. `broadcast` returning false needs four
identical publishes in four consecutive seconds behind a five-minute cooldown;
forcing it means injecting a clock, and a racy test of it would be worse than
the guard. And neither the screen section nor the view model has a test, though
both are established patterns in this project.

Found the same `maxBy`-on-a-shared-second trap again while writing these, which
is now a helper per transport rather than a thing to remember.

1288 tests, no failures. m3Audit: all budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-06 15:33:10 -05:00
Kgothatso NgakoandClaude Opus 5 daf8365a6e fix(frost): a resend names the whole room, because the p-tags are its identity
The resend narrowed its NIP-17 p-tags to the members it was for, on the
reasoning that a wrap is sealed per recipient so repeating one for the whole
room wastes wraps. Both halves of that were wrong.

A receiver does not read the p-tags as a recipient list. It hashes them together
with the sender to work out which room the payload belongs to --
`GiftWrapPayload.aggregatedParticipantsPublicKey`, via
`ChatRoom.deriveChatRoomId`, which is what `GiftWrapSeal.decryptGiftWrapPayload`
files an inbound payload under. Leave a member out and the id changes, so the
resend is filed under a room that does not exist; `getOrCreateChatRoom` then
mints that room rather than rejecting it. A repaired session would have become a
phantom two-person conversation in the reader's list, and the session would have
stayed stalled.

There was no saving to trade against it either: `sealGiftWrapPayload` wraps for
every participant of the room it looks up, not for the p-tags it was handed, so
a narrowed payload cost exactly as many wraps as a full one.

Who a resend is for travels in `frost_silent`, which is not part of that hash,
so nothing is lost by naming everybody.

Marmot was never affected -- a group event names nobody and is routed by its
h-tag.

The two tests that asserted the narrowing now assert the opposite, which is the
property worth having: the p-tag set does not change between a publish and its
repeat. The p-tags were the right thing to assert all along; they just mean
something other than what they look like.

Found while answering whether this is backwards compatible with older receivers.
It is -- no new kind, an unknown tag that old builds ignore, and every
duplicate-folding gate in `record` and `acceptProposal` predates this work. This
bug was never a compatibility bug; it broke old and new receivers identically.

1279 tests, no failures. m3Audit: all budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-06 15:22:52 -05:00
Kgothatso NgakoandClaude Opus 5 2edd05f3ca fix(frost): a broadcast that queued nothing records nothing
`broadcast` now says whether it queued anything, and `publishOwn` records the
local copy only when it did. The copy is what stops `advance` from publishing
that message again, so writing one for a message that never went out is a
message the group waits on forever -- the exact opposite of the trade the
queue-then-record order exists to make. The comment on `publishOwn` had that
trade written down in one direction only.

Reachable only through the id-collision guard added with the resend, which
refuses after four tries rather than overwriting a sent row. Four consecutive
seconds of the same message is not something a person with a button can do, but
"unreachable" and "safe when reached" are different claims.

Also brings the docs up to what was built: the resend note is in the index, the
skipped-keys note points at it as the recovery for the failure it describes --
a new message is encrypted at a generation the receiver has not passed, which is
the whole mechanism -- and the plan records the two things landing it turned up,
plus `ask_again` being reused from the catalogue rather than duplicated.

1279 tests, no failures. m3Audit: all budgets met.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-06 15:09:57 -05:00
Kgothatso NgakoandClaude Opus 5 e0f20b2b63 test(frost): the case the resend exists for, end to end
The headline test is the one that goes through `acceptProposal` from the outside:
Bob's device has no session at all -- his copy of the first proposal decrypted to
nothing, which is terminal and which the sender cannot see -- and the resent
proposal opens it.

Two databases rather than a hand-written row, because an event's id is rebuilt
from its own fields under the author the *receiver* resolves, never the
proposer's word for it. A fabricated event cannot pass that check, which is the
point of the check, so the proposal has to be one a coordinator really made.

What the rest of them pin, in rough order of how much it would cost to get
wrong:

 - a named member republishes the *same bytes*, not a fresh nonce. Two nonces
   for one message against two aggregates is how a secret share is extracted.
 - a named member whose owner has not decided publishes nothing, and is still
   asked. A message from the coordinator must never put a device's share behind
   events its owner has not agreed to.
 - a nudge from somebody who is not the coordinator does nothing.
 - a resent proposal delivered twice mints no new nonce seeds.
 - a republished refusal is counted once. A resend makes duplicates routine, and
   counting one twice abandons a 2-of-3 session on a single no.
 - two resends in one second get two ids.

Plus the state the screen reads: who counts as quiet (not the refusers, not this
device), who is offered the resend (the coordinator), and that the cooldown
leaves the offer standing while quieting the button.

1279 tests, no failures. m3Audit: all budgets met.

Plan: docs/frost-session-resend.md, Phase 8.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-06 15:06:04 -05:00