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

fix: add validator cap and bond checks when creating the delegation strategy #810

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kruspy
Copy link
Collaborator

@kruspy kruspy commented Apr 8, 2024

No description provided.

@kruspy kruspy requested a review from a team as a code owner April 8, 2024 17:28

This comment has been minimized.


// just delegate if the validator does not exceed any of the validator specific caps
if !k.stakingKeeper.CheckExceedsValidatorBondCap(ctx, validator, outputShares) &&
!k.stakingKeeper.CheckExceedsValidatorLiquidStakingCap(ctx, validator, outputShares, false) {
Copy link
Member

Choose a reason for hiding this comment

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

here if it still has some space, we should try to fill everything up

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

what do you mean ?

@kruspy
Copy link
Collaborator Author

kruspy commented Apr 9, 2024

I've done a rework on the function and modified the LiquidStake one as well. The previous version was wrong.

You'll also see I've removed a few test parts that were checking exact delegations since the delegation strategy uses a map and it is not possible to have consistent results when testing. Still, the overall amounts are checked.

if leftOver.LT(numValidators) { // if the leftover is less than the number of validators to be delegated, just add it to the first one that can receive it
diffPerValidator = leftOver
}
for strAddr := range delegations {
Copy link
Member

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants