Skip to content

docs: research branch for decentralized consistency analysis#59

Closed
gzuuus wants to merge 4 commits intomarmot-protocol:masterfrom
gzuuus:docs/consistency-analysis
Closed

docs: research branch for decentralized consistency analysis#59
gzuuus wants to merge 4 commits intomarmot-protocol:masterfrom
gzuuus:docs/consistency-analysis

Conversation

@gzuuus
Copy link
Copy Markdown
Contributor

@gzuuus gzuuus commented Mar 13, 2026

Summary by CodeRabbit

  • New Features

    • Staged activation with bounded pre-send and post-join sync; post-join self-update now awaits sync.
    • Enhanced Welcome envelope: two-layer delivery, optional epoch/commit hints, and epoch-consistency checks; expanded join failure/quarantine and recovery behavior.
    • Commit-sending rules: pre-commit freshness requirement, deferral under uncertainty, initial-commit exception, deterministic multi-commit tie-breaker, and send restrictions while uncertain.
  • Documentation

    • Expanded threat model, failure modes, recovery guidance, and a new decentralized consistency analysis with operational recommendations.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 13, 2026

Walkthrough

Adds staged activation, bounded catch-up, and uncertainty/quarantine semantics for joins and commits; distinguishes Welcome transport wrapper from inner rumor and exposes optional epoch/diagnostic hints; reframes Commit handling as a convergence problem; adds a decentralized consistency analysis doc and expands the threat model with join/tree failure modes.

Changes

Cohort / File(s) Summary
Welcome / Activation Spec
02.md
Replaces single-step join with multi-step activation (PendingJoin / StateUncertain / Quarantined). Defines outer transport wrapper (kind:1059) vs inner unsigned Welcome rumor, optional ea epoch tag and private parent-commit hint, Welcome parsing, epoch-consistency checks, bounded best-effort post-join sync, revised self-update timing, and failure/recovery behaviors.
Commit & Message Processing
03.md, semantic_update_tag
Treats Commits as convergence+crypto operations. Adds pre-Commit bounded freshness sync (relays/unseen kind:445), defers structural Commits when state is uncertain, sender workflow changes (relay ack → optional Welcome send; optional private parent-commit hint), multi-commit resolution priority, and quarantine/recovery rules.
Decentralized Consistency Analysis (new)
decentralized_consistency_analysis.md
New non-normative research/design document: frames cryptographic validity vs convergence, catalogs join failure causes, recommends post-join hygiene, freshness checks, drift containment, epoch_authenticator guidance, and relay/operator discipline.
Threat Model Updates
threat_model.md
Adds T.7.8–T.7.10 covering Pending Join Activation from stale branches, Welcome branch ambiguity, and Divergent Ratchet Tree poisoning; updates T.7.4 with bounded post-join processing guidance and diagnostic treatment of private hints.
Metadata / Manifest & Line Deltas
manifest, semantic_update_tag
Updated manifest/metadata lines and semantic-update tagging to record added/modified docs and changed line counts (+/-).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: it is a research document and analysis focused on decentralized consistency for Marmot, explicitly framed as exploratory work on handling divergence and drift risks from Nostr's weakly-ordered dissemination.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@erskingardner erskingardner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I agree that we could more strongly word the point about commit hygiene when joining a group or coming online after a period of inactivity but I HATE the idea of creating a protocol defined state machine for this. It's way way too prescriptive and YAGNI.

The issue that caused this in the first place was that MDK was not paying close enough attention to the fact that when you joined a group in Epoch N, there might be more commits waiting for you already that you would need to process BEFORE you created your self-update commit. That was poor design and caused all clients using MDK to do dumb things.

We can solve this by simply being more clear about that - and making sure that MDK and marmot-ts are doing it the right way.

Comment thread decentralized_consistency_analysis.md Outdated
Comment thread decentralized_consistency_analysis.md Outdated
Comment thread decentralized_consistency_analysis.md Outdated
Comment thread decentralized_consistency_analysis.md Outdated
- Simplify welcome processing by removing mandatory parent commit binding
- Replace PendingJoin/StateUncertain states with simpler "bounded best-effort sync" guidance
- Add epoch_authenticator as optional confirmation signal for Welcome-epoch consistency
- Update threat model to reflect new sync-before-send discipline
- Clarify that parent commit hints in Welcome rumors are diagnostic only
@gzuuus
Copy link
Copy Markdown
Contributor Author

