paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

add `VersionedRuntimeUpgrade` to kitchensink runtime #14785

Open brunopgalvao opened 1 year ago

paritytech-cicd-pr commented 1 year ago

The CI pipeline was cancelled due to failure one of the required jobs. Job name: cargo-check-benches Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3413748

brunopgalvao commented 1 year ago

With the current code, I am getting the following:

Compiling kitchensink-runtime v3.0.0-dev (/home/bruno/src/substrate/bin/node/runtime)
  error[E0412]: cannot find type `T` in this scope
      --> /home/bruno/src/substrate/bin/node/runtime/src/lib.rs:2013:30
       |
  2013 |     VersionCheckedMigrateV1ToV2<T, ()>,
       |                                 ^ not found in this scope

  error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
      --> /home/bruno/src/substrate/bin/node/runtime/src/lib.rs:2005:43
       |
  2005 |         pallet_nomination_pools::migration::v2::VersionUncheckedMigrateV1ToV2<T, I>,
       |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    - help: remove this generic argument
       |                                                 |
       |                                                 expected 1 generic argument
       |
  note: struct defined here, with 1 generic parameter: `T`
      --> /home/bruno/src/substrate/frame/nomination-pools/src/migration.rs:197:13
       |
  197  |     pub struct VersionUncheckedMigrateV1ToV2<T>(sp_std::marker::PhantomData<T>);
       |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -

I am getting caught up with the generics here. Trying to follow the setup described here:

liamaharon commented 1 year ago

Oops, that looks like a mistake in the docs.

Try replacing T with Runtime and remove the (), I'll fix docs soon.

brunopgalvao commented 1 year ago

Oops, that looks like a mistake in the docs.

Try replacing T with Runtime and remove the (), I'll fix docs soon.

Worked! I will test the migration now. Thanks!!

brunopgalvao commented 1 year ago

Getting try-runtime to build with the node is creating issues:

bruno@polkadot ~/src/substrate
 % cargo b -r -p node-cli --features=try-runtime
    Finished release [optimized] target(s) in 0.52s
bruno@polkadot ~/src/substrate
 % ./target/release/substrate try-runtime
Error: Input("TryRuntime wasn't enabled when building the node. You can enable it with `--features try-runtime`.")
bruno@polkadot ~/src/substrate
 % cargo b -r  -p kitchensink-runtime --features=try-runtime
   Compiling kitchensink-runtime v3.0.0-dev (/home/bruno/src/substrate/bin/node/runtime)
    Finished release [optimized] target(s) in 55.22s
bruno@polkadot ~/src/substrate
 % ./target/release/substrate try-runtime                   
Error: Input("TryRuntime wasn't enabled when building the node. You can enable it with `--features try-runtime`.")

Any idea what I could be doing wrong?

Also, tried using the standalone CLI:

cargo install --git https://github.com/paritytech/try-runtime-cli
    Updating git repository `https://github.com/paritytech/try-runtime-cli`
  Installing try-runtime-cli v0.1.0 (https://github.com/paritytech/try-runtime-cli#6291264e)
    Updating crates.io index
    Updating git repository `https://github.com/paritytech/substrate`
    Updating git repository `https://github.com/w3f/ring-vrf`
    Updating git repository `https://github.com/w3f/fflonk`
    Updating git repository `https://github.com/w3f/ring-proof`
  Downloaded httpdate v1.0.3
.....
Compiling sc-executor v0.10.0-dev (https://github.com/paritytech/substrate?branch=master#94be94be)
error[E0433]: failed to resolve: could not find `StaticSecret` in `x25519_dalek`
  --> /home/bruno/.cargo/git/checkouts/substrate-7e08433d4c370a21/94be94b/primitives/statement-store/src/ecies.rs:74:35
   |
74 |     let ephemeral_sk = x25519_dalek::StaticSecret::new(OsRng);
   |                                      ^^^^^^^^^^^^
   |                                      |
   |                                      could not find `StaticSecret` in `x25519_dalek`
   |                                      help: a struct with a similar name exists: `SharedSecret`

error[E0433]: failed to resolve: could not find `StaticSecret` in `x25519_dalek`
   --> /home/bruno/.cargo/git/checkouts/substrate-7e08433d4c370a21/94be94b/primitives/statement-store/src/ecies.rs:126:29
    |
126 |     let secret = x25519_dalek::StaticSecret::from(hash);
    |                                ^^^^^^^^^^^^
    |                                |
    |                                could not find `StaticSecret` in `x25519_dalek`
    |                                help: a struct with a similar name exists: `SharedSecret`

error[E0412]: cannot find type `StaticSecret` in crate `x25519_dalek`
   --> /home/bruno/.cargo/git/checkouts/substrate-7e08433d4c370a21/94be94b/primitives/statement-store/src/ecies.rs:28:36
    |
28  | pub type SecretKey = x25519_dalek::StaticSecret;
    |                                    ^^^^^^^^^^^^ help: a struct with a similar name exists: `SharedSecret`
    |
   ::: /home/bruno/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x25519-dalek-2.0.0/src/x25519.rs:275:1
    |
275 | pub struct SharedSecret(pub(crate) MontgomeryPoint);
    | ----------------------- similarly named struct `SharedSecret` defined here

Some errors have detailed explanations: E0412, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `sp-statement-store` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `try-runtime-cli v0.1.0 (https://github.com/paritytech/try-runtime-cli#6291264e)`, intermediate artifacts can be found at `/tmp/cargo-installXJcplS`
liamaharon commented 1 year ago

Try installing with --locked

cargo install --git https://github.com/paritytech/try-runtime-cli --locked