Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEP-341: Validators can produce consecutive blocks #341

Conversation

NathanBSC
Copy link
Contributor

@NathanBSC NathanBSC commented Jan 12, 2024

  BEP: 341
  Title: Validators can produce consecutive blocks
  Status: Draft
  Type: Standards
  Created: 2023-09-27
  Discussions(optional): https://forum.bnbchain.org/t/bep-idea-validators-can-produce-consecutive-blocks/2052

BEP-341: Validators can produce consecutive blocks

1. Summary

Each epoch in BSC consists of multiple slots, and a batch of validators take turns in a predefined order to obtain priority block-producing rights for each slot. This BEP proposes an adjustment to the allocation of priority block-producing rights: each validator receives priority block-producing rights for a predetermined number of consecutive slots per round.

2. Abstract

BEP-341 describes a new allocation method for priority block-producing rights, which is logically concise and significantly enhances the system's transaction processing capacity, while remaining orthogonal to transaction processing optimization techniques within blocks.

3. Motivation

The BSC ecosystem is active and continuously evolving, requiring ongoing improvements to the system's transaction processing capacity.

4. Specification

4.1 Scaling Principle

Currently, each validator obtains priority block-producing rights for a single slot and is then rotated, with a fixed block interval of t. The transaction processing limit is t/2 for validating transactions from the previous block and t/2 for processing transactions in the new block.

Assuming the number of transactions that can be processed is T, the average TPS is calculated as follows:
After implementing this BEP, each validator can obtain priority block-producing rights for a continuous sequence of n slots in one round. The first block they process still allocates t/2 for validating transactions from the previous block and t/2 for processing transactions in the new block. However, subsequent blocks can skip the transaction validation process and focus on processing transactions in the new block. It is recommended that the processing time for the last block in their current round be only half of the time required to process transactions in the new block. This helps avoid the situation where the first block processed by the next validator is close to being an empty block.
The TPS after continuous block production is as follows:
Therefore, the TPS improvement rate is:
The relationship between the number of continuous blocks produced and TPS improvement is
As shown in the graph, it is evident that continuous block production cannot double the TPS. There is no benefit when n<3, and increasing n beyond 5 does not proportionally increase the benefits. Therefore, a value within the range [3, 5] is suitable for n; when n=4, r=50%.

4.2 Implementation Specification

4.2.1 Priority Allocation

Each epoch predefines a set of validators, with a total of validatorN validators, and each validator within the set has a unique index ranging from [0, validatorN). If the current block height is blockN, then the validators with the following indices obtain priority block-producing rights.

4.2.2 Validator Set Switch

Each epoch will choose a new validator set, assuming an epoch contains epochSlots slots. The validator set switch occurs only when the block height reaches Bswitch to prevent epoch block forging. The calculation of Bswitch is as follows:

4.2.3 Block Avoidance

To prevent fewer than 1/2 of the nodes from controlling the entire network, block producers are required to produce fewer than n blocks within the previous ((validatorN/2+1)*n-1) historical blocks.

4.2.4 Governable Number of Consecutive Blocks

When n=1, it is equivalent to disabling the feature of consecutive block production, while significant optimization is observed when n belongs to the range [3,5]. Currently, the range for the value of n is set to [1,9] but except 2.

The initial value of n is 1, and changing its value requires the BSC governance process.

4.2.5 Combatting MEV

As the consecutive period in which a single validator gains priority in block production extends, it may facilitate MEV extraction, potentially leading validators to include more transactions in the later blocks they consecutively produce. To constrain validators to promptly package transactions, within a validator's consecutive priority over n blocks, the transaction fees' split to the SystemRewardContract will increase linearly with block number, capped at the value denoted as systemRewardAntiMEVRatio.
Respectively, the split ratio remains at systemRewardBaseRatio when continuous block production is disabled. Once continuous block production is enabled (i.e., when n > 1), the systemRewardRatio is calculated as:

as shown in the following picture:

The initial value of systemRewardAntiMEVRatio is 0, and changing its value also requires the BSC governance process.

5. Incentive Fairness Analysis

Within a single epoch, tail validators have fewer block-producing opportunities, but the allocation of priority rights is unbiased and cannot be manipulated. Therefore, from a statistical perspective, it is fair.

If a validator tries to extract more MEV by placing more transactions in later blocks they produce, it will also increase user transaction confirmation times. To curb this, the systemRewardAntiMEVRatio can be raised through the governance process, which will increase the proportion of transaction fees allocated to the SystemRewardContract. These bonuses will be distributed as Fast Finality voting rewards to validators, keeping their overall benefits unchanged. However, during high traffic and transaction backlog, high-performance validators usually handle more transactions. These changes will reduce the income advantage of having high performance.

6. Security Analysis

This BEP relies on BSC's Fast Finality feature. If Fast Finality fails, it may result in the following issues:

  1. Nodes intentionally hide mined blocks, potentially leading to longer short-term reorganizations.
  2. The probability of finality for transactions increases, requiring waiting for 2/3*validatorN*n+ blocks.

7. Liveness Analysis

The liveness of the chain remains unchanged, meaning it is required to ensure that at least (validatorN/2+1) validators are active. The proof is as follows:

If (validatorN/2+1) validators are active and none are allowed to produce blocks at a certain moment, each validator must have produced at least n blocks in the past ((validatorN/2+1)*n-1) blocks. Thus, collectively, at least (validatorN/2+1)*n blocks must have been produced, which is impossible. Therefore, at any moment, at least one of the (validatorN/2+1) validators must be allowed to produce blocks.

8. License

The content is licensed under CC0.

@NathanBSC NathanBSC force-pushed the bep-234-validators-can-produce-consecutive-blocks branch from 84ddb82 to 1b36e3f Compare January 12, 2024 13:55
@NathanBSC NathanBSC changed the title BEP-301: Validators can produce consecutive blocks BEP-341: Validators can produce consecutive blocks Jan 12, 2024
@Magkoohp
Copy link

0x4ea83aebbd3d2c29cfe79737aa35b4302f26bcb6

@NathanBSC NathanBSC force-pushed the bep-234-validators-can-produce-consecutive-blocks branch 3 times, most recently from d94ca83 to d2994d5 Compare April 23, 2024 11:57
@buddh0 buddh0 assigned will-2012 and unassigned will-2012 Apr 26, 2024
@NathanBSC NathanBSC force-pushed the bep-234-validators-can-produce-consecutive-blocks branch from 9ba10b6 to f4537f1 Compare April 29, 2024 04:23
@NathanBSC NathanBSC force-pushed the bep-234-validators-can-produce-consecutive-blocks branch from 1320f5b to ce0b5be Compare May 10, 2024 03:04
@NathanBSC NathanBSC force-pushed the bep-234-validators-can-produce-consecutive-blocks branch from 4341461 to 494d4f4 Compare May 29, 2024 02:52
@buddh0 buddh0 force-pushed the bep-234-validators-can-produce-consecutive-blocks branch from 494d4f4 to f0939e1 Compare June 4, 2024 10:48
BEPs/BEP-341.md Outdated Show resolved Hide resolved
@NathanBSC NathanBSC force-pushed the bep-234-validators-can-produce-consecutive-blocks branch from d7cf196 to 6cd2582 Compare June 11, 2024 01:58
@huihzhao
Copy link
Contributor

any APY impact for validators?

@NathanBSC NathanBSC force-pushed the bep-234-validators-can-produce-consecutive-blocks branch from 616c347 to 9f2cdd7 Compare June 12, 2024 09:04
@buddh0
Copy link
Contributor

buddh0 commented Jun 12, 2024

  1. Incentive Fairness Analysis

pls refer 5. Incentive Fairness Analysis

@thy-r
Copy link

thy-r commented Jun 19, 2024

Regarding 4.2.5 Combatting MEV, the BEP says "To constrain validators to promptly package transactions, within a validator's consecutive priority over n blocks, the transaction fees' split to the SystemRewardContract will increase linearly with block number... "

The problem with this approach is that it is not possible to force validators to share their MEV profit with delegators / SystemRewardContract.

So, if for example the validators make an extra MEV profit by producing consecutive blocks, they can keep this extra profit to themselves, bypassing SystemRewardContract. Therefore, the constraint made by systemRewardAntiMEVRatio is not really effective as it is limited only to the transaction fees, which is likely just a small fraction of the total profit that validators could potentially make by signing consecutive blocks.

The bottom line is that the extra profit from signing consecutive blocks is much higher than the validator profit from transaction fees and therefore validators can ignore the constraint made by systemRewardAntiMEVRatio and users will wait longer for transaction confirmations.

This change is definitely good for the validators, who will be able to aggressively extract more MEV by signing consequent blocks, but it is not clear how this change is good for the network, as it will result in lower confirmation time for the users.

@huihzhao
Copy link
Contributor

Regarding 4.2.5 Combatting MEV, the BEP says "To constrain validators to promptly package transactions, within a validator's consecutive priority over n blocks, the transaction fees' split to the SystemRewardContract will increase linearly with block number... "

The problem with this approach is that it is not possible to force validators to share their MEV profit with delegators / SystemRewardContract.

So, if for example the validators make an extra MEV profit by producing consecutive blocks, they can keep this extra profit to themselves, bypassing SystemRewardContract. Therefore, the constraint made by systemRewardAntiMEVRatio is not really effective as it is limited only to the transaction fees, which is likely just a small fraction of the total profit that validators could potentially make by signing consecutive blocks.

The bottom line is that the extra profit from signing consecutive blocks is much higher than the validator profit from transaction fees and therefore validators can ignore the constraint made by systemRewardAntiMEVRatio and users will wait longer for transaction confirmations.

This change is definitely good for the validators, who will be able to aggressively extract more MEV by signing consequent blocks, but it is not clear how this change is good for the network, as it will result in lower confirmation time for the users.

As BNBChain has impelmented the PBS, the MEV revenue that through the standard builder API could be included in the gas fee. that is another consideration when wen discuss this topic. I assume, for normal users, they can also use a builder to be protected from attacks, and also of course for searchers.

@bnb-chain bnb-chain deleted a comment from NathanBSC Jul 8, 2024
@NathanBSC NathanBSC force-pushed the bep-234-validators-can-produce-consecutive-blocks branch from 9f2cdd7 to 0857967 Compare July 25, 2024 10:27
@NathanBSC
Copy link
Contributor Author

NathanBSC commented Jul 25, 2024

rebase master and force push 07.25

@zzzckck zzzckck merged commit 048b73b into bnb-chain:master Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.