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

Where clause in Config trait is breaking when not specifying hooks in frame_support::pallet macro #13242

@JuaniRios

Description

@JuaniRios

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

When not specifying hooks inside frame_support::pallet, there will be a default empty hook added. This default hook will break our compilation if we ever use a "where" clause in the Config trait. The error message is not helpful due to being behind a macro.

Steps to reproduce

  1. Start with a pallet template
  2. Add a where clause to Config where an associated type needs to implement a certain trait that is not already implemented.
  3. Fix all other calls to T::Config to include the where clause

you will get something like:

     |
  22 |     #[pallet::pallet]
     |               ^^^^^^ the trait `From<u128>` is not implemented for `<T as frame_system::Config>::Index`

Temporary solution:
add an empty hooks block with the where clause:

	#[pallet::hooks]
	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> where
		<Self as frame_system::Config>::Index: From<u128>
	{}

Metadata

Metadata

Assignees

No one assigned

    Labels

    I3-bugThe node fails to follow expected behavior.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions