사용자 정의 가중치 사용하기
Last updated
pub mod weights;
pub use weights::*;
// -- 생략 --
pub trait Config: frame_system::Config {
// -- 생략 --
/// 런타임 가중치에 대한 정보입니다.
type WeightInfo: WeightInfo;
}#[pallet::weight(T::WeightInfo::example(x.len()))]
fn example(origin: OriginFor<T>, arg: Vec<u32>) -> DispatchResult {
// -- 생략 --
}impl Config for TestRuntime {
// -- 생략 --
type WeightInfo = ();
}impl pallet_example::Config for Runtime {
// -- 생략 --
type WeightInfo = pallet_example::weights::SubstrateWeight<Runtime>;
}