Skip to content
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

feat: serialization format #13

Merged
merged 2 commits into from
Jul 17, 2023
Merged

feat: serialization format #13

merged 2 commits into from
Jul 17, 2023

Conversation

Gozala
Copy link
Contributor

@Gozala Gozala commented Jul 14, 2023

This pr updates piece and aggregate serialization format from { link, size } to { link, height }. This allows need for bigints that are problematic in JSON. Since both are perfect binary trees, leaf count of can be derived as 2 ** height, and the size of the tree can be derived by leafCount * Node.Size (32).

Additionally I've also added bit more code to make piece encode / decode easy, which will need to do quite a bit.

@Gozala Gozala requested a review from vasco-santos July 14, 2023 05:57
@Gozala Gozala merged commit b88afdf into main Jul 17, 2023
3 checks passed
vasco-santos added a commit to storacha/specs that referenced this pull request Jul 18, 2023
Renames `size` to `height` for `piece`/`aggregate` based on described in
storacha/data-segment#13

Note that:
- given `piece` and `aggregate` are both perfect binary trees, leaf
count of can be derived as `2 ** height`, and the size of the tree can
be derived by `leafCount * Node.Size` (32).
vasco-santos added a commit to storacha/w3up that referenced this pull request Jul 25, 2023
…together with client and api (#831)

Renames `size` to `height` for `piece`/`aggregate` based on described in
storacha/data-segment#13

Note that:
- took the opportunity to update this to finally rely on `data-segment`
lib as it is now ready to be used (both in tests, and to validate
aggregate)
- given `piece` and `aggregate` are both perfect binary trees, leaf
count of can be derived as `2 ** height`, and the size of the tree can
be derived by `leafCount * Node.Size` (32).

Needs storacha/specs#66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants