Commit Graph
903 Commits
Author SHA1 Message Date
Kgothatso NgakoandClaude Opus 5.5 4c75ca1b03 feat: a stalled key ceremony says on whom, and offers abandon there (automatic ceremony, Phase 5)
Once everyone has joined nothing is asked, so a ceremony that sits still
is waiting on a device that is not answering. After a day without a new
message, the ritual screen names who it is waiting on and since when,
with the abandon action beside it. Nothing abandons on its own.

A ceremony message is now stored once, on first arrival, so its time is
when it first came and a relay's redelivery does not restart the clock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:02:46 +02:00
Kgothatso NgakoandClaude Opus 5.5 d71cf0c093 feat: one approval screen for a key ceremony (automatic ceremony, Phase 4)
The join screen carries what the round-one screen showed, the members
in particular, and says the device takes it from there. The round-one
and round-two screens, their routes and their strings are gone; the
ritual screen offers only the join, and the ladder describes each round
as something the device does.

Old request lines still read as answered: the automatic round writes
the same line a tapped one did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:55:44 +02:00
Kgothatso NgakoandClaude Opus 5.5 9278ccd54e feat: running key ceremonies resume when the app starts (automatic ceremony, Phase 3)
A ritual moved on an arriving message or a member's tap. Without the
tap, a ceremony holding every message it needs -- one an older build
left waiting to be told to contribute, or one interrupted between
storing a message and acting on it -- would never move.

resumeRunning advances every ceremony this user has joined. Sync runs
it once per activation, after reopening the inbox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:51:09 +02:00
Kgothatso NgakoandClaude Opus 5.5 ca5cda81db feat: joining is the only approval a key ceremony asks for (automatic ceremony, Phase 2)
advance no longer stops at rounds 1 and 2. Contributing follows from
having joined, and confirming is ChillDKG's own check, which refuses a
substituted result whether or not anybody is looking. pendingApproval
returns the join or nothing, and approving a round is a no-op.

ROUND_1 and ROUND_2 stay in the enum, and their timestamps in the
schema, so rows written by older builds keep decoding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:49:12 +02:00
Kgothatso NgakoandClaude Opus 5 e07bb68014 feat: the sender ratchet as its own row, and the receive side beside it (marmot-kmp, Phase 8)
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>
2026-11-19 09:55:31 +02:00
Kgothatso NgakoandClaude Opus 5 3b2b5e3614 test: the skipped keys, half closed and half pinned (marmot-kmp, Phases 5 and 6)
Phase 6 is a probe with no code of its own, so it rides along: both fork tests pass
unchanged, which means marmot-kmp 2.2.1 still scores a fork this device is half of the way
quartz 1.15.2 did. The assertion whose message is "the two sides agree -- the library has
been fixed" did not fire. What changed is that the fix docs/marmot-v2.md predicts is now a
first-class thing on the library's side -- MlsGroup.stageCommit, with the staged commit in
MlsGroupState from its STATE_VERSION 9 -- so it is a choice in MlsCandidateStateEngine
between replaying a branch and taking the state that was kept. Both notes say so.

Phase 5 is the skipped keys, and it is half closed. mls-kmp's state carries them:
skippedApplicationSecrets and skippedHandshakeSecrets, exported by saveState and imported
by restore, arriving at STATE_VERSION 5 so a version-4 blob reads them as an empty map.
That is steps 1 to 3 of the fix docs/mls-skipped-keys.md proposed. Step 4 is not done:
consumedGenerations, the replay guard, is still one SecretTree's field.

The app does not benefit yet, and the first draft of this test claimed it did.
MlsGroupManager.decrypt persists only when the message was a commit that advanced the
epoch, so the secret reaches the live group and never the row. The draft delivered
generation 1, rebuilt the engine, delivered generation 0 and asserted it decrypted -- and
it did, for the wrong reason: a rebuilt engine restores a blob whose sender ratchet never
moved, so generation 0 is simply the next one it expects. A green test proving nothing,
caught by the assertion beside it that looked redundant.

So the three tests say what is true: the secret is in the state the engine would save, a
group rebuilt from those bytes reads the late message, and the stored state does not carry
it. The last one is pinned in the style of the authored fork, with its KDoc saying what to
invert when the receive path starts persisting -- deliberately not done here, because it
is a write per inbound message that re-encodes the ratchet tree, the group context and
every epoch secret. saveSenderRatchet is the library's answer to that cost on the send
side.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-11-19 00:15:28 +02:00
Kgothatso NgakoandClaude Opus 5 9bc05c112d refactor: the names quartz 2.x gave the kinds (marmot-kmp, Phase 2)
Most of this phase was answered by Phase 1 rather than built. `GroupEventResult` still has
exactly nine variants -- `MarmotEngine.inRoom` is an exhaustive `when` used as an
expression, so the compiler says so rather than a reading of the source. The convergence
and lifecycle surface takes and returns what `settleLater` and `awaitSettled` already
expected, `allowsOutboundWork` included. `stageAddMember` -> `StagedCommit` ->
`gate.prepare` -> `installState` needed no edit. And no test's assertions moved: seven
fixtures now build their group with `MarmotGroupPolicy` as the app does, which is a
construction-site change, not a weakened expectation.

