Skip to content

Commit e1f5dab

Browse files
fix(permission0): only allow delegating namespaces for agents (#122)
This change limits to whom you may delegate a namespace permission. From now on, only registered agents will be eligible for receiving namespace contracts. Closes CHAIN-114.
2 parents 0ad885d + 5f307b9 commit e1f5dab

File tree

3 files changed

+443
-0
lines changed

3 files changed

+443
-0
lines changed

pallets/permission0/src/ext/namespace_impl.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ pub fn delegate_namespace_permission_impl<T: Config>(
4444
) -> Result<PermissionId, DispatchError> {
4545
let delegator = ensure_signed(delegator)?;
4646

47+
ensure!(
48+
T::Torus::is_agent_registered(&delegator),
49+
Error::<T>::NotRegisteredAgent
50+
);
51+
ensure!(
52+
T::Torus::is_agent_registered(&recipient),
53+
Error::<T>::NotRegisteredAgent
54+
);
55+
4756
let paths = paths
4857
.into_iter()
4958
.map(|path| {

0 commit comments

Comments
 (0)