I am trying to following the tutorials at substrate.dev and I am getting stuck on this one. Specifically, when I add this code to my runtime/src/lib.rs file:

impl pallet_scheduler::Config for Runtime {
  type Event = Event;
  type Origin = Origin;
  type PalletsOrigin = OriginCaller;
  type Call = Call;
  type MaximumWeight = MaximumSchedulerWeight;
  type ScheduleOrigin = frame_system::EnsureRoot<AccountId>;
  type MaxScheduledPerBlock = MaxScheduledPerBlock;
  type WeightInfo = ();
  type OriginPrivilegeCmp = EqualPrivilegeOnly;
  type PreimageProvider = ();
  type NoPreimagePostponement = ();

I get this error when I try to build:

--- stderr
     Compiling node-template-runtime v4.0.0-dev (/home/bosr/rust/substrate-node-template/runtime)
  error[E0433]: failed to resolve: use of undeclared crate or module `pallet_scheduler`
     --> /home/bosr/rust/substrate-node-template/runtime/src/lib.rs:151:6
  151 | impl pallet_scheduler::Config for Runtime {
      |      ^^^^^^^^^^^^^^^^ use of undeclared crate or module `pallet_scheduler`

I do have this line in the [dependencies] section:

pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }

and the version and branch match the rest of the dependencies.

  • Try importing it <use pallet_scheduler> yesterday
  • If I do that I get an unresolved import pallet_scheduler error ``` --- stderr Compiling node-template-runtime v4.0.0-dev (/home/bosr/rust/substrate-node-template/runtime) error[E0432]: unresolved import pallet_scheduler --> /home/bosr/rust/substrate-node-template/runtime/src/lib.rs:9:5 | 9 | use pallet_scheduler; | ^^^^^^^^^^^^^^^^ no external crate pallet_scheduler ``` yesterday
  • Does it work if you remove the '.git' at the end of the Substrate URL in your Cargo.toml? Also, this line must be in the Cargo.toml file for the runtime crate, not any other Cargo.toml file.
    – rob
  • No, that didn't make a difference. All the other dependencies end in .git as well. Yes, I am using Cargo.toml and that is the only toml file I have. yesterday


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.