-
Notifications
You must be signed in to change notification settings - Fork 236
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: Add iterator to BlobTransactionSidecar #1256
feat: Add iterator to BlobTransactionSidecar #1256
Conversation
hey matts thanks for the reivew, made all changes you requested! |
#[cfg(feature = "serde")] | ||
fn parse_u64_string<'de, T, D>(de: D) -> Result<T, D::Error> | ||
where | ||
D: serde::Deserializer<'de>, | ||
T: FromStr, | ||
<T as FromStr>::Err: core::fmt::Display, | ||
{ | ||
String::deserialize(de)?.parse().map_err(serde::de::Error::custom) | ||
} |
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 is just alloy-serde::quantity
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
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.
impl BlobTransactionSidecar { | ||
/// Creates an iterator | ||
pub fn iter(&self) -> impl Iterator<Item = BlobTransactionSidecarItem> + '_ { | ||
self.blobs.iter().zip(&self.commitments).zip(&self.proofs).enumerate().map( | ||
|(index, ((blob, commitment), proof))| BlobTransactionSidecarItem { | ||
index, | ||
blob: *blob, | ||
kzg_commitment: *commitment, | ||
kzg_proof: *proof, | ||
}, | ||
) | ||
} | ||
} |
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 should be an IntoIter impl instead
#[cfg(feature = "kzg")] | ||
use crate::BlockNumHash; | ||
#[cfg(feature = "serde")] | ||
use alloc::string::String; | ||
#[cfg(not(feature = "std"))] | ||
use alloc::vec::Vec; | ||
|
||
#[cfg(feature = "kzg")] | ||
use alloy_primitives::FixedBytes; | ||
use alloy_primitives::{bytes::BufMut, B256}; | ||
use alloy_rlp::{Decodable, Encodable}; | ||
#[cfg(feature = "kzg")] | ||
use c_kzg::KzgProof; | ||
#[cfg(feature = "serde")] | ||
use core::str::FromStr; | ||
#[cfg(feature = "serde")] | ||
use serde::Deserialize; | ||
#[cfg(feature = "kzg")] | ||
use sha2::{Digest, Sha256}; | ||
#[cfg(feature = "kzg")] |
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.
none of these should be necessary, this makes it very hard to read.
please use full paths instead, this way no import is required
Superseded by #1334 |
closes #1255