Commit Graph
186 Commits
Author SHA1 Message Date
Kgothatso Ngako 1f9c9ef131 docs: the group Lightning wallet's review findings, as seven phased plans
The review asked whether the wallet's operator can spend lightning funds
without t-1 other share holders. The core claim holds; the seven exceptions
each get a phased plan under docs/lightning/, with an index giving the
severity table and the build order.
2026-10-27 09:21:36 +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 ca2a5b790d docs: the group Lightning wallet in the chat is built, and the notes it touched say so (Phase 7)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:21:43 +02:00
Kgothatso NgakoandClaude Opus 5.5 e328720071 docs: the group Lightning wallet in the chat, planned
Every Lightning kind but the three the group signs reaches the transcript's
unsupported arm and leaves a raw-JSON bubble, and the Iceberg ceremony never
got the standing notice above the composer. Seven phases to put both right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 23:55:54 +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 31404c675f docs: an Electrum client for a profile with no node is built, and the notes it touched say so (Phase 4)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:17:25 +02:00
Kgothatso NgakoandClaude Opus 5.5 dc36607eaa docs: a profile with no node gets an Electrum client of its own, planned
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:01:30 +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 e15855faad docs: the direct guardian of a member's wallet is built, and the notes it touched say so (Phase 7)
member-wallet-guarding-group.md is marked built, with a table of where
the build chose differently from the plan. The member-guarded-wallets
note's Phases 10 and 11 and the guardians note's How an ancestor finds
the coins point to it, and the README's reading order places it.

Still to do by hand: the signet run with three emulators.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 12:10:14 +02:00
Kgothatso NgakoandClaude Opus 5.5 0f10ad16c6 docs: forwarding guarded wallets upward is built, and the notes it touched say so (forwarding, Phase 7)
The plan is marked built, with a table of the nine places the build
chose differently -- the forwarder's own line written by share so the
button writes it too, a notice carried on by any device that believes
it whether or not it holds the room's key, one explanatory line under
the fallback section rather than one per row, and the signet run still
to make. The guardians and member-guarded-wallets notes say forwarding
no longer waits on a tap, and the README that it has been built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 11:49:42 +02:00
Kgothatso NgakoandClaude Opus 5.5 eaaa352d57 docs: plan naming the group that directly guards each member wallet
An ancestor's guarded-wallet list shows @alice with nothing saying which
group in the lineage signed her wallet's certificate, so two wallets
under different branches read the same. The plan names the direct
guardian (the certificate's signer, guardians[0]) by its founding name,
carries that group's birth certificate on the forwarding notice so a
device outside it can name it, and gathers a person's wallets under one
header on the group's wallet screen and one row per wallet on their
profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 11:41:12 +02:00
Kgothatso NgakoandClaude Opus 5.5 60c54c8825 docs: plan forwarding guarded wallets upward without a tap
A group above can use its leaf in a guarded wallet only once told, and
today that is the Share button on the lower group's wallet screen. The
plan has every device that files a guarded wallet it believes tell the
groups above it is in -- one elected sender at once, the rest in a
catch-up when a group's chat or wallet screen opens -- and keeps the
button as the fallback for a notice lost on the wire.

It fixes two bugs in the button on the way: it tells guardian groups
below the current one, and a guarding group's own member certificate
never counts as told.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 11:36:30 +02:00
Kgothatso NgakoandClaude Opus 5.5 52b17bbc36 docs: the member-wallet policy is built, and the notes it touched say so (Phase 7)
member-wallet-delay.md is marked built, with a table of where the build
chose differently -- most of all that a request carrying no policy still
reads, so wallets guarded before policies keep verifying. The member
wallets note's "full control" stops saying 12, and its D3 adds that only
an open group takes a request; the guardian-delay note's member-wallet row
and the README follow.

The three-emulator run is still to do by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 10:50:33 +02:00
Kgothatso NgakoandClaude Opus 5.5 29c4c5e0d4 docs: a group opts in to guarding members' wallets, and can close again
The member-wallet policy (30337) becomes the group's opt-in: no policy
means the group does not guard members' wallets (D8), so every new member
wallet's delay is one its group chose. A newer policy with ["closed"]
instead of a delay stops new wallets (D9); it never releases one already
guarded, whose addresses carry the group's leaf. Opening again is a newer
open policy.

The signer table, the picker's refusals (POLICY_UNKNOWN, NOT_OFFERED,
CLOSED), the request, the screen -- now MemberWalletPolicyScreen, with
Stop guarding new wallets -- and the emulator run follow. Phases 4, 5 and
6 now ship together, since 4 and 5 close every group until 6 opens it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 10:24:29 +02:00
Kgothatso NgakoandClaude Opus 5.5 1f67ed9726 docs: plan the group setting the delay on its members' guarded wallets
The group's quorum signs a standing policy in its own room -- a new kind,
30337, ["guardian_delay", <blocks>] -- rather than a birth certificate
tag: the certificate is the parent's statement, frozen at birth, and a
root group has none. A member's request is built under the newest policy
and carries it whole, so late members (through the key notice) and
signers who missed it judge it alike; signers refuse a stale or missing
one. A wallet already guarded keeps its delay. Seven phases, not built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 09:59:23 +02:00
Kgothatso Ngako 05bd6ed6a8 Merge branch 'refs/heads/bennu' into claude/ecstatic-feynman-2c5628 2026-10-24 09:09:17 +02:00
Kgothatso NgakoandClaude Opus 5.5 3b2d9bd82f Merge branch 'bennu' into claude/ecstatic-feynman-2c5628
Brings in member guarded wallets and funding a descendant's guarded wallet.

