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
[Proposal] rework rewards/penalties to be more granular #1747
Conversation
Is this proposal targeting at v011x or v012x? |
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.
First quick scan. 👀
I like going back to this more granular pattern (once upon a time, v0.5.0
...). And yes, we really need more tests for these. 👍
Co-Authored-By: Hsiao-Wei Wang <hwwang156@gmail.com>
@protolambda I've done some work to de-duplicate the tests across source, target, head (want to run same scenarios against each essentially). Curious if you see any less verbose but clean way to further reduce the verbosity here. Essentially edit: and this is all obviously in the context of having good generators |
One problem I'm thinking about here is that ultimately, for each test case I right for a particular deltas function, it might as well have test vector outputs for each of the deltas functions against that test. That leads me to consider default outputing rewards/penalties for each deltas function for each deltas test instead of essentially copying over some tests and having them run separate deltas. The nice thing is that this would de-duplicate pre-states in deltas tests and would ensure that no-ops have the intended effect on tests that don't really concern a deltas function. The bad thing is that it muddies up the output a bit and makes it less clear what is actually being tested (but still shows granularity). not sure. To start, I'll have the proposal ready for review shortly without combining all deltas vectors into one format |
okay @protolambda and @hwwhww, this is finally ready for review (including tests) EDIT: the tests are much more comprehensive, but still keep an eye out for cases that are not covered. happy to add more |
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.
Great work! I reviewed the content correctness, but still thinking about more edge cases. 🤔
tests/core/pyspec/eth2spec/test/phase_0/rewards/test_get_inclusion_delay_deltas.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Hsiao-Wei Wang <hwwang156@gmail.com>
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.
Partial review, going to refresh for latest changes.
tests/core/pyspec/eth2spec/test/phase_0/rewards/test_get_inactivity_penalty_deltas.py
Outdated
Show resolved
Hide resolved
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.
You can batch apply these, the comments were inconsistent after the change to deltas
tests/core/pyspec/eth2spec/test/phase_0/rewards/test_get_inactivity_penalty_deltas.py
Outdated
Show resolved
Hide resolved
tests/core/pyspec/eth2spec/test/phase_0/rewards/test_get_inclusion_delay_deltas.py
Outdated
Show resolved
Hide resolved
tests/core/pyspec/eth2spec/test/phase_0/rewards/test_get_source_deltas.py
Outdated
Show resolved
Hide resolved
tests/core/pyspec/eth2spec/test/phase_0/rewards/test_get_target_deltas.py
Outdated
Show resolved
Hide resolved
tests/core/pyspec/eth2spec/test/phase_0/rewards/test_get_head_deltas.py
Outdated
Show resolved
Hide resolved
… in slashed tests
"rewards/penalties" -> "deltas" in throughout test comments/descriptions Co-authored-by: Diederik Loerakker <proto@protolambda.com>
@hwwhww or @protolambda, I'm looking to get this merged asap for v0.12 release. Let me know if there's anything else you want to see right now |
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.
The PR looks good to me 👍
We can still come up with other new test cases after this PR.
More granular rewards/penalty function to allow us to write and publish tests specific to each of source, target, head, inclusion delay, and inactivity leak.
Includes tests for each and a new rewards generator type