test: Giza derives what Bennu derives, every tag pinned (fork, Phase 8)

ForkCompatibilityTest pins each mantra/ and bennu/ derivation tag through the
function that hashes it: the ChillDKG host key, the Marmot shared-key tweak,
the group Lightning basepoints, the Iceberg pool label and the session,
contribution, commitment, seed and transcript hashes, the member wallet id and
possession message, and the group wallet address and guardian root. A sweep
that renames one of them now fails a test rather than moving a group's coins
and splitting Giza from Bennu.

The vectors come from this tree. A diff against 4e106fb5 shows that the files
holding the tags differ only in packages, imports, comments and the database's
type name, so the vectors are Bennu's too.

docs/giza-rebrand.md gains a table of where the build stands and what turned
out differently, the twelve bennu/ tags first.

jvmTest: 1651 run (1643 + 8), 0 failed, 2 skipped. m3Audit and brandAudit pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kgothatso NgakoandClaude Opus 5.5 committed 2026-11-18 11:00:44 +02:00
1 parent c0f1b3d5e3
commit 851ff0c8c2
2 files changed
+148 -2

No files matched your search

@@ -0,0 +1,117 @@
package mobi.giza.compose.managers
import fr.acinq.bitcoin.ByteVector32
import fr.acinq.bitcoin.Chain
import fr.acinq.bitcoin.PrivateKey
import fr.acinq.bitcoin.byteVector32
import fr.acinq.secp256k1.Hex
import mobi.giza.compose.nostr.wallet.MemberWalletRequestEvent
import kotlin.test.Test
import kotlin.test.assertEquals
/**
* Giza derives what Bennu derives (docs/giza-rebrand.md, Phase 8).
*
* The fork kept every derivation tag it found -- `mantra/` and the twelve `bennu/` --
* because a Bennu peer and a Giza peer have to land on the same keys: in one group, in one
* key ceremony, and for a Bennu seed restored in Giza. Those tags look like brand strings,
* and the next sweep for a name is how they would change. Each one is pinned here, through
* the public function that hashes it, so that a renamed tag fails a test instead of
* silently moving a group's coins.
*
* The vectors were computed by this tree, whose derivation code is Bennu's at `4e106fb5`
* line for line (the fork changed packages and comments in those files, nothing else).
* Some are also pinned elsewhere -- GroupWalletDerivationTest and GuardianDerivationTest
* freeze their own tags -- and this file is the one place that says why every one of
* them must also match Bennu.
*/
class ForkCompatibilityTest {
private fun key(seed: Long): PrivateKey =
PrivateKey(ByteVector32(Hex.decode(seed.toString(16).padStart(64, '0'))))
private val threshold = key(0x91fa).publicKey().toString()
private val room = "00".repeat(31) + "2a"
private val ceremony = ByteVector32("11".repeat(32))
@Test
fun `mantra chilldkg host key`() {
assertEquals(
PINNED_HOST_KEY,
ChillDkgRitualManager.deriveHostPublicKey(key(0x5eed).value.toByteArray()).toString(),
)
}
@Test
fun `mantra shared key tweak at the marmot admin path`() {
assertEquals(PINNED_SHARED_KEY, SharedKeyDerivation.derive(threshold).hex)
}
@Test
fun `bennu group lightning basepoints`() {
val basepoints = GroupLightningDerivation.basepoints(threshold, Chain.Mainnet, 0L)
assertEquals(PINNED_PAYMENT_BASEPOINT, basepoints.payment.publicKey.toString())
assertEquals(PINNED_DELAYED_BASEPOINT, basepoints.delayedPayment.publicKey.toString())
}
@Test
fun `bennu iceberg pool label`() {
assertEquals(PINNED_POOL_LABEL, GroupLightningCoSigner.poolLabel(threshold, 7L).toHex())
}
@Test
fun `bennu iceberg dkg session, contribution, commitment and seed`() {
val params = IcebergDkg.Params.of(2, listOf(key(1).publicKey(), key(2).publicKey(), key(3).publicKey(), key(4).publicKey()), ceremony)
assertEquals(PINNED_ICEBERG_SESSION, params.sessionId.toHex())
val root = ByteVector32("22".repeat(32))
// The first seed participant 1 holds, and the contributions of everyone who holds it.
val rank = params.heldRanks(1).first()
val contribution = IcebergDkg.contribution(params, 1, root, rank)
assertEquals(PINNED_ICEBERG_CONTRIBUTION, contribution.toHex())
assertEquals(PINNED_ICEBERG_COMMITMENT, IcebergDkg.commitment(params, 1, rank, contribution).toHex())
val contributions = params.holders(params.subsets[rank]).map { IcebergDkg.contribution(params, it, root, rank) }
assertEquals(PINNED_ICEBERG_SEED, IcebergDkg.seed(params, rank, contributions).toHex())
}
@Test
fun `bennu iceberg dkg transcript`() {
val params = IcebergDkg.Params.of(2, listOf(key(1).publicKey(), key(2).publicKey(), key(3).publicKey(), key(4).publicKey()), ceremony)
val root = ByteVector32("22".repeat(32))
val commitments = (1..4).associateWith { IcebergDkg.round1(params, it, root) }
assertEquals(PINNED_ICEBERG_TRANSCRIPT, IcebergDkg.transcriptHash(params, commitments).toHex())
}
@Test
fun `bennu member wallet id and possession message`() {
val walletKey = key(0x3a11e7).publicKey()
assertEquals(PINNED_MEMBER_WALLET_ID, MemberWalletDerivation.walletId(walletKey))
assertEquals(
PINNED_POSSESSION_MESSAGE,
MemberWalletRequestEvent.possessionMessage(key(0xa11ce).publicKey().xOnly().value.toHex(), room, walletKey, Chain.Mainnet).toHex(),
)
}
@Test
fun `bennu group wallet account and guardian root`() {
assertEquals(PINNED_GROUP_ADDRESS, GroupWalletDerivation.derive(GroupWalletDerivation.account(threshold, Chain.Mainnet), GroupWalletDerivation.RECEIVE, 0L).address(Chain.Mainnet))
assertEquals(PINNED_GUARDIAN_ROOT, GuardianDerivation.root(threshold).publicKey.toString())
assertEquals(PINNED_GUARDIAN_CHILD_INDEX, GuardianDerivation.childIndex(room))
}
companion object {
const val PINNED_HOST_KEY = "028871ab105eac8812fa7aab4b9110ad20b5dcfba9f65271431dcb417258da08af"
const val PINNED_SHARED_KEY = "5eb33e9c2a5a90ae4d273b687eb1265f8b79c2bcee28f9ae9dc44dba6e788444"
const val PINNED_PAYMENT_BASEPOINT = "02973930314ffd75c72fc909bc0b3586b7f2f1196d6423281a24eec32671f3b510"
const val PINNED_DELAYED_BASEPOINT = "02531089bc88fe949dc54394b8bbb7db2439cb2865495bd239b4ecf0264904a270"
const val PINNED_POOL_LABEL = "9490bb167e551d6e247329d60392e0e9b127c978e9b3a89bd4ddbcb2c2f17b99"
const val PINNED_ICEBERG_SESSION = "fba343265271b4c2ee52d54cf4ea99963ae7205333e36b92af81d9d43aaaceed"
const val PINNED_ICEBERG_CONTRIBUTION = "bd11ce00c8d1a1a825395cd32116e606cba857644e7ef2823b03fedbba362360"
const val PINNED_ICEBERG_COMMITMENT = "ee2b1e4e0a92d2d2722a9149bb8f0487e2dc75d4cd9d76a9510a3e60153c960e"
const val PINNED_ICEBERG_SEED = "d68eeef4eafd2581b55e74e59eb7f6872b0aafd2afe12d3baf6d837fa916d755"
const val PINNED_ICEBERG_TRANSCRIPT = "a0e23009ad3462804bfef145de94ad23901bf188f6ea9a259a30e3db00509316"
const val PINNED_MEMBER_WALLET_ID = "2282987a87614b622a25500102158d65ed01165919f98bc372aa3d39c828d5db"
const val PINNED_POSSESSION_MESSAGE = "43a8cc800f2205edb6384d2758e53b40692859524255449521036f11cdca3396"
const val PINNED_GROUP_ADDRESS = "bc1paul0w26tuf9sm75htghayux7xf6vep4zsqrrm0sysawghqjkdm9smddcqp"
const val PINNED_GUARDIAN_ROOT = "03be02bea3b2feeb8d104c537db973f062211c89a2b82a0d2f9789184c260cbab4"
const val PINNED_GUARDIAN_CHILD_INDEX = 1976210374L
}
}
+31 -2
View File
@@ -10,8 +10,11 @@ Curare to Bennu in `b75d4b42`. It is the first *fork*, though. After it, two app
can be installed on one device, they can share one seed, and they meet on the same relays in the
same groups. Most of what makes this plan more than a find-and-replace comes from that.
**Not started.** Written against `4e106fb5` on `bennu`, with the `lightning-kmp-app` submodule
unchanged. Read these first:
**Built in this tree, but for what needs accounts, artwork or a Mac.** Written against `4e106fb5`
on `bennu`, with the `lightning-kmp-app` submodule unchanged. Built on
`claude/giza-fork-rebrand-plan-2bf717`, one commit per phase. This document keeps Bennu's
spellings throughout: it describes the tree as it was before the fork, and
`giza-rename.sh` skips it on purpose. Read these first:
- `b75d4b42`, *Rebrand Curare to Bennu under com.machankura.bennu*. It is the precedent: 975
files, a package move, and a list of names it left alone on purpose. Every name on that list
@@ -22,6 +25,32 @@ unchanged. Read these first:
- [material-design-conformance.md](./material-design-conformance.md). The audit it enforces
reads a hard-coded source path. That path moves in Phase 3.
### Where the build stands
Each phase was checked against the Phase 0 baseline: `jvmTest` 1,642 run, 0 failed, 2 skipped,
and the `m3-audit` report saved before any change.
| phase | state |
|---|---|
| 0 | the baseline is recorded. **Not done:** confirming the domain, the repository names, the store reservations and the upload key. These are the owner's, outside this tree |
| 1 | `afd43434`: CI runs on `giza`, and the README says Giza is a fork. **Not done:** creating the repository, its remotes and its default branch |
| 2 | `78d913aa`: `curated` → `giza` on desktop, `mobi.giza.android` and `mobi.giza.ios`, `giza-regtest`. `AppDirJvmTest` checks the directory name. **Not done:** the side-by-side install by hand |
| 3 | `30d5feaf` (moves only: 920 renames) and `34e802ce` (contents: 920 files). `Res` is pinned at `mobi.giza.compose.resources`. Tests at the baseline (+1, `AppDirJvmTest`), and the audit report matches line for line. **Not done:** the iOS link and the Xcode build, which need a Mac |
| 4 | `4f3f0da3`: strings, the restore warning, the desktop window and installers, the iOS product, the client tags, the rebrand-history comments |
| 5 | **not built**: it needs the artwork from Phase 0's brief. `BennuTheme` and `BennuShapes` were renamed in Phase 3 |
| 6 | `5b92b838`: `rootProject.name`, the regtest variables and aliases, the README, the docs index, `CLAUDE.md`, and `brand-audit.sh` in `check` and in CI |
| 7 | the build side: `versionCode = 1`, `versionName = "0.1.0"`, and an optional `upload` signing config read from gradle properties or the environment. **Not done:** the store records, provisioning, listings and release notes |
| 8 | `ForkCompatibilityTest` pins every `mantra/` and `bennu/` tag through the function that hashes it. **Not done:** the checks that need devices or two builds: side by side, a mixed group, a mixed regtest run |
| 9 | the procedure is ready (`giza-rename.sh`, `brand-audit.sh`). Nothing has been merged from Bennu yet |
| what the plan said | what it turned out to be |
|---|---|
| the protocol strings to keep are `mantra/` and the admin path | also **twelve `bennu/` tags**, found while building Phase 4. They are hash inputs, as `mantra/` is. They stay, each has a comment saying why, and the brand audit allows them |
| `giza-rename.sh` finds nothing on a renamed tree | at first it searched more loosely than it replaced, so it matched URLs like `code.sigidli.com/machankura/bennu-kmp` and reported rewriting files it had not changed. Its search is now the same pattern as its replacements |
| the brand guard covers `CLAUDE.md` | it does not. `CLAUDE.md` is prose that has to name Bennu to explain the rule. The guard covers what builds and ships: `composeApp`, `iosApp`, `testing` and the gradle scripts |
| D7: the desktop `packageVersion` restarts too | left at `1.0.0`. jpackage refuses a DMG whose major version is 0 |
| Phase 8: a known-answer test for a Bennu seed restored in Giza (npub, first address, host key) | the test pins the tags through the app's own derivation functions. The personal wallet's derivation is lightning-kmp-app's, which the fork does not touch. The vectors were computed by this tree; a diff against `4e106fb5` shows that the files holding the tags differ only in packages, imports, comments and the database's type name |
## What carries the name today
Counted at `4e106fb5`, outside the submodule: