fix(frost): a broadcast that queued nothing records nothing
`broadcast` now says whether it queued anything, and `publishOwn` records the local copy only when it did. The copy is what stops `advance` from publishing that message again, so writing one for a message that never went out is a message the group waits on forever -- the exact opposite of the trade the queue-then-record order exists to make. The comment on `publishOwn` had that trade written down in one direction only. Reachable only through the id-collision guard added with the resend, which refuses after four tries rather than overwriting a sent row. Four consecutive seconds of the same message is not something a person with a button can do, but "unreachable" and "safe when reached" are different claims. Also brings the docs up to what was built: the resend note is in the index, the skipped-keys note points at it as the recovery for the failure it describes -- a new message is encrypted at a generation the receiver has not passed, which is the whole mechanism -- and the plan records the two things landing it turned up, plus `ask_again` being reused from the catalogue rather than duplicated. 1279 tests, no failures. m3Audit: all budgets met. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e0f20b2b63
commit
2edd05f3ca
4 files changed
+61
-6
No files matched your search
@@ -2312,6 +2312,10 @@ object FrostSigningManager {
|
||||
* has no local copy of. A crash between the two therefore costs a duplicate
|
||||
* broadcast — which every receiver folds away — rather than a message the
|
||||
* group waits on forever.
|
||||
*
|
||||
* Which cuts both ways, so a [broadcast] that queued nothing records
|
||||
* nothing: the local copy is the thing that stops the next pass from trying
|
||||
* again.
|
||||
*/
|
||||
private suspend fun publishOwn(
|
||||
database: CurareDatabase,
|
||||
@@ -2320,7 +2324,11 @@ object FrostSigningManager {
|
||||
kind: Kind,
|
||||
content: String
|
||||
) {
|
||||
broadcast(database, localChatRoom, session, kind, content)
|
||||
// Nothing is recorded if nothing was queued. The local copy is what stops
|
||||
// [advance] from publishing this again, so writing one for a message that
|
||||
// did not go out would be a message the group waits on forever -- the
|
||||
// opposite of the trade this order is for.
|
||||
if (!broadcast(database, localChatRoom, session, kind, content)) return
|
||||
|
||||
val known = ownMessage(database, session, kind) != null
|
||||
|
||||
@@ -2369,7 +2377,7 @@ object FrostSigningManager {
|
||||
signerIds: List<Int>? = null,
|
||||
silentMembers: List<HexKey>? = null,
|
||||
recipients: Set<HexKey>? = null
|
||||
) {
|
||||
): Boolean {
|
||||
val sessionTags = FrostSigningEvents.assembleTags(
|
||||
sessionId = session.id,
|
||||
dkgSessionId = if (includeKey) session.dkgSessionId else null,
|
||||
@@ -2432,7 +2440,7 @@ object FrostSigningManager {
|
||||
"Session ${session.id}: kind $kind already queued at every second tried; " +
|
||||
"not publishing it again"
|
||||
)
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
if (isMarmotRoom) {
|
||||
@@ -2460,6 +2468,8 @@ object FrostSigningManager {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/** Whether this id is already an outbound row on the room's transport. */
|
||||
|
||||
Reference in new issue
Block a user