rusty-crewmates / substrate-tutorials

A collection of exercices to teach yourself Substrate
Apache License 2.0
131 stars 113 forks source link

Build fails due to old substrate-node-template version #36

Closed a-moreira closed 1 year ago

a-moreira commented 1 year ago

machine: aarch64-darwin

Just forked and cloned the repo and tried to the run the tests:

$ cargo t
...
   Compiling k256 v0.10.4
   Compiling num-rational v0.4.1
   Compiling num-complex v0.4.2
   Compiling approx v0.5.1
   Compiling rawpointer v0.2.1
   Compiling frame-support-procedural-tools v4.0.0-dev (https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.22#616d33ea)
   Compiling matrixmultiply v0.3.2
   Compiling nalgebra-macros v0.1.0
   Compiling primitive-types v0.11.1
error[E0603]: module `group` is private
   --> /Users/afm/.cargo/git/checkouts/substrate-7e08433d4c370a21/616d33e/frame/support/procedural/tools/src/syn_ext.rs:50:53
    |
50  |                 let syn::group::$name { token, content } = syn::group::$parse(input)?;
    |                                                                 ^^^^^ private module
    |
note: the module `group` is defined here
   --> /Users/afm/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.107/src/lib.rs:308:1
    |
308 | mod group;
    | ^^^^^^^^^

error[E0603]: module `group` is private
   --> /Users/afm/.cargo/git/checkouts/substrate-7e08433d4c370a21/616d33e/frame/support/procedural/tools/src/syn_ext.rs:50:14
    |
50  |                 let syn::group::$name { token, content } = syn::group::$parse(input)?;
    |                          ^^^^^ private module
    |
note: the module `group` is defined here
   --> /Users/afm/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.107/src/lib.rs:308:1
    |
308 | mod group;
    | ^^^^^^^^^

For more information about this error, try `rustc --explain E0603`.
error: could not compile `frame-support-procedural-tools` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

--

I've seen this error before when building older versions of Substrate. I can fix this by upgrading version to polkadot-v0.9.28 in the exercises.

a-moreira commented 1 year ago

@tdelabro I created a PR here to do this https://github.com/rusty-crewmates/substrate-tutorials/pull/37

tdelabro commented 1 year ago

Thanks a lot @a-moreira ! It's merged

tdelabro commented 1 year ago

Closed by #37

Haider-Ali-DS commented 1 year ago

@a-moreira which substrate-node-template version we will use with this polkadot-v0.9.28 i tried latest and polkadot-v0.9.28 one and it give me errors.

error[E0412]: cannot find type `String` in this scope
    --> /home/haider/.cargo/git/checkouts/substrate-7e08433d4c370a21/ce10b9f/primitives/finality-grandpa/src/lib.rs:43:2
     |
  43 |     app_crypto!(ed25519, GRANDPA);
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
     |
     = note: this error originates in the macro `$crate::app_crypto_pair_functions_if_std` which comes from the expansion of the macro `app_crypto` (in Nightly builds, run with -Z macro-backtrace for more info)
  help: consider importing one of these items
     |
  42 |     use alloc::string::String;
     |
  42 |     use codec::alloc::string::String;
     |
  42 |     use scale_info::prelude::string::String;
     |

  Some errors have detailed explanations: E0412, E0433.
  For more information about an error, try `rustc --explain E0412`.

i was trying runtime exercise but seems to be stucked here.

a-moreira commented 1 year ago

@Haider-Ali-DS can you share the steps you took so I can reproduce the error here? I tried checking, building and testing the ex02-runtime exercise (on the plain main branch) and it worked normally here.

tdelabro commented 1 year ago

@Haider-Ali-DS You are supposed to use the substrate-node-template version that exist on the repo as a git sub-repository. I upgraded it to v0.9.28 just after I merged @a-moreira PR.

Haider-Ali-DS commented 1 year ago

@a-moreira @tdelabro yeah i have cloned that into respective folder i also checked out my substrate-node-template to 0.9.28 version. i think issue is something else then. first of all i was having some issue related to js features wasm while building substrate. after that i added this crate in dependencies of substrate

getrandom = {version = "0.2", default-features = false, features = ["custom"]}

and from there i started to have this app_crypto! issue

tdelabro commented 1 year ago

the js issue appears when a crate is imported without default-feature = false in a wasm environment. Adding getrandom won't solve anything.

I managed to reproduce it. I'm currently fixing it. Thanks a lot for signaling this issue

tdelabro commented 1 year ago

I pushed the fix to main just now. Please try again :)