What was left is the six classes quartz 2.x renamed to match what the NIPs call the kinds,
and kept deprecated typealiases for: SealedRumorEvent -> SealEvent, ChatMessageRelayListEvent
-> DmRelayListEvent, RelayFeedsListEvent -> FavoriteRelayListEvent, LnZapEvent ->
ZapReceiptEvent, LongTextNoteEvent -> LongFormContentEvent, ChannelListEvent ->
PublicChatListEvent. 104 references in 25 files; same packages, so each is an identifier
rename. None reaches a string the app persists -- no Room column, no string resource, no
kind number -- and after it the build has no quartz deprecation warnings left.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-11-18 23:59:35 +02:00
Kgothatso NgakoandClaude Opus 5 fc80a089aa build: the Marmot engine comes from marmot-kmp (marmot-kmp, Phase 1)
quartz 1.15.2 -> 2.7.3, and the engine it used to carry from marmot 2.2.1 over mls 1.3.0
over crypto 2.1.0. docs/scripts/marmot-kmp-imports.sh --apply moved 187 lines by the rule;
42 `quartz.marmot` imports stay, which are the event classes quartz kept.

The 854 non-Marmot quartz imports came through the major bump without an edit. All 45
compile errors were in the engine seam, and 44 were one thing: five accessors that were
members of `MlsGroup` in quartz's engine are extension functions in marmot-kmp
(`currentGroupState`, `currentMarmotData`, `currentNostrGroupId`, `currentAdminIdentities`,
`isLocalAdmin`), so 14 files import one now. The 45th, `buildCurrentProfileFrom`, likewise.
No constructor the app drives changed shape, and `GroupEventResult` still has exactly nine
variants -- `MarmotEngine`'s exhaustive `when` compiling is the proof there is no tenth to
drop on the floor.

One change here is not a rename. `MlsGroupPolicy` is new in mls-kmp: quartz's engine
hardcoded Marmot's rules, mls-kmp made them an argument, and every factory defaults it to
`Permissive` -- so the eleven places this app builds a group itself were building a
non-Marmot group. The loud half is that `commitExporter` is then null, `preCommitExporterSecret`
comes back empty and `GroupEventEncryption.encrypt` refuses it ("Group key must be 32
bytes"), which is the one test that failed. The silent half matters more: `Permissive`
greases the leaf's capabilities, which MDK has never been tested against; it knows neither
`0xF2EE` nor the app-data dictionary, so RFC 9420 13.4 refuses a GroupContextExtensions
proposal in a group we are a member of; and it authorizes every commit, proposal and
SelfRemove without a check. So `MarmotGroupPolicy` goes in at all eleven. The
current-profile paths needed none -- `CurrentProfileGroupFactory` and every
`MlsGroupManager` entry point pass it themselves.

1149 tests, 0 failures; compileDebugKotlinAndroid clean; the three audits unchanged.
Import blocks were re-sorted in the touched files only: 253 further files in composeApp
have blocks that were already out of order, and C2 is the reason to leave them be.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-11-18 23:56:27 +02:00
Kgothatso NgakoandClaude Opus 5.5 b27ed2a05f docs: retire the wallet notes, and guard against a wallet coming back (wallet removal, Phase 8)
The 23 wallet notes move to docs/retired/ with a banner; every link between
notes is rewritten for the move and checked. The index lists them as one
Retired paragraph, and seven kept notes carry a line on what changed. The
README and CLAUDE.md describe a Giza with no wallet.

brand-audit.sh loses its "bennu/ exception: every such tag was a wallet's,
so one now is a wallet coming back. wallet-audit.sh --check, in check and
in CI, fails on a retired kind in the app's code, a lightning-kmp import,
a file named for a wallet's pieces, or sats in a string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 16:15:13 +02:00
Kgothatso NgakoandClaude Opus 5.5 005cbc2f23 refactor: composeApp stops importing lightning-kmp (wallet removal, Phase 7a)
W3: a Lightning invoice in a note is a card that opens a lightning: link
in the device's own wallet app, undecoded -- decoding was lightning-kmp's,
and paying from the card was never wired. The dead pay and zap hooks go.

Lightning.randomBytes becomes quartz's RandomInstance; the tests'
LocalKeyManager becomes PhraseKeys; NodeParamsManager.chain becomes
PROFILE_CHAIN, the mainnet constant every profile's preference files are
named under.

What is left of the library is storage (keystore, credentials, seed file,
preferences). Moving it into the app and off the composite build is
Phase 7b, which needs an iOS build and a device to check, and is left for
its own branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 16:08:52 +02:00
Kgothatso NgakoandClaude Opus 5.5 84be1c5beb refactor: no node behind a recovery phrase (wallet removal, Phase 6)
PhraseKeys derives a phrase's nostr key (NIP-06, m/44'/1237'/0'/0/0) and
its profile id (hash160 of m/50'/0', the old node key) with bitcoin-kmp's
DeterministicWallet. ForkCompatibilityTest's Phase 0 pins pass unchanged
through it, so the same phrase is the same person with the same
preference files.

No profile starts a node: Identity.business, startupNode and its state
machine, the platform start/schedule/stop actuals, LightningApplication,
BusinessManager.initialize, the NFC hooks and POST_NOTIFICATIONS go. A
switch is clearing the identity and nothing else. Copy that promised funds
or a wallet is reworded, and the switcher's badge says Recovery phrase.

Forgetting a phrase profile is still refused (now PhraseAttached): the
phrase would derive the key again, and offering it is new UI.

iosMain was edited without an iOS build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 16:03:47 +02:00
Kgothatso NgakoandClaude Opus 5.5 9c2cbf0295 feat: schema 35 -> 36, the wallets' tables and rows dropped (wallet removal, Phase 5)
MIGRATION_35_36, by hand: the wallets' chat lines; GroupTransaction; every
signing session over a transaction or a sweep, with its items and its
members' messages; the other fifteen wallet tables, children first; and
FrostSigningItem.inputIndex, DkgSession.guardianDelay and
ChatMessage.lightningFactKey. DkgSession.walletPolicy stays: the join
screen reads a Bennu ceremony's tag from it. The 36 schema is committed.

The wallet line-type constants and the transcript's arms for them go with
the rows they named.

jvmTest: 1,150 run, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:54:21 +02:00
Kgothatso NgakoandClaude Opus 5.5 c6b231fa84 refactor: remove the group's on-chain wallet, guardians and the subgroup wallet policy (wallet removal, Phase 4)
wallet/ (Electrum included), nostr/wallet/, the policy and guardian tags,
GroupWalletDerivation, GroupWalletManager, GuardianDerivation,
GuardianManager, ProposedSpend, three screens with their view models,
states and routes, and FROST's spend half.

FROST is back to signing events. Every transaction proposal from a Bennu
peer is filed declined without being read, and the decline goes out
through advance(). Certificates and ceremonies carry no wallet tag; a
guarded subgroup's ceremony is filed and not joined, and its join screen
says why (W5). A key state carrying a wallet's certificate is declined.
The last bennu/ derivation tag leaves the code, and the last wallet pins
with it.

jvmTest: 1,148 run, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:48:11 +02:00
Kgothatso NgakoandClaude Opus 5.5 db38640e57 refactor: remove member guarded wallets (wallet removal, Phase 3)
The member-wallet events, MemberWalletManager, MemberWalletDerivation, the
repository and DAO, five screens with their view models, states and routes,
and the 74 strings only they read. GuardianManager stops reading member
certificates. The entities stay until Phase 5's migration.

Guardians and the subgroup wallet policy move to Phase 4: they are built
into the group's on-chain wallet and cannot leave before it and compile.

jvmTest: 1,311 run, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:32:04 +02:00
Kgothatso NgakoandClaude Opus 5.5 1bd0761339 refactor: remove the group Lightning wallet and Iceberg (wallet removal, Phase 2)
The Lightning events, managers, Iceberg ceremony, wallet/lightning, the
repository, five screens with their view models, states and routes, the
four DAOs, and the regtest network with its build wiring. The entities
stay until Phase 5's migration.

FROST's sweep path goes here rather than in Phase 4, since it was built on
GroupSweep: a sweep that arrives is filed declined without being read.
Lightning kinds fall to the retired-kinds arm; existing Lightning lines
stay as settled lines that open nothing. The 147 strings Phases 1 and 2
left unread go, and a Phase 1 test name that said Bennu is renamed.

jvmTest: 1,440 run, 0 failed, 0 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:25:15 +02:00
Kgothatso NgakoandClaude Opus 5.5 8e0f1bd38a feat: Giza neither offers nor signs a wallet (wallet removal, Phase 1)
A Bennu member can put a wallet to a group Giza is in. Giza can no longer
check one, so it declines on arrival, out loud: the proposal is filed as a
declined session and advance() publishes the DECLINE, which the group
counts. Refusing used to be silent, which looks like a phone in a pocket.

- RetiredKinds: 30331-30337 and 30350-30366 stay Bennu's, never reused.
- WalletRefusal: what is a wallet's to sign, read by tag name so it
  outlives the wallet's parsers. approve() declines one instead.
- A retired kind is one line or none in the transcript, never a raw bubble.
- No Lightning dispatch, no guarded-wallet forwarding, no key answers.
- The detail and profile screens and the subgroup picker lose their
  wallets; a guarded room says why it offers no subgroup (W5), and
  certificates carry no wallet tags.
- The wallet tests this behaviour breaks are deleted with it.

jvmTest: 1,495 run, 0 failed, 2 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:14:53 +02:00
Kgothatso NgakoandClaude Opus 5.5 4f3f0da3ca feat: Giza in everything a person reads and on the wire (fork, Phase 4)
- Strings: app_name and the giza key say Giza, as do the eight values that
  named Bennu. Two keys that contained the name are renamed. Two messages that
  meant "has no Marmot key package yet" now say so, since a Bennu user counts.
- Restore: when a recovery phrase is recognised, the sign-in screen says to stop
  using it anywhere else. A seed running in Bennu and Giza at once is two copies
  of one Lightning wallet, which can lose funds.
- Desktop: the window title and the unlock heading come from the catalogue.
  The installers are named Giza (giza on Linux), with a fixed Windows upgrade
  UUID of their own so a Giza MSI never upgrades a Bennu one.
- iOS: PRODUCT_NAME and the product reference are Giza.app.
- Wire: the client tags are Giza and giza. Nothing compares them.
- The twelve bennu/ derivation tags stay as they are. They are hash inputs like
  mantra/, and a Bennu peer and a Giza peer derive the same keys through them.
  Each now has a note saying so. The rebrand-history comments count four.

jvmTest: 1643 run, 0 failed, 2 skipped. compileDebugKotlinAndroid passes.
m3-audit: all budgets met. It differs from the baseline only by the new restore
line (one more stringResource and one more bodyMedium).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 10:46:57 +02:00
Kgothatso NgakoandClaude Opus 5.5 34e802ce6f refactor: packages, classes and Res under mobi.giza (fork, Phase 3b)
docs/scripts/giza-rename.sh, run over the moves of Phase 3a:

- com.machankura.bennu.{compose,android,desktop} -> mobi.giza.{...}, in
  package lines, imports, fully qualified references, the manifest, mainClass,
  the Android namespace (one value with applicationId again), the m3Audit
  source path, the six docs/scripts tools, and the source links in docs/;
- Res moves from bennu.composeapp.generated.resources to
  mobi.giza.compose.resources, now pinned with packageOfResClass so a later
  rename of the root project leaves the imports alone;
- BennuDatabase, BennuTheme and the other eleven Bennu identifiers are Giza*.

The script's search is now the same pattern as its sed expressions, so on a
renamed tree it finds nothing and changes nothing.

Checked against the Phase 0 baseline: jvmTest 1643 run (1642 + AppDirJvmTest),
0 failed, 2 skipped; compileDebugKotlinAndroid passes; m3-audit prints the
baseline report line for line. iOS is not compiled on this Linux host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 10:40:27 +02:00
Kgothatso NgakoandClaude Opus 5.5 30d5feaf87 refactor: move the sources to mobi/giza, paths only (fork, Phase 3a)
docs/scripts/giza-rename.sh --moves-only: com/machankura/bennu becomes
mobi/giza in all six source sets, the nine files named Bennu* are named Giza*,
and the Room schema directory moves to mobi.giza.compose.database.GizaDatabase.
Every source file is a 100% rename, so log --follow and blame go straight
through.

This commit does not compile on purpose: the next one rewrites the contents.
The script, which does both, comes with it so a merge from Bennu can re-run it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 10:35:04 +02:00
Kgothatso NgakoandClaude Opus 5.5 4f1b4a4384 feat(lightning): buying inbound liquidity is on, on mainnet
GroupLightningRollout.LIQUIDITY_ENABLED is true, by decision, ahead of the plan's own Phase 0 check
on mainnet: ACINQ's LSP has not yet been seen to accept a splice whose funding key from us does not
change, so the first purchase there is that check. If it refuses, the splice aborts before anything is
signed into it and the purchase is reported failed. A purchase is bounded meanwhile by the mainnet
channel cap, the fee cap the group signs, and every co-signer's checks. The wallet screen now shows Add
liquidity, and the operator's node buys what the group authorises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 13:09:42 +02:00
Kgothatso NgakoandClaude Opus 5.5 db7d12b606 feat(lightning): a member asks the group to add inbound liquidity (liquidity, Phase 7)
GroupLightningLiquidityScreen asks as Phoenix asks its owner: Phoenix's amounts on a discrete slider,
less those the LSP does not sell and those past the channel cap; the miner fee, service fee, its year
and the total, priced on this device from the operator's report with lightning-kmp's own arithmetic
(LiquidityPrice, which matches what eclair charged on regtest to the sat); Phoenix's warning at a
quarter of the amount and its stop at the balance; a fee cap with room above the estimate; and a
review sheet with Phoenix's acknowledgement. Then a proposal, and the signing session it opens.

The wallet screen gains Add liquidity on its balance card, or the reason it is not there, a purchase's
state on its channel row, and Inbound liquidity added in its payment list (a nullable liquiditySat on
the payment row, in schema 35). The room gets a line when a purchase locks or fails.

All of it is behind GroupLightningRollout.LIQUIDITY_ENABLED, off until the regtest run passes; the
operator's node buys nothing while it is off. m3Audit meets every budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 12:45:01 +02:00
Kgothatso NgakoandClaude Opus 5.5 be90715dd3 feat(lightning): the operator's node buys the liquidity the group authorised (liquidity, Phase 6)
GroupLightningNode.buyAuthorised runs with the node's other actions, on the watch of kind 30363: for
each open buy-liquidity it has not taken on, it finds the LSP's rate for the amount, estimates at the
node's own feerate, and splices only if the estimate is within the authorisation's cap, buying at the
feerate the estimate raised to, as Phoenix does. Once per authorisation; not while the channel has a
splice that has not locked, which eclair would refuse; a failure is reported and not retried.

The snapshot now carries the LSP's rates and the node's feerate, for a member to price a purchase from,
each purchase's state (waiting, pending, locked, failed with its reason), how many funding outputs each
channel has live, and the purchase as a `liquidity` payment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 12:33:50 +02:00
Kgothatso NgakoandClaude Opus 5.5 b481c14cf9 feat(lightning): every co-signer checks a liquidity purchase before the group signs it (liquidity, Phase 5)
A co-signer keeps a ledger per funding output now (schema 35: IcebergChannelLedger keyed by output,
with its index, the parent it spent and the purchase that let it). A commitment on an output it has
no ledger for is the first commitment on a splice's new one: it must follow the newest output by one
index, rebuild from its context, and open from the parent's ledger at the same number with the same
HTLCs, the group's balance lower by no more than an open buy-liquidity authorisation's fee cap
(CoSignerPolicy.openSplice). The shared input is then held to that authorisation: it spends the pinned
output, makes one new output of the group's key with the LSP's under the cap, buys the amount the
group named, is paid from the channel balance alone, costs what the first commitment took to the
msat and no more than the cap, and the LSP puts in what it is paid for. An authorisation is bound to
the parent of the first splice it let, so however many attempts there are, one confirms.

