-
Notifications
You must be signed in to change notification settings - Fork 211
Conversation
@@ -6,7 +6,7 @@ Now you are ready to compile and run your node that has been enhanced with nickn | |||
from the Nicks pallet. Compile the node in release mode with: | |||
|
|||
```bash | |||
cargo build --release | |||
WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo build --release |
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.
All these tutorials use 2.0.0?
You should use a nightly that is around the release of 2.0.0.
And we should also mention which version should be installed for the tutorials.
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.
Yes, all our tutorials are on v2.0.0 🎉 Furthermore, each tutorial (including this one) mentions the specific version of Substrate/the Node Template on which it is built ✔️
Can you recommend a specific nightly? I was under the impression that 2020-10-05 was "the right" one to use w/ v2.0.0. Is this incorrect? Is there a compelling reason to move to another nightly? I have been specifying 2020-10-05 for a while now and I would prefer not to change things if it's not necessary.
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.
If that works it is okay, but there was some other nightly that broke the compilation in between as well and I think it was before october.
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 believe we have constantly been referencing 2020-10-05 with success and no one reporting issues afaik @danforbes @bkchr
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 did not go through the whole file but it just overwrites all changes I made. Not sure why it should be on me to resolve merge conflicts when my PR merged way earlier.
# Add the rust compiler and other tools to your PATH. | ||
# Make sure to add this to your shell startup script, too. | ||
# Configure |
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.
Why?
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 do not think it's necessary to dive into the details of what this does. Furthermore, I don't believe it's necessary to add this to the startup script.
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 source that file manually in every terminal you want to use rust?
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.
Sorry I just realized I never responded to this comment. I'm not sure if the installation scripts have been updated or something but it's no longer necessary to manually add the command to the shell startup script. I have not added such a command, nor do I need to source the file manually in ever terminal. I reviewed all the installation instructions for Rustup that I could find and I was not able to see this listed anywhere as a requirement https://rust-lang.github.io/rustup/installation/index.html
[`nightly` builds](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) to allow | ||
compiled substrate compatible runtimes to Wasm. | ||
[`nightly` builds](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) to allow you to | ||
compile Rust code to the Wasm target. |
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 compile Rust code without nightly to Wasm. It is the substrate runtime that requires nightly because of design decisions we made: paritytech/substrate#1252
Because the nightly toolchain is a moving target and receives daily changes the chance | ||
that some of them break the substrate build from time to time is non-negligible. | ||
|
||
Therefore it is advised to use a fixed nightly version rather than the latest one to | ||
build the runtime. You can install a specific version using this command: | ||
Developers that are building _with_ Substrate (as opposed to the developers building Substrate | ||
_itself_) should use a specific Rust nightly version that is known to be compatible with the version |
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.
This distinction of with and itself is confusing to me. There is no technical difference. For that reason I specifically removed it.
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.
Substrate master moves with the nightly versions, this means if a future version breaks something we fix it on master. This often makes Substrate master fail to compile with an older nightly. So, if you are using Substrate 2.0.0 they should use a specific nightly version. However, if you develop on Substrate master you will probably need to update your nightly regularly.
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.
So then we should write that instead. Working with master vs. working with a release. You need to tell people the why or they will ignore your advice.
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 write whatever you want, people will still ignore it xD :D
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.
yes I agree with @athei the distinction is confusing and just creates more questions than answers.
If you want to build the runtime with the latest nightly compiler which should **generally** be | ||
possible you can install the unspecific `nightly` toolchain: | ||
Developers that are building Substrate _itself_ should always uses the latest bug-free versions of | ||
Rust stable and nightly. To ensure your Rust compiler is always up to date, you should run: |
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.
Same as above
happy to look this over once all the modifications are made and do a final edit @danforbes |
Not on you whatsoever, @athei. As I mentioned here #739 (comment) my apologies for missing the original PR. I appreciate your contributions but it's important that the people who are maintaining this document and the resources that it supports feel comfortable with the approach that is taken. |
Can you incorporate what Basti said to explain why this distinction between build with and on substrate? |
* Update index.md minor modification to clarify objects of install
[`nightly` builds](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) to allow you to | ||
compile Substrate runtime code to the Wasm target. There is | ||
[a GitHub Issue](https://github.com/paritytech/substrate/issues/1252) that describes this | ||
requirement in detail. |
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 might suggest removing the citation for #1252 here unless you feel its such an FAQ this optimizes the set up time
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.
Completely agree
and | ||
[Makefile](https://github.com/substrate-developer-hub/substrate-node-template/blob/master/Makefile) | ||
to specify the Rust nightly version and encapsulate the following steps. Use Rustup to install the | ||
correct nightly: | ||
|
||
```bash | ||
rustup install nightly-<yyyy-MM-dd> |
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.
at the time of writing 2020-11-17, the current default nightly which compiles is 2020-10-05
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 don't want to add this because it creates the question: "the current default nightly that compiles with what?"
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.
It may be good idea to mention how to find the correct nightly for any case. You mention how to do it in Pokadot but why not mention that a way to find out is to take a look to the date of the release and use that date in the nightly-<date of release>
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.
From my POV that gets too deeply into supporting other projects. We need to be very careful about what we are documenting here. We are trying to teach people the best practices for working with Substrate code. I think that at this time it is very important to use a well-known nightly version that corresponds with whatever project you are using. I do not want to encourage people to release Substrate-based code without specifying an exact nightly to use, nor do I want to encourage our users to try to "guess" which nightly they should use. This is definitely an area where I am deciding not to document every possible technical detail in order to encourage people to follow what I believe we should set up as best practice.
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 agree with almost everything except.
encourage our users to try to "guess" which nightly they should use
I think that this a good to have as a way to troubleshoot. In the back it happens all the time, your machine doesn't has the same nightly as mine because we update at different time. My point is that it is a rule of thumb to get the date of the release and use it for nightly. I'm not talking about other projects I referring to every time we have a Substrate release.
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.
Nope, it could go there but it isn't covered. It would be suggesting them to use a very specific date which will work in 99.9999% of the cases. Substrate 2.0 was release in September 22 so using nightly-2020-09-22
will work for them.
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.
No I'm sorry that is just not something I am comfortable supporting at this time.
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 don't get why not. There is no reason for not doing it. It is correct to do it and will prevent us explaining the same thing every time or adding a lot of patches as you have been doing. Please give a good justification for not doing it.
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.
Just saying that you are not comfortable with something that doesn't requires support isn't a valid justification.
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 would say I provided that justification in my previous comment #772 (comment) I don't feel comfortable setting a precedent that the Knowledge Base provides general support for any or all Substrate-based projects. I don't even really feel comfortable with the Knowledge Base having these instructions at all. I really believe this information belongs with the Node Template. I do not think it is good practice for a Substrate-based project to make a release without specifying the nightly it builds with, so therefore I do not feel comfortable providing any type of support or advice for these cases. It is "undefined behavior". That is my justification for not feeling comfortable supporting this.
rustup target add wasm32-unknown-unknown --toolchain nightly | ||
``` | ||
|
||
This toolchain is not tied to a specific version and will be updated just as the | ||
`stable` toolchain: | ||
**It may be necessary to occasionally rerun `rustup update`** if a change in the upstream 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.
Id remove this comment as again it creates more questions than answers and by the time people need to rerun rustup update
I hope they are far enough into the community that this is a known req at times
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 think this is something that the core developers have asked that we keep in the docs in order to help with some common questions they receive. I hear what you're saying for sure and I do think it's important we don't get too into the weeds in this doc, but given the above and the fact that this statement seems like it logically dovetails with the preceding statement I think I'm going to leave it at this time.
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.
Seems fine to me, left a question.
Note that this builds only the runtime with the specified toolchain. The rest of project will | ||
be compiled with your default toolchain, which is usually the latest installed stable toolchain. |
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.
Why remove this, it seems like helpful info for this context?
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.
All the SKIP_WASM_BUILD
should have a value either 1
or true
and | ||
[Makefile](https://github.com/substrate-developer-hub/substrate-node-template/blob/master/Makefile) | ||
to specify the Rust nightly version and encapsulate the following steps. Use Rustup to install the | ||
correct nightly: | ||
|
||
```bash | ||
rustup install nightly-<yyyy-MM-dd> |
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.
It may be good idea to mention how to find the correct nightly for any case. You mention how to do it in Pokadot but why not mention that a way to find out is to take a look to the date of the release and use that date in the nightly-<date of release>
Co-authored-by: Ricardo Rius <[email protected]>
Depends on https://github.com/substrate-developer-hub/substrate-node-template/pull/105