Crate pallet_members

Source
Expand description

This pallet manages members’ registration, heartbeat functionality, and member management within a decentralized network.

This flowchart represents the control flow and interactions of callable functions (register_member, send_heartbeat, unregister_member). It shows the decision points, data operations, and event emissions along with error handling where applicable.

flowchart TD
    
    B[register_member]
    C[send_heartbeat]
    D[unregister_member]
    B --> E[Ensure Signed]
    E -- Yes --> F[Validate Public Key]
    F -- Yes --> G[Check Existing Membership]
    G -- Yes --> H[Unregister Member]
    H --> I[Validate Minimum Stake]
    I -- Yes --> J[Reserve Bond]
    J --> K[Insert Data]
    K --> L[Mark Online]
    L --> M[Event: RegisteredMember]
    M --> N[Call: member_online]
    N --> O[Return OK]
    F -- No --> O1[Return Error: InvalidPublicKey]
    G -- No --> I
    I -- No --> O2[Return Error: BondBelowMinStake]
    E -- No --> O3[Return Error: NotSigned]
    C --> P[Ensure Member]
    P -- Yes --> Q[Update Heartbeat]
    Q --> R[Event: HeartbeatReceived]
    R --> S[Check Online]
    S -- No --> T[Mark Online]
    T --> U[Call: member_online]
    U --> V[Return OK]
    S -- Yes --> V[Return OK]
    P -- No --> V1[Return Error: NotMember]
    D --> W[Ensure Member]
    W -- Yes --> X[Retrieve Network]
    X --> Y[Unregister Member From Network]
    Y --> Z[Unreserve Stake]
    Z --> AA[Remove Data]
    AA --> AB[Event: UnRegisteredMember]
    AB --> AC[Call: member_offline]
    AC --> AD[Return OK]
    W -- No --> AD1[Return Error: NotMember]
    
        %% style extrinsics
		style B fill:#f9f,stroke:#333,stroke-width:2px;
		style C fill:#f9f,stroke:#333,stroke-width:2px;
		style D fill:#f9f,stroke:#333,stroke-width:2px;

		
		%% style errors
		style AD1 fill:#f96,stroke:#333,stroke-width:2px;
		style V1 fill:#f96,stroke:#333,stroke-width:2px;
		style O2 fill:#f96,stroke:#333,stroke-width:2px;
		style O3 fill:#f96,stroke:#333,stroke-width:2px;
		style O1 fill:#f96,stroke:#333,stroke-width:2px;

		
		%% style events
		style AB fill:#bbf,stroke:#333,stroke-width:2px;
		style R fill:#bbf,stroke:#333,stroke-width:2px;
		style M fill:#bbf,stroke:#333,stroke-width:2px;


This flowchart illustrates the decision-making and steps taken within the on_initialize function, highlighting the main actions and checks performed during the process.


 flowchart TD
    A[on_initialize] --> B[Initialize weight]
    B --> C[Is it time for a heartbeat check?]
    C -- Yes --> D[Iterate through members]
    D --> E[Has member sent heartbeat?]
    E -- No --> F[Does member have a network?]
    F -- Yes --> G[Mark member as offline]
    G --> H[Update weight]
    F -- No --> I[Update weight for read]
    E -- Yes --> J[Update weight for read and write]
    D --> K[Update weight for drained heartbeats]
    C -- No --> L[Return weight]
    H --> L
    I --> L
    J --> L
    K --> L

    %% style extrinsics
	style A fill:#f9f,stroke:#333,stroke-width:2px;

Re-exports§

Modules§

  • The pallet module in each FRAME pallet hosts the most important items needed to construct this pallet.