Skip to content

Commit

Permalink
BEP-404: Clear Miner History when Switching Validators Set (bnb-chain…
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh0 authored and galaio committed Nov 1, 2024
1 parent e6ea2ca commit e7c650e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
54 changes: 54 additions & 0 deletions BEPs/BEP-404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<pre>
BEP: 404
Title: Clear Miner History when Switching Validators Set
Status: Candidate
Type: Standards
Created: 2024-07-01
</pre>

# BEP-404: Clear Miner History when Switching Validators Set

- [BEP-404: Clear Miner History when Switching Validators Set](#bep-404-clear-miner-history-when-switching-validators-set)
- [1. Summary](#1-summary)
- [2. Motivation](#2-motivation)
- [3. Status](#3-status)
- [4. Specification](#4-specification)
- [5. Backwards Compatibility](#5-backwards-compatibility)
- [6. License](#6-license)

## 1. Summary
After switching the validator set on the BSC chain, the previous block production record is still used to restrict some validators from producing blocks for the first few blocks after the switch, leading to brief network instability. This BEP aims to resolve this issue.

## 2. Motivation
The validator set on the BSC chain switches at each epoch.

Assume the number of validators in an epoch is validatorN. To ensure the consistency of the BSC chain, it is required that the chain must have at least validatorN/2+1 validators to continue advancing the chain.

To achieve this constraint, a set called MinerHistory is defined, with a length of validatorN/2, recording the validators that produced the last validatorN/2 blocks. New block-producing validators are required to not be in MinerHistory.

This BEP aims to enhance network stability by clearing MinerHistory when the validator set switches.

## 3. Status
This BEP is in progress.

## 4. Specification
In the previous specification, when the validator set switches at each epoch, MinerHistory is not cleared, causing some validators to be unable to produce blocks normally for the first few blocks after the switch.
<div align="center">
<img src=./assets/BEP-404/4-1.png width=100% />
</div>
This BEP clarifies that MinerHistory should be cleared when switching the validator set to solve this issue.

```Go
MinerHistory map[uint64]Address

// The conditions for switching remain unchanged
if BlockNum % EpochLength == (validatorN/2) {
MinerHistory = Address{}
}
```

## 5. Backwards Compatibility
There are no known backward compatibility issues.

## 6. License
The content is licensed under [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
Binary file added BEPs/assets/BEP-404/4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Here is the list of subjects of BEPs:
| [BEP-362](./BEPs/BEP-362.md) | Greenfield Storage Fee Paymaster | Standards | Candidate |
| [BEP-364](./BEPs/BEP-364.md) | Primary Storage Provider acts as the upload agent for object creation and update on Greenfield | Standards | Candidate |
| [BEP-366](./BEPs/BEP-366.md) | PGreenfield Atomic Object Update | Standards | Candidate |
| [BEP-404](./BEPs/BEP-404.md) | Clear Miner History when Switching Validator Set | Standards | Candidate |



Expand Down

0 comments on commit e7c650e

Please sign in to comment.