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

Rewards pallet-integration tests #428

Merged
merged 64 commits into from
Nov 9, 2023
Merged

Rewards pallet-integration tests #428

merged 64 commits into from
Nov 9, 2023

Conversation

gianfra-t
Copy link
Contributor

Regarding #423.

As discussed in the issue, we need to ensure the proper issuance and distribution of the fee and per block reward tokens.

This is tested as follows:

  • In the vault-registry pallet, used due to the fact that it already has functions, constants and genesis configs appropriate to deploy vaults, we test here the block reward distribution. This is done in these integration_* test functions. These tests cover the registry of a vault, execution of the on init function (called directly) and assertion that the vault owners can collect the rewards.

  • In the issue pallet, given that it has the proper mocks for issuing and triggering the fee distribution, we test in these integration module tests, we ensure that the fees are distributed to the many collateral registered vaults, and that all the vaults in the pooled-reward pallet receive these rewards accordingly. (also have in mind the price mock for this example distribution).
    On the same module, we also test that nominated vault is taken into account and that the nominator gets the proper rewards and can collect them.

gianfra-t and others added 30 commits October 6, 2023 18:15
… new configuration to necessary mock runtimes
@gianfra-t gianfra-t marked this pull request as ready for review October 25, 2023 16:27
Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the requested changes @gianfra-t, I really like the tests and the explicit calculations. I added some nitpicky comments again but it looks good to me overall. Great job 👍

pallets/issue/src/tests.rs Show resolved Hide resolved
pallets/issue/src/tests.rs Outdated Show resolved Hide resolved
pallets/issue/src/tests.rs Show resolved Hide resolved
pallets/vault-registry/src/mock.rs Outdated Show resolved Hide resolved
pallets/currency/src/testing_constants.rs Outdated Show resolved Hide resolved
pallets/currency/src/testing_constants.rs Outdated Show resolved Hide resolved
Base automatically changed from 404-add-pooled-reward-pallet to main November 2, 2023 13:55
Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for addressing all my comments and great job overall @gianfra-t 👍

@gianfra-t gianfra-t merged commit c3a2ff0 into main Nov 9, 2023
2 checks passed
@gianfra-t gianfra-t deleted the reward-pallet-tests branch November 9, 2023 20:17
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.

Integration tests for new vault rewards implementation
2 participants