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-404: Clear Miner History when Switching Validators Set #404

Merged

Conversation

buddh0
Copy link
Contributor

@buddh0 buddh0 commented Jul 1, 2024

  BEP: 404
  Title: Clear Miner History when Switching Validators Set
  Status: Candidate
  Type: Standards
  Created: 2024-07-01

BEP-404: Clear Miner History when Switching Validators Set

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.
4-1

This BEP clarifies that MinerHistory should be cleared when switching the validator set to solve this issue.

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

@buddh0 buddh0 force-pushed the clear_miner_history_switch_epoch_validators branch from 2bd87ca to 96ebfac Compare July 1, 2024 10:55
@buddh0 buddh0 changed the title Clear Miner History when Switching Validators Set BEP-403: Clear Miner History when Switching Validators Set Jul 1, 2024
@buddh0 buddh0 marked this pull request as ready for review July 1, 2024 10:59
@NathanBSC NathanBSC changed the title BEP-403: Clear Miner History when Switching Validators Set BEP-404: Clear Miner History when Switching Validators Set Jul 1, 2024
unclezoro
unclezoro previously approved these changes Jul 2, 2024
BEPs/BEP-404.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
BEPs/assets/BEP-404/3-1.png Outdated Show resolved Hide resolved
@zzzckck
Copy link
Contributor

zzzckck commented Jul 2, 2024

may refer this block as an example: https://bscscan.com/block/40110411

@zzzckck zzzckck merged commit c605f1e into bnb-chain:master Jul 2, 2024
galaio pushed a commit to galaio/BEPs that referenced this pull request Nov 1, 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.

3 participants