test: pin the coordinator's part in a confederation (confederation-without-coordinator, Phase 1)
An opening from anyone but the coordinator is refused, and every device waits on the coordinator's broadcast. Phase 7 flips both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b2f22f2cd4
commit
e2de3fa80c
2 files changed
+35
No files matched your search
+27
@@ -335,6 +335,33 @@ class ConfederationCeremonyJvmTest {
|
||||
ceremonies(opened.id).values.forEach { assertEquals(ConfederationCeremonyStage.COMPLETE, it?.stage, it?.failureReason) }
|
||||
}
|
||||
|
||||
// ---- pinned before the coordinator goes (docs/confederation-without-coordinator.md, Phase 1)
|
||||
|
||||
@Test
|
||||
fun `today an opening sent by anyone but the coordinator is refused`() {
|
||||
val (host, proposalId) = network(listOf(listOf(11, 12, 13), listOf(21, 22, 23), listOf(31, 32, 33)))
|
||||
val opened = open(host, proposalId)
|
||||
val impostor = npub(secret(21))
|
||||
pump { payload -> if (payload.kind == ConfederationRitualEvents.OPENING) payload.copy(publicKey = impostor) else payload }
|
||||
ceremonies(opened.id).filterKeys { it != host.person && it != impostor }.values.forEach {
|
||||
assertEquals(ConfederationCeremonyStage.FAILED, it?.stage)
|
||||
assertTrue(it!!.failureReason!!.contains("someone other than the proposal's coordinator"), it.failureReason)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `today every device waits on the coordinator's broadcast`() {
|
||||
val (host, proposalId) = network(listOf(listOf(11, 12, 13), listOf(21, 22, 23), listOf(31, 32, 33)))
|
||||
val opened = open(host, proposalId)
|
||||
pump()
|
||||
joinAll(opened.id)
|
||||
// The broadcast never arrives: it is turned into a kind nobody reads.
|
||||
pump { payload -> if (payload.kind == ConfederationRitualEvents.BROADCAST) payload.copy(kind = 30386) else payload }
|
||||
ceremonies(opened.id).filterKeys { it != host.person }.values.forEach {
|
||||
assertEquals(ConfederationCeremonyStage.DEALING, it?.stage, "every dealing is in, and still nobody moves")
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Phase 13: the confederation's room ----------------------------------------------
|
||||
|
||||
private fun formed(): Pair<Device, mobi.giza.compose.database.model.Confederation> {
|
||||
|
||||
@@ -495,6 +495,14 @@ This document and its row in [README.md](./README.md). Then, before code:
|
||||
- a ceremony waits on the coordinator's 30383 (Phase 7 flips it);
|
||||
- only the coordinator's device makes the confederation's room (Phase 8 flips it).
|
||||
|
||||
**Done.** Two of the four were pinned already: `ConfederationNetworkJvmTest`'s "the coordinator's
|
||||
device says what forming it would take, and nobody else's says anything" (`outcome` is null on
|
||||
every other device) and `ConfederationCeremonyJvmTest`'s "a member's key package missing holds the
|
||||
room back, and nobody else's device makes it". The other two are new tests in
|
||||
`ConfederationCeremonyJvmTest` rather than a file of their own, since they need its devices:
|
||||
"today an opening sent by anyone but the coordinator is refused" and "today every device waits on
|
||||
the coordinator's broadcast".
|
||||
|
||||
### Phase 2: the wire, and the storage
|
||||
|
||||
`K/nostr/confederation/`:
|
||||
|
||||
Reference in new issue
Block a user