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

change reserve emissions config from percent rate to weights #28

Merged
merged 5 commits into from
Jan 13, 2025

Conversation

celestialkylin
Copy link
Contributor

Hello,

I noticed that the share in the emissions configuration is being used directly as a percentage rate. If the total share does not equal 1_0000000, some emissions may be lost when invoking the do_gulp_emissions function.

How about changing the share value from a percentage rate to a weight? This could help prevent emissions from being lost and make the emissions configuration easier to manage.

Additionally, when considering the asset disabling feature, I suggest ignoring the emissions that are sent to the disabled asset as well. With this change, it would be easier to disregard the share of the disabled asset and redistribute the remaining emissions to the other reserves.

@mootz12
Copy link
Contributor

mootz12 commented Jan 9, 2025

👋

Thanks for the PR!

This is a good point about asset disabling, that could make this change worth while.

The original design was done this way instead of shares due to clarity and rounding concerns. With shares, each "share" ends up getting rounded down, then the amount of tokens is rounded down again, rather than the shares being exact. This might not make much of an impact to actual emissions numbers, tho.

I'll look into it and get back here!

@celestialkylin
Copy link
Contributor Author

Thanks for your reply.

Regarding the rounding-down impact, I have a solution. Do you think this can be accepted? The idea is to add the remaining emissions caused by rounding to a random emission element.

Additionally, the disabled asset can be filtered out in the first for-loop by adding some extra code.

Best regards

@mootz12
Copy link
Contributor

mootz12 commented Jan 11, 2025

@celestialkylin

Got time to look into how impactful rounding down can be if we opt use weights, and the impact is pretty minimal.

With extremely unoptimized weights (say, emitting to 10 different assets and all 10 get rounded down) this means about 0.0001% of emissions are lost to rounding.

This could also easily be fixed by the pool creator by adjusting the weights, minimizing the impact even more. Thus, I think the simpler solution is a better solution here.

My suggestions:

I think this change helps a lot when handling disabled assets, so would be happy to merge once the suggestions are addressed.

Thanks for the contribution!

…sions

remove unit test test_set_pool_emissions_panics_if_over_100
add unut test test_set_pool_emissions_panics_if_anyone_share_equal_0
@celestialkylin
Copy link
Contributor Author

Hello @mootz, this is the modification based on your suggestion. Thanks!

Copy link
Contributor

@mootz12 mootz12 left a comment

Choose a reason for hiding this comment

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

LG2M!

@mootz12 mootz12 merged commit 8acb517 into blend-capital:main Jan 13, 2025
3 checks passed
@celestialkylin celestialkylin deleted the feat_emission_weight branch January 21, 2025 05:29
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