-
Notifications
You must be signed in to change notification settings - Fork 228
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
Use core
and alloc
crates for no_std
compatibility (Take 2)
#993
Conversation
Codecov Report
@@ Coverage Diff @@
## master #993 +/- ##
========================================
- Coverage 72.8% 72.8% -0.1%
========================================
Files 206 206
Lines 16635 16638 +3
========================================
- Hits 12126 12121 -5
- Misses 4509 4517 +8
Continue to review full report at Codecov.
|
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.
Quite some work, impressive. Would it be possible to consolidate the multiple preludes into a shared crate to ease with maintenance down the line?
I am a bit reluctant to expose the internal prelude as public interface. It will make it more difficult for us to remove it in the future. It is also not clear that if we do want to expose it, which crate should it be in. The lowest common denominator of all tendermint-rs and ibc-rs crates is probably In any case, I think this is just a temporary measure with minimal content that we can manage with. Once the |
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
Signed-off-by: Thane Thomson <[email protected]>
rpc/Cargo.toml
Outdated
pin-project = { version = "1.0.1", default-features = false } | ||
serde = { version = "1", default-features = false, features = [ "derive" ] } | ||
serde_bytes = { version = "0.11", default-features = false } | ||
serde_json = { version = "1", default-features = false, features = ["std"] } | ||
tendermint-config = { version = "0.23.0-internal", path = "../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.
Should this not be the following?
tendermint-config = { version = "0.23.0-internal", path = "../config" } | |
tendermint-config = { version = "0.23.0-internal", path = "../config", default-features = false } |
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.
Yeah that is about right. Actually the main reason why the option default-features = false
is added everywhere is because there are always weird interaction between the feature flags of each crate that can somehow activate the use of std
.
Worse yet it seems like other crates within the same project repository may also affect the feature flags enabled, so we still have to disable default-features in all crates so that they do not interfere with the features in the crates supporting no_std.
Technically, we could only selectively add default-features = false
to specific crates that are found to interfere with the no_std features. But identifying the offending crates are too tedious, and so it is better off to just add that to every single dependency we use and not worry about it.
rpc/Cargo.toml
Outdated
"flex-error/std" | ||
"flex-error/std", | ||
"tendermint/std", | ||
"tendermint-proto/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.
Following from the comment below regarding the tendermint-config
dependency, should we not also be enabling the std
feature of tendermint-config
as follows?
] | |
"tendermint-config/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.
Actually with a clearer thoughts now, I think it is safe for us to remove all the "std"
feature in each of tendermint-rs and ibc-rs crates. Currently the only use of the default "std"
feature in our crates is to activate the flex-error/eyre_tracer
feature so that the eyre
error tracer is used for richer error information. But we can easily activate flex-error/eyre_tracer
feature at the CLI crate like ibc-relayer-cli
without having go through the individual dependencies, and still get the same benefit.
I have pushed a new commit to remove all use of "std"
features in tendermint crates so that we do not need the same std feature boilerplate as used in Substrate.
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.
One more question here: do these changes modify the API in any meaningful way? i.e. will they impact the way that users depend on/import our crates?
If so we should include a breaking changelog entry.
Also I see the tools build's failing: https://github.com/informalsystems/tendermint-rs/runs/4009051636?check_suite_focus=true |
I think there shouldn't be any change in the API. I have changed the default features of each tendermint-rs crate to One potential breaking change is the removal of the |
Signed-off-by: Thane Thomson <[email protected]>
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'd say we're good to go here. Thanks @soareschen!
Part of informalsystems/ibc-rs#1158
This follows similar work in informalsystems/ibc-rs#1156 to move closer to supporting no_std in tendermint-rs.
This is a succession of #980 with the changes to replace the use of
std::time::SystemTime
being moved to another PR..changelog/