gzuuus commented Mar 15, 2026

Hey! Yes, I agree that the state machine approach was too prescriptive to be a protocol level requirement. I added it as a way to have a clearer mental model for dealing with drift or divergence, but you are right, that's not the best approach. Instead, we can have a clearer post welcome guidance or checks.

I've updated the research document and materialization in the MIPS attaching your comments. Beyond that, I don't think we should overlook this. It is true that this research was motivated by the bug in MDK that was aggressively self updating, but it also highlighted that, in real world scenarios, these kinds of divergences can occur, especially since Nostr relays function as an unordered dissemination layer, and we expect Marmot to be interoperable across different clients and implementations.

I think there's value in finding the right balance in the spec so we do not overstate the challenges of making MLS workable over Nostr, which presents huge challenges, especially for mobile clients, multiple implementations, and large groups. That said, I've updated the research document and removed weaker details and prescriptions. I also discovered the epoch_authenticator concept and added it as a cheap way to detect drift or forks for new members.

I would love to keep discussing this, and get your feedback. But remember, this is ongoing research and not something I am proposing as an addition to the protocol yet, at least until we find the right balance. Once we reach that point, we can finalize its addition to the spec

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
03.md (1)

166-169: ⚠️ Potential issue | 🟠 Major

Clarify normative precedence for the initial-commit relay exception.

Line 166 introduces a new exception that can conflict with existing “Commit events must be published” wording in MIP-01. Please explicitly state that this section supersedes that rule for initial single-member group creation, or add an explicit cross-reference note in both specs to avoid implementer divergence.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@03.md` around lines 166 - 169, State explicitly that the "Exception - Initial
Group Creation" section supersedes the MIP-01 rule "Commit events must be
published" for the specific case of initial single-member group creation: add a
sentence like "For initial single-member group creation, this exception
supersedes the MIP-01 requirement that commit events must be published." Also
add reciprocal cross-reference notes: in MIP-01 add a parenthetical pointer to
the "Exception - Initial Group Creation" explaining the narrow exception, and in
the current section reference MIP-01 by name to avoid implementer divergence
(mention the section title "Exception - Initial Group Creation" and the rule
"Commit events must be published" to locate the text).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@02.md`:
- Around line 60-62: Example uses non-normative tags "commit" and "epoch" while
the spec only defines "ea"; update the canonical example to either remove
"commit" and "epoch" or add normative definitions: if removing, delete
["commit", ...] and ["epoch", ...] from the example entries; if defining, add
normative semantics for "commit" and "epoch" similar to "ea" (specify their
expected token formats, whether they are single-valued or repeatable, how to
parse/validate them, and how clients should treat unknown/unsupported values)
and update parsing instructions to include handling in the same section that
defines "ea". Ensure you update all occurrences (lines around the examples at
the three noted ranges) and reference the tags "commit", "epoch", and existing
"ea" when making the change.

---

