Skip to content

Commit 2d5bdbe

Browse files
committed
chore: update changelog and docs
1 parent 42bcc81 commit 2d5bdbe

File tree

4 files changed

+375
-57
lines changed

4 files changed

+375
-57
lines changed

CHANGELOG.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,81 @@
11
# Changelog
22

3+
## Spec 25
4+
5+
This release refactors the permission system's internal architecture to improve efficiency and maintainability while preserving all external functionality.
6+
7+
### Infrastructure Changes
8+
9+
#### Permission Instance Management Refactoring
10+
11+
Instance management has been restructured for better separation of concerns:
12+
13+
- Instance limits and child tracking moved from the general `PermissionContract` into the specific scopes that need them (`CuratorScope` and `NamespaceScope`).
14+
- Stream permissions no longer carry unnecessary instance-related overhead, reducing storage costs.
15+
- The refactoring improves code maintainability by ensuring each permission type only manages the data it requires.
16+
- All existing permissions are automatically migrated through the v7 migration with no functional changes.
17+
18+
This internal restructuring maintains the same external API while creating a cleaner, more efficient architecture that better reflects the actual usage patterns of different permission types.
19+
20+
## Spec 24
21+
22+
This release introduces multi-recipient permissions, delegated management capabilities, and streamlines the terminology from "emissions" to "streams" throughout the permission system.
23+
24+
### Major Features
25+
26+
#### Multi-Recipient Stream Permissions
27+
28+
Stream permissions now support distributing tokens to multiple recipients in a single permission contract:
29+
30+
- Recipients are managed within the stream scope with individual weight allocations, enabling complex distribution patterns without requiring multiple permissions.
31+
- Individual recipients can opt-out without affecting others, providing autonomy while maintaining the overall distribution structure.
32+
- The system automatically handles recipient management through improved indexing with `BoundedBTreeSet` storage for better performance.
33+
- Existing single-recipient permissions are automatically migrated to the new structure.
34+
35+
#### Delegated Permission Management
36+
37+
Stream permissions can now designate specific accounts to manage operational aspects:
38+
39+
- Permission creators can assign `recipient_manager` and `weight_setter` roles to trusted accounts, enabling separation of concerns between permission ownership and operational management.
40+
- Recipient managers can add or remove recipients from the distribution list without requiring the delegator's signature.
41+
- Weight setters can adjust distribution weights for existing recipients, allowing dynamic rebalancing based on performance or contribution.
42+
- Particularly useful for DAOs, automated systems, and multi-signature operations where different parties handle different aspects of permission management.
43+
44+
#### Dynamic Namespace Instance Management
45+
46+
Namespace permissions now support runtime adjustment of instance limits:
47+
48+
- The new `update_namespace_permission` extrinsic allows delegators to modify maximum instances after creation.
49+
- Validates that changes don't violate parent permission limits or invalidate existing child permissions.
50+
- Enables adaptive permission management based on actual usage patterns without requiring revocation and re-creation.
51+
52+
### API Changes
53+
54+
#### Terminology Standardization
55+
56+
All emission-related terminology has been renamed to "stream" for better clarity:
57+
58+
- Functions like `delegate_emission_permission` are now `delegate_stream_permission`.
59+
- The `EmissionScope` type is now `StreamScope`, and `EmissionAllocation` is now `StreamAllocation`.
60+
- Events like `EmissionDistribution` are now `StreamDistribution` with `target` fields renamed to `recipient`.
61+
- Client applications must update to use the new function and type names.
62+
63+
#### Simplified Event Structure
64+
65+
Permission events have been streamlined for the multi-recipient model:
66+
67+
- The `recipient` field has been removed from `PermissionDelegated`, `PermissionRevoked`, and `PermissionExpired` events.
68+
- Applications should query the permission contract directly to determine current recipients.
69+
- The `revoked_by` field in `PermissionRevoked` is now optional to handle system-automatic revocations.
70+
71+
### Configuration Updates
72+
73+
- Added `MaxRecipientsPerPermission` to control the number of recipients in a single stream permission.
74+
- Added `MaxControllersPerPermission` to limit the number of designated managers per permission.
75+
- Added `MaxBulkOperationsPerCall` to control batch operation sizes.
76+
77+
This release significantly enhances the flexibility and efficiency of the permission system, enabling more sophisticated economic relationships and operational patterns while maintaining backward compatibility through automatic migrations.
78+
379
## Spec 23
480

581
This release builds upon the permission delegation system with enhanced re-delegation capabilities, enabling more sophisticated hierarchical permission structures for curators and namespace management.

docs/namespace.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ This approach creates natural incentives. Agents think carefully about namespace
6969

7070
## Storage Architecture
7171

72+
Namespaces are owned by either the system or an account:
73+
74+
```rust
75+
pub enum NamespaceOwnership<T: Config> {
76+
System,
77+
Account(T::AccountId),
78+
}
79+
```
80+
81+
The `System` ownership is used for root-level namespaces like `agent`, while `Account` ownership represents agent-owned namespaces.
82+
7283
Each namespace stores minimal metadata:
7384

7485
```rust
@@ -108,11 +119,24 @@ Namespaces gain their true power through integration with the permission system.
108119

109120
```rust
110121
pub struct NamespaceScope<T: Config> {
111-
pub paths: BoundedBTreeSet<NamespacePath, T::MaxNamespacesPerPermission>,
122+
pub recipient: T::AccountId,
123+
pub paths: BoundedBTreeMap<
124+
Option<PermissionId>,
125+
BoundedBTreeSet<NamespacePath, T::MaxNamespacesPerPermission>,
126+
T::MaxNamespacesPerPermission,
127+
>,
128+
pub max_instances: u32,
129+
pub children: BoundedBTreeSet<PermissionId, T::MaxChildrenPerPermission>,
112130
}
113131
```
114132

115-
The namespace permission scope contains a set of paths that the recipient can access. The permission system's existing infrastructure handles the complexity of duration, revocation terms, and enforcement authorities. This means namespace permissions can be temporary, require multi-signature revocation, or include third-party controllers. Read more in [permission0.md](permission0.md).
133+
The namespace permission scope contains:
134+
- `recipient`: The account that receives the namespace permission
135+
- `paths`: A map from parent permission IDs to sets of namespace paths, enabling hierarchical permission structures
136+
- `max_instances`: Maximum number of instances that can be created from this permission
137+
- `children`: Set of child permissions created from this permission
138+
139+
The permission system's existing infrastructure handles the complexity of duration, revocation terms, and enforcement authorities. This means namespace permissions can be temporary, require multi-signature revocation, or include third-party controllers. Read more in [permission0.md](permission0.md).
116140

117141
This integration creates composition possibilities. An agent running a data aggregation service could delegate read access to `agent.alice.data.public` while keeping `agent.alice.data.private` restricted, or delegate the entire data scope: `agent.alice.data`. The delegation could be time-limited, revocable by designated arbiters, or controlled by enforcement authorities who verify off-chain conditions.
118142

0 commit comments

Comments
 (0)