- Schema: bennu's v30 (MemberWallet, MemberWalletSpend) is kept as it is;
  DkgSession.guardianDelay moves to v31, with a 30 -> 31 auto-migration.
- Conflicts: strings and README take both sides; the send form's guardian
  delay line moves into the shared SpendForm; the guarded wallet card keeps
  its Fund and Spend buttons and gains this group's own leaf's delay.
- bennu's uses of ANCESTOR_DELAY become each leaf's own delay:
  GuardedWalletRow.arriving, the funding form's "spend these coins again"
  line, the member wallet screens' reach text (MemberWalletManager.delaysOf)
  and the member certificate's proposal summary.
- Four of bennu's fixtures built a "guarded" wallet with no guardian leaf;
  they now carry the ancestor's, as a verified statement would.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 08:31:51 +02:00
Kgothatso NgakoandClaude Opus 5.5 0b8ae8150c feat(wallet): offer member guarded wallets on mainnet
GroupWalletRollout.MEMBER_WALLETS_ON_MAINNET is on, lifted by decision
ahead of the signet run that was to lift it, as GUARDIANS_ON_MAINNET
was. A member's own spend on mainnet stays held to MAINNET_CAP, like
every group and guardian spend: memberCapFor no longer lifts with the
gate, since the run that would have justified lifting both has not
been made. The note says the gate is open, what it still leaves open,
and where the cap lifts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 08:29:58 +02:00
Kgothatso NgakoandClaude Opus 5.5 a8869f533b Merge branch 'bennu' into claude/guarded-wallet-individual-plan-d79fcf
Brings in a group funding a descendant's guarded wallet. Three conflicts:

- GroupSendScreen: funding replaced the address field and named the
  funded wallet in the preview, inside the fields this branch moved
  into SpendForm. SpendForm now takes a destination slot, which a
  funding fills with its card, and the funded wallet's name; the
  preview takes both that name and the member's ownWallet words.
- GroupWalletScreen: the guarded wallet row is funding's card with Fund
  beside Spend, headed by this branch's #name / @name and carrying a
  member's label.
- docs/README.md: both rows.

