Trait sov_modules_api::BlobReaderTrait
source · pub trait BlobReaderTrait: Serialize + DeserializeOwned + Send + Sync + 'static {
type Address: BasicAddress;
// Required methods
fn sender(&self) -> Self::Address;
fn hash(&self) -> [u8; 32];
fn verified_data(&self) -> &[u8] ⓘ;
fn total_len(&self) -> usize;
}
Expand description
This trait wraps “blob transaction” from a data availability layer allowing partial consumption of the blob data by the rollup.
The motivation for this trait is limit the amount of validation work that a rollup has to perform when verifying a state transition. In general, it will often be the case that a rollup only cares about some portion of the data from a blob. For example, if a blob contains a malformed transaction then the rollup will slash the sequencer and exit early - so it only cares about the content of the blob up to that point.
This trait allows the DaVerifier to track which data was read by the rollup, and only verify the relevant data.
Required Associated Types§
sourcetype Address: BasicAddress
type Address: BasicAddress
The type used to represent addresses on the DA layer.
Required Methods§
sourcefn sender(&self) -> Self::Address
fn sender(&self) -> Self::Address
Returns the address (on the DA layer) of the entity which submitted the blob transaction
sourcefn verified_data(&self) -> &[u8] ⓘ
fn verified_data(&self) -> &[u8] ⓘ
Returns a slice containing all the data accessible to the rollup at this point in time.
When running in native mode, the rollup can extend this slice by calling advance
. In zk-mode,
the rollup is limited to only the verified data.
Rollups should use this method in conjunction with advance
to read only the minimum amount
of data required for execution