Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Don't include redundant prev_state in new events #12891

Closed
DMRobertson opened this issue May 26, 2022 · 2 comments · Fixed by #13791
Closed

Don't include redundant prev_state in new events #12891

DMRobertson opened this issue May 26, 2022 · 2 comments · Fixed by #13791
Labels
A-DAG Directed acyclic graph of events (events connected by prev_events) good first issue Good for newcomers T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@DMRobertson
Copy link
Contributor

These need to remain on any existing events so that hashes and signatures etc remain valid. But there is no reason for them hang around. As Rich wrote on MSC2176:

The following event keys are to be removed from the list of those to be
preserved by a redaction:

  • membership
  • prev_state

(Note this refers to the event-level membership property, rather than the
richvdh marked this conversation as resolved.
similarly-named sub-property under the content key.)

Rationale: neither of the above properties have defined meanings any more in the Matrix
protocol, so there is no reason for them to be special-cased in this way.

See matrix-org/matrix-spec#1091 and matrix-org/matrix-spec-proposals#2176

I think we can remove prev_state from here

event_dict: Dict[str, Any] = {
"auth_events": auth_events,
"prev_events": prev_events,
"type": self.type,
"room_id": self.room_id,
"sender": self.sender,
"content": self.content,
"unsigned": self.unsigned,
"depth": depth,
"prev_state": [],
}

and here

# The protoevent received over the JSON wire may not have all
# the required fields. Lets just gloss over that because
# there's some we never care about
if "prev_state" not in pdu_dict:
pdu_dict["prev_state"] = []

@DMRobertson DMRobertson added T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. good first issue Good for newcomers labels May 26, 2022
@richvdh
Copy link
Member

richvdh commented May 26, 2022

related: #4787

@DMRobertson
Copy link
Contributor Author

Thanks Rich. (I did have a quick search this time, but I think prev_state shows up in a lot of error messages and event dumps.)

@MadLittleMods MadLittleMods added the A-DAG Directed acyclic graph of events (events connected by prev_events) label Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-DAG Directed acyclic graph of events (events connected by prev_events) good first issue Good for newcomers T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants