Git Product home page Git Product logo

substrate-parachain-template's Introduction

Substrate Cumulus Parachain Template

A new Cumulus-based Substrate node, ready for hacking โ˜๏ธ..

This project is originally a fork of the Substrate Node Template modified to include dependencies required for registering this node as a parathread or parachain to a relay chain.

The stand-alone version of this template is hosted on the Substrate Devhub Parachain Template for each release of Polkadot. It is generated directly to the upstream Parachain Template in Cumulus at each release branch using the Substrate Template Generator.

๐Ÿ‘‰ Learn more about parachains here, and parathreads here.

๐Ÿง™ Learn about how to use this template and run your own parachain testnet for it in the Devhub Cumulus Tutorial.

substrate-parachain-template's People

Contributors

brunopgalvao avatar davidrhodus avatar dependabot[bot] avatar johnwhitton avatar joshorndorff avatar juniuszhou avatar nuke-web3 avatar paritytech-ci avatar riusricardo avatar satoshi-kusumoto avatar shawntabrizi avatar stanly-johnson avatar tripleight avatar whalelephant avatar xrelkd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

substrate-parachain-template's Issues

Thread 'main' panicked at 'Missing para_id' (when attempting to build-spec for parachain-collator)

Hi, when following along to the README the compiler panics when attempting to build the chain-spec for the collator node. Please find my console log below.

`samuelgoodenough@Samuels-MBP substrate-parachain-template % ./target/release/parachain-collator build-spec --disable-default-bootnode > ./resources/template-local-plain.json

====================

Version: 3.0.0-cdc5e5e-x86_64-macos

0: backtrace::backtrace::trace
1: backtrace::capture::Backtrace::new
2: sp_panic_handler::set::{{closure}}
3: std::panicking::rust_panic_with_hook
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:595:17
4: std::panicking::begin_panic_handler::{{closure}}
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:497:13
5: std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:141:18
6: rust_begin_unwind
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
7: core::panicking::panic_fmt
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
8: core::option::expect_failed
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/option.rs:1241:5
9: sc_cli::config::CliConfiguration::create_configuration
10: sc_cli::runner::Runner::new
11: parachain_collator::main
12: std::sys_common::backtrace::__rust_begin_short_backtrace
13: std::rt::lang_start::{{closure}}
14: core::ops::function::impls::<impl core::ops::function::FnOnce for &F>::call_once
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/ops/function.rs:259:13
std::panicking::try::do_call
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:379:40
std::panicking::try
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:343:19
std::panic::catch_unwind
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panic.rs:431:14
std::rt::lang_start_internal
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/rt.rs:34:21
15: _main

Thread 'main' panicked at 'Missing para_id', node/src/command.rs:68

This is a bug. Please report it at:

    https://github.com/substrate-developer-hub/substrate-parachain-template/issues/new`

Cheers, Sam

Check error: the trait `StateBackend<BlakeTwo256>` is not implemented for

I follow the cumulus-workshop, when I pull this template and run cargo check, I got:

error[E0277]: the trait bound `<impl Backend<PBlock> as sc_client_api::Backend<sp_runtime::generic::Block<sp_runtime::generic::Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::State: StateBackend<BlakeTwo256>` is not satisfied
   --> /Users/admin/.cargo/git/checkouts/cumulus-59522f43471fa161/f511757/primitives/parachain-inherent/src/client_side.rs:205:27
    |
205 |         polkadot_backend: &impl Backend<PBlock>,
    |                                 ^^^^^^^^^^^^^^^ the trait `StateBackend<BlakeTwo256>` is not implemented for `<impl Backend<PBlock> as sc_client_api::Backend<sp_runtime::generic::Block<sp_runtime::generic::Header<u32, BlakeTwo256>, OpaqueExtrinsic>>>::State`

   ::: /Users/admin/.cargo/git/checkouts/substrate-7e08433d4c370a21/e84d2ae/client/api/src/backend.rs:404:17
    |
404 |     type State: StateBackend<HashFor<Block>> + Send;
    |                 ---------------------------- required by this bound in `sc_client_api::Backend`
    |
help: introduce a type parameter with a trait bound instead of using `impl Trait`
    |
202 |     pub fn create_at<PClient, B: Backend<PBlock>>(
203 |         relay_parent: PHash,
204 |         polkadot_client: &PClient,
205 |         polkadot_backend: &impl Backend<PBlock>,
206 |         validation_data: &PersistedValidationData,
207 |         para_id: ParaId,
  ...

error: aborting due to 2 previous errors

no matching package named `cumulus-pallet-xcm-handler` found

no matching package named cumulus-pallet-xcm-handler found

    Updating crates.io index
    Updating git repository `https://github.com/paritytech/cumulus.git`
    Updating git repository `https://github.com/paritytech/substrate.git`
    Updating git repository `https://github.com/paritytech/polkadot`
error: no matching package named `cumulus-pallet-xcm-handler` found
location searched: https://github.com/paritytech/cumulus.git?branch=rococo-v1

Collator not producing Blocks

After following the README set up instructions, the collator wasn't producing blocks.

The reason is I was running the compiled code without optimizations in debug mode.

2021-09-13 14:46:31 [Parachain] โŒ›๏ธ Discarding proposal for slot 135961432; block production took too long    
2021-09-13 14:46:31 [Parachain] ๐Ÿ‘‰ Recompile your node in `--release` mode to mitigate this problem.

Maybe it is worth mentioning it in the README.md as a heads up?

Using `pallet-contracts` with parachain template

I am upgrading my project from the substrate-node-template to the substrate-parachain-template.

I removed by changes for off-chain extensions and am starting with porting just pallet-contracts to support ink!.

The contracts pallet tutorial has been upgraded to support v4.0.0 but the parachain template is still using v3.0.0 dependencies. To resolve an issue resolving parity-util-mem when copying the tutorial code as is, I only needed to update the runtime config code to support v3.0.0. I was able to get the project compiling but without any of the RPC steps from the tutorial.

I've now started one collator (Alice) and used the local node identity printed there to start one validator (Bob).

Screen Shot 2021-08-16 at 8 26 55 AM

Which of the WebSocket ports should I connect to upload & instantiate contracts?

I eventually found a port (8844) where the 'Contracts' tab would show. However, uploading & instantiating a compiled ink contracts hangs on the 'ready' message.

Screen Shot 2021-08-16 at 8 32 30 AM

I have the web console debugger open yet don't see any error messages there.

Do I need to add the RPC segments from the tutorial to the parachain template service somehow? Am I starting the validator + collator correctly (who's bootnode, etc.)? Any way to see more logging underthehood?

Cheers

Parachain collator node not producing blocks

Hello,

I have compiled Polkadot v0.9.9 and followed the steps in the cumulus workshop.

  1. Run a 2-validator polkadot cluster.
./target/release/polkadot \
--alice \
--validator \
--base-path /tmp/relay/alice \
--chain ./rococo-custom-2-raw.json \
--port 30334 \
--ws-port 9944

and

./target/release/polkadot \
--bob \
--validator \
--base-path /tmp/relay/bob \
--chain ./rococo-custom-2-raw.json \
--port 30335 \
--ws-port 9955
  1. Export genesis and wasm using parachain-collator.
./target/release/parachain-collator export-genesis-wasm > para-2000-wasm
./target/release/parachain-collator export-genesis-state --parachain-id 2000 > para-2000-genesis
  1. Register paraId
  2. Use paraSudoWrapper to register parachain
  3. Use rococo-custom-2-raw.json for a 2 parachain collators set.
  4. Run 2 collators
./target/release/parachain-collator \
--alice \
--collator \
--force-authoring \
--parachain-id 2000 \
--base-path /tmp/parachain/alice \
--port 30336 \
-l debug \
-- \
--execution wasm \
--chain ~/Parity/polkadot/rococo-custom-2-raw.json \
--ws-port 9945

and

./target/release/parachain-collator \
--bob \
--collator \
--force-authoring \
--parachain-id 2000 \
--base-path /tmp/parachain/bob \
--port 30337 \
-l debug \
-- \
--execution wasm \
--chain ~/Parity/polkadot/rococo-custom-2-raw.json \
--ws-port 9946

  1. Once the parachain is onboarded, the collator nodes would not produce any blocks.
2021-08-31 10:51:14.680  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 4.9kiB/s โฌ† 3.9kiB/s
2021-08-31 10:51:14.692  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 3.4kiB/s โฌ† 3.0kiB/s
2021-08-31 10:51:19.680  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 1.6kiB/s โฌ† 0.8kiB/s
2021-08-31 10:51:19.693  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0.3kiB/s โฌ† 0.3kiB/s
2021-08-31 10:51:24.681  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 0.4kiB/s โฌ† 0.4kiB/s
2021-08-31 10:51:24.693  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0 โฌ† 0
2021-08-31 10:51:29.682  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 0.7kiB/s โฌ† 0.4kiB/s
2021-08-31 10:51:29.694  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0.3kiB/s โฌ† 0.3kiB/s
2021-08-31 10:51:34.683  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 0.5kiB/s โฌ† 0.5kiB/s
2021-08-31 10:51:34.694  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 32 B/s โฌ† 25 B/s
2021-08-31 10:51:39.683  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 40 B/s โฌ† 23 B/s
2021-08-31 10:51:39.695  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0 โฌ† 0
2021-08-31 10:51:44.683  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 1.0kiB/s โฌ† 0.8kiB/s
2021-08-31 10:51:44.695  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0.3kiB/s โฌ† 0.3kiB/s
2021-08-31 10:51:49.684  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 0 โฌ† 0
2021-08-31 10:51:49.696  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0 โฌ† 0
2021-08-31 10:51:54.684  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 0.4kiB/s โฌ† 0.4kiB/s
2021-08-31 10:51:54.696  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0 โฌ† 0
2021-08-31 10:51:59.685  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 0.3kiB/s โฌ† 0.3kiB/s
2021-08-31 10:51:59.697  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0.2kiB/s โฌ† 0.2kiB/s
2021-08-31 10:52:04.685  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 0.5kiB/s โฌ† 0.6kiB/s
2021-08-31 10:52:04.697  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0 โฌ† 0
2021-08-31 10:52:08.531  INFO tokio-runtime-worker sub-libp2p: [Relaychain] ๐Ÿ” Discovered new external address for our node: /ip6/::1/tcp/30344/ws/p2p/12D3KooWPgkRNPCudo8nh4xE9Pm5kPHLDtrwKZuH7FXVvjiuicDn
2021-08-31 10:52:09.686  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 0.5kiB/s โฌ† 0.7kiB/s
2021-08-31 10:52:09.697  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 0 โฌ† 0
2021-08-31 10:52:14.686  INFO tokio-runtime-worker substrate: [Relaychain] ๐Ÿ’ค Idle (0 peers), best: #0 (0xa24fโ€ฆ6a6c), finalized #0 (0xa24fโ€ฆ6a6c), โฌ‡ 0.8kiB/s โฌ† 0.6kiB/s
2021-08-31 10:52:14.698  INFO tokio-runtime-worker substrate: [Parachain] ๐Ÿ’ค Idle (1 peers), best: #0 (0x771bโ€ฆ0678), finalized #0 (0x771bโ€ฆ0678), โฌ‡ 49 B/s โฌ† 57 B/s

I noticed that alot of lines being logged look as follows:

2021-08-31 10:52:36.019 DEBUG tokio-runtime-worker parachain::approval-distribution: [Relaychain] Processing NewBlocks
2021-08-31 10:52:36.019 DEBUG tokio-runtime-worker parachain::approval-distribution: [Relaychain] Got new blocks [(0xa236750396fed2e8c2d38bb06e2d9754e235997fcfe2bbbc670b96e4aea433d8, 56)]
2021-08-31 10:52:36.019 DEBUG tokio-runtime-worker wasm-heap: [Relaychain] allocator being destroyed, max_total_size 1104, max_bumper 1230056
2021-08-31 10:52:36.021 DEBUG tokio-runtime-worker wasm_overrides: [Relaychain] No WASM override available for block BlockId::Hash(0xa236750396fed2e8c2d38bb06e2d9754e235997fcfe2bbbc670b96e4aea433d8), using onchain code

Remove `polkadot-cli` flags in `node/Cargo.toml`

# FIXME: You MUST set the relay chain networks you wish to target in the `features` here
# Options are found here: https://github.com/paritytech/polkadot/blob/master/cli/Cargo.toml#L64-L71
#
# Alternatively to setting here, you can use cargo CLI at build time:
# https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options
#
# ** Don't enable relay chains you don't need, as this is a **very** heavy build for no reason**
# More info: https://github.com/paritytech/polkadot/pull/3189
polkadot-cli = { git = 'https://github.com/paritytech/polkadot', branch = 'release-v0.9.6', features = [ "rococo-native" ] }

Need to confirm this is best practice, and if so, include documentation in the README and workshop

Add ability to target different relay chains via CLI

<@Taulepton:matrix.org> Dan Shields: when you say Rocovo open slots "fairly soon" is that on the order of days or weeks? I'm trying to assess if it's worth trying to deploy to chachacha.

I don't have a solid time, sorry. I would see no harm in testing on #chachacha:matrix.org , it should be rather simple to target your parachchain to both via CLI option and a custom chain spec
(like is done for dev vs local)

in fact, I would suggest such a configuration. try the behavior out to change between these maybe? would be curious to see what you discover is best. others here that have parachains deployed on multiple relays may have better advice too

you may need to consider the implications of "hot swapping" a collator between them... the base path may need to be adjusted accordingly for example

Add sensible default XCM config

The current XCM config in the template is mostly copied from the parachains in the cumulus repo (AFAICT):

impl Config for XcmConfig {
type Call = Call;
type XcmSender = XcmRouter;
// How to withdraw and deposit an asset.
type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToTransactDispatchOrigin;
type IsReserve = NativeAsset;
type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of UNIT
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call>;
type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;
type ResponseHandler = (); // Don't handle responses for now.
}

We probably want to default to a config that is more suitable for a community parachain (e.g. disallow teleports) and point out which things to adjust.

why do not open rpc function in this template

hello guys! I used this template to create my parachain, but when i connected my node by rpc, it did not works.

could you add the rpc.rs to this template in the next commit? thanks.

Compiling with benchmarking feature fails

After creating a pallet and adding some benchmarking code, executing:

cargo build --release --features runtime-benchmarks

Results the following compilation error:

  Compiling parachain-runtime v2.0.0 (/home/rakan/Enjin/efinity-dev/runtime)
   Compiling pallet-collective v3.0.0 (https://github.com/paritytech/substrate.git?branch=rococo-v1#645299e8)
   Compiling pallet-society v3.0.0 (https://github.com/paritytech/substrate.git?branch=rococo-v1#645299e8)
   Compiling rococo-runtime v0.8.29 (https://github.com/paritytech/polkadot?branch=rococo-v1#46c826f5)
   Compiling polkadot-node-core-bitfield-signing v0.1.0 (https://github.com/paritytech/polkadot?branch=rococo-v1#46c826f5)
   Compiling sc-finality-grandpa-warp-sync v0.9.0 (https://github.com/paritytech/substrate.git?branch=rococo-v1#645299e8)
   Compiling polkadot-approval-distribution v0.1.0 (https://github.com/paritytech/polkadot?branch=rococo-v1#46c826f5)
   Compiling polkadot-node-core-backing v0.1.0 (https://github.com/paritytech/polkadot?branch=rococo-v1#46c826f5)
   Compiling polkadot-node-core-provisioner v0.1.0 (https://github.com/paritytech/polkadot?branch=rococo-v1#46c826f5)
   Compiling polkadot-node-core-candidate-selection v0.1.0 (https://github.com/paritytech/polkadot?branch=rococo-v1#46c826f5)
   Compiling polkadot-statement-distribution v0.1.0 (https://github.com/paritytech/polkadot?branch=rococo-v1#46c826f5)
   Compiling polkadot-collator-protocol v0.1.0 (https://github.com/paritytech/polkadot?branch=rococo-v1#46c826f5)
   Compiling sc-cli v0.9.0 (https://github.com/paritytech/substrate.git?branch=rococo-v1#645299e8)
error[E0046]: not all trait items implemented, missing: `successful_origin`
   --> /home/rakan/.cargo/git/checkouts/substrate-7e08433d4c370a21/645299e/frame/collective/src/lib.rs:875:1
    |
875 | / impl<
876 | |     O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>,
877 | |     AccountId: Default,
878 | |     I,
...   |
891 | |     }
892 | | }
    | |_^ missing `successful_origin` in implementation
    |
    = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`
error[E0046]: not all trait items implemented, missing: `successful_origin`
   --> /home/rakan/.cargo/git/checkouts/substrate-7e08433d4c370a21/645299e/frame/collective/src/lib.rs:895:1
    |
895 | / impl<
896 | |     O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>,
897 | |     N: U32,
898 | |     AccountId,
...   |
912 | |     }
913 | | }
    | |_^ missing `successful_origin` in implementation
    |
    = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`
error[E0046]: not all trait items implemented, missing: `successful_origin`
   --> /home/rakan/.cargo/git/checkouts/substrate-7e08433d4c370a21/645299e/frame/collective/src/lib.rs:918:1
    |
918 | / impl<
919 | |     O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>,
920 | |     N: U32,
921 | |     D: U32,
...   |
936 | |     }
937 | | }
    | |_^ missing `successful_origin` in implementation
    |
    = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`
error[E0046]: not all trait items implemented, missing: `successful_origin`
   --> /home/rakan/.cargo/git/checkouts/substrate-7e08433d4c370a21/645299e/frame/collective/src/lib.rs:942:1
    |
942 | / impl<
943 | |     O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>,
944 | |     N: U32,
945 | |     D: U32,
...   |
960 | |     }
961 | | }
    | |_^ missing `successful_origin` in implementation
    |
    = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0046`.
error: could not compile `pallet-collective`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0046]: not all trait items implemented, missing: `successful_origin`
    --> /home/rakan/.cargo/git/checkouts/substrate-7e08433d4c370a21/645299e/frame/society/src/lib.rs:1155:1
     |
1155 | impl<T: Config> EnsureOrigin<T::Origin> for EnsureFounder<T> {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `successful_origin` in implementation
     |
     = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0046`.
error[E0046]: not all trait items implemented, missing: `successful_origin`
   --> /home/rakan/.cargo/git/checkouts/polkadot-4038f27d5e4ea2e8/46c826f/runtime/rococo/src/lib.rs:602:1
    |
602 | impl EnsureOrigin<Origin> for PriviledgedOrigin {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `successful_origin` in implementation
    |
    = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0046`.
error: build failed

As apparent, it seems like the implementation of successful_origin is missing from the rococo-v1 branch.

I checked substrate and it seems like this is already fixed on substrate's master:

https://github.com/paritytech/substrate/blob/9ed9f3a55a58265f53419e2b62f09c6b03652fa0/frame/collective/src/lib.rs#L961-L964

failed to run custom build command for `parachain-runtime v2.0.0

I forked the project.

git checkout -b cumulus-workshop

cargo build --release

I got error

  Compiling parachain-runtime v2.0.0 (/home/zb/Desktop/rust/substrate-parachain-template/runtime)
error: failed to run custom build command for `parachain-runtime v2.0.0 (/home/zb/Desktop/rust/substrate-parachain-template/runtime)`

Caused by:
  process didn't exit successfully: `/home/zb/Desktop/rust/substrate-parachain-template/target/release/build/parachain-runtime-8acca8e2cad25517/build-script-build` (exit code: 1)
  --- stdout
  Information that should be included in a bug report.
  Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/home/zb/Desktop/rust/substrate-parachain-template/target/release/wbuild/parachain-runtime/Cargo.toml" "--color=always" "--release"
  Using rustc version: rustc 1.54.0-nightly (625d5a693 2021-06-01)


  --- stderr
     Compiling proc-macro2 v1.0.26
     Compiling unicode-xid v0.2.1
     Compiling syn v1.0.69
     Compiling serde_derive v1.0.125
     Compiling serde v1.0.125
     Compiling radium v0.6.2
     Compiling funty v1.1.0
     Compiling tap v1.0.1
     Compiling wyz v0.2.0
     Compiling byte-slice-cast v1.0.0
     Compiling arrayvec v0.7.0
     Compiling log v0.4.14
     Compiling crunchy v0.2.2
     Compiling memchr v2.3.4
     Compiling static_assertions v1.1.0
     Compiling cfg-if v1.0.0
     Compiling sp-std v3.0.0 (https://github.com/paritytech/substrate.git?branch=rococo-v1#2be8fcc4)
     Compiling byteorder v1.4.3
     Compiling ref-cast v1.0.6
     Compiling autocfg v1.0.1
     Compiling hex v0.4.3
     Compiling regex-syntax v0.6.23
     Compiling lazy_static v1.4.0
     Compiling ahash v0.4.7
     Compiling tracing-core v0.1.17
     Compiling parity-util-mem v0.9.0
     Compiling pin-project-lite v0.2.6
     Compiling hash-db v0.15.2
     Compiling zeroize v1.2.0
     Compiling either v1.6.1
     Compiling paste v1.0.5
     Compiling smallvec v1.6.1
     Compiling bitflags v1.2.1
     Compiling arrayvec v0.4.12
     Compiling nodrop v0.1.14
     Compiling libc v0.2.93
     Compiling constant_time_eq v0.1.5
     Compiling convert_case v0.4.0
     Compiling getrandom v0.2.2
     Compiling hex-literal v0.3.1
     Compiling ryu v1.0.5
     Compiling ucd-trie v0.1.3
     Compiling zstd-safe v3.0.1+zstd.1.4.9
     Compiling ppv-lite86 v0.2.10
     Compiling serde_json v1.0.64
     Compiling itoa v0.4.7
     Compiling semver-parser v0.7.0
     Compiling rustc-demangle v0.1.18
     Compiling remove_dir_all v0.5.3
     Compiling same-file v1.0.6
     Compiling rand_core v0.6.2
     Compiling ansi_term v0.12.1
     Compiling environmental v1.1.2
  error[E0557]: feature has been removed
    --> /home/zb/.cargo/registry/src/github.com-1ecc6299db9ec823/environmental-1.1.2/src/lib.rs:42:43
     |
  42 | #![cfg_attr(not(feature = "std"), feature(const_fn))]
     |                                           ^^^^^^^^ feature has been removed
     |
     = note: split into finer-grained feature gates

  error: aborting due to previous error

  For more information about this error, try `rustc --explain E0557`.
  error: could not compile `environmental`

  To learn more, run the command again with --verbose.
  warning: build failed, waiting for other jobs to finish...
  error: build failed
warning: build failed, waiting for other jobs to finish...
error: build failed

How change this ?

Test benchmarking

Once #33 is in place, ensure that the benchmarks actually build with the feature flag and work.

duplicate lang item in crate `sp_io` (which `frame_support` depends on): `panic_impl`

I am working with substrate-parachain-template release polkadot-v0.9.8 and attempting to use pallet orml_tokens (v0.4.0) to
use a currency type.

I have this error when running cargo check that I cannot resolve; I see that the error results from there being 2 definitions of sp_io inside the rmeta files for wasm32.

Compiling pallet-template v3.0.0 (/home/toto/projects/substrate-parachain-template/pallets/template)
  error: duplicate lang item in crate `sp_io` (which `frame_support` depends on): `panic_impl`.
    |
    = note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
    = note: first definition in `sp_io` loaded from /home/toto/projects/substrate-parachain-template/target/debug/wbuild/parachain-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-1ffd242fcdafe517.rmeta
    = note: second definition in `sp_io` loaded from /home/toto/projects/substrate-parachain-template/target/debug/wbuild/parachain-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-70babcf65ff02ce0.rmeta

  error: duplicate lang item in crate `sp_io` (which `frame_support` depends on): `oom`.
    |
    = note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
    = note: first definition in `sp_io` loaded from /home/toto/projects/substrate-parachain-template/target/debug/wbuild/parachain-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-1ffd242fcdafe517.rmeta
    = note: second definition in `sp_io` loaded from /home/toto/projects/substrate-parachain-template/target/debug/wbuild/parachain-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-70babcf65ff02ce0.rmeta

To reproduce :
I cloned substrate-developer-hub/substrate-parachain-template
I checked out polkadot-v0.9.8

changes to pallet/src/lib.rs =>
added this line

type CurrencyId = ::CurrencyId;

below

#[frame_support::pallet]
pub mod pallet {

changes to pallet/cargo.toml
added 1 line to [dependencies]

orml-traits = { version = '0.4.0', default-features = false }

and added 1 line to std features

std = [
..snip..
	'orml-tokens/std',
]

did cargo clean
cargo check and got the error above "duplicate lang item in crate sp_io"

ustup show
toto@dev01:~$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/toto/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu (default)
nightly-2021-03-15-x86_64-unknown-linux-gnu
nightly-2021-05-20-x86_64-unknown-linux-gnu
nightly-2021-07-03-x86_64-unknown-linux-gnu
nightly-2021-08-01-x86_64-unknown-linux-gnu
nightly-2021-09-12-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.55.0 (c8dfcfe04 2021-09-06)

=======================================================================
Side note.
I am using polkadot-v0.9.8 ibecause of the error below when doing the same in polkadot-v0.9.10 or polkadot-v0.9.9

   Updating crates.io index
error: failed to select a version for `parity-util-mem`.
    ... required by package `polkadot-parachain v0.9.10 (https://github.com/paritytech/polkadot?branch=release-v0.9.10#aeea9b7b)`
    ... which is depended on by `cumulus-client-network v0.1.0 (https://github.com/paritytech/cumulus?branch=polkadot-v0.9.10#870b2146)`
    ... which is depended on by `cumulus-client-collator v0.1.0 (https://github.com/paritytech/cumulus?branch=polkadot-v0.9.10#870b2146)`
    ... which is depended on by `cumulus-client-service v0.1.0 (https://github.com/paritytech/cumulus?branch=polkadot-v0.9.10#870b2146)`
    ... which is depended on by `parachain-collator v3.0.0 (/home/toto/projects/darkex-parachain/node)`
versions that meet the requirements `^0.10.0` are: 0.10.2, 0.10.1, 0.10.0

the package `parity-util-mem` links to the native library `parity-util-mem-ban-duplicates`, but it conflicts with a previous package which links to `parity-util-mem-ban-duplicates` as well:
package `parity-util-mem v0.9.0`
    ... which is depended on by `sp-core v3.0.0`
    ... which is depended on by `frame-metadata v13.0.0`
    ... which is depended on by `frame-support v3.0.0`
    ... which is depended on by `orml-traits v0.4.0`
    ... which is depended on by `pallet-template v3.0.0 (/home/toto/projects/darkex-parachain/pallets/template)`
    ... which is depended on by `parachain-runtime v3.0.0 (/home/toto/projects/darkex-parachain/runtime)`
    ... which is depended on by `parachain-collator v3.0.0 (/home/toto/projects/darkex-parachain/node)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='parity-util-mem' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.

Validation code with std environment

Following evmc interface, our pallet need to load .so library file to create a vm. We could only execute these codes in std environment but looks like these codes are not generated into validation code using parachain-collator export-genesis-wasm > para-wasm.wasm.

Therefore, when we trying to send our pallet extrinsic, our local test relay chain could not verify new block with the following error:

panicked at 'Storage root must match that calculated.', /root/.cargo/git/checkouts/substrate-7e08433d4c370a21/f397f24/frame/executive/src/lib.rs:398:9

Is there any solution or workaround for this problem? Thanks!

Compiling error: type annotations needed

I've got this error while compiling:

  error[E0282]: type annotations needed
      --> /Users/suvi/.cargo/git/checkouts/substrate-7e08433d4c370a21/83544d4/primitives/arithmetic/src/fixed_point.rs:541:9
       |
  541  |                   let accuracy = P::ACCURACY.saturated_into();
       |                       ^^^^^^^^ consider giving `accuracy` a type
  ...
  1595 | / implement_fixed!(
  1596 | |     FixedI64,
  1597 | |     test_fixed_i64,
  1598 | |     i64,
  ...    |
  1601 | |     "_Fixed Point 64 bits signed, range = [-9223372036.854775808, 9223372036.854775807]_",
  1602 | | );
       | |__- in this macro invocation
       |
       = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

I know this could be fixed by setting the rustic version to nightly-2020-10-06, while I am compiling it on apple silicon(M1),
nightly-2020-10-06-aarch64-apple-darwin is not found/supported in the channel.

Add a strong notice if the template is rococo compatible

A flag in the README that let's you know STRONGLY if it's rococo compatible or not.
We (Parity support team) must maintain this warning, trigger a warning on rococo resets until it's updated and go to "all good" status for comparability.

Building with 'runtime-benchmarks' fails

Running cargo +nightly build --release --features runtime-benchmarks generates the error

error[E0046]: not all trait items implemented, missing: `successful_origin`
    --> /Users/x/.cargo/git/checkouts/substrate-7e08433d4c370a21/fcc54a7/frame/collective/src/lib.rs:990:1
     |
990  | / impl<
991  | |         O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>,
992  | |         AccountId: Default,
993  | |         I,
...    |
1007 | |     }
1008 | | }
     | |_^ missing `successful_origin` in implementation
     |
     = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`

error[E0046]: not all trait items implemented, missing: `successful_origin`
    --> /Users/x/.cargo/git/checkouts/substrate-7e08433d4c370a21/fcc54a7/frame/collective/src/lib.rs:1011:1
     |
1011 | / impl<
1012 | |         O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>,
1013 | |         N: U32,
1014 | |         AccountId,
...    |
1029 | |     }
1030 | | }
     | |_^ missing `successful_origin` in implementation
     |
     = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`

error[E0046]: not all trait items implemented, missing: `successful_origin`
    --> /Users/x/.cargo/git/checkouts/substrate-7e08433d4c370a21/fcc54a7/frame/collective/src/lib.rs:1035:1
     |
1035 | / impl<
1036 | |         O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>,
1037 | |         N: U32,
1038 | |         D: U32,
...    |
1054 | |     }
1055 | | }
     | |_^ missing `successful_origin` in implementation
     |
     = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`

error[E0046]: not all trait items implemented, missing: `successful_origin`
    --> /Users/x/.cargo/git/checkouts/substrate-7e08433d4c370a21/fcc54a7/frame/collective/src/lib.rs:1060:1
     |
1060 | / impl<
1061 | |         O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>,
1062 | |         N: U32,
1063 | |         D: U32,
...    |
1079 | |     }
1080 | | }
     | |_^ missing `successful_origin` in implementation
     |
     = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`

compile failed on windows

error[E0433]: failed to resolve: could not find `unix` in `os`
  --> C:\Users\mospit\.cargo\git\checkouts\polkadot-4038f27d5e4ea2e8\127eb17\node\core\pvf\src\execute\worker.rs:29:6
   |
29 |     os::unix::net::UnixStream,
   |         ^^^^ could not find `unix` in `os`

compile platforms v0.2.1 error

error[E0583]: file not found for module `target`
  --> /home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/lib.rs:29:1
   |
29 | pub mod target;
   | ^^^^^^^^^^^^^^^
   |
   = help: to create the module `target`, create file "/home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/target.rs"

error[E0432]: unresolved imports `crate::target::Arch`, `crate::target::Env`, `crate::target::OS`
  --> /home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/platform/tier1.rs:16:14
   |
16 |     target::{Arch, Env, OS},
   |              ^^^^  ^^^  ^^ no `OS` in `target`
   |              |     |
   |              |     no `Env` in `target`
   |              no `Arch` in `target`

error[E0432]: unresolved imports `crate::target::Arch`, `crate::target::Env`, `crate::target::OS`
  --> /home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/platform/tier2.rs:20:14
   |
20 |     target::{Arch, Env, OS},
   |              ^^^^  ^^^  ^^ no `OS` in `target`
   |              |     |
   |              |     no `Env` in `target`
   |              no `Arch` in `target`

error[E0432]: unresolved imports `crate::target::Arch`, `crate::target::Env`, `crate::target::OS`
  --> /home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/platform/tier3.rs:11:14
   |
11 |     target::{Arch, Env, OS},
   |              ^^^^  ^^^  ^^ no `OS` in `target`
   |              |     |
   |              |     no `Env` in `target`
   |              no `Arch` in `target`

error[E0432]: unresolved imports `crate::target::TARGET_ARCH`, `crate::target::TARGET_ENV`, `crate::target::TARGET_OS`
  --> /home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/lib.rs:36:14
   |
36 |     target::{TARGET_ARCH, TARGET_ENV, TARGET_OS},
   |              ^^^^^^^^^^^  ^^^^^^^^^^  ^^^^^^^^^ no `TARGET_OS` in `target`
   |              |            |
   |              |            no `TARGET_ENV` in `target`
   |              no `TARGET_ARCH` in `target`

error[E0412]: cannot find type `Arch` in this scope
  --> /home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/platform/mod.rs:36:22
   |
36 |     pub target_arch: Arch,
   |                      ^^^^ not found in this scope

error[E0412]: cannot find type `OS` in this scope
  --> /home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/platform/mod.rs:39:20
   |
39 |     pub target_os: OS,
   |                    ^^ not found in this scope

error[E0412]: cannot find type `Env` in this scope
  --> /home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/platform/mod.rs:44:28
   |
27 | pub struct Platform {
   |                    - help: you might be missing a type parameter: `<Env>`
...
44 |     pub target_env: Option<Env>,
   |                            ^^^ not found in this scope

error[E0412]: cannot find type `Env` in this scope
  --> /home/lx/.cargo/registry/src/github.com-1ecc6299db9ec823/platforms-0.2.1/src/platform/mod.rs:44:28
   |
44 |     pub target_env: Option<Env>,
   |                            ^^^ not found in this scope

error: aborting due to 9 previous errors

Some errors have detailed explanations: E0412, E0432, E0583.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `platforms`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

environment:

  • Ubuntu 18.04

  • rust:

    $ rustup show
    Default host: x86_64-unknown-linux-gnu
    rustup home:  /home/lx/.rustup
    
    installed toolchains
    --------------------
    
    stable-x86_64-unknown-linux-gnu (default)
    nightly-2020-10-06-x86_64-unknown-linux-gnu
    
    active toolchain
    ----------------
    
    stable-x86_64-unknown-linux-gnu (default)
    rustc 1.48.0 (7eac88abb 2020-11-16)
    

I followed this post to build this repo: https://substrate.dev/cumulus-workshop/#/1-prep/1-compiling?id=building-the-collator-template

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.