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

fix(sequencer): provide unit tests and fixes for vote extensions #1836

Merged
merged 7 commits into from
Nov 27, 2024

Conversation

Fraser999
Copy link
Contributor

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

  • Provided comprehensive unit test coverage of the app::vote_extensions module.
  • Fixed a handful of issues uncovered.

Testing

These are tests.

Changelogs

No updates required - the changelogs will be updated right before the feature merges to main.

@Fraser999 Fraser999 requested a review from a team as a code owner November 25, 2024 23:20
@Fraser999 Fraser999 requested review from SuperFluffy and noot and removed request for SuperFluffy November 25, 2024 23:20
@github-actions github-actions bot added the sequencer pertaining to the astria-sequencer crate label Nov 25, 2024
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);
Copy link
Collaborator

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in e472b7b.

Copy link
Collaborator

@noot noot left a 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!

@Fraser999 Fraser999 merged commit ed60c03 into feat/oracle Nov 27, 2024
45 checks passed
@Fraser999 Fraser999 deleted the noot/more-tests branch November 27, 2024 14:20
Fraser999 added a commit that referenced this pull request Nov 27, 2024
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants