-
Notifications
You must be signed in to change notification settings - Fork 244
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
Domains staking: Epoch transition and Pending unlocks #1657
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a631690
finalize domain operator switch during the old domain epoch transition
vedhavyas 2838994
ability to unlock operator at specific domain block number
vedhavyas 226070e
finalize the operators deregistration
vedhavyas cdccaf8
define error type for epoch transitions
vedhavyas ab875d8
add operator withdrawal finalization at epoch and adjust the Operator…
vedhavyas 0b4aed5
operator deposit finalization at the end od epoch
vedhavyas 15138e5
add domain epoch finalization and begins next epoch
vedhavyas 0c07426
unlock all the pending operators and nomination withdrawals
vedhavyas e45668e
track operator balances within staking summary for easier proof verif…
vedhavyas 5be738f
process all operator related info and then remove the operator once u…
vedhavyas beb4f72
Merge branch 'main' into domains/epoch_transition
vedhavyas 3d7e79a
Merge branch 'main' into domains/epoch_transition
vedhavyas 648b9bb
Merge branch 'main' into domains/epoch_transition
vedhavyas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 use the consensus block for this period? We need to use the domain block instead.
IMO, this locking period of withdrawal is introduced in case there are slashes after the user issue withdrawal, such that we can still deduct from the locking withdrawal. The slash happens if there is fraud proof challenging an invalid ER, and the challenge period of ER is measured by domain block (i.e.
BlockTreePruningDepth
).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.
No, this is per spec where once its moves to unlocking state, it is tracked with consensus chain block
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.
Seems it takes only
StakeEpochDuration
domain blocks (currently set to 5) to move into the unlock state, which is much smaller thanBlockTreePruningDepth
(currently set to 256).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.
I believe the parameterization will be revisited once the block tree PR lands, should be a non-blocker for this PR.
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.
My point is not about the parameterization,
StakeEpochDuration
is expected to be small whileBlockTreePruningDepth
is expected to be large.My concern is in the current implementation a malicious operator can submit a fraudulent ER and then deregister immediately, so they can successfully get away from slashing.
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.
In either scenario of domain stall, network delay, and too many bundles to fit in one consensus block, can cause no domain bundle included in a consensus block thus no domain block will be driven from that consensus block, so the consensus chain will progress faster than the domain chain, which means the unlocking period (using consensus block) will progress faster than the challenging period (using domain block).
The following example uses
BlockTreePruningDepth = 256
,StakeWithdrawalLockingPeriod = 100
andStakeEpochDuration = 5
as the current implementation:#10
and domain chain#10
, a malicious operator submits a fraudulent ER and a deregister request.#10 -> #12
and domain chain progress#10 -> #12
, the domain epoch transited the deregistration and reached the unlocking state.#12
, but the consensus chain progressed as usual#12 -> #112
, and the deregistration was unlock#266
) but can not slash the malicious operator as it is already deregistered.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.
I think it won't bring extra cost compared to the current approach, we just need to change the index of the unlock list from
consensus_block_number
to(domain_id, domain_block_number)
unless I miss something.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.
Not just that, but we also need to adjust the other Storage items like PendingWithdrawals. This will be also be scoped such that each with withdrawal is on FIFO order. May not be such a trivial change since the underlying assumption has changed.
This is not the final number and has a TODO to revisit this number.
Looking at the example there, I dont see that practically but this was the known concern during our offline discussion.
I do not have a strong opinion here but we need to update spec accordingly once we make the decision since calling it Global pending unlocks is confusing as well.
The change will be handled as either a separate PR or part of the epoch PR that uses block tree.
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.
The domain block number is also monotonically increasing as the consensus block, thus this is preserved.
No matter how large this number can be the malicious operator can always choose to attack at the last few blocks of the current epoch, that is why I use 12 in the above example instead of 15.
I do think it is an issue we need to address but I'm okay with this.
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.
Aboslutely, please start the discussion on the spec v2 regarding or open existing one. Thanks!