Funding reads guarded wallets through GuardianManager.guardedWalletsOf,
which this branch widened to members' wallets, so a group can now fund
a member's guarded wallet. Every place funding named a wallet with
`name ?: "a subgroup"` -- the title, the destination card, the preview,
the proposal summary, a signer's refusal -- uses displayName, so it
reads "Fund @alice's guarded wallet". A test funds a member's wallet
end to end through GroupSpend.fundingsOf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 08:15:27 +02:00
Kgothatso NgakoandClaude Opus 5.5 d2e5fa082d docs: member guarded wallets are built, and the notes they touched say so (Phase 12)
The plan is marked built, with a table of the thirteen places the build
chose differently -- the key notice carrying the key rather than the
signed key state, the request travelling whole inside an inner event,
Put to the group living on the group's page, the wallet screen
following a member's spends while open, and the signet run still to
make before the mainnet gate lifts. The guardians and subgroups notes
point here, and the README says it has been built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 08:00:46 +02:00
Kgothatso NgakoandClaude Opus 5.5 e3e79393f0 docs: the guardian delay is built, and the notes it touched say so (Phase 8)
guardian-delay.md is marked built, with a table of where the build chose
differently. group-wallet-guardians.md's "Why 12, and why for everybody"
becomes "Why a delay, and who sets it": each parent chooses its own leaf's
delay from 6 to 65,535 blocks, inherited ones keep theirs, and a long
delay is a backstop rather than an override. The policy note's picker
section and the README follow.

The three-emulator run is still to do by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 07:49:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 b5f0709c3f docs: funding a guarded wallet is built, and the notes it touched say so (Phase 6)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 07:42:59 +02:00
Kgothatso NgakoandClaude Opus 5.5 414b160d3f docs(regtest): how to run the regtest wallet test, and what its failures mean
testing/regtest/README.md now covers the prerequisites and ports, where
the run's output and eclair's log end up, and a troubleshooting table. The
docs index and CLAUDE.md's "Checking your work" link to it.

The test checks the network before it starts. If a service isn't
listening, or `regtest.sh up` didn't finish, it fails at once, names what
is missing and says how to start it. Before, that was a bare connection
error or a three-minute timeout.

BENNU_REGTEST is now an input of the test task. Before, a skipped run left
jvmTest up to date, and asking for the regtest run afterwards replayed the
skip without running anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 07:41:37 +02:00
Kgothatso NgakoandClaude Opus 5.5 4a556e7ec4 docs: D1 of the guardian-delay plan is decided
A parent sets only its own leaf's delay; an inherited ancestor keeps the
delay it chose, all the way down a guarded subtree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 07:27:15 +02:00
Kgothatso NgakoandClaude Opus 5.5 afc443b0ee docs: plan a parent choosing its subgroups' guardian delay, and saying it in time
A parent picks its own leaf's delay when it makes a guarded subgroup, from
6 blocks to 65,535 (BIP68's block-based ceiling, about 15 months); an
inherited ancestor keeps the delay it chose. The delay rides the ceremony
proposal, is signed into the certificate's guardian tag and checked by
both quorums, and every screen that quotes "12" says each leaf's own
delay as blocks with an approximate duration. Eight phases, not built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 07:17:15 +02:00
Kgothatso NgakoandClaude Opus 5.5 620cd438a8 docs: plan a guarded wallet a group keeps for one member
The member's device makes a random key, works out every ancestor leaf
and both descriptors, and only then asks the group. The group's quorum
signs a member wallet certificate of its own kind (30334) rather than a
birth certificate, since every reader of 30329 assumes a room. Ancestors
list the wallet as @name, and the group's page opens the member's profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 07:09:44 +02:00
Kgothatso NgakoandClaude Opus 5.5 4c6cc9d1a0 docs: plan a group funding a descendant's guarded wallet
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 06:53:38 +02:00
Kgothatso Ngako 60cb3fa7ae Merge remote-tracking branch 'origin/bennu' into claude/parent-group-wallet-control-5a1540
# Conflicts:
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/repository/DatabaseChatRepository.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/repository/ChatRepository.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui/view/model/ChatRoomDetailViewModel.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/ui/view/state/ChatRoomDetailUIState.kt
#	composeApp/src/commonTest/kotlin/com/machankura/bennu/compose/text/ProposedEventTest.kt
2026-10-24 06:13:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 d8d8d038f9 test(lightning): the group's wallet end to end on regtest, and what it found
`testing/regtest/` builds bitcoind, electrs, an eclair v0.14.4 LSP set up as
a Phoenix LSP, and a payer. `GroupLightningRegtestJvmTest` (run with
BENNU_REGTEST=1) drives four devices through it with a real lightning-kmp
node: open, receive on a channel opened on the fly, pay through the LSP's
trampoline, close mutually, then force-close a second channel and sweep its
delayed output with a FROST script-path spend. It passes from a fresh
network in about thirty seconds.

The run found four bugs in the operator's node, fixed here:

- It learned the chain's height only at the next block, and until then
  could answer no invoice request and take no payment. It now asks as it
  starts.
- It turned down every on-the-fly channel, because lightning-kmp's default
  liquidity policy caps fees at 2,000 sats and the statement's signed
  `maxLiquidityFeeSat` never reached it. The node's policy is now the
  statement's.
- A channel could ask for round one before the pool held it. The node now
  waits for a minimum pool before connecting, and otherwise refuses and
  retries.
- A force close waited forever for feerates, which lightning-kmp fetches
  only once. The node now refreshes them, and takes a flat rate on regtest.

Public eclair cannot route a Bolt11 payment to a wallet by its peer-id
route hint, so the run pays the group's Bolt12 offer. The offer is now part
of the wallet: every snapshot carries it, every member keeps it only if
its own copy of the seed derives it, and the receive screen shows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 22:30:25 +02:00
Kgothatso NgakoandClaude Opus 5.5 e9fae262c8 docs: the subgroup wallet policy is built, and the notes it touched say so (Phase 9)
subgroup-wallet-policy.md is marked built, with a table of where the
build chose differently. group-wallet-guardians.md's "why it is still the
child's choice" becomes "whose choice it is": the parent decides, the
chain still does not enforce it, and an older certificate still leaves it
to the child. subgroups.md gains the wallet tag and the policy as the
second value the coordinator picks for other people.

The three-emulator run is still to do by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 22:11:00 +02:00
Kgothatso NgakoandClaude Opus 5.5 fed7e67c3d docs: plan the parent deciding a subgroup's wallet policy at birth
The coordinator picks guarded or unguarded on the subgroup picker, the
parent's quorum signs the choice into the birth certificate, and the
child's admins agree to it by joining and again when they sign the key
state. Every honest client then offers, signs, derives and watches only
the wallet the certificate allows. An unguarded certificate carries no
guardian keys, and a guarded group can only make guarded subgroups.

Not built: Phase 0's decisions and nine phases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 21:48:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 bab4b67fca feat(lightning): the rollout gates, and who has not answered (Phase 15)
The gates are in code and stay closed. `GroupLightningRollout.ENABLED` is
false because its own condition, a regtest end-to-end run, has not been
met; mainnet is refused by `allows` whatever a screen offers.

The ceremony screen names every participant who has not answered the
proposal, with a word that their build may not know the new kinds: a
member on an old build is a co-signer who never answers, and the group
is smaller for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:12:54 +02:00
Kgothatso NgakoandClaude Opus 5.5 6140aef33a feat(lightning): the group re-keys its Lightning wallet when members change (Phase 14)
Iceberg cannot reshare, so a member who leaves keeps a share of the key
and the node's seed until the group opens a new wallet without them.

- A ceremony is now over the onchain key's holders who are still in the
  room (D1, narrowed), and a statement verifies when every participant
  holds the onchain key, so the wallets before and after a removal both
  stand.
- A room can have several wallets on a network. The highest-numbered is
  current, and a new statement takes the next number, under a key no
  wallet uses yet.
- The wallet screen names who has left and offers the new key or the new
  wallet. It lists earlier wallets with their balance, one decision to
  close every channel they still have, their sweeps, and a way to run
  their node when nobody does.
- `GroupLightningNodes` runs one node per wallet a device operates.
- Removing a member who holds a share says what the removal leaves.

A five-device test removes a member, refuses the leaver's own ceremony,
re-keys over the four who remain, opens wallet 1 beside wallet 0 with an
operator each, and closes wallet 0's channels in one session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:09:13 +02:00
Kgothatso NgakoandClaude Opus 5.5 b770b07472 feat(lightning): the group sweeps closed channels into its onchain wallet (Phase 13, part 2)
The operator's snapshot now lists what closing channels pay to the
group's basepoints, found by the fork's `GroupHeldOutputs`. Any member
proposes a sweep from the wallet screen. A sweep is a FROST session of its
own subject, `SWEEP`: every input is a taproot script-path spend, signed
under the leaf key each member derives from its own basepoints, and every
output must be a receive address of the onchain wallet. `GroupSweep.check`
refuses anything else.

A signed sweep is a `GroupTransaction` row like a spend, so the watcher
sends it, again every ten minutes until the network accepts it once the
delay is over. The approval screen, the proposal list and the onchain
wallet's history say what a sweep is.

A four-device test sweeps a to_remote and a to_local output built with
lightning-kmp's own scripts, and the interpreter accepts the result.
Splicing out is not built; the plan's doc says why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:53:43 +02:00
Kgothatso NgakoandClaude Opus 5.5 cb6934b806 feat(lightning): the group closes and force-closes its channels (Phase 13, part 1)
Two new authorisation actions on kind 30346, `close` and `force-close`,
each naming one channel and open for three days. The operator's node acts
on each once: a mutual close to the onchain wallet's first address, or
publishing our own commitment. Any member proposes one from the channel's
menu on the wallet screen.

Co-signers sign our own commitment only under a force-close
authorisation, only after rebuilding it, and never one more than a step
behind the counterparty commitment they last signed: anything older is
revoked. A four-device test force-closes with a signature that spends the
funding output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:40:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 d69344fe1b feat(lightning): the group pays from its Lightning wallet (Phase 12)
A member proposes a payment from the new send screen: an invoice, the
amount when it names none, and a fee limit. The group signs it as an
authorisation (kind 30346, `pay`) like any decision; the summary leads
with the amount and the most the fee can be.

Every co-signer reads the signed authorisations as budgets, so the
operator can only make payments the group signed for. An expired one
closes to new HTLCs but still settles what is in flight. The operator's
node pays each authorised payment once.

The co-signers now also hold what the group offers at once under the
statement's in-flight cap, which nothing checked while nothing could be
offered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:32:21 +02:00
Kgothatso Ngako 79f2ec3d4d Merge branch 'bennu' into claude/remove-nostr-relays-posts-fc5580
# Conflicts:
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/model/ChatMessage.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/database/repository/DatabaseChatRepository.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/nostr/wallet/GroupWallet.kt
#	composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/repository/ChatRepository.kt
2026-10-23 18:28:25 +02:00
Kgothatso NgakoandClaude Opus 5.5 b4fbae748d feat(lightning): members receive into the group's Lightning wallet (Phase 11)
A member asks for an invoice (kind 30347) from the new receive screen; the
operator's running node finds each request no invoice answers yet, makes
one with lightning-kmp's `createInvoice`, and sends it to the room (kind
30348). Every member files an invoice only from the operator, and only if
it pays the node the group's statement names, so the screen never shows
an invoice that pays somebody else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:20:18 +02:00
Kgothatso NgakoandClaude Opus 5.5 33a1ef0ed2 feat(lightning): the operator reports the group's wallet to the room (Phase 10)
The running node sends a snapshot (kind 30345) as it starts, whenever its
channels or payments change, and every five minutes otherwise: the channels,
the payments it has seen, and the round-one label assignments, so whoever
operates next signs under the verification nonces this operator published.

