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

Clean up verify_indexed_attestation #1028

Merged
merged 5 commits into from
May 8, 2019
Merged

Clean up verify_indexed_attestation #1028

merged 5 commits into from
May 8, 2019

Conversation

JustinDrake
Copy link
Contributor

@JustinDrake JustinDrake commented May 2, 2019

Cosmetic changes:

  • Add 4 lines of comments (now every statement has a comment)
  • Avoid unnecessary assert (the end goal for me is for asserts to be exclusive to the operation processing helpers).
  • Merge returns into one (increase readability, reduce verbosity)
  • Use shorter-named bit_0_indices and bit_1_indices helper variables

Substantive change:

  • Remove the condition that len(0_indices) + len(1_indices) > 0. This condition is redundant in the context of process_attester_slashing because of slashed_any. It is artificial in process_attestation where validators are incentivised to maximise new attestations.

Cosmetic changes:

* Add 4 lines of comments (now every statement has a comment)
* Avoid unnecessary `assert` (the end goal for me is for `assert`s to be exclusive to the operation processing helpers).
* Merge `return`s into one (increase readability, reduce verbosity)
* Use shorter-named `bit_0_indices` and `bit_1_indices` helper variables

Substantive change:

* Remove the condition that `len(0_indices) + len(1_indices) > 0`. This condition is redundant in the context of `process_attester_slashing` because of `slashed_any`. It is largely artificial in `process_attestation` where validators are incentivised to maximise new attestations.
@JustinDrake JustinDrake added the general:presentation Presentation (as opposed to content) label May 2, 2019
@djrtwo
Copy link
Contributor

djrtwo commented May 7, 2019

aw, you skipped the raise. Understandable I suppose as it's not anywhere else in the spec.

This looks good to me.

@djrtwo
Copy link
Contributor

djrtwo commented May 7, 2019

It is artificial in process_attestation where validators are incentivised to maximise new attestations

A bit torn on this. Can a validator then include any empty attestations in the extra attestations positions and unnecessarily bloat block size? Seems like it could become an unintended source of graffiti

@JustinDrake
Copy link
Contributor Author

Seems like it could become an unintended source of graffiti

I've been thinking about this. It turns out there are other cheap ways to generate graffiti. For example, a block proposed can make Transfers where sender == recipient and encode data in the amounts. Because graffiti cannot be avoided the Zen approach is to embrace them. The good news is that all operations are capped, so at a minimum any source of graffiti is bounded.

and unnecessarily bloat block size?

Bloating is negligible, or even zero since the default rational behaviour is probably to max out the number of attestations in a block to maximise revenue. And using Attestations for graffiti means forgoing on the opportunity to make fees, so there's an opportunity cost.

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

added back in the test_empty_aggregation_bitfield test, but changed it to ensure it passes. It's a strange case and because we explicitly (at this time) want it to pass, it's good to have a test for it :)

@djrtwo djrtwo merged commit 9ee240b into dev May 8, 2019
@djrtwo djrtwo deleted the JustinDrake-patch-10 branch May 8, 2019 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general:presentation Presentation (as opposed to content)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants