Conversation
added 2 commits
September 22, 2026 20:00
The 'origin' key and the state-event 'prev_state' key were removed from the event format in room v3. EventBuilder.Build emitted them for all room versions, which makes strict peers (e.g. SyTest's mock federation server) that keep those keys when redacting derive event IDs that disagree with the declared ones. Only emit both keys for EventFormatV1 (room v1/v2). New v3+ events are self-consistent: content hashes and signatures are computed over what is actually serialised, and both spec (12-key) and legacy (17-key) redaction of a key-free event produce the same reference hash. Stored events are unaffected.
The repository is Apache-2.0 and its files carry no per-file headers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EventBuilder.Build serialises every event with the top-level
originkey, and state events additionally getprev_state: []. Both keys were removed from the event format in room v3.Strict peers that redact with a legacy key list before deriving event IDs (e.g. SyTest's mock federation server) end up with IDs that disagree with the ones we declared and fail resolving our event references. This surfaces as the long-failing SyTest case
Server correctly resyncs when server leaves and rejoins a roomagainst Dendrite.This change gates both keys on
EventFormatV1(rooms v1/v2 only). Newly built events remain self-consistent: content hashes and signatures are computed over exactly what is serialised, and both the spec (12-key) and legacy (17-key) redaction of a key-free event produce the same reference hash. Stored events are unaffected — redaction simply no longer finds the keys.A regression test asserts key presence/absence across room versions 1, 2, 6, 10 and 12, for state and non-state events.