-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: tx and receipt compression utils for no-std config #11112
feat: tx and receipt compression utils for no-std config #11112
Conversation
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.
please also update the pr title to be more descriptive of the change, as it will show up in the changelog
@@ -38,6 +39,38 @@ thread_local! { | |||
)); | |||
} | |||
|
|||
/// Tx compressor creator |
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.
please update these comments to be in the same style as the rest of the codebase, i.e. "Creates a [Compressor
] for transactions" or something like that
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.
Done
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.
ptal @joshieDo
#[cfg(feature = "std")] | ||
use std::thread_local; |
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.
please use full paths instead of feature gating imports
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.
Remove macro above import?
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.
you can use std::thread_local!
directly
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.
make sense
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.
done
Functionality wise looks fine, but i'm not entirely sure of the overhead of doing this for each tx/receipt. Maybe for |
d119729
to
8a4947b
Compare
let mut compressor = compressor.borrow_mut(); | ||
let mut tmp = Vec::with_capacity(256); | ||
let mut tmp = Vec::with_capacity(256); | ||
if cfg!(feature = "std") { |
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.
Can we use cfg_if here?
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.
I've viewed that crate. I can't foresee more than 2 if-else branches in this place, therefore this crate doesn't seem much useful
@@ -38,6 +38,35 @@ thread_local! { | |||
)); | |||
} | |||
|
|||
/// Fn creates as many tx compressors per thread as times its called. It is meant to be used in no-std config |
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.
/// Fn creates as many tx compressors per thread as times its called. It is meant to be used in no-std config | |
/// Creates a [`Compressor`] for transactions. |
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.
And for the others
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.
changed
lint / fmt script fails on my machine as well as in pipeline. @joshieDo could you help me with this? |
if you run either |
@joshieDo |
Tx and receipt compression utils for no-std environment.