While two outputs are live a payment settles on both at one commitment number; each ledger records
what its last commitment consumed, and a sibling spends only the difference. Before this the second
commitment was refused as under its floor.

GroupLightningSpliceCoSigningJvmTest, seven four-device tests on regtest and mainnet: a purchase the
group signs and the script interpreter accepts, payments over both live outputs, and each refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 12:30:10 +02:00
Kgothatso NgakoandClaude Opus 5.5 28f2d5a72a feat(lightning): the group decides to buy inbound liquidity (liquidity, Phase 4)
A fourth action for kind 30363, `buy-liquidity`: one channel, an amount of inbound, a cap on the fee
(our share of the splice's mining fee and the purchase's own together), an expiry, and an id so two
purchases for one channel are two events. An older build reads it as no authorisation at all, and
refuses the splice that follows.

GroupLightningAuthorisations gains liquidityPurchases, prepareBuyLiquidity -- which refuses a purchase
of nothing, or one past the mainnet channel cap, with a LiquidityProblem of its own -- and
proposeBuyLiquidity. The proposal reads "Add 500,000 sats of inbound liquidity", with the fee cap and
the LSP's year, and the room gets a line once the group signs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 12:14:55 +02:00
Kgothatso NgakoandClaude Opus 5.5 89504df765 feat(lightning): the co-signing wire carries a splice (liquidity, Phase 3)
A splice's shared input now reaches every co-signer with what it is: CoSigningWire.Context type
`splice`, with the parent funding output, the new one by index, the counterparty's new key, both
contributions, the liquidity purchase and the feerate. A commitment's context names its funding index,
and a request carries every other output the transaction spends.

messageOf computes the taproot sighash at the input that spends the funding output, over every spent
output, and is null when the request leaves one out; check 3 lets a splice spend the funding output
once beside the counterparty's inputs, and refuses a request with no hash to compute. A splice is
still refused, now by name, until the co-signer checks one (Phase 5). The context's spec is optional,
since a splice has none, and every check that reads one refuses a context without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 12:14:55 +02:00
Kgothatso NgakoandClaude Opus 5.5 dcde4a7330 feat(lightning): the fork tells a signer it is signing a splice (liquidity, Phase 2)
Advances lightning-kmp to the splice signing context: a splice's shared input is signed with a
SigningContext.Splice that names the parent and new funding outputs, both contributions and the
liquidity purchase, and every commitment's context names the funding output it is on. The app maps
the new context to nothing on the wire for now, so a co-signer still reads a splice as unsaid and
refuses it, as before; Phase 3 carries it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 12:13:14 +02:00
Kgothatso NgakoandClaude Opus 5.5 84984ca887 feat(lightning): the key ceremony asks once, and ends itself when it stalls
Joining is now the only approval. Every check in the other two rounds --
a contribution against its commitment, everyone's transcript hash, the
public shares making one key -- is the device's, so after joining it sends
its contributions and confirms by itself. Asking a person to tap through
them only let a member who joined and never came back hold the ceremony
open for everybody.

A ceremony that has not finished 24 hours after its proposal is abandoned
by the first participant's device to notice, checked each minute beside
the group nodes, naming who had not taken their part. The deadline runs
from the proposal's own timestamp, so every device agrees on it, and a
proposal read after its deadline is not filed. Any participant can also
abandon a ceremony from its screen. Before this a ceremony nobody finished
blocked the room for good, since a room runs one at a time.

