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/objectarium compression #205

Merged
merged 22 commits into from
May 3, 2023
Merged

Feat/objectarium compression #205

merged 22 commits into from
May 3, 2023

Conversation

ccamel
Copy link
Member

@ccamel ccamel commented Apr 28, 2023

This PR addresses #192, which enables the support of compression of objects, through the Snappy compression algorithm as the primary supported algorithm.

The implementation introduces a design for the smart contract interface that enables the expression of object compression and control over the supported algorithms in a given bucket. This development paves the way for experimentation that will provide insights into the gas consumption associated with object storage in various contexts (cf. #191).

@codecov
Copy link

codecov bot commented Apr 28, 2023

Codecov Report

Merging #205 (905b06e) into main (184796e) will increase coverage by 0.15%.
The diff coverage is 98.55%.

@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
+ Coverage   96.30%   96.45%   +0.15%     
==========================================
  Files          30       31       +1     
  Lines        3952     4318     +366     
==========================================
+ Hits         3806     4165     +359     
- Misses        146      153       +7     
Impacted Files Coverage Δ
contracts/okp4-objectarium/src/msg.rs 84.61% <50.00%> (-2.89%) ⬇️
contracts/okp4-objectarium/src/error.rs 91.52% <91.07%> (-8.48%) ⬇️
contracts/okp4-objectarium/src/contract.rs 99.74% <99.70%> (-0.03%) ⬇️
contracts/okp4-law-stone/src/contract.rs 93.86% <100.00%> (+0.04%) ⬆️
contracts/okp4-objectarium/src/compress.rs 100.00% <100.00%> (ø)
contracts/okp4-objectarium/src/lib.rs 100.00% <100.00%> (ø)
contracts/okp4-objectarium/src/state.rs 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ccamel ccamel force-pushed the feat/objectarium-compression branch from 8e8c5ca to cb71cb8 Compare April 29, 2023 09:28
@bot-anik
Copy link
Member

bot-anik commented Apr 29, 2023

size-limit report 📦

Path Size
target/wasm32-unknown-unknown/release/okp4_objectarium.wasm 401.86 KB (+18.82% 🔺)
target/wasm32-unknown-unknown/release/okp4_law_stone.wasm 647 KB (+0.95% 🔺)
target/wasm32-unknown-unknown/release/okp4_cognitarium.wasm 227.03 KB (0%)

@ccamel ccamel force-pushed the feat/objectarium-compression branch from a5ee4bf to 0ed75c5 Compare May 2, 2023 16:17
@ccamel ccamel self-assigned this May 2, 2023
@ccamel ccamel force-pushed the feat/objectarium-compression branch from 0ed75c5 to 4fb8515 Compare May 2, 2023 16:31
@ccamel ccamel force-pushed the feat/objectarium-compression branch 2 times, most recently from 9725c77 to 85b3e85 Compare May 2, 2023 16:49
@ccamel ccamel force-pushed the feat/objectarium-compression branch from 85b3e85 to 905b06e Compare May 2, 2023 17:49
@ccamel ccamel marked this pull request as ready for review May 2, 2023 17:56
@ccamel ccamel requested review from amimart and bdeneux May 2, 2023 17:56
Copy link
Contributor

@bdeneux bdeneux left a comment

Choose a reason for hiding this comment

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

Nice, that seems good ! Thanks.

I'm just opening a discussion about limits of bucket. I'm wondering about the max_object_size and max_total_size limits attributes that is related to the size of the uncompressed object.
Is it relevant to limit the total max size on uncompressed objects size ? Maybe on the size of one object could be useful but for the total bucket size I will use the compressed size to check limits (by changing limits attribute name max_compressed_total_size or adding a new limits attributes or just add a comment on this attribute documentation)

@ccamel
Copy link
Member Author

ccamel commented May 3, 2023

I'm just open a discussion about limits of bucket. I'm wondering about the max_object_size and max_total_size limits attributes that is related to the size of the uncompressed object. Is it relevant to limit the total max size on uncompressed objects size ? Maybe on the size of one object could be useful but for the total bucket size I will use the compressed size to check limits (by changing limits attribute name max_compressed_total_size or adding a new limits attributes or just add a comment on this attribute documentation)

@bdeneux ah, yes it's a good point, and I had wondered about it. I am quite divided on the question. 🤔 Let's just say that from what I see of compressed volumes usually, the limits apply on the uncompressed data because through the volume, the files are seen for their actual size, and that's the approach I've taken. Also, limiting the total size by compressed size requires compressing first, which is costly (in gas) if the resulting size turns out to be unfortunatly larger than the limit.
However, I can understand that calculating on the uncompressed size does not make much sense in our case.
In any case, it is important to clarify this point as you have pointed out.

@amimart your thoughts?

@amimart
Copy link
Member

amimart commented May 3, 2023

@amimart your thoughts?

For me both behaviors can be justified, but I'll have a preference with considering the size the uncompressed object. Because even it is compressed at the storage level, it doesn't reflect the actual size of the object at the interface level when storing or querying an object.

Copy link
Member

@amimart amimart 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 to me! 😉

@ccamel
Copy link
Member Author

ccamel commented May 3, 2023

Thanks for the review guys. 👍

@ccamel ccamel merged commit d59f4a5 into main May 3, 2023
@ccamel ccamel deleted the feat/objectarium-compression branch May 3, 2023 14:15
@bot-anik
Copy link
Member

🎉 This PR is included in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants