2

I get the following stacktrace while trying to build my node binary with benchmarking features.

Build command: cargo build --release --features runtime-benchmarks

error[E0046]: not all trait items implemented, missing: `successful_origin`
   --> /home/dylan/.cargo/registry/src/github.com-1ecc6299db9ec823/pallet-collective-3.0.0/src/lib.rs:872:1
    |
872 | / impl<
873 | |     O: Into<Result<RawOrigin<AccountId, I>, O>> + From<RawOrigin<AccountId, I>>,
874 | |     AccountId: Default,
875 | |     I,
...   |
888 | |     }
889 | | }
    | |_^ missing `successful_origin` in implementation
    |
    = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`


3

1 Answer 1

1

This error usually occurs when you have forgotten to enable the runtime-benchmarks feature flag for dependent crates.

Inside of pallet-collective this trait is implemented, but is hidden behind a feature flag:

#[cfg(feature = "runtime-benchmarks")]
fn successful_origin() -> O {
    let zero_account_id =
        AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes())
            .expect("infinite length input; no invalid inputs for type; qed");
    O::from(RawOrigin::Member(zero_account_id))
}

To get this code active, this crate needs to enable the runtime-benchmarks feature flag.

For example, if you are writing your runtime library, you will need to include your pallet like:

pallet-collective = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git" }

For all of these dependencies, you need to make sure to enable the feature flags for the downstream crates. For example:

[features]
default = ["std"]
std = [
    "frame-collective/std",
]
runtime-benchmarks = [
    "frame-collective/runtime-benchmarks",
]
2
  • Adding this did the trick and I am able to compile now. Thank you so much! Feb 22, 2022 at 15:09
  • please feel free to mark this as the answer to your question
    – Shawn Tabrizi
    Feb 22, 2022 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.