Merge branch 'claude/guarded-wallet-individual-plan-d79fcf' into bennu
Member guarded wallets are offered on mainnet; a member's own spend there stays held to MAINNET_CAP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
ff007f70ae
4 files changed
+31
-12
No files matched your search
+1
-1
@@ -375,7 +375,7 @@ object MemberWalletManager {
|
||||
is GroupSpend.Result.Refused -> throw IllegalStateException("This spend ${result.reason}")
|
||||
}
|
||||
GroupWalletRollout.memberCapFor(row.chain)?.let { cap ->
|
||||
check(checked.amountSent <= cap) { "This spend sends more than ${cap.sat} sats while member wallets are new" }
|
||||
check(checked.amountSent <= cap) { "This spend sends more than the ${cap.sat} sats one spend may send on mainnet" }
|
||||
}
|
||||
|
||||
val signed = checked.witnessed(checked.inputs.map { MemberWalletDerivation.sign(key, row.chain, it) })
|
||||
|
||||
+12
-8
@@ -46,22 +46,26 @@ object GroupWalletRollout {
|
||||
|
||||
/**
|
||||
* Whether a member is offered a guarded wallet of their own on mainnet --
|
||||
* `docs/member-guarded-wallets.md`, D8. Test networks are offered one from
|
||||
* the start. Shut until a three-level hierarchy has watched one member's
|
||||
* wallet on signet and its root has made a guardian spend from it: the
|
||||
* member's own spend is the first single-signer path this app has.
|
||||
* `docs/member-guarded-wallets.md`, D8. Test networks were offered one from
|
||||
* the start. On: lifted by decision, ahead of the signet run its own
|
||||
* condition named -- a three-level hierarchy watching one member's wallet,
|
||||
* and its root making a guardian spend from it -- as [GUARDIANS_ON_MAINNET]
|
||||
* was. What it still leaves open is the mixed-version risk: a signer on a
|
||||
* build that predates member wallets is shown a certificate it cannot check.
|
||||
*
|
||||
* The entrances only. A device with it shut still accepts, shows and signs
|
||||
* a certificate somebody else asked for.
|
||||
*/
|
||||
const val MEMBER_WALLETS_ON_MAINNET: Boolean = false
|
||||
const val MEMBER_WALLETS_ON_MAINNET: Boolean = true
|
||||
|
||||
fun offersMemberWalletsOn(chain: Chain): Boolean = MEMBER_WALLETS_ON_MAINNET || !chain.isMainnet()
|
||||
|
||||
/**
|
||||
* The most a member's own spend from their guarded wallet may send on
|
||||
* [chain]: [MAINNET_CAP] on mainnet until [MEMBER_WALLETS_ON_MAINNET] lifts,
|
||||
* since the member's spend is signed by a path no group spend goes through.
|
||||
* [chain]: [MAINNET_CAP] on mainnet, as every other spend is. The gate
|
||||
* lifted before the run that was to lift the cap with it, and the member's
|
||||
* spend is signed by a path no group spend goes through, so the cap stays
|
||||
* until that run has been made.
|
||||
*/
|
||||
fun memberCapFor(chain: Chain): Satoshi? = capFor(chain).takeIf { !MEMBER_WALLETS_ON_MAINNET }
|
||||
fun memberCapFor(chain: Chain): Satoshi? = capFor(chain)
|
||||
}
|
||||
+6
-1
@@ -126,7 +126,12 @@ class MemberWalletRequestJvmTest {
|
||||
assertFailsWith<IllegalStateException> { MemberWalletManager.request(db, groupRoom, member, chain, label = null) }
|
||||
assertTrue(db.memberWalletDao().getByOwner(memberPublicKey).isEmpty(), "a refused request makes no key")
|
||||
|
||||
assertEquals(Refusal.NOT_ON_THIS_NETWORK, MemberWalletManager.refusal(db, groupRoom, canSign = true, Chain.Mainnet))
|
||||
// Offered on mainnet since the gate lifted -- the refusal is the room's, not
|
||||
// the network's -- and a member's own spend there still held to the cap.
|
||||
assertTrue(com.machankura.bennu.compose.wallet.GroupWalletRollout.offersMemberWalletsOn(Chain.Mainnet))
|
||||
assertEquals(com.machankura.bennu.compose.wallet.GroupWalletRollout.MAINNET_CAP, com.machankura.bennu.compose.wallet.GroupWalletRollout.memberCapFor(Chain.Mainnet))
|
||||
assertNull(com.machankura.bennu.compose.wallet.GroupWalletRollout.memberCapFor(Chain.Signet))
|
||||
assertEquals(Refusal.KEY_UNKNOWN, MemberWalletManager.refusal(db, groupRoom, canSign = true, Chain.Mainnet))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -28,7 +28,7 @@ signs to agree to it.
|
||||
code as it stood at `8cb6f04e`, schema v29; the build is schema v30.
|
||||
`MemberWalletDerivation`, `MemberWalletRequestEvent`, `MemberWalletCertificateEvent`,
|
||||
`MemberWalletManager` and `GuardianManager.GuardedSubject` are the entry points,
|
||||
and `GroupWalletRollout.MEMBER_WALLETS_ON_MAINNET` is the gate, shut. The phases
|
||||
and `GroupWalletRollout.MEMBER_WALLETS_ON_MAINNET` is the gate. The phases
|
||||
below are kept as written; where the build chose differently the table says so.
|
||||
|
||||
| what the plan said | what it turned out to be |
|
||||
@@ -45,7 +45,17 @@ below are kept as written; where the build chose differently the table says so.
|
||||
| Phase 9: `GroupTransactionWatcher` generalised | a member's spend has no session, so `MemberWalletViewModel` follows the member's spends while the wallet screen is open, sending again any Electrum has not heard of -- the economy the guardian-spend notice makes. *Bump the fee* is not built for a member's spend |
|
||||
| Phase 10: `descendantChatRoomId` becomes `subject.id`, `statement` becomes `signedEvent` | both keep their names -- `descendantChatRoomId` is `subject.id`, and `statement` is the 30334 for a member -- so the guardian spend path did not change a line. `Spender.Guardian.name` is `@name` for a member |
|
||||
| Phase 11: the person's page shows the amount within each group's reach | it does not watch the chain, so it shows the guarding group and *Spend*; the group's wallet screen has the amount. On one's own profile the section is not drawn: the profile's own list is the answer there |
|
||||
| Phase 12: the three-emulator run | not made. It is what lifts the gate |
|
||||
| Phase 12: the three-emulator run lifts the gate | the gate was lifted by decision before the run; see below |
|
||||
| D8: the member's own spend is capped until the gate lifts | capped on mainnet by `MAINNET_CAP` regardless, since the gate lifted without the run that was to justify lifting both |
|
||||
|
||||
**The mainnet gate is open.** It was to lift on Phase 12's run -- a three-level
|
||||
hierarchy on signet watching one member's wallet, the root making a guardian
|
||||
spend from it -- and was lifted by decision before that run, as the guardians
|
||||
note's gate was. The run is still worth making. Until it has been, a member's
|
||||
own spend on mainnet is held to `GroupWalletRollout.MAINNET_CAP`, as every
|
||||
group spend and every guardian spend is; `memberCapFor` is where that lifts.
|
||||
The mixed-version risk below is unchanged: a group whose signers are not all on
|
||||
a build from Phase 7 onward should not be asked to guard a member's wallet.
|
||||
|
||||
Still to do by hand: Phase 12's run on signet.
|
||||
|
||||
|
||||
Reference in new issue
Block a user