frame_suite/
lib.rs

1// SPDX-License-Identifier: MPL-2.0
2//
3// Part of Auguth Labs open-source softwares.
4// Built for the Substrate framework.
5//
6// This Source Code Form is subject to the terms of the Mozilla Public
7// License, v. 2.0. If a copy of the MPL was not distributed with this
8// file, You can obtain one at https://mozilla.org/MPL/2.0/.
9//
10// Copyright (c) 2026 Auguth Labs (OPC) Pvt Ltd, India
11
12#![cfg_attr(not(feature = "std"), no_std)]
13// ===============================================================================
14// ````````````````````````````````` FRAME SUITE `````````````````````````````````
15// ===============================================================================
16
17//! A composable, type-driven foundation for building modular runtime systems
18//! on top of Substrate.
19//!
20//! This crate is a collection of **orthogonal, interoperable abstractions**
21//! that capture recurring runtime patterns and execution without prescribing
22//! concrete implementations.
23//!
24//! The focus is not on providing ready-made systems, but on defining
25//! **reusable semantics and capabilities** that can be composed, extended,
26//! and adapted across different contexts.
27//!
28//! The design is guided by:
29//!
30//! - **Type-first abstractions**
31//! - **Plugin-driven behavior**
32//! - **Decoupled structure, storage, and execution**
33//!
34//! The crate is expected to evolve over time, growing as new reusable patterns
35//! emerge, while maintaining a consistent approach to abstraction and composition.
36//!
37//! ## How Everything is Designed
38//!
39//! The crate follows a consistent design model across all modules:
40//!
41//! - **Traits define semantics**
42//!   Each module exposes traits that describe *what a system means*,
43//!   not how it is implemented.
44//!
45//! - **Types encode constraints**
46//!   Capabilities, invariants, and relationships are expressed through
47//!   associated types and bounds, ensuring correctness at compile time.
48//!
49//! - **Behavior is externalized**
50//!   Logic is not embedded into core structures. Instead, it is provided
51//!   through pluggable models and context-driven execution.
52//!
53//! - **Storage is not assumed**
54//!   Data layout and persistence are left to the implementing context,
55//!   allowing the same abstraction to work across different storage strategies.
56//!
57//! - **Composition is the mechanism**
58//!   Larger systems emerge by combining small, orthogonal primitives,
59//!   rather than extending monolithic components.
60//!
61//! This results in abstractions that are:
62//! - reusable across domains
63//! - extensible without modification
64//! - adaptable to different runtime environments
65//!
66//! ## Architecture Overview
67//!
68//! The crate is organized into domain-oriented modules, each contributing
69//! a focused set of traits and primitives. These modules are intentionally
70//! **loosely coupled** and can be used independently or composed together
71//! to form higher-level systems.
72//!
73//! The crate is organized from
74//!
75//! ```text
76//! low-level primitives -> structural abstractions -> domain systems -> execution
77//! ```
78//!
79//! ### Core Primitives
80//!
81//! - [`base`]         : Foundational traits for deterministic, codec-safe types  
82//! - [`fixedpoint`]   : Deterministic numeric and fixed-point abstractions  
83//! - [`keys`]         : Deterministic identifier derivation  
84//! - [`mutation`]     : Mutation-centric abstractions over ownership  
85//! - [`misc`]         : Small, reusable building blocks across semantic-boundaries
86//!
87//! ### Structural & Behavioral Core
88//!
89//! - [`virtuals`]     : Type-driven virtual struct system (decoupled structure layer)  
90//! - [`plugins`]      : Pluggable, type-safe execution and behavior layer  
91//!
92//! ### Progression & Accumulation
93//!
94//! - [`accumulators`] : Step-based progression and accumulation models  
95//! - [`xp`]           : Experience points as a pseudo-fungible progression primitive  
96//!
97//! ### Value & Financial Semantics
98//!
99//! - [`assets`]       : Lazy, receipt-based accounting models  
100//! - [`commitment`]   : Value bonding and intent-driven primitives  
101//!
102//! ### Coordination & Governance
103//!
104//! - [`roles`]        : Role lifecycle, funding, and incentive semantics  
105//! - [`elections`]    : Generic, plugin-based selection and weighting systems  
106//! - [`blockchain`]   : Author lifecycle, rewards, and coordination abstractions  
107//!
108//! ### Execution Layer
109//!
110//! - [`routines`]     : Structured Best-effort offchain-workers execution model  
111//!
112//! ## Design Principles
113//!
114//! ### Decoupled Concerns
115//!
116//! Structure, storage, and behavior are treated as independent dimensions:
117//!
118//! - **Structure**: expressed via traits and type-level schemas  
119//! - **Storage**: abstracted or externalized  
120//! - **Behavior**: injected via pluggable models  
121//!
122//! This separation allows systems to evolve without forcing redesigns
123//! across unrelated layers.
124//!
125//! ### Plugin-Driven Execution
126//!
127//! Behavior is modeled as **pluggable units of computation**, enabling:
128//!
129//! - compile-time selection of logic  
130//! - context-driven customization  
131//! - interchangeable implementations without changing interfaces  
132//!
133//! ### Type-Level Composition
134//!
135//! The framework encodes meaning through types:
136//!
137//! - capabilities and constraints live in trait bounds  
138//! - composition emerges from generic relationships  
139//! - correctness is enforced at compile time  
140//!
141//! ### Lazy & Deferred Semantics
142//!
143//! Several modules adopt **lazy or deferred evaluation models** to:
144//!
145//! - minimize unnecessary state updates  
146//! - defer computation until it is required  
147//! - scale efficiently with system complexity  
148//!
149//! ## Hygiene
150//!
151//! All public symbols are **re-exported at the crate root**.
152//!
153//! This ensures:
154//!
155//! - a flat and ergonomic import surface  
156//! - no need to depend on internal module paths  
157//! - consistent and predictable naming across the crate  
158
159// ===============================================================================
160// ``````````````````````````````````` MODULES ```````````````````````````````````
161// ===============================================================================
162
163pub mod accumulators;
164pub mod assets;
165pub mod base;
166pub mod blockchain;
167pub mod commitment;
168pub mod elections;
169pub mod fixedpoint;
170pub mod forks;
171pub mod keys;
172pub mod misc;
173pub mod mutation;
174pub mod plugins;
175pub mod roles;
176pub mod routines;
177pub mod virtuals;
178pub mod xp;
179
180// ===============================================================================
181// `````````````````````````````````` RE-EXPORTS `````````````````````````````````
182// ===============================================================================
183
184pub use accumulators::*;
185pub use assets::*;
186pub use base::*;
187pub use blockchain::*;
188pub use commitment::*;
189pub use elections::*;
190pub use fixedpoint::*;
191pub use forks::*;
192pub use keys::*;
193pub use misc::*;
194pub use mutation::*;
195pub use plugins::*;
196pub use roles::*;
197pub use routines::*;
198pub use virtuals::*;
199pub use xp::*;