Expand description
The network pallet manages the registration and configuration of various
blockchain networks within a decentralized system. It provides functionality
to add new networks, retrieve network information, and ensures each network
is uniquely identified by a NetworkId.
§Features
-
Allows privileged users to add new blockchain networks with unique
ChainName. This operation requires root authorization. -
Maintains storage of network configurations using a mapping between
NetworkIdandChainName. -
Initializes the pallet with predefined network configurations during blockchain genesis, ensuring seamless operation from the start.
graph TD
B[add_network]
B --> C{Ensure Root}
C -->|Root| D[Call insert_network]
C -->|Not Root| E[Return Error::NotRoot]
D --> F{Check Network Exists}
F -->|Exists| G[Return Error::NetworkExists]
F -->|Doesn't Exist| H[Get NetworkIdCounter]
H --> I{Check Overflow}
I -->|Overflow| J[Return Error::NetworkIdOverflow]
I -->|No Overflow| K[Increment NetworkIdCounter]
K --> L[Store Network in Networks]
L --> M[Update NetworkIdCounter]
M --> N[Emit NetworkAdded Event]
N --> O[Return Ok]
%% style extrinsics
style B fill:#f9f,stroke:#333,stroke-width:2px;
%% style errors
style E fill:#f96,stroke:#333,stroke-width:2px;
style G fill:#f96,stroke:#333,stroke-width:2px;
style J fill:#f96,stroke:#333,stroke-width:2px;
%% style events
style N fill:#bbf,stroke:#333,stroke-width:2px;
Re-exports§
pub use pallet::*;
Modules§
- The
palletmodule in each FRAME pallet hosts the most important items needed to construct this pallet.