The group screen's Lightning row test now covers both sides of the row
waiting for an onchain wallet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 10:11:57 +02:00
Kgothatso NgakoandClaude Opus 5.5 83289aa4d0 fix(lightning): the group page's Lightning row waits for an onchain wallet
The Lightning wallet's key is made by the onchain wallet's signers and its
channels close to that wallet, so until the group has opened one the row
has nothing behind it. It now stays on the page disabled, and says that
Lightning is only available once the group has an onchain wallet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 09:51:51 +02:00
Kgothatso NgakoandClaude Opus 5.5 c4d8561cb0 fix(lightning): the wallet's payment list says a close is a close, and a sent amount without its fee
The same two misreadings the regtest run found in the room's lines, on the
wallet screen: a channel's close, which lightning-kmp files as an outgoing
payment with no payment hash, was listed as sent, and a sent amount
included its fee. Both now read through GroupLightningReports.isChannelClose
and recipientMsat, which the room's lines use too. A close is listed as one,
or as closing until it confirms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 09:06:02 +02:00
Kgothatso NgakoandClaude Opus 5.5 94385d2f4a fix(lightning): a channel's close is not a payment sent, and a sent amount leaves out its fee
Found by the regtest run, now that it checks the transcript. lightning-kmp
files a channel's close as an outgoing payment with no payment hash, which
wrote "sent" beside each closed line, and an outgoing payment's amount
includes its fee, so 20,000 sats with an 84-sat fee read as 20,084 sent.
GroupLightningRegtestJvmTest now asserts every device's lines: one per
channel opened and closed, one per payment, and no raw JSON, refusal or
alarm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 09:01:18 +02:00
Kgothatso NgakoandClaude Opus 5.5 a660fabd7e feat(lightning): a co-signer's refusal and the equivocation alarm, as lines (Phase 6)
The wallet's plan said a person sees a refusal as a transcript line, and
that two hashes echoed for one label raise the alarm in the transcript;
both were logger calls. A refusal is now said on the refusing device only,
once per request, with the check that failed; an operator asking for two
messages under one label is said on every device that sees it, once per
label, in the error tint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:21:21 +02:00
Kgothatso NgakoandClaude Opus 5.5 3ec79b95ad feat(lightning): what the operator's snapshots say happened, as lines (Phase 5)
A channel opening or closing, and a payment received, sent or failed, each
get one line however many snapshots repeat them. The snapshot restates the
whole wallet, so the line is keyed on the fact, not the message:
ChatMessage.lightningFactKey (v34, an AutoMigration) holds the channel's or
the payment's id. A payment's line sits where the payment happened, and a
channel a newer snapshot no longer holds is said to have closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:19:38 +02:00
Kgothatso NgakoandClaude Opus 5.5 1b4ed09798 feat(lightning): what the operator and the members say to each other, as lines (Phase 4)
The node seed being handed out, an invoice asked for and made, and an
operator's node stopping now each write one line, through
GroupLightningLines: on the way out by the device that sends the message,
which never reads its own back, and on arrival by every other, keyed on the
inner event so a redelivery is not a second line. An invoice request and a
stop are filed on arrival for the first time, and a stop is believed only
from the operator of the term it names.

The operator election line names the operator, the Lightning wallet's
signed lines get icons of their own, and every Lightning line opens the
wallet's screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:11:56 +02:00
Kgothatso NgakoandClaude Opus 5.5 3922c15d74 feat(lightning): the Lightning ceremony's lines read like the shared key's (Phase 3)
A ceremony stopped on another device was recorded as "Abandoned by" a key
prefix and the sender's exception message, and the screen showed it after
"Abandoned:". IcebergRitualManager.describe now says each fault as a
sentence naming the member at fault, sends that sentence in the failure
message, and the screen shows it in the error card the shared key ceremony
uses.

RitualNotice's chevron was described as opening the shared key ceremony on
every line; each family now says what it opens, the lines that lead nowhere
draw none, and only a request line can carry the approved tick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:06:20 +02:00
Kgothatso NgakoandClaude Opus 5.5 03833a1c42 feat(lightning): the Lightning wallet's key ceremony asks from above the composer (Phase 2)
The standing notice under the newest message read only the shared key's
ceremonies, so a member owed the Lightning wallet's join, reveal or confirm
had to scroll to its request line. AwaitingCeremony now says which ceremony
and what it wants, the chat's view model observes the Lightning ceremonies
beside the shared key's, and a tap opens the screen that ceremony has.

The member who opened the Lightning ceremony is also asked, once its key is
made, to open the wallet -- the counterpart to ChillDKG's room awaiting
creation -- until a wallet statement for it is being signed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:03:01 +02:00
Kgothatso NgakoandClaude Opus 5.5 638c5aab64 fix(lightning): the wallet's own messages leave no raw JSON in the chat (Phase 1)
Every kind the group Lightning wallet's devices send each other -- the
Iceberg ceremony, the co-signing, the operator's snapshots and invoices --
reached applyInnerEvent's last arm and was written as an unsupported line
holding the event's JSON, beside the lines the managers already write.
GroupLightningEvents.PROTOCOL now joins the ChillDKG and FROST families as
protocol, and MIGRATION_32_33 deletes the bubbles already in rooms, found by
the kind of the inner event behind them, as MIGRATION_26_27 did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 23:58:07 +02:00
Kgothatso NgakoandClaude Opus 5.5 515ddea2be feat(lightning): the group node acts as requests arrive, and the mainnet run is recorded
On the first mainnet run, most of the wait for an invoice (six seconds) and for an authorised
payment to leave (five) was the node's ten-second poll. The node now watches the room's
invoice requests (30364) and authorisations (30363, which carry channel actions too), and acts
the moment either changes. The poll stays, for expiries and snapshots. Answering, paying and
closing each take one lock, so a wakeup, the poll and a direct call never act twice on the
same request: payAuthorised checks hasPaid, which suspends, before it marks a payment in hand.

Advances lightning-kmp-app to the commit that keeps payment preimages out of a release build's
Logcat.

The plan doc records the run with ACINQ's mainnet LSP: an on-the-fly 25,000-sat taproot
channel, 8,558 sats received, and a 21-sat payment sent. Every co-signer approved every
commitment. The doc also notes that a payment larger than the channel's 16,442 sats of
inbound would need the splice the co-signers still refuse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 23:47:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 309a486de9 fix(lightning): set the group node up as Phoenix sets up its own
ACINQ's mainnet LSP hung up on the group's node seven milliseconds after init, every time. The
node required simple taproot channels (bit 564). The LSP's init lists neither 564 nor 565, and
BOLT 9 obliges a peer to hang up on a required feature it does not offer. Phoenix leaves the
feature optional and stays connected. Nothing is lost by matching it: lightning-kmp asks for the
taproot channel type in every channel it opens, and the co-signers rebuild every funding output
and commitment as taproot.