A member believes a snapshot only from the operator the group elected for
the term it names, about the node the statement names. It files the newest
(schema 30) and keeps every payment, and the wallet screen shows balance,
channels and payments, each channel checked against what this device last
co-signed for it.

The invoice wire and its table land here too, because they share the
schema bump; Phase 11 puts them to use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:13:04 +02:00
Kgothatso NgakoandClaude Opus 5.5 0449293963 fix(marmot): a direct message's envelope is opened, not taken for a signing decline
FrostSigningEvents.DECLINE and MarmotDirectMessage.ENVELOPE_KIND are both
30330. Recognising protocol kinds first (ceremony-creation Phase 6) returned
before the direct-message branch, so every direct message in a
current-profile room was dropped unopened. A 30330 that holds a gift wrap is
an envelope; only one that does not is a decline.

ProtocolKindDispatchJvmTest now opens an envelope through
fromGroupEventResult, which no test did before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:13:02 +02:00
Kgothatso NgakoandClaude Opus 5.5 7746f3d17f feat(wallet): offer guarded wallets on mainnet
GroupWalletRollout.GUARDIANS_ON_MAINNET is on, lifted by decision ahead of
the signet run its condition named. The mixed-version risk stays open and
is said so in the gate and the guardians note; guardian spends on mainnet
are held to MAINNET_CAP like every other spend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:06:19 +02:00
Kgothatso NgakoandClaude Opus 5.5 dd0d4b003d feat(lightning): run the group's node on the operator's device (Phase 8)
GroupLightningNode builds a lightning-kmp Peer from the wallet's seed,
with the group's funding signer, basepoints and closing address
(GroupNodeKeyManager), on Phoenix's SQLite databases under names of its
own. It starts only on the elected operator's device, once that device
has heard from the room recently, and stops itself when a later term
begins, telling the room where its channels were. GroupLightningNodes
keeps one running per wallet this identity operates, behind the
rollout gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:59:10 +02:00
Kgothatso NgakoandClaude Opus 5.5 b21f4c4d2c refactor(groups): remove the group's nostr profile, relays and posts
The group's detail screen loses its "Nostr profile", "Relays" and "Posts"
rows, and the six screens behind them go with them: the profile, its
editor, the relay lists, their editor, the posts and the composer. So do
the readers they stood on (GroupNostrProfile, GroupRelayList, GroupPost),
their ChatRepository methods, and 97 strings.

Two things go that were not named, because nothing else reaches them.
BroadcastGroupSignedEventScreen was only opened from those three screens,
so the app no longer sends a group-signed event to a relay, and
EventPublishTransport goes with it. "Propose event" accepted only a
profile, a post or a relay list, so it would refuse every paste;
ProposeGroupEventScreen and GroupEventProposal are removed, and with them
the detail screen's canEditNostrProfile gate. What is left of that block
is the wallet row, shown in Marmot rooms only.

The transcript keeps what it already holds. The three message types stay
as private legacy names in GROUP_IDENTITY_TYPES, as the curated-lists
types did, so rows already written stay system lines. A profile or relay
list arriving in a room now applies to nothing, so a signing session an
older build opened for one ends without a raw-JSON bubble. A kind:1 falls
through to "unsupported", which is what it was before posts existed.
ProposedEvent no longer describes the three kinds.

GroupSignedWorkRowsJvmTest now covers the wallet row and the absence of
the removed rows. The chronicle tests still use a profile, a relay list
and a post as their kinds; they compare GroupSignedEvent rows, which are
unchanged, so only ChronicleTestKinds' account of why is corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:56:58 +02:00