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

document how CLVM compression works and its format #527

Merged
merged 2 commits into from
Jan 7, 2025
Merged

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented Jan 6, 2025

This may help further development in this area. There are some optimizations available in both serialization and deserialization.

Copy link

coveralls-official bot commented Jan 6, 2025

Pull Request Test Coverage Report for Build 12649089164

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.639%

Totals Coverage Status
Change from base Build 12605920076: 0.0%
Covered Lines: 5888
Relevant Lines: 6288

💛 - Coveralls

@arvidn arvidn requested a review from matt-o-how January 6, 2025 10:32
sub-trees).

We keep popping operations off of the op-stack until it's empty. We take the
following actions dependin on the operation:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
following actions dependin on the operation:
following actions depending on the operation:

serialized CLVM tree. To understand what the parse stack is, we first need to
look at how CLVM is parsed.

The parser has a stack of _operations_ and a stack of the parsed result (the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The parser has a stack of _operations_ and a stack of the parsed result (the
The parser has a stack of _operations_ and a stack of the parsed results (the

bit traversal direction: <- x
```

A 0 bit means follow the left sub-tree, a 1-bit means follow the right sub-tree.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A 0 bit means follow the left sub-tree, a 1-bit means follow the right sub-tree.
A `0` bit means follow the left sub-tree, while a `1` bit means follow the left sub-tree.

### Example back-reference

Consider the following LISP structure: ((`1` . `2`) . (`1` . `2`))
It Can be serialized as `0xff` `0xff` `1` `2` `0xfe` `0b10`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It Can be serialized as `0xff` `0xff` `1` `2` `0xfe` `0b10`
It can be serialized as `0xff` `0xff` `1` `2` `0xfe` `0b10`

Copy link
Contributor

@richardkiss richardkiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent and probably very helpful to noobs. Just a few minor edits you might consider.

@arvidn arvidn merged commit 2eee1cf into main Jan 7, 2025
29 checks passed
@arvidn arvidn deleted the compression-docs branch January 7, 2025 18:53
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.

3 participants