The node now takes Phoenix's setup wherever the group's terms allow:
- lightning-kmp's default features and peer storage
- connect and handshake timeouts that grow with each attempt, tripled over Tor
- the LSP's onion address while the identity has Tor on, and no clearnet dial over Tor
- the 50% relative cap on liquidity fees

The absolute fee cap stays the statement's, and the redial backoff stays: Phoenix's resets at
every handshake, which against an LSP that hangs up after init would redial every 0.1 s.

On the operator's emulator, the group's connection to ACINQ now holds. The regtest run still
opens a simple_taproot_channel and passes. Whether ACINQ opens a taproot channel to the group's
node is still unknown until one is opened on mainnet. The plan doc says so, and Phase 0's
instruction to require the feature is corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 23:03:27 +02:00
Kgothatso NgakoandClaude Opus 5.5 3e4de464fe feat(lightning): the group node redials the LSP, and says why it was dropped
lightning-kmp never reconnects by itself. The identity's own node has Phoenix's connection
daemon for that; the group's node connected once, so a single drop left it offline for the
rest of the term.

It now redials after every drop, waiting two seconds and doubling up to five minutes. A
connection that ends within a minute counts as a failure, so an LSP that hangs up on our
features isn't redialled every two seconds. Each drop is logged with its reason. When the
LSP's init doesn't offer a feature we require, the log names it. The node waits up to a
second for that init, because the socket can read as closed before the init's event arrives.

Run against ACINQ's mainnet LSP on an emulator, every drop reads: "Connection closed: the
LSP does not offer simple_taproot_channels, which this node requires". The plan doc now
records that against Phase 0's first step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 22:37:54 +02:00
Kgothatso NgakoandClaude Opus 5.5 cf8ae0200e feat(lightning): the group Lightning wallet on mainnet only
The Lightning wallet now opens on the node's own network, mainnet,
where the group's onchain wallet already is, so the separate testnet3
onchain wallet and its row on the group's screen are gone.
GroupLightningRollout.allows takes mainnet and regtest, nothing else.

This lifts the plan's mainnet gate by decision, ahead of its condition:
an outside review of the Iceberg scheme and the DKG, and a month on
testnet3. The LSP's signing deadline was never measured either.
Meanwhile:

- Every co-signer refuses to sign for a mainnet channel over
  MAINNET_CHANNEL_CAP, 1,000,000 sats, so a bigger one never opens; none
  grows, since splices are refused.
- The opening screen says the scheme is unreviewed and names the cap.

Running the co-signing suite on mainnet (now a second test class) found a
bug that would have stopped everything there: every key manager was built
with a testnet swap-in tpub, which lightning-kmp rejects on mainnet. That
covers every co-signer and the operator's node. Mainnet now takes the
mainnet LSP's published xpub; nothing derives from it.

The full JVM suite (1,578 tests) and the regtest run pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 21:45:57 +02:00
Kgothatso NgakoandClaude Opus 5.5 5ff9380b03 feat(lightning): turn the group Lightning wallet on, on testnet3 (Phase 15)
GroupLightningRollout.ENABLED is now true. A Marmot group's screen offers
the Lightning wallet and the testnet3 onchain wallet it closes to, and
devices run the group nodes they are elected to. NIP-17 rooms still get
neither: they have no key to sign with. Mainnet is still refused by
GroupLightningRollout.allows, whatever a screen offers.

It was turned on before Phase 0's testnet3 measurement of how long the
LSP waits for a signature, so the 60-second signing deadline is a guess
until the first groups run there. The plan doc says so.

The wallet-row test now finds the onchain row by its title and status,
since the testnet3 row is also "Not opened yet". A new test checks that
the Lightning rows open the Lightning wallet and the testnet3 wallet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 21:25:37 +02:00
Kgothatso NgakoandClaude Opus 5.5 0939bd4c55 Merge branch 'bennu' into claude/lightning-wallet-iceberg-f20da1
Brings in an Electrum client for a profile with no node: IdentityElectrum
gives an nsec or npub profile a StandaloneElectrum of its own, so every
profile can watch the chain.

For the group Lightning wallet:

- GroupChainClients now sits on IdentityElectrum's client for the node's
  network, so group wallets and the watcher work on profiles with no node
  too.
- Each other network (testnet3, for the Lightning wallet) now gets a
  StandaloneElectrum instead of this branch's own connection loop. The
  old loop picked a server with ElectrumServers and connected directly,
  ignoring the profile's Tor setting, so a profile with Tor on would have
  reached a testnet3 server in the clear. The new one uses onion servers
  while Tor is on. A test covers it.
- The group's Lightning node takes its context and logger from the app,
  not the identity's Phoenix business, so a profile with no node that
  holds a share can be elected and run it.
- The member wallet's follow() keeps its network parameter.

The full JVM suite (1,568 tests) and the regtest run pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 21:28:17 +02:00
Kgothatso NgakoandClaude Opus 5.5 cb277d3269 Merge branch 'bennu' into claude/lightning-wallet-iceberg-f20da1
Brings in the guarded member wallets, guarded subgroup wallets, ceremony
creation, and the removal of the group's nostr profile, relays and posts.

