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

chore(conductor): avoid large enum variants #1858

Closed
ethanoroshiba opened this issue Dec 6, 2024 · 0 comments · Fixed by #1865
Closed

chore(conductor): avoid large enum variants #1858

ethanoroshiba opened this issue Dec 6, 2024 · 0 comments · Fixed by #1865
Assignees
Labels
code-quality conductor pertaining to the astria-conductor crate

Comments

@ethanoroshiba
Copy link
Contributor

ethanoroshiba commented Dec 6, 2024

We should void having large enum variants as described here: https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant

Problem point:

#[derive(Debug, thiserror::Error)]
pub(crate) enum FirmSendError {
#[error("executor was configured without firm commitments")]
NotSet,
#[error("failed sending blocks to executor")]
Channel {
#[from]
source: mpsc::error::SendError<ReconstructedBlock>,
},
}
#[derive(Debug, thiserror::Error)]
pub(crate) enum FirmTrySendError {
#[error("executor was configured without firm commitments")]
NotSet,
#[error("failed sending blocks to executor")]
Channel {
#[from]
source: mpsc::error::TrySendError<ReconstructedBlock>,
},
}

┆Issue Number: ENG-1039

@ethanoroshiba ethanoroshiba self-assigned this Dec 6, 2024
@ethanoroshiba ethanoroshiba added conductor pertaining to the astria-conductor crate code-quality labels Dec 6, 2024
github-merge-queue bot pushed a commit that referenced this issue Jan 6, 2025
## Summary
Changed firm block channel to use boxed `ReconstructedBlock`.

## Background
A large error variant lint was triggered when running clippy with Rust
1.83.0 in #1857 due to send errors returning the whole block. Large enum
variants should be avoided because enums are only as small as their
largest variant:
https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant.
Changing the channel to consist of a boxed block instead solves this
problem at its source.

## Changes
- Changed firm block channel to use boxed `ReconstructedBlock` instead
of it being unboxed.

## Testing
Passing all tests.

## Changelogs
No updates needed.

## Breaking Changes
Overridden code freeze since this is a very small, non breaking change
that shouldn't have any bearing since our previous audit.

## Related Issues
closes #1858
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality conductor pertaining to the astria-conductor crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant