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

fix: Lz4 compression with prepended data size, added blob tx de/compression test #74

Merged
merged 2 commits into from
Mar 7, 2024

Conversation

merklefruit
Copy link
Contributor

No description provided.

// Usually the Lz4 compression ratio is 2.1x. So 4x should be plenty.
let min_uncompressed_size = data.len() * 4;
let bytes = decompress(data, min_uncompressed_size).map_err(|e| {
let bytes = decompress_size_prepended(data).map_err(|e| {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this heuristic was really unsafe and bad, it's better to prepend the decompressed data instead.

@merklefruit merklefruit added the C-chore Category: Chore label Mar 6, 2024
Copy link
Contributor

@mempirate mempirate left a comment

Choose a reason for hiding this comment

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

Looks good, got a clippy lint warning though

@merklefruit
Copy link
Contributor Author

@mempirate solved

@mempirate mempirate merged commit 603f29d into main Mar 7, 2024
7 checks passed
@mempirate mempirate deleted the fix/lz4-compression-test branch March 7, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-chore Category: Chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants