-
Notifications
You must be signed in to change notification settings - Fork 14
Rewards script rust #146
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 script rust #146
Conversation
0e4d4bd to
3d908c5
Compare
|
FYI, you need to solve conflicts for the CI to run |
| pub struct HttpResponse<T: for<'a> Deserialize<'a>> { | ||
| _marker: PhantomData<T>, | ||
| inner: Response, | ||
| body: String, |
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.
curious about this change, didn't want reqwest types in our api?
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.
As part of expanding the testing for the proposers script, I've added a MockClient for testing the code paths that grab data from vit-ss, and it felt weird to have reqwest types in the public API. Also, last time I checked, it was either impossible or just annoying to construct a fake Reponse from outside reqwest, but I didn't look into that much
| .collect() | ||
| } | ||
|
|
||
| fn calculate_total_stake_from_block0( |
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.
I think we should use VoterHIR instead of block0 like we do with other tools
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.
I'm not sure what that would look like, is there somewhere I can look for an example of this? Doing a grep for VoterHir didn't help much :/
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.
Instead of commitee keys + block0 accept as input a Vec<VoterHIR>, which is essentially the output from our snapshot tool. Then it should be something like
hirs.iter().map(|v| v.voting_power).sum()
because we don't punt commitee keys in the snapshot (or rather, all voters in the snapshot should be eligible to vote / earn rewards)
zeegomo
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.
there's an empty cli/rewards/proposers/util.rs file
| .collect() | ||
| } | ||
|
|
||
| fn calculate_total_stake_from_block0( |
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.
Instead of commitee keys + block0 accept as input a Vec<VoterHIR>, which is essentially the output from our snapshot tool. Then it should be something like
hirs.iter().map(|v| v.voting_power).sum()
because we don't punt commitee keys in the snapshot (or rather, all voters in the snapshot should be eligible to vote / earn rewards)
|
So does that mean that we should be reading some serialized |
| @@ -0,0 +1 @@ | |||
| /nix/store/079q0fpi94z0x8a4rj3bzhjl8lrxm5xy-source No newline at end of file | |||
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.
should flake-inputs/* be committed?
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.
Nope, this whole dir should be ignored 😅
cong-or
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.
Code LGTM and well tested. I dont have much context on proposer logic etc.. So cant comment on that stuff.
|
Some PR mixups has meant that this was addressed in the other PR |
This PR replaces the
proposer_rewards.pyscript with an equivalent written in Rust.Some details are fuzzy, in particular types. The python script had type annotations, but there were a few type errors so not sure how to resolve things.
It passes tests in vt-testing locally, this is the PR for vit-testing: input-output-hk/vit-testing#292
The diff is huge because of a gitignore mistake, I'll fix that