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

Feat: nomination commission #760

Merged
merged 3 commits into from
Nov 16, 2022

Conversation

sander2
Copy link
Member

@sander2 sander2 commented Nov 9, 2022

Implement commission: every time we withdraw from the global pool, we directly transfer the commission to the operator. The remaining goes into the vault's staking pool. That also means that there's no technical reason to place restrictions on when the commission can be modified, although there could be other reasons to add such restrictions in the future.

One drawback of this approach, though, is that it is less clear for the operator to see how much they have earned.

I also added a randomized test to test the reward distribution, which compares the actual rewards with one calculated by a very simple (and therefore less error-prone) brute-force implementation. I am aware that fee distribution is going to change in the future but the test should be easy enough to update when that happens.

Also note the fix in the vault-registry that prevents incorrect reward distribution after vault collateral changes.

A final thing to note is that the commission is stored and set in the fee pallet rather than the nomination pallet. There is an argument to be made to place it in the nomination pallet, but that'd slightly complicate the implementation (we'd require a config item trait that allows the fee pallet to make calls to the nomination pallet. But in the end the commission is directly related to the fees so it's not a terrible spot for it either.

@sander2 sander2 marked this pull request as ready for review November 10, 2022 09:33
@sander2 sander2 force-pushed the feat/nomination-commission branch from ec9b6c4 to 2779f32 Compare November 16, 2022 11:46
standalone/runtime/tests/test_redeem.rs Outdated Show resolved Hide resolved
crates/vault-registry/src/lib.rs Show resolved Hide resolved
@sander2 sander2 force-pushed the feat/nomination-commission branch from 2779f32 to f4834d8 Compare November 16, 2022 12:38
@sander2 sander2 enabled auto-merge November 16, 2022 12:49
@sander2 sander2 merged commit 3922cd6 into interlay:master Nov 16, 2022
@sander2 sander2 added this to the Release 1.20 milestone Dec 7, 2022
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.

2 participants