#[repr(C)]pub struct BlobTransactionSidecar {
pub blobs: Vec<Blob>,
pub commitments: Vec<Bytes48>,
pub proofs: Vec<Bytes48>,
}
kzg-sidecar
only.Expand description
This represents a set of blobs, and its corresponding commitments and proofs.
This type encodes and decodes the fields without an rlp header.
Fields§
§blobs: Vec<Blob>
The blob data.
commitments: Vec<Bytes48>
The blob commitments.
proofs: Vec<Bytes48>
The blob proofs.
Implementations§
source§impl BlobTransactionSidecar
impl BlobTransactionSidecar
sourcepub const fn new(
blobs: Vec<Blob>,
commitments: Vec<Bytes48>,
proofs: Vec<Bytes48>,
) -> Self
pub const fn new( blobs: Vec<Blob>, commitments: Vec<Bytes48>, proofs: Vec<Bytes48>, ) -> Self
Constructs a new BlobTransactionSidecar from a set of blobs, commitments, and proofs.
sourcepub fn from_kzg(
blobs: Vec<Blob>,
commitments: Vec<Bytes48>,
proofs: Vec<Bytes48>,
) -> Self
Available on crate feature kzg
only.
pub fn from_kzg( blobs: Vec<Blob>, commitments: Vec<Bytes48>, proofs: Vec<Bytes48>, ) -> Self
kzg
only.Creates a new instance from the given KZG types.
sourcepub fn validate(
&self,
blob_versioned_hashes: &[B256],
proof_settings: &KzgSettings,
) -> Result<(), BlobTransactionValidationError>
Available on crate feature kzg
only.
pub fn validate( &self, blob_versioned_hashes: &[B256], proof_settings: &KzgSettings, ) -> Result<(), BlobTransactionValidationError>
kzg
only.Verifies that the versioned hashes are valid for this sidecar’s blob data, commitments, and proofs.
Takes as input the KzgSettings, which should contain the parameters derived from the KZG trusted setup.
This ensures that the blob transaction payload has the same number of blob data elements, commitments, and proofs. Each blob data element is verified against its commitment and proof.
Returns BlobTransactionValidationError::InvalidProof if any blob KZG proof in the response fails to verify, or if the versioned hashes in the transaction do not match the actual commitment versioned hashes.
sourcepub fn versioned_hashes(&self) -> impl Iterator<Item = B256> + '_
pub fn versioned_hashes(&self) -> impl Iterator<Item = B256> + '_
Returns an iterator over the versioned hashes of the commitments.
sourcepub fn versioned_hash_for_blob(&self, blob_index: usize) -> Option<B256>
pub fn versioned_hash_for_blob(&self, blob_index: usize) -> Option<B256>
Returns the versioned hash for the blob at the given index, if it exists.
sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Calculates a size heuristic for the in-memory size of the BlobTransactionSidecar.
sourcepub fn try_from_blobs(blobs: Vec<Blob>) -> Result<Self, Error>
Available on crate features kzg
and arbitrary
only.
pub fn try_from_blobs(blobs: Vec<Blob>) -> Result<Self, Error>
kzg
and arbitrary
only.Tries to create a new BlobTransactionSidecar
from the given blobs.
sourcepub fn rlp_encoded_length(&self) -> usize
pub fn rlp_encoded_length(&self) -> usize
Calculates the length of the BlobTransactionSidecar when encoded as RLP.
sourcepub fn rlp_encode(&self, out: &mut dyn BufMut)
pub fn rlp_encode(&self, out: &mut dyn BufMut)
Encodes the BlobTransactionSidecar as RLP bytes.
sourcepub fn rlp_decode(buf: &mut &[u8]) -> Result<Self>
pub fn rlp_decode(buf: &mut &[u8]) -> Result<Self>
Decodes the BlobTransactionSidecar from RLP bytes.
Trait Implementations§
source§impl<'a> Arbitrary<'a> for BlobTransactionSidecar
Available on crate feature arbitrary
only.
impl<'a> Arbitrary<'a> for BlobTransactionSidecar
arbitrary
only.source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self
from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read moresource§impl Clone for BlobTransactionSidecar
impl Clone for BlobTransactionSidecar
source§fn clone(&self) -> BlobTransactionSidecar
fn clone(&self) -> BlobTransactionSidecar
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BlobTransactionSidecar
impl Debug for BlobTransactionSidecar
source§impl Decodable for BlobTransactionSidecar
impl Decodable for BlobTransactionSidecar
source§impl Default for BlobTransactionSidecar
impl Default for BlobTransactionSidecar
source§fn default() -> BlobTransactionSidecar
fn default() -> BlobTransactionSidecar
source§impl<'de> Deserialize<'de> for BlobTransactionSidecar
impl<'de> Deserialize<'de> for BlobTransactionSidecar
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Encodable for BlobTransactionSidecar
impl Encodable for BlobTransactionSidecar
source§impl Hash for BlobTransactionSidecar
impl Hash for BlobTransactionSidecar
source§impl PartialEq for BlobTransactionSidecar
impl PartialEq for BlobTransactionSidecar
source§impl Serialize for BlobTransactionSidecar
impl Serialize for BlobTransactionSidecar
impl Eq for BlobTransactionSidecar
impl StructuralPartialEq for BlobTransactionSidecar
Auto Trait Implementations§
impl Freeze for BlobTransactionSidecar
impl RefUnwindSafe for BlobTransactionSidecar
impl Send for BlobTransactionSidecar
impl Sync for BlobTransactionSidecar
impl Unpin for BlobTransactionSidecar
impl UnwindSafe for BlobTransactionSidecar
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more