-
Notifications
You must be signed in to change notification settings - Fork 24
fix(CIP-145): updates from forum discussion #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,9 +37,14 @@ below, and would result in pruning of Data Events coinciding with Time Events. | |
| * A `fork point` is the last common ancestor of two events `A` and `B`. | ||
| * A `merge point` is the first common descendant of two events `A` and `B`. | ||
| * `A` is a `covered event` if another event `B` has `A`'s CID in its `prev` field. | ||
| * Said differently, if event `B` has event `A`'s CID in its `prev` field, then event `B` "covers" event `A`. By | ||
| transitivity, event `B` also covers every event covered by event `A`. | ||
| * `A` is an `uncovered event` if there is no event with `A`'s CID in its `prev` field. | ||
| * A `diverged stream` has more than one uncovered event. | ||
| * A `converged stream` has a single uncovered event. | ||
| * A `dominant Data Event` is one that is not covered by another Data Event. | ||
| * A `non-dominant Data Event` is one that is covered by another Data Event. This applies transitively through Time | ||
| Events. | ||
| * A `diverged stream` has more than one dominant Data Event. | ||
| * A `converged stream` has a single dominant Data Event. | ||
| * An `invalid Data Event` is one that has either an invalid signature or an expired CACAO. | ||
| * A `valid Data Event` is one that has a valid signature and a valid CACAO (if applicable). | ||
|
|
||
|
|
@@ -51,17 +56,15 @@ branches are pruned. Since pruning branches that contain Data Events would resul | |
| a Data Event to contain multiple ancestor events in its `prev` field so that a new merge point Data Event can cover | ||
| multiple events. | ||
|
|
||
| 1. If a stream is in a diverged state (see events `A` and `B` in fig. 5), we only consider branches that contain valid, | ||
| uncovered Data Events. | ||
| 2. For branches that contain valid, uncovered Data Events, we only consider the first Data Event on a branch after the | ||
| fork. | ||
| 3. The Data Event that is covered by the earliest Time Event wins (see event `A` in fig. 5). | ||
| 4. If two uncovered Data Events are covered by Time Events at the same block height, the Data Event with the lower CID | ||
| wins. | ||
|
|
||
| Using multi-prev Data Events allows us to reduce the number of uncovered events and converge the stream so that there is | ||
| only a single uncovered event, without any data abandoned on pruned branches. The stream's converged/diverged state can | ||
| be determined by looking at the `prev` fields of all the Data Events for that stream. | ||
| 1. If a stream is in a diverged state (see events `A` and `B` in fig. 5), we consider branches that contain dominant | ||
| Data Events. Branches containing only Time Events will get pruned. | ||
| 2. For branches that contain dominant Data Events, consider the first Data Event on a branch after the fork. | ||
| 3. The Data Event that is covered by the earliest Time Event wins (see event `A` in fig. 5). | ||
| 4. If two Data Events share the earliest timestamp, then the branch of the Data Event with the lower CID wins. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does it mean for a Data Event to "win" in the context of multiple prev?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We updated the wording. A Data Event "winning" here meant that that Data Event would be marked the tip by the protocol. An application would be able to make use of this information to create a merge Data Event, though other candidate CIDs would also be present in the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I don't understand why we need to distinguish between winning and non-winning tips? Why not just call them all tips and put them all in the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. e.g. The protocol just gives the application a list of tips. It's up to the application to decide what is "winning" and what's not. It's also up to the application to chose the order of tips in it's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get where you're going, but I'm not sure how well interoperability would work if two projects have different ideas on tip consensus 🤔 Or do you with application here mean the ceramic node? As in, the stream type implementation would decide on how to solve conflicts? I think that would make sense if so, as there may be other valid interpretations of this depending on the stream type.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, when I say protocol here I'm referring to the event streaming protocol. Stream type handlers is an application. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes full-on sense then 👌
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
To answer your question, @oed, there are two reasons for this:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't the application need to be given all tips anyway? In order to include them all in the |
||
|
|
||
| Using multi-prev Data Events allows us to reduce the number of dominant Data Events and converge the stream so that | ||
| there is only a single dominant Data Event, without any data abandoned on pruned branches. The stream's | ||
| converged/diverged state can be determined by looking at the `prev` fields of all the Data Events for that stream. | ||
|
|
||
| Events that have invalid signatures cannot be tips, even if uncovered. This has important implications for Data Events | ||
| with expired CACAOs. In figures 5 and 6, if we assume event `A` has an expired CACAO, the aggregation layer can choose | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would time events get pruned?
Consider Fig. 6:
3<n<44Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Since the data A branch is the tip according to the rest of the rules in fig 4, I'm not sure why we should try to merge the descendants of T1 🤔

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good question. @AaronGoldman and I had a good discussion about this scenario.

In this example,
Data Ccan only be created afterData Bhas been validated to either be within the expiration timeout or to already have a valid Time Event.We can assume that the author of
Data CvalidatedData BbecauseData CfollowsData B.Of course, if
Time 3forData Bis available beforeData Cis created, the CID ofTime 3will be included inData C's multi-prev.To your point, @m0ar, including
Time 1's descendants allows multi-prev to cover existing history (even if pruned) in the stream state, whereas today, pruned events are lost from the stream state.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we really make this assumption? In theory the author of
Data Ccould "import"Data Binto the log even though it's invalid, e.g.Time 3doesn't exist or is too late.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Events like
Time 3are definitely worth pinning, and potentially worth including in the multi-prev of subsequent Data Events.We feel that the validity of
Data Cdoes not require proof of validity ofData AorData B. However, establishing the latter's time bounds does require recordingTime 2andTime 3.Time 2is already part ofData C's history. IncludingTime 3in a future multi-prev would ensure that it also becomes part of the stream history.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that
Data C's validity is not predicated on the validity ofAorB. However, the validity ofData Bis predicated onTime 3being available. Therefore, it doesn't seem right to say that we can pruneTime 3.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, what would you think about including
Time 3in the multi-prev of the next event to be added to the stream? That's what we meant to say here:What if a new event
Data D(occurring afterTime 4) had aprevof[Time 4, Time 3]? Even thoughTime 3will not take precedence during tip selection, it will always remain part of the stream history.Or, let's say,
Time 3didn't show up until we already hadTime 4->Data D->Time 5->Data E->Time 6. ThenData F(occurring afterTime 6) would have aprevof[Time 6, Time 3].Data Bwould remain in an "unverified" state untilTime 3was discovered.Tracking
Data B's validity this way would be a little more complicated than the usual flow, but always possible. Moreover, now all events related to the stream would be part of the DAG, which is great.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is what I mean! Just wanted to be clear that
Time 3can't be pruned if we expect the creator ofData Dto include it in prev.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smrz2001 since it seems hat we are in agreement, maybe you can update the language to be clear that the TimeEvent doesn't get pruned?