Hey Substrate Community,
is there a way to annotate a extrinsic call function with the Rust cfg
condition compile execution?
#[cfg_attr(feature = "with-global-disputes", pallet::weight(T::WeightInfo::start_global_dispute(CacheSize::get())))]
#[cfg_attr(feature = "with-global-disputes", transactional)]
#[cfg(feature = "with-global-disputes")]
pub fn start_global_dispute(origin: OriginFor<T>, #[pallet::compact] market_id: MarketIdOf<T>) -> DispatchResultWithPostInfo {
...
}
This produces an error:
error: Invalid pallet::call, requires weight attribute i.e. `#[pallet::weight($expr)]`
--> /Users/tesst/dev/random/test-project.rs
|
963 | pub fn start_global_dispute(origin: OriginFor<T>, #[pallet::compact] market_id: MarketIdOf<T>) -> DispatchResultWithPostInfo {
constuct_runtime
macro now so you can now add in pallets via features.#[cfg(feature = "runtime-benchmarks")]