-
Notifications
You must be signed in to change notification settings - Fork 1k
Added an example program to derive constraints on shielded reward parameters #4573
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
Conversation
08cd41d to
471e5fd
Compare
471e5fd to
0559439
Compare
0559439 to
848bd44
Compare
848bd44 to
01593a9
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4573 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
batconjurer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits in the doc strings. Also, I know that this is just an example, but it might actually end up being fairly useful. It will be annoying to have to restart the entire flow because of malformed input. I would suggest two UX improvements: One allow parsing all inputs from a file optionally (this is once users have a rough idea of the inputs and just want to tweak things) and also, instead of eagerly erroring out on bad input, just loop until correct input is given.
examples/shielded_rewards.rs
Outdated
| precision, incent_code | ||
| ); | ||
|
|
||
| // It must be that S*C/Y >= I, which implies that the reward rate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C is defined below. Consider moving doc string up. Also, S seems to be missing a definition in the doc strings entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, moved. I think S is defined at https://github.com/anoma/namada/blob/1cb9fccc857d2c0608f01a01fb72518bda9e5b2b/examples/shielded_rewards.rs#L81 .
16ff912 to
1cb9fcc
Compare
|
@murisi we should merge this if we can, is it ok? |
@brentstone This PR touches a file outside the |
|
@tzemanovic or @batconjurer would you mind reviewing? |
|
This is the third time I've been asked to review this with my comments from the first review not being addressed. I'll say it again: |
I really don't know how I missed that comment. My bad. Both ideas (file input and error recovery) are very good. The former is a little awkward to implement because the input range of certain variables depends on the value selected for earlier variables, but I think this can be achieved. Indeed file inputs (and outputs) would also allow us to keep (and share) a record of how the precision parameters were derived. And the latter idea would go with increased input validation (like making sure that numbers are within certain ranges). Thanks for bringing up these points - will work on them today or tomorrow. |
7609762 to
5bf8e92
Compare
5bf8e92 to
0b3ae12
Compare
Describe your changes
Wrote a Cargo example that derives constraints on shielded reward parameters in order to ensure that end-users get non-zero rewards. Essentially this example takes the native token supply, incentivisation threshold, target locked amount, and locked amount tolerance and computes bounds on inflation, token precision, and nominal proportional gain sufficient to yield non-zero rewards. See the formulas upon which this example program is based at: https://hackmd.io/oqLHjyvwRMaxSD5JJNrB2w#Setting-parameters-to-ensure-non-zero-rewards . This program can be run with the following command:
cargo run --example shielded-rewards.Checklist before merging
breaking::labelsnamada-docsreponamada-indexerornamada-masp-indexer, a corresponding PR is opened in that repo