-
Notifications
You must be signed in to change notification settings - Fork 329
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
Tracking issue for no-std support #1158
Comments
Hi, I'm glad to see you've written this in such detail, and I agree with what you've written when you list this. After all the skimming through the third one listed, this one I think can go for it. For the penultimate one, I don't know who is in charge of the |
I am also responsible to having no_std supported in tendemint-rs. I am still looking at informalsystems/tendermint-rs#890, but got side tracked by something else, sorry for haven't giving any feedback yet. That being said, I think the work need to be done on tendermint-rs side should be similar with what's mentioned in this issue, and I will create a separate tracking issue for that. I also think that the two developments can be done in parallel, and we'd have a separate PR to update tendermint-rs in ibc-rs once the changes have been merged on tendermint-rs side. |
I found this issue on substrate (paritytech/substrate#4043), which mentions that the Because of this, I think we should refine the acceptance criteria of what we are aiming for here:
The first three acceptance criteria are rather straightforward to verify. However I have not been able to find good source of verifying for no-std compliance on Substrate. The only information available is on the guide which shows how to configure Cargo.toml feature flags to switch between What I found instead is that Substrate crates like |
Related issue on checking for |
Thanks for the write-up, @soareschen! My understanding is that at the moment, we want both WebAssembly (
@DaviRain-Su Can you please chime in here to provide with more details on this? Especially as to how we can test that the |
Regarding the validation on substrate, we use ibc to implement pallet (a term used in substrate) and the use of pallet is registered to the runtime, the final compilation output in substrate is native binary, and wasm files, these pallet files will be compiled into wasm files. files will also be compiled into wasm files. So the conclusion here is that the verification result on substrate is to set the compilation target to the WebAssembly target. relate toutials: https://substrate.dev/docs/en/tutorials/add-a-pallet/import-a-pallet
This means that the substrate platform can also be applicable as long as the requirements proposed in the previous three are suitable. |
@DaviRain-Su many thanks for your support with no_std so far! |
Oh, thanks, this time is in line with our expectations |
@soareschen Hi, I would like to know how this issue is progressing now. |
@DaviRain-Su I have some time to work on this for the next few weeks. Many changes have been merged and moving us closer to no_std support. However there are still quite a number of blockers, in particular on the no_std support from the dependencies. I have identified some of the main issues that still need to be addressed and updated the list in the description. At the moment it is not clear how much time is needed to resolve the current issues, and how many new issues will still be uncovered. |
For |
Hi @soareschen , I encountered some errors when integrating This is error:
|
@DaviRain-Su Looks to me like |
Thx,I'll give it a try |
Yes, I am updating this branch so that it will be using the same |
Okay, when you fix it, you can @DaviRain-Su |
After I run this command, I see that all the versions of this library( |
@DaviRain-Su the crate I have updated #1390 to keep up to date to master. But now the no_std support is broken, with various new issues such as tendermint-rs/issues/1027 and #1612. |
@DaviRain-Su please use the branch in #1613, which I have updated the original branch with new versions of As mentions, the support for no_std #1390 is currently broken. It may take a while before we can fix everything again. Just be aware that #1613 has been lagging behind master since October, and there have been many breaking changes made on master since then. |
Yes because of this problem, I found out for a long time a few days ago because of this problem that the upper dependency of |
Update: the full support for no_std with the latest version of ibc-rs is now available at #1846. There are just some minor fixes need to be upstreamed to |
The |
This is a tracking issue to track the progress of no-std support for ibc-rs to close #29. The change set for PR #1109 is pretty broad, and as a result it is difficult to review and merge the PR all in one go. I would suggest that we split the changes into multiple smaller PRs, so that the changes can be incremental with the goal of eventually supporting no-std.
Based on the changes in PR #1109, I'd suggest we have separate PRs for the following changes:
Full no-std support for ibc crate #1846
Tracking issue for no-std compliance for dependencies in ibc-rs and tendermint-rs #1359
Full support of no_std in
ibc
crate #1390Full support of no_std in
tendermint
crate tendermint-rs#988Separate generated code from
prost
andtonic
inproto-compiler
cosmos/ibc-proto-rs#7Move out
tendermint::config
totendermint-config
crate tendermint-rs#986Split out verifier parts of
tendermint-light-client
to a separate no_std compliant crate tendermint-rs#1027Remove use of
Time::now()
inibc
crate #1612Add
--build-tonic
flag to proto-compiler, sync protobuf script, and generate protobuf for std and no_std mode #1439tendermint-proto
usesstd
features in dependencies tendermint-rs#981Use
core
andalloc
crates forno_std
compatibility (Take 2) tendermint-rs#993Move
config
module out fromtendermint
into its own crate tendermint-rs#983url
crate used bytendermint
does not support no_std tendermint-rs#985tendermint
crate usesstd
features ined25519-dalek
tendermint-rs#992Use
flex-error
to define error types (Use flex-error to define errors #988)anomaly
for fine grained error handling. While not directly related to no-std, the PR removes majority use ofstd::error::Error
and allows different error tracers such asanyhow
,eyre
, or naiveStringTracer
to be used, depending on their support in no-std environment.Use
core
andalloc
crates in place ofstd
crate whenever possible (Usecore
andalloc
crates forno_std
compatibility #1156)core
andalloc
can be accessed by both std and no-std code, and therefore do not require feature flag to switch between importing fromcore
/alloc
orstd
.alloc
in std mode, we just have to add anextern crate alloc
in the root module, and that is automatically linked by Rust in std mode.std
that are not available incore
noralloc
. In that case, the PR leaves the use ofstd
in those cases, and have them fixed in follow up PRs.core
andalloc
can be done in a separate PR independent of other changes. While we cannot ensure that the change covers everything, this will reduce the number of changes required in subsequent PRs and make it easier for review.Use a wrapper struct for
Box<dyn std::error::Error>
for remaining errors not updated by Use flex-error to define errors #988.Box<dyn std::error::Error>
, however there are still a few places remaining that are still usingstd::error::Error
.no-std
support toibc
#1109 attempts to polyfillstd::error::Error
by aliasing it to aDummyError
struct in no-std mode. However doing so does not prevent dependencies from constructingBox<dyn std::error::Error>
, which would prevent no-std from being supported. On the other hand, if we have control of all places that produceBox<dyn std::error::Error>
, we can also modify them to return something other thanBox<dyn std::error::Error>
.LegacyError
, which is either a newtype wrapper toBox<dyn std::error::Error>
in std mode, or a newtype wrapper toString
in no-std mode. By always using a newtype wrapper, we can avoid accidental implicit coercion fromBox<dyn std::error::Error>
toLegacyError
in std mode, which will prevent no-std mode to work.LegacyError
. The purpose is to be able to test the two modes ofLegacyError
without fully activating no-std.AddUse flex-error to define errors #988, or a follow up PR tono-std
support toibc
#1109AddUse flex-error to define errors #988. It is also possible to make this change against master, although there will be much more changes needed.no-std
support toibc
#1109std::error::Error
are now removed.Find alternative crates that replace missing functionalities in
core
andalloc
.SystemTime
that are provided bystd
, but not provided bycore
noralloc
.no-std
support toibc
#1109 attempts to polyfill the types likeSystemTime
inside no-std mode. However this makes it difficult to maintain two version of the code depending on the std/no-std mode.chrono::DateTime
directly instead ofSystemTime
. If we can, then it would reduce our burden of having to maintain the code in different modes.Update
Cargo.toml
to use updated dependencies that have been published and support no-std, includingtendermint-rs
crates.no-std
support toibc
#1109 has a[patch.crates-io]
section that refers to upstream dependencies liketendermint-rs
that are also being patched to support no-std. This makes it difficult to review and merge the PR, because we cannot easily see what is being changed in the upstream dependencies. Even if the reviews pass, the PR cannot be merged because we cannot publish Cargo crates with git dependencies inside.Add Cargo feature flags to activate
#![no_std]
.#![no_std]
is enabled.#![no_std]
.#![no_std]
for ibc-proto crate #1164,#![no_std]
alone is still not sufficient for true no-std support, as dependencies may still usestd
behind the scene. The current known way to verify for true no-std support is to compile the crate with the targetwasm32-unknown-unknown
.For Admin Use
The text was updated successfully, but these errors were encountered: