3

With a fresh substrate-parachain-template

I ran cargo build --features runtime-benchmarks

I got errors from a deep dependency in pallet_society, which doesn't seem relevant to the parachain-template's pallets:

error[E0046]: not all trait items implemented, missing: `successful_origin`
    --> /root/.cargo/git/checkouts/substrate-7e08433d4c370a21/4aeb95f/frame/society/src/lib.rs:1268:1
     |
1268 | impl<T: Config> EnsureOrigin<T::Origin> for EnsureFounder<T> {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `successful_origin` in implementation
     |
     = help: implement the missing item: `fn successful_origin() -> OuterOrigin { todo!() }`

But it looks like fn successful_origin()... is already there:

/// Simple ensure origin struct to filter for the founder account.
pub struct EnsureFounder<T>(sp_std::marker::PhantomData<T>);
impl<T: Config> EnsureOrigin<T::Origin> for EnsureFounder<T> {
    type Success = T::AccountId;
    fn try_origin(o: T::Origin) -> Result<Self::Success, T::Origin> {
        o.into().and_then(|o| match (o, Founder::<T>::get()) {
            (frame_system::RawOrigin::Signed(ref who), Some(ref f)) if who == f => Ok(who.clone()),
            (r, _) => Err(T::Origin::from(r)),
        })
    }

    #[cfg(feature = "runtime-benchmarks")]
    fn successful_origin() -> T::Origin {
        let founder = Founder::<T>::get().expect("society founder should exist");
        T::Origin::from(frame_system::RawOrigin::Signed(founder))
    }
}

How can I resolve this?

Origin issue here

1 Answer 1

7

Thanks for reporting the issue. The problem here was a missing feature flag which enabled the runtime-benchmarks features in downstream dependencies.

The solution for you should simply be to simply enable the runtime-benchmarks feature flag on polkadot-cli in ./node/Cargo.toml:

[features]
runtime-benchmarks = [
    "parachain-template-runtime/runtime-benchmarks",
    # Add the line below
    "polkadot-cli/runtime-benchmarks",
]

We have made an upstream PR to fix this in the future!

https://github.com/paritytech/cumulus/pull/991

3
  • aha i see, thank you : ) Feb 17, 2022 at 12:02
  • I tried using your solution here where I am also using branch 'polkadot_v0.9.17' and I had already enabled the runtime-benchmarks feature flag on polkadot-cli, but when I run cargo check --features runtime-benchmarks I still get error missing 'successful_origin' in implementation that it says is caused by pallet-xcm Mar 17, 2022 at 8:27
  • 1
    You need to make sure any crates you added to your project have the feature flag correctly setup. If you can prepare a minimal example of your issue, you should open a new question and we can answer it
    – Shawn Tabrizi
    Mar 17, 2022 at 10:01

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.