pub struct DataDesc {
pub size: u64,
pub pages: Vec<ArenaPageRef>,
}Expand description
Page-granular sparse content of a data cap. size is the full logical
extent in bytes (a PAGE_SIZE multiple); pages names only the
non-zero pages, sorted by page_index (strictly ascending, unique), each
backed by an arena window of its non-zero prefix (zero-padded back to
PAGE_SIZE at decode) — see ArenaPageRef.
Decodes (via DataDesc::to_data_cap) to a DataCap whose identity is
over logical {size, page_index -> content} only — independent of arena
layout, page ordering, or page sharing. So eliding zero pages and
deduplicating identical pages never change a cap hash.
Fields§
§size: u64§pages: Vec<ArenaPageRef>Implementations§
Source§impl DataDesc
impl DataDesc
Sourcepub fn page_count(&self) -> u64
pub fn page_count(&self) -> u64
Number of logical pages (size / PAGE_SIZE).
Sourcepub fn validate(&self, arena_len: usize) -> Result<(), DataDescError>
pub fn validate(&self, arena_len: usize) -> Result<(), DataDescError>
Eagerly validate this descriptor against an arena of arena_len
bytes: size a PAGE_SIZE multiple; every page-ref page-aligned,
in-bounds, with page_index < page_count; pages strictly ascending
by page_index (canonical, no duplicates). Untrusted wire input is
checked here — a loud Err, never a panic — before any arena slice
is taken in to_data_cap.
Sourcepub fn to_data_cap(&self, arena: &[u8]) -> DataCap
pub fn to_data_cap(&self, arena: &[u8]) -> DataCap
Materialize the runtime DataCap: each
named page is Loaded from its PAGE_SIZE arena window at its
absolute page_index; omitted pages are the canonical zero page.
The result is byte-identical (and hash-identical) to
DataCap::from_bytes_sized(equivalent_contiguous_content, size).
Assumes validate has passed (the deblob gate); an
out-of-range arena_off panics — the intended loud failure for a
producer bug.
Trait Implementations§
Source§impl Decode for DataDesc
impl Decode for DataDesc
Source§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true iff this type is fixed-length.Source§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
BYTES_PER_LENGTH_OFFSET].Source§fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
bytes, rejecting trailing input.Source§impl Encode for DataDesc
impl Encode for DataDesc
Source§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true iff this type is fixed-length (no variable-length fields).Source§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
BYTES_PER_LENGTH_OFFSET] (i.e. the size of the offset slot).Source§fn ssz_bytes_len(&self) -> usize
fn ssz_bytes_len(&self) -> usize
self when serialized.Source§fn ssz_append(&self, buf: &mut Vec<u8>)
fn ssz_append(&self, buf: &mut Vec<u8>)
self to buf.§fn is_basic_type() -> bool
fn is_basic_type() -> bool
true for “basic” SSZ types (uintN, bool), which pack adjacent
elements into shared 32-byte chunks for merkleization. Composite
types (containers, lists, structs) return false (the default).§fn as_ssz_bytes(&self) -> Vec<u8> ⓘ
fn as_ssz_bytes(&self) -> Vec<u8> ⓘ
Vec<u8> allocated through the global allocator.