fix(marmot): align MIP compliance tests with held-back v2 and signed commits
Two drifts surfaced as 7 failing tests on the jvmTest run:
1. MarmotGroupData CURRENT_VERSION is held at 2 for mdk-core interop
(see the const-doc block), but three tests still assumed v3:
- marmotGroupData_defaultVersionIsThree asserted the constant directly.
- marmotGroupData_roundTripWithDisappearingSecs and
buildGroupEvent_appendsExpirationTagWhenDisappearingConfigured relied
on the default version emitting the v3-only disappearing_message_secs
field, which the encoder correctly skips for v2.
Rename the first to `currentVersionIsHeldAtTwoForMdkInterop` with a
spec-cross-reference comment and an extra assertion that v3 is still
in SUPPORTED_VERSIONS. Pin version=3 explicitly in the other two so
they exercise the v3 path regardless of the interop hold-back.
2. MlsGroup.processCommit now requires a non-empty FramedContentTBS
signature on non-external commits (per RFC 9420 §6.1, introduced in
0c970945). Four pipeline tests still called the raw processCommit
overload with signature=ByteArray(0), so they all failed with
"FramedContentTBS signature missing on commit from leaf 0".
Add a `processFramedCommit` wrapper on MlsGroupManager that mirrors
MlsGroup.processFramedCommit + the retention/persistence bookkeeping
from processCommit, and switch the four tests to feed framedCommitBytes
through it. MarmotInboundProcessor is unaffected (it already has the
decoded PublicMessage fields).
All 7 originally-failing Marmot tests now pass; the 4 unrelated
NostrClient network tests remain independently flaky.
https://claude.ai/code/session_01XQNAmwn1y87GAoK94QWgyn
This commit is contained in:
+16
-2
@@ -60,8 +60,17 @@ class MarmotMipComplianceTest {
|
||||
// ---------------------------------------------------------------------- MIP-01
|
||||
|
||||
@Test
|
||||
fun marmotGroupData_defaultVersionIsThree() {
|
||||
assertEquals(3, MarmotGroupData.CURRENT_VERSION)
|
||||
fun marmotGroupData_currentVersionIsHeldAtTwoForMdkInterop() {
|
||||
// MIP-01 spec targets v3, but mdk-core (whitenoise-rs' MLS engine)
|
||||
// rejects v3 NostrGroupData payloads with `ExtensionFormatError`
|
||||
// ("Trailing bytes in NostrGroupDataExtension"), violating the spec's
|
||||
// forward-compat rule. Until mdk-core ships the fix, Amethyst holds
|
||||
// CURRENT_VERSION at 2 for cross-client interop; v3 stays parseable
|
||||
// (see disappearing_message_secs round-trip test below). Bump this
|
||||
// assertion back to 3 in lockstep with the MarmotGroupData constant
|
||||
// once mdk publishes the parser fix.
|
||||
assertEquals(2, MarmotGroupData.CURRENT_VERSION)
|
||||
assertTrue(3 in MarmotGroupData.SUPPORTED_VERSIONS, "v3 MUST remain parseable for forward compat")
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -89,8 +98,13 @@ class MarmotMipComplianceTest {
|
||||
|
||||
@Test
|
||||
fun marmotGroupData_roundTripWithDisappearingSecs() {
|
||||
// disappearing_message_secs is a v3+ field. CURRENT_VERSION is held
|
||||
// at 2 for MDK interop (see marmotGroupData_currentVersionIsHeldAtTwoForMdkInterop),
|
||||
// so this test pins v3 explicitly to exercise the v3 encoder/decoder
|
||||
// path end-to-end.
|
||||
val original =
|
||||
MarmotGroupData(
|
||||
version = 3,
|
||||
nostrGroupId = groupId32,
|
||||
adminPubkeys = listOf(adminPubkey),
|
||||
relays = listOf("wss://relay.example/"),
|
||||
|
||||
Reference in New Issue
Block a user