-
Notifications
You must be signed in to change notification settings - Fork 256
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
Feat: 4844 SidecarBuilder #250
Conversation
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 generally good, the API makes sense to me, but need a few questions answered before I can lgtm
/// Returns `Err(())` if there is an error. | ||
fn decode_one<'a>(mut fes: impl Iterator<Item = WholeFe<'a>>) -> Result<Option<Vec<u8>>, ()> { | ||
let first = fes.next().ok_or(())?; | ||
let mut num_bytes = u64::from_be_bytes(first.as_ref()[1..9].try_into().unwrap()) as usize; |
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.
would be nice to have a method on WholeFe
that does the array ref conversion, documented with assumptions about how WholeFe
is constructed
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'd prefer to omit, as reading from a WholeFe
is generally not advisable. These should be a coder implementation detail, basically
ace8a37
to
5dccace
Compare
f64f1d4
to
249fb99
Compare
test: test ingestion feat: trim and inspect builder wip feat: modulus in 4844 feat: simple coder and ingestion strategies fix: required_fes in ingestion strategy refactor: names fix: clippy and doclinks fix: more doclinks and clippy fix: remove deref impls fix: delegate len and is_empty refactor: mutable sidecar coder
6fe0b12
to
6fef96a
Compare
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.
blob math looks kinda cursed -.-
did not look at the math
/// Create a new builder with a given capacity. | ||
pub fn with_capacity(capacity: usize) -> Self { | ||
let mut blobs = Vec::with_capacity(capacity); | ||
blobs.push(Blob::new([0u8; BYTES_PER_BLOB])); |
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.
this also adds a new blob,
looking at the other function, I think this is intended
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.
yeah, the intention is to never allow the blobs vec to be empty
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've improved instantiation quite a bit 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.
LGTM, left a note on with_capacity docs
Motivation
There is currently no convenient way to construct valid sidecars from data
Solution
Add a sidecar builder that ingests arbitrary data, blobs it, and builds into a sidecar
PR Checklist