-
Notifications
You must be signed in to change notification settings - Fork 26
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(evmstaking): replace staking keeper endblocker #209
Conversation
38493f3
to
9ed02e5
Compare
spendableAmount := k.bankKeeper.SpendableCoin(ctx, delegatorAddr, sdk.DefaultBondDenom).Amount | ||
if spendableAmount.IsZero() { | ||
log.Warn(ctx, "No spendable coins for undelegation", | ||
errors.New("no spendable coins for undelegation"), | ||
"delegator", entry.delegatorAddress, | ||
"validator", entry.validatorAddress, | ||
"original_amount", entry.amount.String()) | ||
|
||
continue | ||
} | ||
|
||
// If the requested undelegation amount is greater than the spendable amount, set the real undelegation amount to | ||
// the total spendable amount. | ||
if entry.amount.GT(spendableAmount) { | ||
entry.amount = spendableAmount | ||
log.Warn(ctx, "Spendable amount is less than the requested undelegation amount", | ||
errors.New("spendable amount is less than the requested undelegation amount"), | ||
"delegator", entry.delegatorAddress, | ||
"validator", entry.validatorAddress, | ||
"requested_amount", entry.amount.String(), | ||
"spendable_amount", spendableAmount.String()) | ||
} |
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.
Should we add tests to ensure this invariance is not broken? cc @limengformal
We should also add the crisis module for invariance checks, cc @edisonz0718.
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.
Will add a test to cover that this invariance is not broken in the following 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.
lgtm
9ed02e5
to
bd0d8fc
Compare
bd0d8fc
to
9befa97
Compare
Binary uploaded successfully 🎉📦 Version Name: 0.12.0-d2e195c |
* chore(release): release version 0.12.1 unstable * feat(epochs): revert epoch module (#198) * feat(api): revert add epochs api * feat(epochs): revert porting epochs module * feat(evmstaking): use deterministic cosmos sdk (#211) * feat(evmstaking): replace staking keeper endblocker (#209) --------- Co-authored-by: Hans Lee <38912532+0xHansLee@users.noreply.github.com> Co-authored-by: Zerui Ge <gezerui1997@gmail.com>
With this implementation, I replaced the EndBlocker of staking keeper.
It now returns the array of completed unbonding, so we can use them for processing withdrawal.
issue: #197