Two clashes needed more than a textual resolution:

- Event kinds. The guarded-wallet family took 30333-30337, the numbers
  the Lightning family used for its ceremony. Nothing conflicted
  textually and nothing would have failed, since each side reads the
  other's events by kind. The Lightning family moves to a fresh run,
  30350-30366, which costs nothing: rumor kinds that never shipped.
  GroupLightningEventsTest now knows the guarded-wallet kinds and asserts
  the family starts past every kind the app uses.
- Schema versions. bennu used 27-31. This branch's four versions were
  never on an installed database, so they become one migration, 31 to 32,
  adding the 13 Lightning tables.

Also:

- bennu's new member-wallet calls (broadcast, confirmationsOf,
  guardianSpends, the fee suggestion) now take the network, because this
  branch made Electrum clients per network.
- bennu's watcher conflict check uses the transaction's own network.
- NEVER_BROADCAST is gone with the broadcast screen, and so is the test
  that checked the Lightning statements against it.

The full JVM suite (1,554 tests) and the regtest run pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:23:33 +02:00
Kgothatso NgakoandClaude Opus 5.5 3f5de5887c refactor(wallet): every profile can watch, so the cannot-watch branches go (Phase 3)
The wallets are non-null wherever a screen is reached with an identity, and
with them go GroupWalletAddressesUIState.CannotWatch, the CANNOT_WATCH refusal,
canWatch on both wallet states and the new-member-wallet view model, and the
two strings that explained it. An nsec profile can now ask for a member wallet.
The profile screen keeps a nullable wallets, for previews and tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:16:29 +02:00
Kgothatso NgakoandClaude Opus 5.5 da48d7b06c feat(wallet): an nsec or npub profile watches the chain on a client of its own (Phase 2)
IdentityElectrum hands the nav host the node's client for a profile with a
node, and a StandaloneElectrum for one without, stopping the last before the
next is made. The group wallets and the transaction watcher are made from it,
so they now exist for every profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:10:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 9899c57164 feat(wallet): an Electrum connection loop for a profile with no node (Phase 1)
StandaloneElectrum is the node daemon's Electrum branch without the business:
the identity's server, the same pauses and handshake timeouts, a fresh start
on any change to the network, Tor or the server, and no clearnet connection to
a server the user wants reached only over Tor. Not wired in yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:05:31 +02:00
Kgothatso NgakoandClaude Opus 5.5 ceffda81f6 Merge remote-tracking branch 'origin/bennu' into claude/wallet-guardian-group-display-4e7e78
Brings in guarded-wallet forwarding (docs/guarded-wallet-forwarding.md),
which made telling the groups above automatic and touched the same
sharing code in GuardianManager.

Resolved by keeping both: its upwardOf, elected sender and catch-up,
and this branch's naming and certificate tag. Its automatic forward now
carries the guardian's birth certificate too (guardianCertificateFor),
and D5's re-tell rule moved into its told(), replacing alreadyTold. Its
wallet-level named() is dropped in favour of this branch's, which also
fills the guardian and branch names.

GuardedWalletForwardJvmTest's "the button offers only what goes up"
now shares with the certificate, as every share from this build does;
without it the wallet is rightly offered once more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 12:18:38 +02:00
Kgothatso NgakoandClaude Opus 5.5 abb2c550ab feat(wallet): a person's page lists each guarded wallet once, with the group that guards it (Phase 6)
Wallets your groups guard drew one row per holding group, so a wallet
held by a group and its parent appeared twice, each row calling its
holder the guardian. MemberWalletManager.byWallet gathers the rows into
one entry per wallet: headed by its label, "Guarded by #M" for the
group that signed its certificate, and under it each group here with a
leaf in it, nearest first -- "#P: after 144 blocks, about 1 day" --
with Spend where this device holds a share, described as "Spend from
Savings as #P".

GuardedHere.guardianName, which was the holder's room name, is now
holderName, so it is not mistaken for the direct guardian's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 12:09:26 +02:00
Kgothatso NgakoandClaude Opus 5.5 a49c3c1639 feat(wallet): an ancestor's wallet screen gathers a member's wallets and names who guards each (Phase 5)
Members' guarded wallets move under a Members' wallets sub-heading, one
header per person -- @alice, "2 wallets, guarded by 2 groups" -- that
opens their profile, with a card per wallet beneath it. Each card says
which group below guards it: "Guarded by #N", "Guarded by #M, below
#P" where it is further down than this group's own child, "Guarded by
this group", or, with no name this device can check, "Guarded by a
group below #P". An unlabelled wallet is headed by that line.

Fund and Spend now name the wallet as well as the person, so a screen
reader tells one member's several wallets apart. The spend form's
title, the proposal a signer reads and the transcript line name a
labelled member wallet the same way: @alice's guarded wallet "Savings".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 12:04:08 +02:00
Kgothatso NgakoandClaude Opus 5.5 695b3db84c feat(wallet): an ancestor's guarded wallets gathered by person (Phase 4)
byPerson() gathers the member wallets among an ancestor's guarded rows
into one PersonGuardedWallets per member: their rows nearest first,
then by the guarding group's name, and a count of the distinct groups
that directly guard them. Subgroups' wallets are left out. Pure, over
the rows the screen already holds, so nothing has to be kept in step
while the chain redraws them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 11:58:16 +02:00