From 5ff9380b0384bd9ce36f0a6c5ef3fdabc97697a5 Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Mon, 26 Oct 2026 21:25:37 +0200 Subject: [PATCH] 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 --- .../compose/wallet/GroupLightningRollout.kt | 7 +++-- .../composable/GroupSignedWorkRowsJvmTest.kt | 29 ++++++++++++++++++- docs/group-lightning-wallet.md | 4 +-- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/wallet/GroupLightningRollout.kt b/composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/wallet/GroupLightningRollout.kt index 14bd135a..90970c55 100644 --- a/composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/wallet/GroupLightningRollout.kt +++ b/composeApp/src/commonMain/kotlin/com/machankura/bennu/compose/wallet/GroupLightningRollout.kt @@ -12,9 +12,12 @@ import fr.acinq.bitcoin.Chain object GroupLightningRollout { /** * Whether the group's screen offers a Lightning wallet, and the test-network on-chain wallet it closes - * to. Lifts when Phases 0 to 12 are in, the JVM suite passes and a regtest end-to-end run passes. + * to, and whether this device runs the group nodes it is elected to. On, on testnet3 only: the phases + * are in, the JVM suite passes and the regtest end-to-end run passes. Phase 0's measurement of how + * long the LSP waits for a signature was still to be made on testnet3 when it was lifted, so the + * signing deadline is a guess until the first groups run there. */ - const val ENABLED: Boolean = false + const val ENABLED: Boolean = true /** * The only network a Lightning wallet may be opened on. Iceberg says not to put money behind it, so diff --git a/composeApp/src/jvmTest/kotlin/com/machankura/bennu/compose/ui/composable/GroupSignedWorkRowsJvmTest.kt b/composeApp/src/jvmTest/kotlin/com/machankura/bennu/compose/ui/composable/GroupSignedWorkRowsJvmTest.kt index 5b20a102..0a076d28 100644 --- a/composeApp/src/jvmTest/kotlin/com/machankura/bennu/compose/ui/composable/GroupSignedWorkRowsJvmTest.kt +++ b/composeApp/src/jvmTest/kotlin/com/machankura/bennu/compose/ui/composable/GroupSignedWorkRowsJvmTest.kt @@ -7,18 +7,22 @@ import androidx.compose.ui.test.ComposeUiTest import androidx.compose.ui.test.ExperimentalTestApi import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.getBoundsInRoot +import androidx.compose.ui.test.hasText import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick import androidx.compose.ui.test.runDesktopComposeUiTest +import com.machankura.bennu.compose.nostr.wallet.GroupWalletStatementEvent import com.machankura.bennu.compose.repository.ChatRepository import com.machankura.bennu.compose.repository.NostrRepository import com.machankura.bennu.compose.ui.composable.GroupSignedWorkFixtures.activeUserPublicKey import com.machankura.bennu.compose.ui.composable.GroupSignedWorkFixtures.chatRoomId +import com.machankura.bennu.compose.ui.composable.navigation.routes.GroupLightningWalletRoute import com.machankura.bennu.compose.ui.composable.navigation.routes.GroupWalletRoute import com.machankura.bennu.compose.ui.composable.navigation.routes.Route import com.machankura.bennu.compose.ui.composable.widgets.ProvideSnackbarHost import com.machankura.bennu.compose.ui.theme.BennuTheme import com.machankura.bennu.compose.ui.view.state.ChatRoomDetailUIState +import com.machankura.bennu.compose.wallet.GroupLightningRollout import com.machankura.bennu.compose.wallet.GroupWalletRollout import kotlin.test.Test import kotlin.test.assertEquals @@ -53,13 +57,36 @@ class GroupSignedWorkRowsJvmTest { var opened: Route? = null render(state(), onNavigateToRoute = { opened = it }) { - onNodeWithText("Not opened yet").assertIsDisplayed() + // This row's own status: the testnet3 wallet's row, below it, says the same of its wallet. + onNode(hasText(WALLET_ROW) and hasText("Not opened yet")).assertIsDisplayed() onNodeWithText(WALLET_ROW).performClick() } assertEquals(GroupWalletRoute(activeUserPublicKey, chatRoomId, relayHint = null), opened) } + @Test + fun `the Lightning wallet's rows open it, and the testnet3 wallet it closes to`() { + if (!GroupWalletRollout.ENABLED || !GroupLightningRollout.ENABLED) return + val network = GroupWalletStatementEvent.chainName(GroupLightningRollout.NETWORK) + val opened = mutableListOf() + + render(state(), onNavigateToRoute = { opened += it }) { + onNode(hasText("Lightning wallet") and hasText(network)).assertIsDisplayed() + onNode(hasText("Group onchain wallet on $network") and hasText("Not opened yet")).assertIsDisplayed() + onNodeWithText("Lightning wallet").performClick() + onNodeWithText("Group onchain wallet on $network").performClick() + } + + assertEquals( + listOf( + GroupLightningWalletRoute(activeUserPublicKey, chatRoomId), + GroupWalletRoute(activeUserPublicKey, chatRoomId, relayHint = null, chain = network), + ), + opened, + ) + } + @Test fun `the group's screen has no nostr profile, relays, posts or paste`() = render(state()) { onNodeWithText("Nostr profile").assertDoesNotExist() diff --git a/docs/group-lightning-wallet.md b/docs/group-lightning-wallet.md index 8d5de94a..f8cc79b2 100644 --- a/docs/group-lightning-wallet.md +++ b/docs/group-lightning-wallet.md @@ -43,11 +43,11 @@ build chose differently, this table says so. | 12 | done: `GroupLightningAuthorisationEvent` (kind 30363, `pay`), budgets read from the signed authorisations, the node paying each once, its summary and transcript line, and the send screen (`GroupLightningSendScreen`). The co-signers now hold offered HTLCs under the statement's in-flight cap. Seven new tests | | 13 | done, except splicing out. `close` and `force-close` authorisations, the node acting on each once, the co-signers signing our own commitment only under a force-close authorisation and only after rebuilding it, and the channel menu on the wallet screen. Sweeps: the snapshot lists what closed channels left the group, any member proposes a sweep (`GroupSweep`, a new FROST subject), every member checks it against its own basepoints and the onchain wallet, and the watcher sends it. Five new tests: a force close and a two-input sweep both pass the script interpreter | | 14 | done: a room can have several Lightning wallets on a network, the highest-numbered current. A member who leaves is named on the wallet screen until a new wallet replaces it; the new key is made over the onchain key's holders who are still in the room; the old wallet keeps its operator and node until its channels are closed, in one decision for all of them; and removing a share holder says what it leaves. A five-device test re-keys after a removal | -| 15 | the gates are in code and closed. `GroupLightningRollout.ENABLED` stays `false`. The JVM suite and the regtest run pass; what is left of its condition is Phase 0's testnet3 measurement of how long the LSP waits for a signature, and lifting it is a product decision either way. Mainnet is refused by `GroupLightningRollout.allows`, whatever a screen offers. The ceremony screen names every participant who has not answered, with a word that their build may not know the new kinds | +| 15 | **on, on testnet3.** `GroupLightningRollout.ENABLED` is `true`: the 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. It was lifted with Phase 0's testnet3 measurement of how long the LSP waits for a signature still to make, so the 60-second signing deadline is a guess until the first groups run there. Mainnet is still refused by `GroupLightningRollout.allows`, whatever a screen offers, until the scheme and the DKG are reviewed outside the project and a testnet3 group has run a month cleanly. The ceremony screen names every participant who has not answered | | what the plan said | what it turned out to be | |---|---| -| Phase 0's two spikes run against the testnet3 LSP | **not run.** Both need a channel that somebody pays into, and the regtest alternative means creating docker containers on a development machine that already runs other stacks. That should be somebody's deliberate act, not a side effect of a build. The signer's deadline is therefore a parameter, `RemoteIcebergFundingSigner.deadline`, and not a measured constant. Measuring it is the first thing to do with a funded testnet3 node | +| Phase 0's two spikes run against the testnet3 LSP | one stands in, one is still to make. The regtest run ("The regtest run" below) covers the second, a group node against an LSP. The first, how long the LSP waits for a signature, needs a funded testnet3 node, and the rollout was lifted before it was made. The signer's deadline is therefore a parameter, `RemoteIcebergFundingSigner.deadline`, at 60 seconds, and not a measured constant: measuring it is the first thing to do with the first testnet3 group | | the DKG goes in the bitcoin-kmp fork, beside `Iceberg.kt` | in the app, as `IcebergDkg` beside `GroupWalletDerivation`. It uses only `Iceberg`'s public API and SHA-256, so it needs nothing from inside the library, and putting it there would add a third nested fork branch to every bump. It moves down once it has been reviewed | | a complaint round is left out, so equivocation is caught but not blamed | a reveal that does not match its commitment *is* blamed, as `Fault.BadReveal`. Only committing to two values in front of two members goes unblamed, and the transcript signature still catches it | | every `FundingSigner` method suspends | only the three that sign. `verificationNonce` and `publishedNonceSession` stay synchronous, because one is called from `InteractiveTxSession`'s secondary constructor and fifty-one call sites build sessions that way. Round one is served from a pool the group fills ahead of time, so nothing there has to wait. An unprovisioned label throws `IcebergNonceNotProvisioned`, and the operator's node must not connect while its pool is short (Phase 8) |