如何解决如何在锈蚀基板托盘的基准测试中定义自定义来源?
我必须对基材中的一个托盘进行基准测试 - [说注册商] 在这里,我们定义了自己的自定义帐户类型[自定义来源],这样只有有效的注册商或root 才能添加其他帐户[也是xyzAccountType 的自定义]。
这里有一些片段 - #[frame_support::pallet]
selectProduct
现在我必须对这个托盘和函数 add_registrar 进行基准测试。现在,因为我们需要 2 args 1. 注册商帐户类型其他是 XyzaccountId。我知道如何定义像 root 和 caller 这样的预定义原点,但我不确定如何在这里定义这个自定义原点。任何人都可以帮我解决这个问题吗?
..
..
/// Type of a registrar.
pub type XyzAccountOf<T> = <T as Config>::XyzAccountId;
#[pallet::config]
pub trait Config: frame_system::Config + Debug {
type XyzAccountId: Parameter + Default;
/// The origin which may forcibly set or remove a name. Root can always do this.
type ForceOrigin: EnsureOrigin<Self::Origin>;
/// The origin which may add or remove registrars. Root can always do this.
type RegistrarOrigin: EnsureOrigin<Self::Origin>;
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
.....
.....
.....
....
#[pallet::weight(0)]
pub fn add_registrar(origin: OriginFor<T>,account: XyzAccountOf<T>) -> dispatchResult {
T::RegistrarOrigin::ensure_origin(origin)?;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。