Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

add VersionedRuntimeUpgrade to kitchensink runtime #14785

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

brunopgalvao
Copy link

No description provided.

Comment on lines 25 to 26
#![cfg(all(feature = "experimental", feature = "try-runtime"))]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#![cfg(all(feature = "experimental", feature = "try-runtime"))]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remove that line I get:

Compiling kitchensink-runtime v3.0.0-dev (/home/bruno/src/substrate/bin/node/runtime)
error: failed to run custom build command for `kitchensink-runtime v3.0.0-dev (/home/bruno/src/substrate/bin/node/runtime)`

Caused by:
  process didn't exit successfully: `/home/bruno/src/substrate/target/debug/build/kitchensink-runtime-b16098d4b7703ca7/build-script-build` (exit status: 1)
  --- stdout
  Information that should be included in a bug report.
  Executing build command: RUSTFLAGS="-C target-cpu=mvp -C target-feature=-sign-ext -C link-arg=--export-table -Clink-arg=--export=__heap_base -C link-arg=--import-memory  " SKIP_WASM_BUILD="" "/home/bruno/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/home/bruno/src/substrate/target/debug/wbuild/kitchensink-runtime/Cargo.toml" "--color=always" "--profile" "release"
  Using rustc version: rustc 1.70.0 (90c541806 2023-05-31)

@paritytech-cicd-pr
Copy link

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
Copy link
Author

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:

pallet_nomination_pools::migration::v2::MigrateToV2<Runtime>,
pallet_alliance::migration::Migration<Runtime>,
pallet_contracts::Migration<Runtime>,
VersionCheckedMigrateV1ToV2<T, ()>,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generic <T> is not found in this scope.

@liamaharon
Copy link
Contributor

liamaharon commented Aug 18, 2023

Oops, that looks like a mistake in the docs.

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

@brunopgalvao
Copy link
Author

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
Copy link
Author

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
Copy link
Contributor

liamaharon commented Aug 18, 2023

Try installing with --locked

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants