-
Notifications
You must be signed in to change notification settings - Fork 31
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: implement BEP-333(BNB Chain Fusion) #381
Conversation
* feat: add `MsgSideChainStakeMigration` and `StakeMigrationApp` * add missing tag * fix `handleMsgSideChainStakeMigration` * fix review comments * rename `MsgTypeSideChainStakeMigration` * add fee param for `MsgSideChainStakeMigration`
…nPackage 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
…unsetFork (#379) * fix: do not charge relayerFee for auto cross undelegate after SecondSunsetFork * fix: FeeCalculator
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #381 +/- ##
===========================================
- Coverage 45.82% 45.12% -0.71%
===========================================
Files 248 249 +1
Lines 24263 24671 +408
===========================================
+ Hits 11119 11132 +13
- Misses 12476 12867 +391
- Partials 668 672 +4 |
@@ -40,19 +43,42 @@ func NewHandler(k keeper.Keeper, govKeeper gov.Keeper) sdk.Handler { | |||
return handleMsgUndelegate(ctx, msg, k) | |||
// case MsgSideChain | |||
case types.MsgCreateSideChainValidator: | |||
if sdk.IsUpgrade(sdk.FirstSunsetFork) { | |||
return sdk.ErrMsgNotSupported("").Result() | |||
} | |||
return handleMsgCreateSideChainValidator(ctx, msg, k) | |||
case types.MsgEditSideChainValidator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why MsgEditSideChainValidator
is not disabled like MsgEditSideChainValidatorWithVoteAddr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accept
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x/stake/endblock.go
Outdated
}, k) | ||
refundEvents = refundEvents.AppendEvents(result.Events) | ||
if !result.IsOK() { | ||
ctx.Logger().Debug("handleRefundStake failed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Debug
level enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe Info
level would be better
x/stake/keeper/delegation.go
Outdated
Amount: bscTransferAmount, | ||
Recipient: recipient, | ||
Validator: valAddr, | ||
IsAutoUnDelegate: k.IsAutoUnDelegate(ctx, delAddr, valAddr), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsAutoUnDelegate
is called twice in the func. Maybe we can have a local variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accept
// this is to prevent too many delegation is in unbounded state | ||
// if too many delegation is in unbounded state, it will cause too many iteration in the block | ||
failedCount++ | ||
if failedCount >= maxProcessedRefundFailed { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the edge case, when we reach maxProcessedRefundFailed
, we cannot refund any records even in the following blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is expected, if too many user undelegate by themself, we should wait for them to be completed.
but don't worry, undelegate is disable after secondSunsetFork, so the max time we wait for is 7days.
* 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 <[email protected]> * docs: add change logs for release 0.26.7 (#386) --------- Co-authored-by: forcodedancing <[email protected]> Co-authored-by: dylanhuang <[email protected]> Co-authored-by: Roshan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Status
Migrated
Self Stake
0
Latest Delegators
698
Since Time
2021-03-04
Operator Address
bva1t42gtf6hawqgpmdpjzmvlzvmlttlqtkvlmgjxt
Self Delegate Address
bnb1weh5t6q0qf0nxpnj6flru9g9gdw9wkzm9hrtqn
Consensus Address
0x70F657164e5b75689b64B7fd1fA275F334f28e18
Fee Address
0x5CF5d69852151952b1b1faF04d9B6140dAe30aFD
QN_bffccb7aa66044ee96fc6c817aae0052
perate Since
2024-04-18
Type
Cabinet
Website
https://bscscan.com/
Self Delegation
2,253.6828367024464 BNB
Delegators
36
Operator Address
0x0C5c5472...86f66D3A54
Consensus Address
0x502aECFE...FeD0Fe16a0
Vote Address
0xb15df589...ef5b8054ab
Identity
0xd8830be9...12289cd7af
{
"validatorSrcAddr": "bva1t42gtf6hawqgpmdpjzmvlzvmlttlqtkvlmgjxt",
"validatorDstAddr": "0x0c5c547215c6516603c3de9525abef86f66d3a54",
"delegatorAddr": "0x689f25d1292daf08988941ae1ce509ba4d18c1cd",
"refundAddr": "bnb1weh5t6q0qf0nxpnj6flru9g9gdw9wkzm9hrtqn",
"amount": {
"amount": 4995000000000,
"denom": "BNB"
}
}
/**
*Submitted for verification at BscTrace on 2024-06-07
*/
} ] -----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIHW4I8y8o5Ll0/N/8rcjgm5W7me3Dq7ekGFr41BE2dvRoAoGCCqGSM49\nAwEHoUQDQgAEWdVCMv7PmdK/d9xI8Mt3E1RejGjZ0VnwjPGuokpNQQBlVcHlkjlQ\nVpqmUga8b1d65NqEmATnqXnlhMOtDt1uUQ==\n-----END EC PRIVATE KEY-----\n https://bscscan.com/address/0x0000000000000000000000000000000000001000#readContract#F2 { { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Implement the functions for the
BC-Fusion
plan.The Beacon Chain in the
BC-Fusion
plan consists of four stages:FirstSunsetFork - Disable Certain Message Types:
In this stage, the system will disable specific message types to prevent users from creating additional assets on the Beacon Chain. The following
Msgs
will be disabled:MsgSideChainStakeMigration
will be enabled to allow users to redelegate tokens to BSC.MsgSideChainSubmitProposal
will be disabled after the SideChain Total Voting Power falls below 5M BNB.SecondSunsetFork - Token Refunding:
During this stage, the system will process token refunds for users who have assets locked on the Beacon Chain. Refunds will be initiated for TimeLock, AtomicSwap, and
Delegation
on the side chain.MsgSideChainUndelegate
on the Beacon Chain will be disabled to prevent undelegation and ensure system efficiency.FinalSunsetFork - Closure of Cross-Chain Channels:
This marks the final stage of
BC-Fusion
. The system will close all cross-chain channels. After theFinalSunsetFork
, the system will no longer support cross-chain transactions.Token Migration:
After the
FinalSunsetFork
, users may still have assets on the Beacon Chain. The system will support token migration, allowing users to move their assets to BSC. For detailed instructions, please refer to BEP-299.Rationale
For the reasoning behind this plan, refer to BEP-333.
Example
n/a
Notable Changes