This document explains the fundamental concepts behind the GenLayer consensus and fee distribution mechanism. Understanding these concepts is essential to comprehending the purpose and function of this simulator.
The system involves several key roles:
- Sender: The user who initiates a transaction and provides the budget to pay for its processing.
- Leader: A validator chosen to lead a consensus round. The leader is responsible for proposing a result for the transaction.
- Validator: A participant in a consensus round who votes on the leader's proposed result.
- Appellant: A participant (either the leader or a validator) who disputes the outcome of a round by paying an appeal bond to initiate an appeal round.
A "transaction" in this context is not a simple transfer but a multi-round process to achieve consensus on a result.
- A Leader is selected for the round.
- The Leader proposes a result and sends a
LEADER_RECEIPT. - Validators vote on the leader's proposal.
Validators can cast one of several votes:
AGREE: The validator agrees with the leader's proposal.DISAGREE: The validator disagrees with the leader's proposal.TIMEOUT: The validator failed to submit a vote in time.IDLE: The validator was non-responsive and did not participate. They are removed from the round and replaced by a reserve if available.
The collective votes determine the round's outcome:
- Majority: If >50% of participants vote the same way (e.g.,
AGREE), that becomes the majority outcome. - Minority: Participants who did not vote with the majority.
- Undetermined: If no single vote type achieves a majority, the outcome is undetermined.
LEADER_TIMEOUT: If the leader fails to submit aLEADER_RECEIPT, the round ends in a timeout.
If a participant believes the outcome of a round was incorrect, they can initiate an appeal.
- Purpose: To challenge the result of a normal round. This is the core dispute resolution mechanism.
- Initiation: An Appellant pays an Appeal Bond to start a new, larger appeal round.
- Fresh Participants: Appeal rounds are conducted by a new, larger set of validators who did not participate in the original round, ensuring impartiality.
- Outcomes:
- Successful Appeal: If the appeal round's outcome overturns the original round's outcome. The original round is retroactively marked as
SKIP_ROUND. - Unsuccessful Appeal: If the appeal round's outcome confirms the original round's outcome.
- Successful Appeal: If the appeal round's outcome overturns the original round's outcome. The original round is retroactively marked as
The system is designed to economically incentivize honest and timely participation.
leaderTimeout&validatorsTimeout: These are the basic fee units paid from the Sender's budget.- Normal Round (Majority Outcome):
- The Leader earns
leaderTimeout+validatorsTimeout. - Majority Validators each earn
validatorsTimeout.
- The Leader earns
- Successful Appeal:
- The Appellant is rewarded handsomely, receiving 1.5x their appeal bond back (a 50% return on investment).
burns:- Minority Validators in a normal round with a clear majority have a portion of their fees
burnedas a penalty for being incorrect. The penalty isPENALTY_REWARD_COEFFICIENT * validatorsTimeout. - An unsuccessful Appellant loses their entire appeal bond, which is either burned or distributed to the participants of the next round.
- Minority Validators in a normal round with a clear majority have a portion of their fees
slashing:- A more severe penalty applied directly to a validator's staked capital.
IDLEvalidators are slashed a percentage of their stake (IDLE_PENALTY_COEFFICIENT).- Validators committing Deterministic Violations (e.g., cryptographic failures) are slashed a larger percentage (
DETERMINISTIC_VIOLATION_PENALTY_COEFFICIENT).
The system is designed to increase security in response to contention.
NORMAL_ROUND_SIZES:[5, 11, 23, ...]APPEAL_ROUND_SIZES:[7, 13, 25, ...]
- Escalation: Each appeal round uses more validators than the last, making it progressively harder and more expensive to challenge the consensus.
- Cumulative Participation: Normal rounds reuse the cumulative set of all validators who have participated in any previous round (normal or appeal). This ensures that after a dispute (which introduces many new validators), the next normal round has a much higher security level.
- Mechanical Brake: If an appeal follows another unsuccessful appeal, its size is reduced by 2. This is a "mechanical brake" to prevent runaway security escalation from long chains of failed appeals.
For a detailed explanation of the algorithm, see ADDRESS_ALLOCATION_ALGORITHM.md.
Consider the path: Normal (Majority Agrees) → Validator Appeal (Successful) → Normal
- Round 0 (
NORMAL_ROUND): A leader and 5 validators participate. A majority agrees, but a minority disagrees and decides to appeal. - Round 1 (
APPEAL_VALIDATOR_SUCCESSFUL): An appellant from the minority pays an appeal bond. A new set of 7 validators is brought in. They vote, and this time the outcome isDISAGREE, overturning the original result.- The appellant receives 1.5x their bond back.
- The original majority from Round 0 is penalized.
- Round 2 (
NORMAL_ROUND): Because of the successful appeal, the original Round 0 is now considered invalid. Its label is retroactively changed toSKIP_ROUND. The system proceeds to a new normal round.- This new normal round will be much larger (11 participants), reusing the validators from both Round 0 and Round 1 to ensure a higher level of security after the dispute.