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: bc fusion hardfork implementation #358

Merged
merged 22 commits into from
Nov 29, 2023
Merged

Conversation

j75689
Copy link
Collaborator

@j75689 j75689 commented Aug 28, 2023

Description

This PR has implemented the function for bc-fusion hard forks.

Rationale

That will introduce 3 Phases for bc-fusoin:

  1. First Sunset Fork

The Beacon Chain will disable specific types of transactions to encourage users to keep their funds in their own wallets. The following types of Beacon chain transactions will be disabled: TimeLockMsg, TimeRelockMsg, FreezeMsg, IssueMsg, MintMsg, IssueMiniMsg, HTLTMsg, DepositHTLTMsg.

The Governance module will be automatically disabled when the voting power is below 5M BNB.

  1. Second Sunset Fork

The following transactions will be disabled: MsgSideChainSubmitProposal, MsgSideChainDelegate, MsgSideChainReDelegate.

All TimeLock and AtomicSwap will automatically be refunded to the user's wallet. All the BSC delegation will be undelegated automatically, if the delegation comes through BEP153, the funds will be sent back to the BSC network.

  1. Final Sunset Fork

After Final Sunset, cross-chain communication between the Beacon Chain and BSC will be completely stopped.

Some of the funds will be permanently locked:

  • The total amount of staking funds for validators on the Beacon Chain itself is approximately 110k BNB.
  • On the Beacon Chain, the BEP2/BEP8 tokens that are not mirrored or bound to BSC.
  • The BEP153 staking reward that is less than 0.1BNB or staked value which is less than 0.01BNB will be locked forever.

Example

n/a

Changes

Notable changes:

  • staking
  • ibc

@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2023

Codecov Report

Merging #358 (0bac842) into develop (5a7b238) will decrease coverage by 0.25%.
The diff coverage is 7.45%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #358      +/-   ##
===========================================
- Coverage    45.82%   45.58%   -0.25%     
===========================================
  Files          248      248              
  Lines        24263    24411     +148     
===========================================
+ Hits         11119    11128       +9     
- Misses       12476    12613     +137     
- Partials       668      670       +2     

@j75689 j75689 changed the title feat: disable msgs feat: bc fusion hardfork Nov 16, 2023
x/stake/endblock.go Outdated Show resolved Hide resolved
x/stake/endblock.go Outdated Show resolved Hide resolved
x/stake/endblock.go Outdated Show resolved Hide resolved
x/stake/endblock.go Outdated Show resolved Hide resolved
x/stake/endblock.go Outdated Show resolved Hide resolved
x/stake/handler.go Outdated Show resolved Hide resolved
x/gov/handler.go Outdated Show resolved Hide resolved
x/ibc/endblock.go Outdated Show resolved Hide resolved
x/ibc/endblock.go Outdated Show resolved Hide resolved
x/stake/endblock.go Outdated Show resolved Hide resolved
x/stake/handler.go Outdated Show resolved Hide resolved
types/upgrade.go Outdated Show resolved Hide resolved
x/stake/endblock.go Outdated Show resolved Hide resolved
x/stake/endblock.go Outdated Show resolved Hide resolved
x/ibc/endblock.go Outdated Show resolved Hide resolved
x/ibc/endblock.go Outdated Show resolved Hide resolved
@j75689 j75689 changed the base branch from develop to bc-fusion November 29, 2023 07:29
@j75689 j75689 changed the title feat: bc fusion hardfork feat: bc fusion hardfork implementation Nov 29, 2023
@j75689 j75689 marked this pull request as ready for review November 29, 2023 08:31
@unclezoro unclezoro merged commit 065b547 into bnb-chain:bc-fusion Nov 29, 2023
1 check passed
unclezoro pushed a commit that referenced this pull request Feb 26, 2024
* feat: bc fusion hardfork implementation (#358)

* fix: panic issue when doing refundStake and closeCorssChainChannel (#362)

* fix: handleMsgSideChainUndelegate should not pass prefixCtx

* fix: nil pointer when doing ibc method in endblock

* fix: add logs to sunset fork events and immediate sidechain undelegation (#364)

* fix: revert immediate sidechain undelegation and handle undelegation in endblock (#365)

* fix: disable ClaimMsg after FinalSunsetFork (#366)

* feat: add `MsgSideChainStakeMigration` and `StakeMigrationApp` (#367)

* feat: add `MsgSideChainStakeMigration` and `StakeMigrationApp`

* add missing tag

* fix `handleMsgSideChainStakeMigration`

* fix review comments

* rename `MsgTypeSideChainStakeMigration`

* add fee param for `MsgSideChainStakeMigration`

* fix: add missing register for new msg (#368)

* fix: error within `CreateRawIBCPackageByIdWithFee` (#369)

* fix: decimal for BCFusionStopGovThreshold (#370)

* fix: panic when totally unbound the validator in voting period (#371)

* fix: add missing event (#372)

* fix: wrong json tag (#373)

* fix: add missing tag of relayer fee in `handleMsgSideChainStakeMigration` (#376)

* feat: add IsAutoUnDelegate field to CrossStakeDistributeUndelegatedSynPackage and  prevent too many failed in auto refund (#377)

* feat: add IsAutoUnDelegate field to CrossStakeDistributeUndelegatedSynPackage

* fix: disable undelegate after SecondSunsetFork and prevent too many failed in auto refund

* chore: add more logs

* revert: cross stake changes

* fix: error handling in refund

* fix: transferPackage

* fix: CrossStakeDistributeUndelegatedSynPackageV2

* fix: reset context every time in refund loop (#378)

* fix: do not charge relayerFee for auto cross undelegate after SecondSunsetFork (#379)

* fix: do not charge relayerFee for auto cross undelegate after SecondSunsetFork

* fix: FeeCalculator

* chore: add logs for processed refunding count (#380)

* fix: close mirror, mirrorSync channel after FinalSunsetFork (#382)

* fix: disable MsgEditSideChainValidator after FirstSunsetFork and refine codes (#383)

* fix: change StakeMigrationRelayFee to 0.002BNB (#384)

* fix: appHash mismatch causes by channelsMap (#385)

---------

Co-authored-by: Roshan <48975233+Pythonberg1997@users.noreply.github.com>
unclezoro added a commit that referenced this pull request Feb 26, 2024
* fix: fix nil validator when publishing message (#356)

* feat: implement BEP-333(BNB Chain Fusion) (#381)

* feat: bc fusion hardfork implementation (#358)

* fix: panic issue when doing refundStake and closeCorssChainChannel (#362)

* fix: handleMsgSideChainUndelegate should not pass prefixCtx

* fix: nil pointer when doing ibc method in endblock

* fix: add logs to sunset fork events and immediate sidechain undelegation (#364)

* fix: revert immediate sidechain undelegation and handle undelegation in endblock (#365)

* fix: disable ClaimMsg after FinalSunsetFork (#366)

* feat: add `MsgSideChainStakeMigration` and `StakeMigrationApp` (#367)

* feat: add `MsgSideChainStakeMigration` and `StakeMigrationApp`

* add missing tag

* fix `handleMsgSideChainStakeMigration`

* fix review comments

* rename `MsgTypeSideChainStakeMigration`

* add fee param for `MsgSideChainStakeMigration`

* fix: add missing register for new msg (#368)

* fix: error within `CreateRawIBCPackageByIdWithFee` (#369)

* fix: decimal for BCFusionStopGovThreshold (#370)

* fix: panic when totally unbound the validator in voting period (#371)

* fix: add missing event (#372)

* fix: wrong json tag (#373)

* fix: add missing tag of relayer fee in `handleMsgSideChainStakeMigration` (#376)

* feat: add IsAutoUnDelegate field to CrossStakeDistributeUndelegatedSynPackage and  prevent too many failed in auto refund (#377)

* feat: add IsAutoUnDelegate field to CrossStakeDistributeUndelegatedSynPackage

* fix: disable undelegate after SecondSunsetFork and prevent too many failed in auto refund

* chore: add more logs

* revert: cross stake changes

* fix: error handling in refund

* fix: transferPackage

* fix: CrossStakeDistributeUndelegatedSynPackageV2

* fix: reset context every time in refund loop (#378)

* fix: do not charge relayerFee for auto cross undelegate after SecondSunsetFork (#379)

* fix: do not charge relayerFee for auto cross undelegate after SecondSunsetFork

* fix: FeeCalculator

* chore: add logs for processed refunding count (#380)

* fix: close mirror, mirrorSync channel after FinalSunsetFork (#382)

* fix: disable MsgEditSideChainValidator after FirstSunsetFork and refine codes (#383)

* fix: change StakeMigrationRelayFee to 0.002BNB (#384)

* fix: appHash mismatch causes by channelsMap (#385)

---------

Co-authored-by: Roshan <48975233+Pythonberg1997@users.noreply.github.com>

* docs: add change logs for release 0.26.7 (#386)

---------

Co-authored-by: forcodedancing <just.haha.it@gmail.com>
Co-authored-by: dylanhuang <j75689@gmail.com>
Co-authored-by: Roshan <48975233+Pythonberg1997@users.noreply.github.com>
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.

5 participants