-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Compile the wasm runtime with a stable toolchain #1252
Comments
The alloc crate is on the course of stabilization: PR |
alloc crate is stabilized by the way |
The biggest offenders for this are actually not in Substrate, but dependencies such as |
|
* Bump versions, tweak deposit costs. * Version * Lock * Make test work ok when numbers are not round. * Bump Substrate * Lock
What about dropping Given that using nightly creates a a lot of friction and support overhead that might worth a shot. |
Thanks. Question is if those points are still valid a year later. I am just wondering how using a nightly only feature (whose definition is to be unstable) is considered more stable than using a stable compiler. I see that this nasty std = native assumption would making the switch very painful, though. |
I raised this question recently on a retreat, although with different reasons. The main concern in our discussion was the resulting binary size, and then the discussion spiraled into other realms. I was of opinion that there should be a minor increase in binary size which should be fine. I never checked though. An argument against I heard back is that we are still changing nightlies every now and then because something breaks, or something. But I am not sure if I buy this argument. I am pretty sure that all our stuff works on many previous stable compiler versions. As to Wei's list,
The biggest problem from the list is that the libstd is available and will panic on unsupported operations. Although I think it's unlikely, but still not impossible, e.g. that some crate dependency tries to spawn a thread. I don't see a plausible way to check that without going to inspect MIR or something alike. On the other hand, I think one would need to put a lot of effort in order to accidentally get such an issue even on a testnet: that implies no inspection and no testing. That said, I think it is very unlikely that we get |
With LTO enabled unused functionality should be removed effectively. I also don't expect a huge impact. It mainly gets huge when using the included memory allocator which we will not.
I agree. Using a proper feature was always the right thing to do that. It is just that this fact will add a lot of code churn to the transition. But still more of a mechanical change than something difficult.
We could still avoid |
(My point is that I don't see a big reason to avoid |
I get that. However, buying into your point is not necessary for using std. We can still continue to not use it. |
Yeah, that takes into account effects of LTO. The problem is that the libstd builds use some additional machinery (IIRC, it was around panics). Also, perhaps related. There were discussions about introducing a custom target. #4225 |
@pepyakin should this be closed or moved? |
Nope, still relevant. |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
So Should we use stable toolchain for compilation or still nightly? |
It is still nightly. There is no stable way to use |
This is not more than a workaround but note that you may use stable if you really need/want to, as long as you also use |
rust-lang/rust#66741 was just closed. We may have stable runtime builds soon. |
1.67 this should be included then? What actions are needed on ops and tooling to move to stable once once it is?
|
wasmbuilder needs to be changed to use a stable toolchain instead of defaulting to the latest installed nightly compiler. We still use nightly for rustfmt. This is also executed inside the CI. So purging nightly from all our CI images is not possibly unless we are willing to move to stable rustfmt (and losing some formatting rules). |
Loosing the odd formatting rule seems a small price to pay tbh. I don't think that should hold us back. |
Rust 1.67 landed. We can compile the runtime with stable now if we use the default @koute Can we remove this error from the alloc error handler for the sake of compiling with stable? Maybe we can put the logging into the client side allocator? It can write a log when it can't fulfil a memory request which should lead to an panic. |
We can remove it. The feature isn't currently active and oom should be detected by our allocator anyway on the host side. Not sure if this is even triggered somehow. |
Apparently it is not in 1.67. I thought since it was merged mid December it should be in this release. |
Yeah that's fine. As Basti said, I'm not entirely sure if it's actually possible to trigger it. That callback is called by the |
Great. Thanks for the explanation. In that case the handler should never called indeed. Then I do this a as soon as a stable version with this is released. |
I prepared a new A build can be tested from this workflow with a manual start (workflow dispatch) and some input similar to what is shown below: The most import being to use the proper Docker image: |
Didn't we just discover that it doesn't work with 1.67? |
I missed that part @athei. I can update and make a new image with 1.68 or whenever it lands so we can test and confirm. |
Now, rust 1.68 has been released. |
Nice. I will make a PR. @chevdor can you prepare an image with the new stable version? |
I have created another version (hadn't seen your pr, but also started earlier) that is fully backwards compatible: #13580 |
@athei yep I started already and found an issue in srtool, which is now fixed and merged. |
Closed mine. I think your non breaking version makes more sense for the transition. |
We require nightly compiler for building the wasm runtime. The main reason for that is several important features was available only on the nightly compilers.
However, as the time progresses more and more features are promoted to stable.
std::arch::wasm32::unreachable
(tracking issue)core_intrinsics
(trie/hash-db, not sure why)alloc_error_handler
becoming panic by default (tracking issue, formelly this)The text was updated successfully, but these errors were encountered: