-
Notifications
You must be signed in to change notification settings - Fork 87
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
fix(sequencer): provide unit tests and fixes for vote extensions #1836
Conversation
prices | ||
let Some(lower_index) = midpoint.checked_sub(1) else { | ||
// We can only get here if `price_list` is empty; just return 0. | ||
return Price::new(0); |
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 price list should never be empty if constructed correctly in the caller, arguably this should error/panic as silently returning 0 could be bad
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 agree as currently called, this line should never get hit. I'll change this to return an error, but in apply_prices_from_vote_extensions
where we iterate over all the medians, I'll just skip any medians which errored. That way, a bug here won't halt block production.
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.
Done in e472b7b.
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.
looks great, thanks so much for taking this on!
## Summary This is a simple merge of `main`. It is based on top of the commits in `noot/more-tests` which forms PR #1836, so this is blocked by that PR. ## Background We want to keep the feature branch as in sync with `main` as possible. ## Changes - Merged `main`. Surprisingly few conflicts, and all trivial: only three in the following files: - crates/astria-core/Cargo.toml - crates/astria-core/src/generated/mod.rs - crates/astria-core/src/lib.rs ## Testing No new tests added. ## Changelogs No updates required. --------- Co-authored-by: Itamar Reif <9663129+itamarreif@users.noreply.github.com> Co-authored-by: quasystaty <ido@astria.org> Co-authored-by: Jordan Oroshiba <jordan@astria.org> Co-authored-by: elizabeth <elizabethjbinks@gmail.com> Co-authored-by: Ethan Oroshiba <ethan@astria.org> Co-authored-by: noot <36753753+noot@users.noreply.github.com> Co-authored-by: Richard Janis Goldschmidt <github@aberrat.io>
Summary
Increase test coverage of the
app::vote_extensions
module and fixes issues discovered while implementing these tests.Background
This was work spun out of previous PRs to this feature branch to allow parallelizing efforts to complete the feature.
Changes
app::vote_extensions
module.Testing
These are tests.
Changelogs
No updates required - the changelogs will be updated right before the feature merges to
main
.