pub enum BlobTransactionSidecarVariant {
Eip4844(BlobTransactionSidecar),
Eip7594(BlobTransactionSidecarEip7594),
}Expand description
This represents a set of blobs, and its corresponding commitments and proofs. Proof type depends on the sidecar variant.
This type encodes and decodes the fields without an rlp header.
Variants§
Eip4844(BlobTransactionSidecar)
EIP-4844 style blob transaction sidecar.
Eip7594(BlobTransactionSidecarEip7594)
EIP-7594 style blob transaction sidecar with cell proofs.
Implementations§
Source§impl BlobTransactionSidecarVariant
impl BlobTransactionSidecarVariant
Sourcepub const fn is_eip4844(&self) -> bool
pub const fn is_eip4844(&self) -> bool
Returns true if this is a BlobTransactionSidecarVariant::Eip4844.
Sourcepub const fn is_eip7594(&self) -> bool
pub const fn is_eip7594(&self) -> bool
Returns true if this is a BlobTransactionSidecarVariant::Eip7594.
Sourcepub const fn as_eip4844(&self) -> Option<&BlobTransactionSidecar>
pub const fn as_eip4844(&self) -> Option<&BlobTransactionSidecar>
Returns the EIP-4844 sidecar if it is Self::Eip4844.
Sourcepub const fn as_eip7594(&self) -> Option<&BlobTransactionSidecarEip7594>
pub const fn as_eip7594(&self) -> Option<&BlobTransactionSidecarEip7594>
Returns the EIP-7594 sidecar if it is Self::Eip7594.
Sourcepub fn into_eip4844(self) -> Option<BlobTransactionSidecar>
pub fn into_eip4844(self) -> Option<BlobTransactionSidecar>
Converts into EIP-4844 sidecar if it is Self::Eip4844.
Sourcepub fn into_eip7594(self) -> Option<BlobTransactionSidecarEip7594>
pub fn into_eip7594(self) -> Option<BlobTransactionSidecarEip7594>
Converts the EIP-7594 sidecar if it is Self::Eip7594.
Sourcepub fn blobs(&self) -> &[FixedBytes<alloy_eips::::eip4844::Blob::{constant#0}>]
pub fn blobs(&self) -> &[FixedBytes<alloy_eips::::eip4844::Blob::{constant#0}>]
Get a reference to the blobs
Sourcepub fn into_blobs(
self,
) -> Vec<FixedBytes<alloy_eips::::eip4844::Blob::{constant#0}>>
pub fn into_blobs( self, ) -> Vec<FixedBytes<alloy_eips::::eip4844::Blob::{constant#0}>>
Consume self and return the blobs
Sourcepub const fn size(&self) -> usize
pub const fn size(&self) -> usize
Calculates a size heuristic for the in-memory size of the BlobTransactionSidecarVariant.
Sourcepub fn try_convert_into_eip7594(
self,
) -> Result<BlobTransactionSidecarVariant, Error>
Available on crate feature kzg only.
pub fn try_convert_into_eip7594( self, ) -> Result<BlobTransactionSidecarVariant, Error>
kzg only.Attempts to convert this sidecar into the EIP-7594 format using default KZG settings.
This method converts an EIP-4844 sidecar to EIP-7594 by computing cell KZG proofs from the blob data. If the sidecar is already in EIP-7594 format, it returns itself unchanged.
The conversion requires computing CELLS_PER_EXT_BLOB cell proofs for each blob using
the KZG trusted setup. The default KZG settings are loaded from the environment.
§Returns
Ok(Self)- The sidecar in EIP-7594 format (either converted or unchanged)Err(c_kzg::Error)- If KZG proof computation fails
§Examples
// Convert an EIP-4844 sidecar to EIP-7594 format
let eip7594_sidecar = sidecar.try_convert_into_eip7594()?;
// Verify it's now in EIP-7594 format
assert!(eip7594_sidecar.is_eip7594());Sourcepub fn try_convert_into_eip7594_with_settings(
self,
settings: &KZGSettings,
) -> Result<BlobTransactionSidecarVariant, Error>
Available on crate feature kzg only.
pub fn try_convert_into_eip7594_with_settings( self, settings: &KZGSettings, ) -> Result<BlobTransactionSidecarVariant, Error>
kzg only.Attempts to convert this sidecar into the EIP-7594 format using custom KZG settings.
This method converts an EIP-4844 sidecar to EIP-7594 by computing cell KZG proofs from the blob data using the provided KZG settings. If the sidecar is already in EIP-7594 format, it returns itself unchanged.
The conversion requires computing CELLS_PER_EXT_BLOB cell proofs for each blob using
the provided KZG trusted setup parameters.
Use this method when you need to specify custom KZG settings rather than using the
defaults. For most use cases, try_convert_into_eip7594
is sufficient.
§Arguments
settings- The KZG settings to use for computing cell proofs
§Returns
Ok(Self)- The sidecar in EIP-7594 format (either converted or unchanged)Err(c_kzg::Error)- If KZG proof computation fails
§Examples
// Load custom KZG settings
let kzg_settings = EnvKzgSettings::Default.get();
// Convert using custom settings
let eip7594_sidecar = sidecar.try_convert_into_eip7594_with_settings(kzg_settings)?;
// Verify it's now in EIP-7594 format
assert!(eip7594_sidecar.is_eip7594());Sourcepub fn try_into_eip7594(self) -> Result<BlobTransactionSidecarEip7594, Error>
Available on crate feature kzg only.
pub fn try_into_eip7594(self) -> Result<BlobTransactionSidecarEip7594, Error>
kzg only.Consumes this sidecar and returns a BlobTransactionSidecarEip7594 using default KZG
settings.
This method converts an EIP-4844 sidecar to EIP-7594 by computing cell KZG proofs from
the blob data. If the sidecar is already in EIP-7594 format, it extracts and returns the
inner BlobTransactionSidecarEip7594.
Unlike try_convert_into_eip7594, this method returns
the concrete BlobTransactionSidecarEip7594 type rather than the enum variant.
The conversion requires computing CELLS_PER_EXT_BLOB cell proofs for each blob using
the KZG trusted setup. The default KZG settings are loaded from the environment.
§Returns
Ok(BlobTransactionSidecarEip7594)- The sidecar in EIP-7594 formatErr(c_kzg::Error)- If KZG proof computation fails
§Examples
// Convert and extract the EIP-7594 sidecar
let eip7594_sidecar = sidecar.try_into_eip7594()?;
// Now we have the concrete BlobTransactionSidecarEip7594 type
assert_eq!(eip7594_sidecar.blobs.len(), eip7594_sidecar.commitments.len());Sourcepub fn try_into_eip7594_with_settings(
self,
settings: &KZGSettings,
) -> Result<BlobTransactionSidecarEip7594, Error>
Available on crate feature kzg only.
pub fn try_into_eip7594_with_settings( self, settings: &KZGSettings, ) -> Result<BlobTransactionSidecarEip7594, Error>
kzg only.Consumes this sidecar and returns a BlobTransactionSidecarEip7594 using custom KZG
settings.
This method converts an EIP-4844 sidecar to EIP-7594 by computing cell KZG proofs from
the blob data using the provided KZG settings. If the sidecar is already in EIP-7594
format, it extracts and returns the inner BlobTransactionSidecarEip7594.
Unlike try_convert_into_eip7594_with_settings,
this method returns the concrete BlobTransactionSidecarEip7594 type rather than the
enum variant.
The conversion requires computing CELLS_PER_EXT_BLOB cell proofs for each blob using
the provided KZG trusted setup parameters.
Use this method when you need to specify custom KZG settings rather than using the
defaults. For most use cases, try_into_eip7594 is sufficient.
§Arguments
settings- The KZG settings to use for computing cell proofs
§Returns
Ok(BlobTransactionSidecarEip7594)- The sidecar in EIP-7594 formatErr(c_kzg::Error)- If KZG proof computation fails
§Examples
// Load custom KZG settings
let kzg_settings = EnvKzgSettings::Default.get();
// Convert and extract using custom settings
let eip7594_sidecar = sidecar.try_into_eip7594_with_settings(kzg_settings)?;
// Now we have the concrete BlobTransactionSidecarEip7594 type
assert_eq!(eip7594_sidecar.blobs.len(), eip7594_sidecar.commitments.len());Sourcepub fn validate(
&self,
blob_versioned_hashes: &[FixedBytes<32>],
proof_settings: &KZGSettings,
) -> Result<(), BlobTransactionValidationError>
Available on crate feature kzg only.
pub fn validate( &self, blob_versioned_hashes: &[FixedBytes<32>], proof_settings: &KZGSettings, ) -> Result<(), BlobTransactionValidationError>
kzg only.Verifies that the sidecar is valid. See relevant methods for each variant for more info.
Sourcepub fn commitments(&self) -> &[FixedBytes<48>]
pub fn commitments(&self) -> &[FixedBytes<48>]
Returns the commitments of the sidecar.
Sourcepub fn versioned_hashes(&self) -> VersionedHashIter<'_>
pub fn versioned_hashes(&self) -> VersionedHashIter<'_>
Returns an iterator over the versioned hashes of the commitments.
Sourcepub fn versioned_hash_index(&self, hash: &FixedBytes<32>) -> Option<usize>
pub fn versioned_hash_index(&self, hash: &FixedBytes<32>) -> Option<usize>
Returns the index of the versioned hash in the commitments vector.
Sourcepub fn blob_by_versioned_hash(
&self,
hash: &FixedBytes<32>,
) -> Option<&FixedBytes<alloy_eips::::eip4844::Blob::{constant#0}>>
pub fn blob_by_versioned_hash( &self, hash: &FixedBytes<32>, ) -> Option<&FixedBytes<alloy_eips::::eip4844::Blob::{constant#0}>>
Returns the blob corresponding to the versioned hash, if it exists.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for BlobTransactionSidecarVariant
impl<'arbitrary> Arbitrary<'arbitrary> for BlobTransactionSidecarVariant
Source§fn arbitrary(
u: &mut Unstructured<'arbitrary>,
) -> Result<BlobTransactionSidecarVariant, Error>
fn arbitrary( u: &mut Unstructured<'arbitrary>, ) -> Result<BlobTransactionSidecarVariant, Error>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(
u: Unstructured<'arbitrary>,
) -> Result<BlobTransactionSidecarVariant, Error>
fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<BlobTransactionSidecarVariant, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for BlobTransactionSidecarVariant
impl Clone for BlobTransactionSidecarVariant
Source§fn clone(&self) -> BlobTransactionSidecarVariant
fn clone(&self) -> BlobTransactionSidecarVariant
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Decodable for BlobTransactionSidecarVariant
impl Decodable for BlobTransactionSidecarVariant
Source§fn decode(buf: &mut &[u8]) -> Result<BlobTransactionSidecarVariant, Error>
fn decode(buf: &mut &[u8]) -> Result<BlobTransactionSidecarVariant, Error>
Decodes the inner BlobTransactionSidecar fields from RLP bytes, without a RLP header.
Source§impl Decodable7594 for BlobTransactionSidecarVariant
impl Decodable7594 for BlobTransactionSidecarVariant
Source§fn decode_7594(buf: &mut &[u8]) -> Result<BlobTransactionSidecarVariant, Error>
fn decode_7594(buf: &mut &[u8]) -> Result<BlobTransactionSidecarVariant, Error>
Source§impl Default for BlobTransactionSidecarVariant
impl Default for BlobTransactionSidecarVariant
Source§fn default() -> BlobTransactionSidecarVariant
fn default() -> BlobTransactionSidecarVariant
Source§impl<'de> Deserialize<'de> for BlobTransactionSidecarVariant
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BlobTransactionSidecarVariant
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<BlobTransactionSidecarVariant, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<BlobTransactionSidecarVariant, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Encodable7594 for BlobTransactionSidecarVariant
impl Encodable7594 for BlobTransactionSidecarVariant
Source§fn encode_7594_len(&self) -> usize
fn encode_7594_len(&self) -> usize
Source§fn encode_7594(&self, out: &mut dyn BufMut)
fn encode_7594(&self, out: &mut dyn BufMut)
impl Eq for BlobTransactionSidecarVariant
Source§impl From<BlobTransactionSidecar> for BlobTransactionSidecarVariant
impl From<BlobTransactionSidecar> for BlobTransactionSidecarVariant
Source§fn from(value: BlobTransactionSidecar) -> BlobTransactionSidecarVariant
fn from(value: BlobTransactionSidecar) -> BlobTransactionSidecarVariant
Source§impl From<BlobTransactionSidecarEip7594> for BlobTransactionSidecarVariant
impl From<BlobTransactionSidecarEip7594> for BlobTransactionSidecarVariant
Source§fn from(value: BlobTransactionSidecarEip7594) -> BlobTransactionSidecarVariant
fn from(value: BlobTransactionSidecarEip7594) -> BlobTransactionSidecarVariant
Source§impl<'a> From<BlobTransactionSidecarVariant<'a>> for BlobTransactionSidecarVariant
impl<'a> From<BlobTransactionSidecarVariant<'a>> for BlobTransactionSidecarVariant
Source§fn from(
value: BlobTransactionSidecarVariant<'a>,
) -> BlobTransactionSidecarVariant
fn from( value: BlobTransactionSidecarVariant<'a>, ) -> BlobTransactionSidecarVariant
Source§impl Hash for BlobTransactionSidecarVariant
impl Hash for BlobTransactionSidecarVariant
Source§impl Serialize for BlobTransactionSidecarVariant
impl Serialize for BlobTransactionSidecarVariant
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for BlobTransactionSidecarVariant
Source§impl TryFrom<BlobTransactionSidecarVariant> for BlobTransactionSidecarEip7594
Available on crate feature kzg only.
impl TryFrom<BlobTransactionSidecarVariant> for BlobTransactionSidecarEip7594
kzg only.Source§fn try_from(
value: BlobTransactionSidecarVariant,
) -> Result<BlobTransactionSidecarEip7594, <BlobTransactionSidecarEip7594 as TryFrom<BlobTransactionSidecarVariant>>::Error>
fn try_from( value: BlobTransactionSidecarVariant, ) -> Result<BlobTransactionSidecarEip7594, <BlobTransactionSidecarEip7594 as TryFrom<BlobTransactionSidecarVariant>>::Error>
Source§impl TxEip4844Sidecar for BlobTransactionSidecarVariant
impl TxEip4844Sidecar for BlobTransactionSidecarVariant
Source§fn validate(
&self,
blob_versioned_hashes: &[B256],
proof_settings: &KzgSettings,
) -> Result<(), BlobTransactionValidationError>
fn validate( &self, blob_versioned_hashes: &[B256], proof_settings: &KzgSettings, ) -> Result<(), BlobTransactionValidationError>
kzg only.Auto Trait Implementations§
impl Freeze for BlobTransactionSidecarVariant
impl RefUnwindSafe for BlobTransactionSidecarVariant
impl Send for BlobTransactionSidecarVariant
impl Sync for BlobTransactionSidecarVariant
impl Unpin for BlobTransactionSidecarVariant
impl UnsafeUnpin for BlobTransactionSidecarVariant
impl UnwindSafe for BlobTransactionSidecarVariant
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 80 bytes
Size for each variant:
Eip4844: 72 bytesEip7594: 72 bytes