pub trait AttestersReadApi<Account, Balance, BlockNumber> {
    // Required methods
    fn previous_committee() -> Vec<Account, Global>;
    fn current_committee() -> Vec<Account, Global>;
    fn active_set() -> Vec<Account, Global>;
    fn honest_active_set() -> Vec<Account, Global>;
    fn read_attester_info(attester: &Account) -> Option<AttesterInfo>;
    fn read_nominations(
        for_attester: &Account
    ) -> Vec<(Account, Balance), Global>;
    fn get_activated_targets() -> Vec<[u8; 4], Global>;
    fn read_attestation_latency(target: &[u8; 4]) -> Option<LatencyStatus>;
    fn estimate_finality_fee(target: &[u8; 4]) -> Balance;
    fn estimate_finality_reward(
        target: &[u8; 4],
        blocks_delay: BlockNumber
    ) -> Balance;
    fn estimate_batching_factor(target: &[u8; 4]) -> Option<BatchingFactor>;
}

Required Methods§

fn previous_committee() -> Vec<Account, Global>

fn current_committee() -> Vec<Account, Global>

fn active_set() -> Vec<Account, Global>

fn honest_active_set() -> Vec<Account, Global>

fn read_attester_info(attester: &Account) -> Option<AttesterInfo>

fn read_nominations(for_attester: &Account) -> Vec<(Account, Balance), Global>

fn get_activated_targets() -> Vec<[u8; 4], Global>

fn read_attestation_latency(target: &[u8; 4]) -> Option<LatencyStatus>

fn estimate_finality_fee(target: &[u8; 4]) -> Balance

fn estimate_finality_reward( target: &[u8; 4], blocks_delay: BlockNumber ) -> Balance

fn estimate_batching_factor(target: &[u8; 4]) -> Option<BatchingFactor>

Implementors§

§

impl<Account, Balance, Error, BlockNumber> AttestersReadApi<Account, Balance, BlockNumber> for AttestersReadApiEmptyMock<Account, Balance, Error>where Balance: Zero,

source§

impl<T: Config> AttestersReadApi<<T as Config>::AccountId, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

Finality Fee Estimation and User Base Projection

This module provides functionalities for estimating future finality fees and user base in a decentralized system, drawing inspiration from the concept of a pension scheme.

Overview

The aim of this module is to estimate future fees and user base in a way that balances the interests of all participants. This is achieved by employing methods similar to those used in pension systems, where fees paid by current participants are used to support earlier generations.

Two primary functions provided by this module are:

  1. estimate_user_finality_fee
  2. estimate_future_user_base
Functionality
estimate_user_finality_fee

This function estimates the finality fee for an individual user. The function considers the total fee paid in the most recent epoch and divides it by the number of users in that epoch to calculate a base user fee. An overcharge factor is then added to this base fee to account for fluctuations and provide a buffer. This calculation mirrors the process in pension systems where individual contributions are calculated based on total liabilities and the number of current contributors.

estimate_future_user_base

The estimate_future_user_base function forecasts the user base size for a future epoch. The function calculates the average growth rate of the user base over the past few epochs and applies this rate iteratively to project future growth. This function is similar to population projections in pension systems, which are critical in determining future contribution rates.

Concluding Remarks

The functions in this module draw inspiration from pension systems, projecting future conditions based on past data and current trends. While the context is different – a decentralized system instead of a pension scheme – the fundamental concepts are the same. The ability to estimate future fees and user base size contributes to system sustainability and fairness, much like in a well-managed pension scheme.