Outside diff comments:
In `@03.md`:
- Around line 166-169: State explicitly that the "Exception - Initial Group
Creation" section supersedes the MIP-01 rule "Commit events must be published"
for the specific case of initial single-member group creation: add a sentence
like "For initial single-member group creation, this exception supersedes the
MIP-01 requirement that commit events must be published." Also add reciprocal
cross-reference notes: in MIP-01 add a parenthetical pointer to the "Exception -
Initial Group Creation" explaining the narrow exception, and in the current
section reference MIP-01 by name to avoid implementer divergence (mention the
section title "Exception - Initial Group Creation" and the rule "Commit events
must be published" to locate the text).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c697d1f-fa38-4b02-a843-72b4f33a2335

📥 Commits

Reviewing files that changed from the base of the PR and between a585b49 and ad543ad.

📒 Files selected for processing (4)
  • 02.md
  • 03.md
  • decentralized_consistency_analysis.md
  • threat_model.md

Comment thread 02.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
02.md (1)

222-223: ⚠️ Potential issue | 🟠 Major

Avoid reintroducing undefined epoch metadata in the summary.

Line 222 mentions optional metadata “such as epoch,” but this file only normatively defines ea. This reopens ambiguity around epoch handling semantics. Either remove epoch here or add explicit parsing/validation semantics in the optional-fields section.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@02.md` around lines 222 - 223, The mention of "epoch" in the optional private
hints line reintroduces an undefined metadata field; either delete "epoch" from
that sentence or add a normative definition and validation rules for it in the
optional-fields section so it matches the existing `ea` (epoch_authenticator)
semantics; if you choose to define it, specify its exact name (`epoch`), type,
allowed range/format, parsing rules, and how it interacts with
`epoch_authenticator` (`ea`) and update any references to use the same
terminology to avoid ambiguity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@02.md`:
- Around line 45-48: Add a formatted security note to 02.md that follows the
repo's `{00..04}.md` style: include an explicit "Security note" section with ✅
(protections) and ⚠️ (limitations) markers, reference threat_model.md for
metadata-observability context, and clearly state observable metadata and
privacy limitations for Welcome delivery (mention outer kind: 1059 gift-wrap is
only a transport wrapper and the actual payload is in the inner unsigned rumor
event); also call out that clients SHOULD NOT place parent Commit references or
branch-linking metadata on the outer kind: 1059 event and summarize what minimal
routing metadata (e.g., recipient p tag) is exposed.
- Around line 145-146: The current wording in the "After successfully processing
a Welcome message..." paragraph is stricter than MIP-03; change the sentence to
match MIP-03's normative strength by making the self-update a SHOULD for
catch-up (i.e., clients SHOULD attempt a self-update/MLS Update proposal for
their own LeafNode after welcome processing) but allow the fallback behavior
under timeout/partial visibility described in MIP-03 (so implementers may
proceed if the bounded best-effort sync does not complete in time); apply the
same harmonization to the corresponding text in the later paragraph referenced
(lines 161-166) so both places use the same SHOULD-level guidance and explicit
fallback language.

---

Duplicate comments:
In `@02.md`:
- Around line 222-223: The mention of "epoch" in the optional private hints line
reintroduces an undefined metadata field; either delete "epoch" from that
sentence or add a normative definition and validation rules for it in the
optional-fields section so it matches the existing `ea` (epoch_authenticator)
semantics; if you choose to define it, specify its exact name (`epoch`), type,
allowed range/format, parsing rules, and how it interacts with
`epoch_authenticator` (`ea`) and update any references to use the same
terminology to avoid ambiguity.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 968ada5c-8721-4edf-8c72-acb960f794eb

📥 Commits

Reviewing files that changed from the base of the PR and between ad543ad and 6da4a5d.

📒 Files selected for processing (1)
  • 02.md

Comment thread 02.md
Comment on lines +45 to +48
Welcome delivery uses [NIP-59](https://github.com/nostr-protocol/nips/blob/master/59.md) gift-wrapping for privacy and unlinkability. In Marmot, the outer `kind: 1059` gift-wrap is only a transport wrapper. The actual application-defined Welcome payload is carried in the inner unsigned rumor event.

The outer gift-wrap SHOULD reveal only the minimum metadata required for routing, typically the recipient `p` tag. Clients SHOULD NOT place parent Commit references or other branch-linking metadata on the outer `kind: 1059` event.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Complete security-note formatting/context required by repo guidelines.

This new privacy/security guidance should include explicit ✅/⚠️ markers and a pointer to threat_model.md for metadata-observability context, to match the spec style required for {00..04}.md.

As per coding guidelines "{00,01,02,03,04}.md: Reference threat_model.md for security context and document observable metadata and privacy limitations" and "Include ✅ (protections) and ⚠️ (limitations) markers in security notes".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@02.md` around lines 45 - 48, Add a formatted security note to 02.md that
follows the repo's `{00..04}.md` style: include an explicit "Security note"
section with ✅ (protections) and ⚠️ (limitations) markers, reference
threat_model.md for metadata-observability context, and clearly state observable
metadata and privacy limitations for Welcome delivery (mention outer kind: 1059
gift-wrap is only a transport wrapper and the actual payload is in the inner
unsigned rumor event); also call out that clients SHOULD NOT place parent Commit
references or branch-linking metadata on the outer kind: 1059 event and
summarize what minimal routing metadata (e.g., recipient p tag) is exposed.

Comment thread 02.md
Comment on lines +145 to 146
After successfully processing a Welcome message, clients SHOULD perform a self-update (MLS Update proposal for their own LeafNode) as soon as possible. However, that self-update SHOULD be sent only after the bounded best-effort sync described above completes so the self-update is based on the freshest visible group state. Sending a self-update from stale state increases the risk of local state divergence (effectively "forking yourself" out of the group).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Harmonize self-update sequencing semantics with MIP-03.

Line 145 currently reads stricter than 03.md (which says self-update catch-up is a SHOULD). This creates inter-spec ambiguity for implementers. Please align wording so both MIPs express the same normative strength and fallback behavior under timeout/partial visibility.

Proposed spec-alignment diff
-After successfully processing a Welcome message, clients SHOULD perform a self-update (MLS Update proposal for their own LeafNode) as soon as possible. However, that self-update SHOULD be sent only after the bounded best-effort sync described above completes so the self-update is based on the freshest visible group state. Sending a self-update from stale state increases the risk of local state divergence (effectively "forking yourself" out of the group).
+After successfully processing a Welcome message, clients SHOULD perform a self-update (MLS Update proposal for their own LeafNode) as soon as possible. Clients SHOULD first perform the bounded best-effort sync described above so the self-update is based on the freshest visible group state. If sync is incomplete due to timeout or relay unavailability, clients MAY proceed conservatively while continuing catch-up attempts. Sending a self-update from stale state increases the risk of local state divergence (effectively "forking yourself" out of the group).

Also applies to: 161-166

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@02.md` around lines 145 - 146, The current wording in the "After successfully
processing a Welcome message..." paragraph is stricter than MIP-03; change the
sentence to match MIP-03's normative strength by making the self-update a SHOULD
for catch-up (i.e., clients SHOULD attempt a self-update/MLS Update proposal for
their own LeafNode after welcome processing) but allow the fallback behavior
under timeout/partial visibility described in MIP-03 (so implementers may
proceed if the bounded best-effort sync does not complete in time); apply the
same harmonization to the corresponding text in the later paragraph referenced
(lines 161-166) so both places use the same SHOULD-level guidance and explicit
fallback language.

@gzuuus gzuuus requested a review from erskingardner March 15, 2026 18:59
@gzuuus
Copy link
Copy Markdown
Contributor Author

gzuuus commented Mar 23, 2026

Hey! I wanted to share some updates on this research. I added a focused set of tests in marmot-ts research branch to try to harden the claims of this ongoing research, and I think they helped clarify where epoch_authenticator is actually valuable.

What I found most useful is that these cases make the role of epoch_authenticator much more precise. In the honest path, it behaves as expected and confirms that the Welcome tag, the inviter state, and the joiner’s locally derived state all match after a successful join. Under competing same-window commits, it helps identify which branch actually produced the Welcome. In the more interesting failure-adjacent cases, it also shows that a join can still succeed while the transported claim is false or corresponds to the wrong branch, which means successful Welcome processing alone is not always enough to classify what happened. At the same time, the tests also confirmed the boundary I was hoping to preserve: epoch_authenticator is diagnostic, not a substitute for MLS validation, so it does not rescue a structurally invalid Welcome.

That is the main reason this now feels more solid to me as research. The value is that it gives us a cheap and RFC-aligned way to distinguish a normal successful join from a successful join carrying a false or misbound claim, and from cases where no valid joined state exists in the first place. For a system like Marmot, where relay delivery is weakly ordered and mixed-client behavior is realistic, that seems like a meaningful improvement in how we reason about drift and branch uncertainty. More over mls implementations like ts-mls use these as an internal correctness and conformance invariant. And what I'm proposing here is using the same property, but elevating it into a decentralized diagnostic signal for Welcome-path branch consistency.

I am still treating this as ongoing research rather than a concrete protocol proposal, but I think these tests made the argument both narrower and stronger, and they gave me more confidence that this is worth keeping in the discussion.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
decentralized_consistency_analysis.md (2)

1-387: Strong research document; add systematic MIP cross-references throughout.

This document provides valuable analysis and clear reasoning for protocol design decisions. The structure is logical, the mental models are well-articulated, and the normative language (MUST/SHOULD/MAY) is used appropriately.

However, the document would benefit significantly from systematic cross-references to relevant MIPs:

  • MIP-02 for Welcome handling, epoch_authenticator, and join semantics
  • MIP-03 for Commit discipline and timing requirements
  • threat_model.md for security implications (as per retrieved learnings)

These cross-references would help readers understand:

  1. Which recommendations are already implemented
  2. Which are proposed additions
  3. How this research connects to normative protocol text

Based on learnings: Protocol specifications benefit from documenting edge cases, race conditions, and failure modes, and should update threat_model.md when there are security implications.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@decentralized_consistency_analysis.md` around lines 1 - 387, Add systematic
cross-references to MIPs and the threat model throughout the document: link
MIP-02 wherever Welcome handling, epoch_authenticator, join semantics, or
"Welcome Handling" are discussed; link MIP-03 for all Commit discipline,
pre-Commit catch-up, timing and same-epoch conflict sections; reference
threat_model.md where security implications, drift, fork containment, or
recovery semantics are described. For each referenced recommendation (e.g.,
"Post-Join Send Hygiene", "Require Freshness Checks Before Structural Commits",
"Drift As A First-Class Operational Condition", "Welcome Handling", "Commit
Discipline", "Recovery"), annotate whether it is already implemented, proposed,
or open (implemented/proposed/open) and add a short pointer to the specific MIP
or threat_model.md entry that captures normative language or required updates.

160-171: Reference MIP-03 for Commit discipline.

This section discusses Commit creation requirements that relate directly to MIP-03. Adding a cross-reference would help readers connect this research to the protocol specification.

🔗 Suggested addition
-### 2. Require Freshness Checks Before Structural Commits
+### 2. Require Freshness Checks Before Structural Commits (see [MIP-03](03.md))
 
 The same discipline that applies after joining or resuming from stale state should also apply to commit creation.

As per coding guidelines, reference other MIPs using [MIP-XX](XX.md) format.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@decentralized_consistency_analysis.md` around lines 160 - 171, Add a
cross-reference to MIP-03 in the "Require Freshness Checks Before Structural
Commits" section by referencing the protocol specification using the required
format; update the heading paragraph to mention and link MIP-03 like
"[MIP-03](MIP-03.md)" where you discuss Commit discipline and explicitly tie the
requirements (bounded catch-up, avoiding sends on uncertain local state,
deferring on known branch conflict) to MIP-03 so readers can follow the protocol
specification for Commit creation rules (mentioning Commit, member add/remove
Commits, bounded catch-up, and branch conflict to aid discoverability).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@decentralized_consistency_analysis.md`:
- Around line 25-29: Update the architectural paragraph to include explicit
cross-references to MIP-02 and MIP-03 using the required format; replace or
append references to "Welcome handling" and "Commit discipline" with
`[MIP-02](02.md)` and `[MIP-03](03.md)` respectively in the text that currently
reads "This architectural description directly relates to concepts specified in
MIP-02 (Welcome handling) and MIP-03 (Commit discipline)"; ensure both
references use the exact `[MIP-XX](XX.md)` syntax and maintain the original
sentence flow in decentralized_consistency_analysis.md.
- Around line 216-231: Update the "Normative Direction" paragraph to reference
the existing MIP-02 feature and change the future-tense phrasing to
present-tense: replace "Marmot SHOULD add encrypted `epoch_authenticator`
confirmation" with a statement that Marmot adopts the optional `ea` tag and the
compare/quarantine behavior as specified in MIP-02 (use the cross-reference
format [MIP-02](02.md)); explicitly mention `epoch_authenticator`, Welcome
processing, and the MUST quarantine / SHOULD compare rules from MIP-02 so
readers know this is already implemented rather than planned.

---

Nitpick comments:
In `@decentralized_consistency_analysis.md`:
- Around line 1-387: Add systematic cross-references to MIPs and the threat
model throughout the document: link MIP-02 wherever Welcome handling,
epoch_authenticator, join semantics, or "Welcome Handling" are discussed; link
MIP-03 for all Commit discipline, pre-Commit catch-up, timing and same-epoch
conflict sections; reference threat_model.md where security implications, drift,
fork containment, or recovery semantics are described. For each referenced
recommendation (e.g., "Post-Join Send Hygiene", "Require Freshness Checks Before
Structural Commits", "Drift As A First-Class Operational Condition", "Welcome
Handling", "Commit Discipline", "Recovery"), annotate whether it is already
implemented, proposed, or open (implemented/proposed/open) and add a short
pointer to the specific MIP or threat_model.md entry that captures normative
language or required updates.
- Around line 160-171: Add a cross-reference to MIP-03 in the "Require Freshness
Checks Before Structural Commits" section by referencing the protocol
specification using the required format; update the heading paragraph to mention
and link MIP-03 like "[MIP-03](MIP-03.md)" where you discuss Commit discipline
and explicitly tie the requirements (bounded catch-up, avoiding sends on
uncertain local state, deferring on known branch conflict) to MIP-03 so readers
can follow the protocol specification for Commit creation rules (mentioning
Commit, member add/remove Commits, bounded catch-up, and branch conflict to aid
discoverability).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 639b793b-6f9f-4939-940b-9205204e3935

📥 Commits

Reviewing files that changed from the base of the PR and between 6da4a5d and 05e2e33.

📒 Files selected for processing (1)
  • decentralized_consistency_analysis.md

Comment on lines +25 to +29
The right way to think about Marmot is:

- MLS provides the cryptographic state machine.
- Nostr provides a decentralized dissemination layer.
- Marmot must define the convergence rules needed to safely operate MLS over that transport.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add cross-references to relevant MIPs.

This architectural description directly relates to concepts specified in MIP-02 (Welcome handling) and MIP-03 (Commit discipline). As per coding guidelines, reference other MIPs using the [MIP-XX](XX.md) format.

📚 Suggested addition
 The right way to think about Marmot is:
 
 - MLS provides the cryptographic state machine.
 - Nostr provides a decentralized dissemination layer.
-- Marmot must define the convergence rules needed to safely operate MLS over that transport.
+- Marmot must define the convergence rules needed to safely operate MLS over that transport (see [MIP-02](02.md) and [MIP-03](03.md)).

As per coding guidelines, MIP cross-references should use [MIP-XX](XX.md) format.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The right way to think about Marmot is:
- MLS provides the cryptographic state machine.
- Nostr provides a decentralized dissemination layer.
- Marmot must define the convergence rules needed to safely operate MLS over that transport.
The right way to think about Marmot is:
- MLS provides the cryptographic state machine.
- Nostr provides a decentralized dissemination layer.
- Marmot must define the convergence rules needed to safely operate MLS over that transport (see [MIP-02](02.md) and [MIP-03](03.md)).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@decentralized_consistency_analysis.md` around lines 25 - 29, Update the
architectural paragraph to include explicit cross-references to MIP-02 and
MIP-03 using the required format; replace or append references to "Welcome
handling" and "Commit discipline" with `[MIP-02](02.md)` and `[MIP-03](03.md)`
respectively in the text that currently reads "This architectural description
directly relates to concepts specified in MIP-02 (Welcome handling) and MIP-03
(Commit discipline)"; ensure both references use the exact `[MIP-XX](XX.md)`
syntax and maintain the original sentence flow in
decentralized_consistency_analysis.md.

Comment on lines +216 to +231
#### Normative Direction

For Marmot, these checks should not remain soft diagnostics in mixed-client ecosystems.

The honest-path result is important but limited: when the Welcome is valid and the inviter is honest, `epoch_authenticator` is mostly confirmatory. Its real value appears in the non-ideal cases that decentralized delivery makes plausible, especially raced branches, mixed implementations, buggy state production, or adversarially wrong metadata.

The intended direction is:

- MLS tree validation remains mandatory through normal Welcome processing,
- clients MUST fail closed on ratchet-tree or related MLS validation failures,
- Marmot SHOULD add encrypted `epoch_authenticator` confirmation for the Welcome epoch,
- clients that support this confirmation SHOULD compare it before first outbound traffic,
- clients MUST quarantine state on mismatch and MUST NOT send application traffic or structural Commits from that state.

Failure to enforce these checks materially increases the risk of silent drift and persistent forks in mixed-client environments.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add MIP-02 cross-reference and clarify implementation status.

The normative direction described here is already partially implemented in MIP-02:

  • Line 77 of 02.md specifies the optional ea tag
  • Lines 100-121 of 02.md specify SHOULD compare and MUST quarantine on mismatch

However, line 226 phrases this as "Marmot SHOULD add" (future tense), which may confuse readers since this feature already exists in the current spec.

🔗 Suggested clarification
 The intended direction is:
 
 - MLS tree validation remains mandatory through normal Welcome processing,
 - clients MUST fail closed on ratchet-tree or related MLS validation failures,
-- Marmot SHOULD add encrypted `epoch_authenticator` confirmation for the Welcome epoch,
+- Marmot SHOULD strengthen encrypted `epoch_authenticator` confirmation for the Welcome epoch (see [MIP-02](02.md)),
 - clients that support this confirmation SHOULD compare it before first outbound traffic,
 - clients MUST quarantine state on mismatch and MUST NOT send application traffic or structural Commits from that state.

As per coding guidelines, reference other MIPs using [MIP-XX](XX.md) format.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#### Normative Direction
For Marmot, these checks should not remain soft diagnostics in mixed-client ecosystems.
The honest-path result is important but limited: when the Welcome is valid and the inviter is honest, `epoch_authenticator` is mostly confirmatory. Its real value appears in the non-ideal cases that decentralized delivery makes plausible, especially raced branches, mixed implementations, buggy state production, or adversarially wrong metadata.
The intended direction is:
- MLS tree validation remains mandatory through normal Welcome processing,
- clients MUST fail closed on ratchet-tree or related MLS validation failures,
- Marmot SHOULD add encrypted `epoch_authenticator` confirmation for the Welcome epoch,
- clients that support this confirmation SHOULD compare it before first outbound traffic,
- clients MUST quarantine state on mismatch and MUST NOT send application traffic or structural Commits from that state.
Failure to enforce these checks materially increases the risk of silent drift and persistent forks in mixed-client environments.
#### Normative Direction
For Marmot, these checks should not remain soft diagnostics in mixed-client ecosystems.
The honest-path result is important but limited: when the Welcome is valid and the inviter is honest, `epoch_authenticator` is mostly confirmatory. Its real value appears in the non-ideal cases that decentralized delivery makes plausible, especially raced branches, mixed implementations, buggy state production, or adversarially wrong metadata.
The intended direction is:
- MLS tree validation remains mandatory through normal Welcome processing,
- clients MUST fail closed on ratchet-tree or related MLS validation failures,
- Marmot SHOULD strengthen encrypted `epoch_authenticator` confirmation for the Welcome epoch (see [MIP-02](02.md)),
- clients that support this confirmation SHOULD compare it before first outbound traffic,
- clients MUST quarantine state on mismatch and MUST NOT send application traffic or structural Commits from that state.
Failure to enforce these checks materially increases the risk of silent drift and persistent forks in mixed-client environments.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@decentralized_consistency_analysis.md` around lines 216 - 231, Update the
"Normative Direction" paragraph to reference the existing MIP-02 feature and
change the future-tense phrasing to present-tense: replace "Marmot SHOULD add
encrypted `epoch_authenticator` confirmation" with a statement that Marmot
adopts the optional `ea` tag and the compare/quarantine behavior as specified in
MIP-02 (use the cross-reference format [MIP-02](02.md)); explicitly mention
`epoch_authenticator`, Welcome processing, and the MUST quarantine / SHOULD
compare rules from MIP-02 so readers know this is already implemented rather
than planned.

@erskingardner
Copy link
Copy Markdown
Member

Thanks @gzuuus

I looked through the new stuff and ran the tests.

My overall take hasn't changed much:

  • I do think you're correctly identifying a real source of operational / interop issues: stale local state around invite/join windows, aggressive self-updates, same-epoch races, and poisoned Welcomes are real failure modes.
  • I do not think the added signaling solves the core decentralized visibility problem. epoch_authenticator is useful as a narrow same-epoch diagnostic (“did inviter and joiner derive the same Welcome-epoch state?”), but it cannot tell you whether another better / winning Commit is still out there on relays somewhere. It also does not remove the need for rollback/replay/recovery if a better branch becomes visible later.

Because of that, the strongest parts of this PR for me are the hygiene/recovery rules:

  • bounded catch-up after join before first send/self-update
  • bounded catch-up before structural Commits
  • deferring structural Commits when state is stale/uncertain
  • suspending sends and quarantining/recovering on losing/inconsistent state

Those seem worth specifying more clearly in the smallest possible spec changes. I do not think that we need to add any extra metadata to welcomes or any other commit messages. I could probably be swayed to include the optional epoch_authenticator in the Welcome metadata, but I still don't think that's necessary and should remain optional.

In adddition - this PR adds A LOT of new normative text that I think is not necessary and should be removed. We should absolutely add some new hygiene/recovery recommendations (strong recommendations even), but I don't think that we need to make these changes MUST normative requirements.

Obviously, before merge we'll need to remove the tests and other research docs as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants