-
Notifications
You must be signed in to change notification settings - Fork 24
Add context to CIP124 EventIDs #148
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 all commits
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 |
|---|---|---|
|
|
@@ -48,13 +48,14 @@ An eventId is a special type of [StreamId](https://cips.ceramic.network/CIPs/cip | |
|
|
||
| ```js | ||
| concatBytes( | ||
| varint(0xce), // streamid varint | ||
| varint(0x05), // cip-124 EventID varint | ||
| varint(network_id), // network_id varint | ||
| last8bytes(sha256(sort_value)), // separator [u8; 8] | ||
| varint(0xce), // streamid varint b'\xce\x01' | ||
| varint(0x05), // cip-124 EventID varint b'\x05' | ||
| varint(network_id), // network_id varint 1 or 5 bytes | ||
| last8Bytes(sha256(separator_key + "|" + separator_value)), // separator [u8; 8] | ||
| context_value // [u8; 8] | ||
| cbor(blockNumber), // 0 - u64_max; 1-9 bytes | ||
| last8bytes(sha256(controller)), // controller [u8; 8] | ||
| last4bytes(init_event_cid_bytes), // StreamID [u8; 4] | ||
| cbor(event_height), // event_height cbor unsigned int | ||
| event_cid_bytes, // [u8] | ||
| ) | ||
| ``` | ||
|
|
@@ -63,10 +64,15 @@ Where: | |
| * `0xce` is the streamid multicode as defined in the [multicodec table](https://github.com/multiformats/multicodec/blob/master/table.csv). | ||
| * `0x05` is the streamtype code for an cip-124 EventID as defined in the [streamTypes table](../tables/streamtypes.csv). | ||
| * `network_id` is a number as defined in the [networkIds table](../tables/networkIds.csv) | ||
| * `sort_value` is based on a user provided value for *sort-key* and *sort-value* | ||
| * `separator_key` is the header field that has the separator_value in it. | ||
| * `separator_value` is the value in the field specified by the separator_key | ||
| * `context_key` is the header field that has the context_value in it. | ||
| * `context_value` is the first 8 bytes of the value in the field specified by the context_key. | ||
| * `blockNumber` is the ETH blockNumber from the after header or a prev time event. | ||
| * If the after header is not present then follow the prev cain to a time event. | ||
| * If there is no time event in the chain then use 0 | ||
|
Comment on lines
+71
to
+73
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. Can we use |
||
| * `controller` is the controller DID of the stream this event belongs to | ||
| * `init_event_cid_bytes` is the CID of the first Event of the this stream. | ||
| * `event_height` is the "height" of the event InitEvent. For InitEvents this value is `0` else `prev.event_height + 1`. | ||
|
Comment on lines
75
to
-69
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. Given that we are removing |
||
| * `event_cid_bytes` the CID of the event itself | ||
| * `last8bytes` and `last4bytes` takes the last N bytes of the input and prepends with zeros if the input is shorter | ||
|
|
||
|
|
||
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.
"after header" isn't really defined yet (CIP is pending) does it make sense to mention it here? Maybe we need to merge the after CIP before this PR?