Merge branch 'claude/submodule-update-bitcoin-kmp-5aa639' into giza
This commit is contained in:
commit
4ac6f24059
3 files changed
+437
-1
No files matched your search
@@ -0,0 +1,105 @@
|
||||
package mobi.giza.compose
|
||||
|
||||
import fr.acinq.bitcoin.ByteVector
|
||||
import fr.acinq.bitcoin.ByteVector32
|
||||
import fr.acinq.bitcoin.Crypto
|
||||
import fr.acinq.bitcoin.PrivateKey
|
||||
import fr.acinq.bitcoin.crypto.confederation.Confederation
|
||||
import fr.acinq.bitcoin.crypto.confederation.ConfederationDkgOutput
|
||||
import fr.acinq.bitcoin.crypto.confederation.ConfederationRoleId
|
||||
import fr.acinq.bitcoin.crypto.confederation.ConfederationRoster
|
||||
import fr.acinq.bitcoin.crypto.confederation.ConfederationSignerSelection
|
||||
import fr.acinq.bitcoin.crypto.confederation.ConfederationTweak
|
||||
import fr.acinq.secp256k1.Hex
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
/**
|
||||
* That bitcoin-kmp's confederation API reaches Giza, and that the native library Giza loads has
|
||||
* the module in it (docs/confederation-submodule-update.md, Phase 4).
|
||||
*
|
||||
* A compile only proves the classes are on the classpath. A libsecp256k1 built from an older
|
||||
* secp256k1-zkp compiles just the same and fails at the first call, with an
|
||||
* UnsatisfiedLinkError -- here, rather than in whatever first needs a confederation.
|
||||
*
|
||||
* This is not a ceremony and nothing in the app calls it. [Confederation.dkgLocal] and
|
||||
* [Confederation.signLocal] run every role in one process, holding every host key and every
|
||||
* share: upstream's test harness, because the distributed rounds are not public at the pinned
|
||||
* native revision. The module is experimental and unaudited. Seeds are fixed so a failure
|
||||
* reproduces; a real caller would use fresh randomness.
|
||||
*/
|
||||
class ConfederationReachableJvmTest {
|
||||
|
||||
/** The "rpd" roster of bitcoin-kmp 0c34097's confederation/vectors.json: 2-of-(2-of-3), nine roles. */
|
||||
private val roster: ConfederationRoster = ConfederationRoster.fromData(
|
||||
ByteVector(
|
||||
Hex.decode(
|
||||
"""
|
||||
435250440000000100000000000000010000000000000001000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000020000000330ba64f9170cd7e6016549ab4473dfe9b79529c1a43b0a2428b18e8c0b027397
|
||||
0000000000000000000000010000000200000003000000003846c95d6a3be4a58e967cac9f00fc967cf4ec256eb13189
|
||||
bd3f48b2d2f282920222ca50390e660f601036dd7502bb973bdcd104b5dcb8f2e74de8edc6c292b03a00000001b477fa
|
||||
af5c8b288892943134b4231d034dcaaa63c607e7170b3bae0f07a19bfe02141481bf1181ed61aa025f1fe708f68cb018
|
||||
c2c9d6eb719ccd94b3f6ff61530800000002155964e6d8547e42ed7d0c2075244afd27193891e7c99e7a886799ca6752
|
||||
8c6803cfc18f02cc004640f2116fdd1f6ca2022e39be25df75e27c80bde842e6b6f93800000001000000000000000100
|
||||
00000200000003000000009c92cab2d63e63afb08ae7ff625dc6efc9268839a61782f15e498ec1140609a302dde3f965
|
||||
b67e7b28007619e4ac6efdebdab9b8e09b308c81cccef3bd1c31432c00000001a96960a7d148d5b5116ac89ef1255780
|
||||
f2a3eb860449084a3c7cb15a10f0c3e5023388bcc23425458e991f46ca6235c50a57490556becbaf259d3c14f99a80a0
|
||||
87000000026676fee565b3a3f7ef818ac3992247def729b18f954c419b7865160782e71ae9039f04c563cb1b1ab0a325
|
||||
e23cc2768a986d44de723aecaeb60e99b175efe26a060000000200000000000000010000000200000003000000007aa1
|
||||
7bba982198be36ceac68bbb124d5a83e8e6a2e8f63d5386fccb9a94abf1803d26bd0131b8c12de3dd8fefc136d9f9544
|
||||
ac963d4cbcbaa802ba941ef0b46a19000000019dadfeaa8750d16ae95ff7f9250cc43800291aa10ff8a552e798f9c2d4
|
||||
917ac0026a209f2385a83ebf8884aeb2c70949a496eeb1bc2354c62361f2f5a6c21f10ae00000002b5e114d8c490796d
|
||||
4fac253d6c4dd8652801d0a0fcf72799ff55c150b9e11c8203dcd3370cdb67e8f2163960edfef5f66b465a03d4d447f5
|
||||
ca1d99d29e57d1fdb9
|
||||
""".filterNot { it.isWhitespace() },
|
||||
),
|
||||
),
|
||||
).right!!
|
||||
|
||||
private fun seed(tag: Int, i: Int) = ByteVector32(ByteArray(32).also { it[0] = tag.toByte(); it[31] = (i + 1).toByte() })
|
||||
|
||||
/** The vectors' host keys, which the roster's host public keys are made from. */
|
||||
private val hostSecrets: Map<ConfederationRoleId, PrivateKey> =
|
||||
roster.roleIds.withIndex().associate { (i, id) -> id to PrivateKey(ByteArray(32).also { it[30] = 0x10; it[31] = (i + 1).toByte() }) }
|
||||
|
||||
private val dkg: ConfederationDkgOutput = Confederation.dkgLocal(
|
||||
roster,
|
||||
seed(0x5e, 0),
|
||||
hostSecrets,
|
||||
roster.roleIds.withIndex().associate { (i, id) -> id to seed(0xd0, i) },
|
||||
roster.roleIds.withIndex().associate { (i, id) -> id to seed(0x42, i) },
|
||||
).right!!
|
||||
|
||||
/** Groups 0 and 2, two admins of each: one of the smallest coalitions the roster accepts. */
|
||||
private val selection = ConfederationSignerSelection(mapOf(0u to setOf(0u, 2u), 2u to setOf(1u, 2u)))
|
||||
|
||||
@Test
|
||||
fun `the roster is the vectors' roster`() {
|
||||
assertEquals(ByteVector32("7cae865ba55ff2433a59cbc25795f6a2b968694daf2c8ecc8980e3ed584c4973"), roster.hash)
|
||||
assertEquals(9, roster.roleIds.size)
|
||||
assertEquals(9, dkg.shares.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `a confederation key signs and the signature verifies`() {
|
||||
val message = seed(0x99, 0)
|
||||
val sig = Confederation.signLocal(dkg.keyState, dkg.shares, hostSecrets, selection, emptyList(), seed(0x7a, 0), message).right!!
|
||||
assertTrue(Crypto.verifySignatureSchnorr(message, sig, dkg.keyState.publicKey))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `a taproot tweak signs for the P2TR output key and not the internal key`() {
|
||||
val internalKey = dkg.keyState.publicKey
|
||||
val tapTweak = Crypto.TaprootTweak.KeyPathTweak
|
||||
val message = seed(0x99, 1)
|
||||
val sig = Confederation.signLocal(
|
||||
dkg.keyState, dkg.shares, hostSecrets, selection,
|
||||
listOf(ConfederationTweak.taproot(internalKey, tapTweak)), seed(0x7a, 1), message,
|
||||
).right!!
|
||||
assertTrue(Crypto.verifySignatureSchnorr(message, sig, internalKey.outputKey(tapTweak).first))
|
||||
assertFalse(Crypto.verifySignatureSchnorr(message, sig, internalKey))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
# Submodule update: bringing bitcoin-kmp's confederation API up to Giza
|
||||
|
||||
On 2026-11-21, bitcoin-kmp `threshold` gained `fr.acinq.bitcoin.crypto.confederation`. Confederation
|
||||
is nested threshold keys: a roster of outer groups, each with its own inner threshold of admins,
|
||||
holds one BIP 340 key. The work below bitcoin-kmp is already done and pushed. secp256k1-kmp has the
|
||||
bindings, and secp256k1-zkp has the module. Nothing above bitcoin-kmp has moved. This plan carries
|
||||
that work up through lightning-kmp and lightning-kmp-app to Giza, so the API can be imported from
|
||||
`composeApp`.
|
||||
|
||||
It follows [submodule-refresh.md](./submodule-refresh.md), which set the procedure: a worktree with
|
||||
its own submodule checkout, a branch per level, pushes bottom up, and tracked branches
|
||||
fast-forwarded only once Giza is green. Read that first. This note covers only what is different
|
||||
this time.
|
||||
|
||||
Measured on 2026-11-21 after `git fetch --all` at every level, against Giza `d0437d6c`.
|
||||
|
||||
## Progress
|
||||
|
||||
| phase | result |
|
||||
|---|---|
|
||||
| 0 | done 2026-11-21. FROST, ChillDKG, enrollment, refresh, MuSig and schnorrsig sources identical between zkp `31ea015c` and `c68e2384`. Natives rebuilt from scratch for Linux and four Android ABIs, each exporting 30 `secp256k1_confederation_*` symbols. secp256k1-kmp `:tests:jvmTest` 125/125 (13 confederation); bitcoin-kmp `jvmTest` 293/293 (19 confederation, 51 FROST/ChillDKG). `connectedAndroidTest` **cannot build**: see below |
|
||||
| 1 | done. lightning-kmp `ab8d4760` on `claude/confederation`. `:lightning-kmp-core:jvmTest` `crypto` + `channel` 568/568, `iceberg` + `prefractal` 47/47 |
|
||||
| 2 | done. lightning-kmp-app `e6be5e5` on `claude/confederation`. `:library:compileKotlinJvm`, `:library:compileAndroidMain` |
|
||||
| 3 | done. Giza `4555f5d1`. `compileDebugKotlinAndroid`; `jvmTest` 1411/1411; `check` with the brand, M3, Magpie lock, Marmot and wallet audits all at 0. No app change |
|
||||
| 4 | done but for the device checks below. `ConfederationReachableJvmTest` 3/3 through the desktop JNI library Giza loads. Android: a debug build installed over the existing one on `Medium_Phone` (API 36, x86_64; its Room schema was 42, the same as this branch's) launches and loads `libsecp256k1-jni.so` with no crash or link error. That profile had no group, so **no group was signed in**. The Alice/Bob/Charlie emulators were left alone. Desktop run and iOS build not done. `libsecp256k1-jni.so` is now 1.6–2.0 MB per ABI; no pre-bump APK was at hand to compare |
|
||||
|
||||
**secp256k1-kmp's instrumented tests don't build, and this update didn't cause it.**
|
||||
`:tests:dexBuilderDebugAndroidTest` fails because D8 rejects the method name
|
||||
`` `the zkp vectors come out the same through the bindings` `` in `FrostRefreshTest`: names with
|
||||
spaces need DEX 040, i.e. a minSdk of 30. `-Pandroid.injected.build.api=36` doesn't get around
|
||||
it. The test came in with `0f5a710` (2026-11-19, FROST share refresh) and is already in `bcaa985`,
|
||||
which Giza pinned before this update. None of the confederation tests use spaced names. The
|
||||
fix is to rename the methods in `FrostRefreshTest`. That is a secp256k1-kmp commit, and the
|
||||
chain above it would have to be bumped again, so it is left for its own change.
|
||||
|
||||
This worktree does **not** use `git submodule update --init`. That would share, and repoint,
|
||||
the main checkout's `.git/modules`. Instead each level is an independent `git clone` of the
|
||||
main checkout's copy, with `origin` set back to the real remote and fetched. Giza records the
|
||||
gitlink from the nested repository's `HEAD` all the same.
|
||||
|
||||
## Where it stands
|
||||
|
||||
| level | repository | tracks | pinned by its parent | tip of tracked branch | gap |
|
||||
|---|---|---|---|---|---|
|
||||
| 0 | `giza-kmp` | `giza` | — | `d0437d6c` | — |
|
||||
| 1 | `kngako/lightning-kmp-app` | `master` | `d87af50` | `d87af50` | 0 |
|
||||
| 2 | `kngako/lightning-kmp` | `threshold` | `f8835338` | `f8835338` | 0 |
|
||||
| 3 | `kngako/bitcoin-kmp` | `threshold` | `0fd254b` (by `f8835338`) | `0c34097` | **3** |
|
||||
| 4 | `kngako/secp256k1-kmp` | `threshold` | `fce4d81` (by `0c34097`) / `bcaa985` (by `0fd254b`) | `fce4d81` | 0 from bitcoin-kmp's tip |
|
||||
| 5 | `frost/secp256k1-zkp` | **`frost`** (was `main`) | `c68e2384` (by `fce4d81`) | `c68e2384` | 0 |
|
||||
|
||||
The gap is one pointer: **lightning-kmp pins bitcoin-kmp at `0fd254b`, three commits behind
|
||||
`threshold`.** Every level above it inherits that gap. Every level below is already current.
|
||||
`0fd254b` is an ancestor of `0c34097`, so the update is a fast-forward and nothing has to be merged.
|
||||
|
||||
The three bitcoin-kmp commits:
|
||||
|
||||
| commit | what |
|
||||
|---|---|
|
||||
| `50c0e1c` | secp256k1-kmp `bcaa985` → `fce4d81`. No source change. The commit says the existing suites pass unchanged on jvm and linuxX64. |
|
||||
| `42d184d` | `Confederation`, `ConfederationRoster`, `ConfederationKeyState`, `ConfederationTransition`, `ConfederationShare`, `ConfederationRecoveryPackage`, `ConfederationOperation`, plus tests and vectors copied from secp256k1-kmp `fce4d81` |
|
||||
| `0c34097` | `ConfederationTweak.taproot` and `Confederation.signTaprootInputLocal`: BIP 341 key-path signing, tested end to end through the script interpreter |
|
||||
|
||||
Below them, secp256k1-kmp `bcaa985..fce4d81` adds seven commits: the zkp bump, the descriptors,
|
||||
transitions, shares and recovery, DKG and signing, hardening, and docs. zkp `31ea015c..c68e2384`
|
||||
adds 88 commits, the confederation module merged with `frost_refresh`.
|
||||
|
||||
## What arrives, and what it can and cannot do
|
||||
|
||||
**It is additive.** At every level the diff touches only confederation:
|
||||
|
||||
- bitcoin-kmp: six files, all under `crypto/confederation/`, plus the submodule pointer.
|
||||
- secp256k1-kmp: one line removed in `Secp256k1.kt`, plus the `.def` header lists. Everything else
|
||||
is added: JNI, Kotlin/Native and the `Secp256k1` interface. `-DSECP256K1_ENABLE_MODULE_CONFEDERATION=ON`
|
||||
joins `CMAKE_DEFAULT_OPTS` in `native/build.gradle.kts`.
|
||||
- zkp: outside `src/modules/confederation/`, `include/secp256k1_confederation.h`, tools, docs and
|
||||
examples, the only changes are build wiring, `src/secp256k1.c` (+4, the include), `src/tests.c`,
|
||||
`src/ctime_tests.c`, and a ChillDKG test in `src/modules/prefractal/tests_impl.h`. **No other
|
||||
header in `include/` changed, and neither did the FROST, ChillDKG, enrollment or refresh
|
||||
sources Giza signs with.**
|
||||
|
||||
**Giza can use it in tests, but not across devices.** The bitcoin-kmp KDoc is explicit on this:
|
||||
|
||||
- `Confederation.dkgLocal` and `signLocal` run *every role in one process*, holding every host
|
||||
secret key and every share. They are a simulation and test harness. "The round-by-round steps,
|
||||
and enrollment, refresh, masking and resharing, are not public at the pinned native revision."
|
||||
- The module is experimental research code, "not audited or stable", and "must not be used in
|
||||
production or to protect value". The recovery-package encryption is "a non-standard candidate
|
||||
construction that has not been reviewed".
|
||||
- Transport, sender authentication, durable attempt records, timeouts and atomic persistence are
|
||||
left to the application.
|
||||
|
||||
So after this update Giza can import the confederation types, build rosters and key states from
|
||||
their canonical encodings, and run a whole confederation in a test. It cannot yet run a
|
||||
confederation ceremony across members' devices. That has to wait until the distributed rounds are
|
||||
public, and it needs its own design document, as reduced enrollment did (submodule-refresh.md,
|
||||
Phase 6).
|
||||
|
||||
**zkp now tracks `frost`, not `main`.** secp256k1-kmp `fce4d81` changed its `.gitmodules` branch
|
||||
to `frost`. [submodule-refresh.md](./submodule-refresh.md) recorded that move as a decision *not*
|
||||
taken, because zkp's `frost` branch held the BIP 445 rewrite of the FROST signing module. It has
|
||||
now been taken upstream, as part of this work. At the pinned commits the FROST sources are
|
||||
byte-identical (Phase 0 re-checks this), so Giza's signing does not change. But from now on, any
|
||||
`git submodule update --remote` at that level follows `frost`. The next zkp bump is where a
|
||||
signing-module change could come in, and its plan has to check for it.
|
||||
|
||||
## Before starting
|
||||
|
||||
This worktree (`claude/submodule-update-bitcoin-kmp-5aa639`) has the submodule registered but not
|
||||
checked out. `lightning-kmp-app/` is empty.
|
||||
|
||||
1. **Shared `.git/modules`.** Linked worktrees share `.git/modules/` with the main checkout
|
||||
([jvm-target.md](./jvm-target.md)). The main checkout currently has every level on a
|
||||
`claude/dependency-update` branch, except zkp, which is detached at
|
||||
`origin/claude/frost-share-refresh`. All five are clean. Record
|
||||
`git submodule status --recursive` in the main checkout before you start. Restore it at the
|
||||
end, or say in the PR that it moved.
|
||||
2. **Concurrent work.** bitcoin-kmp's three commits landed at 19:36–19:42 today. Another session
|
||||
may still be working at the bitcoin-kmp or secp256k1-kmp level. Re-fetch before each push, and
|
||||
confirm that `threshold` at bitcoin-kmp is still `0c34097`. If it has moved, pin the new tip
|
||||
only after reading what it adds.
|
||||
3. Check out the chain and the SDK paths:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Then add `local.properties` at all five Gradle roots, using the loop in the root `README.md`.
|
||||
4. **Branch per level.** Name the branches `claude/confederation` at lightning-kmp (from
|
||||
`threshold`) and at lightning-kmp-app (from `master`). Giza's branch is this worktree's.
|
||||
bitcoin-kmp, secp256k1-kmp and zkp need no branch, because nothing is committed there.
|
||||
|
||||
## Phase 0: confirm the bottom of the chain
|
||||
|
||||
No commit. Prove that what lightning-kmp is about to pin builds and passes, before stacking on it.
|
||||
|
||||
1. In `…/bitcoin-kmp`, check out `0c34097` and run `git submodule update --recursive`. Confirm that
|
||||
secp256k1-kmp is at `fce4d81` and zkp at `c68e2384`.
|
||||
2. Confirm that the FROST signing module did not change under the tracking-branch move. Each of
|
||||
these should print nothing:
|
||||
|
||||
```bash
|
||||
git -C …/native/secp256k1 diff --stat 31ea015c c68e2384 -- src/modules/frost src/modules/chilldkg src/modules/frost_enrollment src/modules/frost_refresh src/modules/musig include/secp256k1_frost.h include/secp256k1_chilldkg.h include/secp256k1_frost_enrollment.h include/secp256k1_frost_refresh.h
|
||||
```
|
||||
|
||||
3. **Rebuild the natives.** The main checkout's `native/build/linux/libsecp256k1.a` is dated
|
||||
2026-11-20, before confederation. `native/build.gradle.kts` declares the submodule sources and
|
||||
CMake flags as inputs, so Gradle *should* rebuild. Don't rely on that: delete `native/build/`,
|
||||
rebuild Linux and Android, then confirm the symbols are there:
|
||||
|
||||
```bash
|
||||
nm native/build/linux/libsecp256k1.a | grep -c secp256k1_confederation_
|
||||
```
|
||||
|
||||
A stale library shows up later as an `UnsatisfiedLinkError` on the first confederation call. It
|
||||
does not show up at compile time.
|
||||
4. In secp256k1-kmp, run `:tests:jvmTest`. Pay most attention to `ConfederationTest`,
|
||||
`ConfederationVectorsTest`, `ConfederationTransitionTest` and `ConfederationRecoveryTest`, and
|
||||
to the existing FROST, ChillDKG, enrollment and refresh suites, which must pass unchanged.
|
||||
5. In bitcoin-kmp, run `./gradlew jvmTest`, focusing on `ConfederationTestsCommon`,
|
||||
`ConfederationTaprootTestsCommon` and everything under `crypto/frost/` and `crypto/dkg/`.
|
||||
6. If an emulator is available, run secp256k1-kmp `:tests:connectedAndroidTest`. The JNI glue grew
|
||||
by 828 lines of C (`fr_acinq_secp256k1_Secp256k1CFunctions.c`), and a marshalling mistake would
|
||||
hide there.
|
||||
|
||||
**Done when** both JVM suites pass against natives built from `c68e2384`, and the FROST diff above
|
||||
is empty.
|
||||
|
||||
If the FROST diff is *not* empty, stop. The update then changes how Giza signs, and that needs its
|
||||
own plan.
|
||||
|
||||
## Phase 1: lightning-kmp, bump bitcoin-kmp
|
||||
|
||||
One commit on lightning-kmp `claude/confederation`, from `threshold` (`f8835338`), moving
|
||||
`experimental/bitcoin-kmp` from `0fd254b` to `0c34097`:
|
||||
|
||||
```
|
||||
Bump bitcoin-kmp: confederation
|
||||
|
||||
0fd254b -> 0c34097: the Confederation API and taproot key-path signing
|
||||
over secp256k1-kmp fce4d81 / secp256k1-zkp c68e2384. Additive; zkp now
|
||||
tracks its `frost` branch.
|
||||
```
|
||||
|
||||
lightning-kmp calls no confederation code. The check is that it still compiles and that its FROST
|
||||
and crypto tests pass against the new natives:
|
||||
|
||||
- `:lightning-kmp-core:compileKotlinJvm`
|
||||
- `:lightning-kmp-core:jvmTest`, at least the `crypto` and `channel` packages. The full suite is
|
||||
long. `ElectrumClientTest` "get headers" times out against a live server and did so before this
|
||||
work (submodule-refresh.md), so don't count it as a regression.
|
||||
|
||||
**Done when** those pass.
|
||||
|
||||
## Phase 2: lightning-kmp-app, bump lightning-kmp
|
||||
|
||||
One commit on lightning-kmp-app `claude/confederation`, from `master` (`d87af50`), moving
|
||||
`experimental/lightning-kmp` from `f8835338` to the Phase 1 commit:
|
||||
|
||||
```
|
||||
Bump lightning-kmp: confederation down the chain
|
||||
```
|
||||
|
||||
Checks:
|
||||
|
||||
- `:library:compileKotlinJvm`
|
||||
- `:library:compileAndroidMain`
|
||||
|
||||
**Done when** both compile.
|
||||
|
||||
## Phase 3: Giza, bump lightning-kmp-app
|
||||
|
||||
One commit on this branch, moving `lightning-kmp-app` from `d87af50` to the Phase 2 commit. It
|
||||
follows the subject style of `c8a529a1`:
|
||||
|
||||
```
|
||||
build: lightning-kmp-app with bitcoin-kmp's confederation down the chain
|
||||
```
|
||||
|
||||
No change to `composeApp/build.gradle.kts` is expected:
|
||||
|
||||
- The composite substitution in `settings.gradle.kts` is unchanged.
|
||||
- secp256k1-kmp still says `0.24.0` at `fce4d81`, so the
|
||||
`secp256k1-kmp-jni-android:0.24.0` line still resolves to `:jni:android` from source.
|
||||
- Nothing new arrives between `d87af50` and the Phase 2 commit except the bump. Unlike the last
|
||||
refresh, no unrelated wallet commits come along.
|
||||
|
||||
Checks, cheapest failure first:
|
||||
|
||||
```bash
|
||||
./gradlew :composeApp:compileDebugKotlinAndroid :composeApp:jvmTest
|
||||
```
|
||||
|
||||
```bash
|
||||
./gradlew check
|
||||
```
|
||||
|
||||
`check` runs the M3, brand and wallet audits. The bump touches none of the files they scan, and
|
||||
`wallet-audit.sh` reads Giza's own code rather than the submodule. They should pass untouched. Of
|
||||
the JVM tests, these exercise the rebuilt natives:
|
||||
|
||||
- `ForkCompatibilityTest`. Its npub, profile id and host key must not move.
|
||||
- `FrostSigningRoundTest`, `SharedKeyDerivationTest`, and the ceremony suites:
|
||||
`CeremonyAcrossDevicesJvmTest`, `RobustRoomKeyCeremonyTest`,
|
||||
`SubgroupCeremonyInParentRoomTest`, and `FrostSigning*JvmTest`.
|
||||
- `ChillDkgRitualManager` and `ShareRefreshManager` through their tests. Both import
|
||||
`ChilldkgFault` from secp256k1-kmp, whose enum did not change.
|
||||
|
||||
**Done when** both commands pass with no app change.
|
||||
|
||||
## Phase 4: prove Giza can reach it (recommended)
|
||||
|
||||
A bump that compiles proves the classes are on the classpath. It does not prove the native library
|
||||
Giza loads has the confederation symbols in it. Add one JVM test in `composeApp/src/jvmTest`,
|
||||
`ConfederationReachableJvmTest`, that:
|
||||
|
||||
- parses the `rpd` roster from bitcoin-kmp's `confederation/vectors.json`, inlined as hex with a
|
||||
comment naming bitcoin-kmp `0c34097`, and checks its hash against the vectors' `rpd_hash`;
|
||||
- runs `Confederation.dkgLocal` and `signLocal` once, and verifies the signature with
|
||||
`Crypto.verifySignatureSchnorr`;
|
||||
- signs under `ConfederationTweak.taproot` and checks the signature against the P2TR output key,
|
||||
and not against the internal key. It does not build or spend a transaction: Giza keeps no
|
||||
wallet, and bitcoin-kmp's own `ConfederationTaprootTestsCommon` already covers the spend.
|
||||
|
||||
It is a test, not a feature. Nothing in `commonMain` imports `crypto.confederation`, and the
|
||||
test's KDoc repeats upstream's single-process warning, so nobody reads it as a ceremony.
|
||||
|
||||
Then the checks this tree cannot fully run:
|
||||
|
||||
- **An Android debug build installed over the current one.** Open an existing profile and sign in
|
||||
a group. This is the only check that exercises the rebuilt Android JNI `.so` inside the app. Note
|
||||
the APK size before and after, because the native library gains a whole module.
|
||||
- **A desktop run** (`jvm` target) doing the same.
|
||||
- **An iOS build on a Mac**, where cinterop regenerates from the new header list. This can't be
|
||||
done on Linux. Until it is done, say so in the PR.
|
||||
|
||||
**Done when** the test passes on JVM, and the device checks pass or are listed in the PR as not
|
||||
done.
|
||||
|
||||
## Phase 5: land, bottom up
|
||||
|
||||
Only once Phases 3 and 4 are green:
|
||||
|
||||
1. Re-fetch. Confirm that bitcoin-kmp `threshold` is still `0c34097` and that nobody has advanced
|
||||
lightning-kmp `threshold` or lightning-kmp-app `master` in the meantime. If they have, rebase the
|
||||
bump onto the new tip and repeat that phase's checks.
|
||||
2. Push lightning-kmp `claude/confederation`. Fast-forward `threshold` to it and push.
|
||||
3. Push lightning-kmp-app `claude/confederation`. Fast-forward `master` to it and push.
|
||||
4. Push Giza's branch and open the PR against `giza`. In the PR, list the device checks not made,
|
||||
and note that zkp now tracks `frost`.
|
||||
|
||||
Fast-forward rather than merge. A fast-forward makes no new commit, so the pointers committed in
|
||||
Phases 1–3 stay valid. A merge commit would mean redoing every bump above it. A parent may only pin
|
||||
a commit that exists on the child's remote, so each child is pushed before its parent.
|
||||
|
||||
Still open from the last refresh: lightning-kmp-app has **no tags**, so JitPack consumers can't
|
||||
resolve it by version. If a tagging scheme gets chosen, tag the fast-forwarded `master` here.
|
||||
|
||||
## Phase 6: Giza uses confederation (not part of this update)
|
||||
|
||||
Nothing in Giza is a confederation today. The obvious use is a subgroup structure in which a parent
|
||||
room's key is held by its subgroups ([subgroups.md](./subgroups.md)). Building it is a feature and
|
||||
needs its own document in the manner of [shared-key-ceremony.md](./shared-key-ceremony.md), and it
|
||||
is blocked on upstream:
|
||||
|
||||
- The distributed DKG and signing rounds must be public in zkp, and wrapped in bitcoin-kmp, before
|
||||
Giza can run either over Marmot. `dkgLocal` and `signLocal` cannot be the basis of a ceremony.
|
||||
- The roster's entity attestation, the transition certificate's "authorization, not consensus",
|
||||
and the per-epoch exposure of a compromised host key are all left to the application. Each needs
|
||||
a decision in that document.
|
||||
- It should not ship to users while upstream calls the module experimental. Like share refresh, it
|
||||
would be built behind a flag that is off in release.
|
||||
|
||||
## Afterwards
|
||||
|
||||
[giza-wallet-removal.md](./giza-wallet-removal.md) Phase 7b plans to make bitcoin-kmp Giza's own
|
||||
submodule and drop lightning-kmp-app. It has not been built. If it lands, this chain shortens to
|
||||
three levels and Phases 1–3 collapse into one bump. The two don't conflict: do this update now,
|
||||
and 7b starts from a bitcoin-kmp that already has confederation.
|
||||
|
||||
## Summary
|
||||
|
||||
| phase | where | commit | done when |
|
||||
|---|---|---|---|
|
||||
| 0 | secp256k1-kmp, bitcoin-kmp | none | natives rebuilt from `c68e2384`; both JVM suites pass; FROST sources unchanged |
|
||||
| 1 | lightning-kmp | bump bitcoin-kmp `0fd254b` → `0c34097` | compiles; `crypto` and `channel` tests pass |
|
||||
| 2 | lightning-kmp-app | bump lightning-kmp `f8835338` → Phase 1 | `:library` compiles for JVM and Android |
|
||||
| 3 | Giza | bump `lightning-kmp-app` `d87af50` → Phase 2 | `compileDebugKotlinAndroid`, `jvmTest`, `check`, with no app change |
|
||||
| 4 | Giza | `ConfederationReachableJvmTest` | test passes; Android and desktop on device; iOS noted |
|
||||
| 5 | all | fast-forward `threshold` / `master`, push bottom up | Giza PR open |
|
||||
| 6 | Giza | — | separate design document, after upstream publishes the distributed rounds |
|
||||
+1
-1
Submodule lightning-kmp-app updated: d87af507de...e6be5e5949.
Reference in new issue
Block a user