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

feat: add new fork block and precompile contract for BEP294 and BEP299 #1874

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

pythonberg1997
Copy link
Contributor

@pythonberg1997 pythonberg1997 commented Sep 18, 2023

Description

This pr is to support

  • BEP-294: BSC Native Staking after BC Fusion
  • BEP-299: Token Migration after BC Fusion

Rationale

See 4. Motivation in BEP-294, BEP-299,

Changes

Notable changes:

  • add new precompile contract verifyDoubleSignEvidence and secp256k1SignatureRecover
  • add new systemTx to parlia to update validatorSet everyday after the fusion fork
  • add upgrade setting

core/vm/contracts.go Outdated Show resolved Hide resolved
core/vm/contracts.go Outdated Show resolved Hide resolved
core/vm/contracts.go Outdated Show resolved Hide resolved
core/vm/contracts.go Outdated Show resolved Hide resolved
core/vm/contracts.go Outdated Show resolved Hide resolved
sort.SliceStable(validatorHeap, validatorHeap.Less)
} else {
i := 0
for len(validatorHeap) < int(maxElectedValidators.Int64()) && i < len(allValidators) {
Copy link
Collaborator

@unclezoro unclezoro Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is complicated than I think.

Let's simplify it:
we get allVotingPowers slice, heap.init() it, then pop until 1. top maxElectedValidators, or 2. the heap is empty. Each pop item goes to eligibleValidators

@j75689 j75689 changed the title feat: add new fork block and precompile contract for BEP294 feat: add new fork block and precompile contract for BEP294 and BEP299 Nov 10, 2023
core/types/block.go Outdated Show resolved Hide resolved
consensus/parlia/parlia.go Outdated Show resolved Hide resolved
miner/worker.go Outdated Show resolved Hide resolved
@unclezoro unclezoro changed the base branch from develop to bc-fusion November 30, 2023 03:06
core/vm/contracts.go Outdated Show resolved Hide resolved
params/config_test.go Outdated Show resolved Hide resolved
@unclezoro unclezoro merged commit 030e416 into bnb-chain:bc-fusion Nov 30, 2023
5 checks passed
Copy link

@octavio12345300 octavio12345300 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gracias

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.

7 participants