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

virtual-staking: Add tests for validator withdrawal and rebalance #132

Merged
merged 4 commits into from
Oct 9, 2023

Conversation

uint
Copy link
Contributor

@uint uint commented Oct 2, 2023

No description provided.

@uint uint requested a review from maurolacy October 3, 2023 18:38
@uint uint marked this pull request as ready for review October 3, 2023 18:38
@uint
Copy link
Contributor Author

uint commented Oct 3, 2023

@maurolacy Could you take a look if these are good enough tests for jail/tombstone/removal for #123? https://github.com/osmosis-labs/mesh-security/pull/132/files#diff-55aab61e430421dc3035cc9d8bcf2263cbc08138462de265da9a4b0efe4c3038R558-R622 They currently fail, but that's expected.

@uint uint force-pushed the 123-fix-validator-withdrawal branch from b6b0379 to 6ed7579 Compare October 3, 2023 18:40
Copy link
Collaborator

@JakeHartnell JakeHartnell left a comment

Choose a reason for hiding this comment

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

LGTM!

@uint uint force-pushed the 123-fix-validator-withdrawal branch from 6ed7579 to 727b2b8 Compare October 4, 2023 13:04
@uint
Copy link
Contributor Author

uint commented Oct 4, 2023

Rebased

Copy link
Collaborator

@maurolacy maurolacy left a comment

Choose a reason for hiding this comment

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

Sorry for the delay in reviewing. These tests are great, thanks for adding them.

contract.quick_bond(deps.as_mut(), "val1", 5);
contract
.hit_epoch(deps.as_mut())
.assert_no_bonding()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this because max_cap by default is zero? Please add a comment / rename the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Good catch - the max_cap = 0 should definitely be explicit.

contract.quick_bond(deps.as_mut(), "val2", 40);
contract
.hit_epoch(deps.as_mut())
.assert_bond(&[("val1", (1u128, &denom)), ("val2", (4u128, &denom))])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this because of rebalance, right? Better add a comment, and / or change the test name.

I would also add a test in which the max_cap is enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would be a clearer test name here? bond_rebalance?

simple_bond is a test case in which there's enough bonded.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a test case that's like simple_bond, but with 2 validators.

Copy link
Collaborator

Choose a reason for hiding this comment

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

bond_rebalance is OK.

@uint
Copy link
Contributor Author

uint commented Oct 9, 2023

@maurolacy I updated test names/comments. Hopefully it's all clear at a glance now!

@uint uint merged commit c1e85ab into main Oct 9, 2023
2 checks passed
@maurolacy maurolacy deleted the 123-fix-validator-withdrawal branch October 9, 2023 08:08
@uint uint mentioned this pull request Oct 12, 2023
10 tasks
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.

3 participants