SubspaceYuma Consensus

Yuma Consensus

Yuma Consensus, the core invention of Bittensor, is a widely applicable mechanism for neutralizing manipulation attempts from dishonest minority groups in a dynamically stable honest majority equilibrium.

It is a fuzzy consensus to determine a robust agreement in a decentralized trustless setting, using stake and its submitted weights. The consensus incentive forces the collective of validators to converege to a uniform validation methodology enforcing clear order on the chaotic nature of open permissionless systems.

You only need to understand 3 fundamental things about Yuma Consensus to navigate it. How the consensus weight is determined, how manipulation attempts are neutralized and how manipulation attempts are penalized.

The consensus weight is calculated by determining the highest weight supported by at least the stake majority, meaning the majority has submitted either equal or higher weight. The majority level is adjustable through the k parameter.

This is calculated using a weighted (k) stake-based median over the stakes-weights distribution.

Stake setting weights on miners is 'bonding' to them. Bonds are Stake-weight proportional ownership over the share of emissions accrued by the miner, paid out as dividends every epoch. This is where yield comes from.

The concept of the bond, as an intermediary between stake and yield, allows to modulate the incentives of validators. This is a vital component to Yuma Consensus, ensuring the robustness of the honest majority equilibrium.

After the consensus weight is determined, there are 2 core mechanisms for neutralizing and penalizing manipulation attempts.

  1. clipping all excess weights set above the consensus weight down to the consensus weight.

note: weights set below the consensus weight are ignored in the nature of the median calculation

  1. slashing the bonds of stake-weight set above the consensus weight, reducing stake dividends. (based on β parameter)

note: setting weights below the consensus weight means a lower bond in a higher value miner, in its nature leading to dividend penalty. However, higher bonds have to be corrected.

This translates to a consensus based reward for weights. The deeper in-consensus validator weights are, the higher the stake dividends. The weaker consensus, the higher the reward for strengthening consensus, while out‐of‐consensus weights come at increasing cost.

This creates a robust honest majority equilibrium difficult to break once stabilized.

Parameters:

  • k-majority
    • higher value = more robust and conservative consensus with lower resolution
    • lower value = more vulnerable consensus with higher resolution
  • β bond penalty
    • higher value = more dividend loss from deviating from consensus, hence more incentive to stick closely to consensus
    • lower value = less dividend loss from deviating from consensus, more tolerance for slight deviations that may be caused by unmalicious reasons

Yuma Consensus parameters can be adjusted on the fly to optimize its forces as necessary.

For more information and robustness proofs look here.

Conlusion for builders

You see, once understood Yuma Consensus is very straightforward. Especially relevant for you as a subnet builder or validator is understanding that all validators need to end up with approximately similar weights to everyone else. Every deviation from the consensus comes at a reward penalty. Yuma Consensus is build for a uniform measurement standard applied across the whole subnet. So if for example a validator uses a different dataset than others, both its weights impact and rewards will be strongly reduced. This forces subnets to converge to a clear structured methodology. order from chaos.

Yuma Consensus Blockchain Implementation

The Commune blockchain code implements the consensus as follows

YumaCalc Struct

The YumaCalc struct is the main entry point for running the Yuma Consensus calculation. It contains various fields such as:

  • module_count: The number of modules on the subnet.
  • netuid: The UID of the subnet.
  • kappa: The consensus majority ratio (e.g., 51%).
  • founder_key and founder_emission: Information related to the founder's key and emission.
  • to_be_emitted: The total amount to be emitted.
  • current_block, activity_cutoff, last_update, and block_at_registration: Block-related information.
  • validator_permits and validator_forbids: Vectors indicating permitted and forbidden validators.
  • max_allowed_validators: The maximum number of allowed validators.

run Method

The run method is the main function that performs the Yuma Consensus calculation. It follows these steps:

  1. Computes the weights based on the validator permits, self-weight masking, and normalization.
  2. Computes the stake and active stake based on the module states and validator permits.
  3. Computes the consensus weights and validator trust using weighted median calculation and clipping.
  4. Computes the incentives, ranks, and trust based on the consensus weights and active stake.
  5. Computes the bonds and dividends using exponential moving average (EMA) and matrix multiplication.
  6. Computes the emissions for servers, validators, and combined emissions based on the incentives and dividends.
  7. Updates the storage with the computed values, such as consensus, dividends, emissions, incentives, pruning scores, ranks, trust, and validator permits.
  8. Distributes the emissions to the respective accounts based on the computed values.

Key Functions

The implementation includes several key functions that perform specific calculations:

  • compute_weights: Computes the weights based on the validator permits, self-weight masking, and normalization.
  • compute_stake: Computes the stake based on the module states.
  • compute_active_stake: Computes the active stake based on the inactive modules and validator permits.
  • compute_consensus_and_trust: Computes the consensus weights and validator trust using weighted median calculation and clipping.
  • compute_incentive_and_trust: Computes the incentives, ranks, and trust based on the consensus weights and active stake.
  • compute_bonds_and_dividends: Computes the bonds and dividends using exponential moving average (EMA) and matrix multiplication.
  • compute_emissions: Computes the emissions for servers, validators, and combined emissions based on the incentives and dividends.
  • distribute_emissions: Distributes the emissions to the respective accounts based on the computed values.