FIP: Edit Casts using a Bitemporal Strategy #112
Replies: 4 comments 5 replies
-
I'm a fan of the idea of having an
|
Beta Was this translation helpful? Give feedback.
-
What about reactions and replies? If I'm not mistaken, they reference the CastId of the "replaced" cast. How should clients handle them? What if the original cast is deleted after SupersedingCastAdd has been sent? How is this case handled? |
Beta Was this translation helpful? Give feedback.
-
You can built an Edit Cast feature at the client level by simply deleting and re-adding a new cast under the hood. To the user, this would look identical to the edit functionality offered on Twitter and other social networks. It's a little more noisy (add + delete + add) but achieves the same user experience without increasing the complexity of the set logic. |
Beta Was this translation helpful? Give feedback.
-
Closing due to inactivity |
Beta Was this translation helpful? Give feedback.
-
FIP: Edit Casts using a Bitemporal Strategy
Title: Edit Casts using a Bitemporal Strategy
Type: Implementation FIP
Authors: @christopherwxyz
Abstract
This FIP suggests a way to "edit" Casts without actually changing the original Cast. We'll use a bitemporal strategy to introduce a "Superseding Cast" that acts as an update or edit to an existing Cast.
Problem
Once data is added to the network, it's permanent. Traditional systems can edit or modify data directly, but we can't do that here. That's why we need a creative way to "edit" Casts. A bitemporal strategy allows us to create new Casts that serve as updates to existing ones.
Specification
What's Bitemporal?
Bitemporal data keeps track of two kinds of time:
Changes to Cast CRDT
New Type of Message:
SupersedingCastAdd
We're introducing a new message type called
SupersedingCastAdd
. This message will have:original_cast_hash
: The identity of the Cast a signer wants to update.new_data
: The updated information or data.valid_from
: When does this update start being valid?valid_to
: When does this update stop being valid? (This is optional; with avalid_to
, then no successful "edit" will settle as an update, and succeeding Superseding Casts will be rejected.)Rationale
Other approaches, like directly updating Casts or using versioning, break the immutability principle. The bitemporal strategy respects the existing rules and adds the flexibility to update Casts, including within only a specific timeframe.
Release
SupersedingCastAdd
type.Rules to Check:
m.signer
) must be an allowed signer for that Cast.SupersedingCastAdd
is only valid if an original Cast with theoriginal_cast_hash
exists. We do not want to accept Superseding Casts if the network has pruned it from state. Therefore, operators may prune Superseding Casts along with the original cast as part of garbage collection or similar hub maintenance.valid_to
, there cannot be another future respected superseding cast. This could be useful for ensuring a more permanent message if the caster's keys are compromised.valid_from
may not occur before the original message timestamp. Hubs should reject messages that precede the original.What If Two Updates Conflict?
If two
SupersedingCastAdd
messages conflict:How to Find These Casts
When you look up a Cast, you should get the latest
SupersedingCastAdd
along with the original Cast. This shows the full history of that Cast.Will This Work With Old Specifications?
Yes, older implementations that don't use this new feature will still work but won't recognize the "edit" messages.
What's Next?
Sample Messages in JSON Format
Original Cast Message
Superseding Cast Message
Another Superseding Cast Message (Conflict)
Handling Conflicts
In this case, the message with hash
lmn456
will not supersede the one with hashxyz789
since it has a newervalid_from
timestamp.Additionally, the
lmn456
cast is not a permanent "edit", as it lacks avalid_to
timestamp.Conclusion
This bitemporal strategy lets us "edit" Casts while keeping the original data untouched. It makes our system more flexible without breaking any of the existing cast rules.
Beta Was this translation helpful? Give feedback.
All reactions