pub struct FieldBlob {
pub data: Vec<ScalarField>,
pub commitments: Vec<Curve>,
}
Expand description
A FieldBlob<F>
is what Storage Provider stores per user’s
contract: a list of SRS_SIZE * num_chunks
field elements, where
num_chunks is how much the client allocated.
It can be seen as the encoding of a Vec<u8>
, where each field
element contains 31 bytes.
Fields§
§data: Vec<ScalarField>
§commitments: Vec<Curve>
Implementations§
Source§impl FieldBlob
impl FieldBlob
pub fn alloc_empty(num_chunks: usize) -> FieldBlob
pub fn apply_diff( &mut self, srs: &SRS<Curve>, domain: &Radix2EvaluationDomain<ScalarField>, diff: &Diff<ScalarField>, )
pub fn from_data(srs: &SRS<Curve>, data: &[ScalarField]) -> FieldBlob
pub fn from_bytes<D: EvaluationDomain<ScalarField>>( srs: &SRS<Curve>, domain: D, bytes: &[u8], ) -> FieldBlob
Sourcepub fn into_bytes(blob: FieldBlob) -> Vec<u8> ⓘ
pub fn into_bytes(blob: FieldBlob) -> Vec<u8> ⓘ
Returns the byte representation of the FieldBlob
. Note that
bytes ≠ into_bytes(from_bytes(bytes))
if bytes.len()
is not
divisible by 31*SRS_SIZE. In most cases into_bytes
will return
more bytes than from_bytes
created, so one has to truncate it
externally to achieve the expected result.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FieldBlobwhere
ScalarField: CanonicalDeserialize + CanonicalSerialize,
impl<'de> Deserialize<'de> for FieldBlobwhere
ScalarField: CanonicalDeserialize + CanonicalSerialize,
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for FieldBlobwhere
ScalarField: CanonicalDeserialize + CanonicalSerialize,
impl Serialize for FieldBlobwhere
ScalarField: CanonicalDeserialize + CanonicalSerialize,
impl StructuralPartialEq for FieldBlob
Auto Trait Implementations§
impl Freeze for FieldBlob
impl RefUnwindSafe for FieldBlob
impl Send for FieldBlob
impl Sync for FieldBlob
impl Unpin for FieldBlob
impl UnwindSafe for FieldBlob
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
Mutably borrows from an owned value. Read more