ColumnIndex in DaBlob (#693)
* ColumnIndex in DaBlob * Use u16 for column index
This commit is contained in:
parent
2922e9ce74
commit
2ca822e6ec
|
@ -45,6 +45,9 @@ impl DaDispersal for MockExecutorDispersalAdapter {
|
|||
for (i, column) in encoded_data.extended_data.columns().enumerate() {
|
||||
let blob = DaBlob {
|
||||
column: column.clone(),
|
||||
column_idx: i
|
||||
.try_into()
|
||||
.expect("Column index shouldn't overflow the target type"),
|
||||
column_commitment: encoded_data.column_commitments[i],
|
||||
aggregated_column_commitment: encoded_data.aggregated_column_commitment,
|
||||
aggregated_column_proof: encoded_data.aggregated_column_proofs[i],
|
||||
|
|
|
@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize};
|
|||
use sha3::{Digest, Sha3_256};
|
||||
// internal
|
||||
use super::build_blob_id;
|
||||
use super::ColumnIndex;
|
||||
use crate::common::Column;
|
||||
use crate::common::Commitment;
|
||||
use crate::common::{
|
||||
|
@ -15,6 +16,7 @@ use crate::common::{
|
|||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct DaBlob {
|
||||
pub column: Column,
|
||||
pub column_idx: ColumnIndex,
|
||||
#[serde(
|
||||
serialize_with = "serialize_canonical",
|
||||
deserialize_with = "deserialize_canonical"
|
||||
|
|
|
@ -19,6 +19,7 @@ pub struct Row(pub Vec<Chunk>);
|
|||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Column(pub Vec<Chunk>);
|
||||
pub struct ChunksMatrix(pub Vec<Row>);
|
||||
pub type ColumnIndex = u16;
|
||||
|
||||
pub const NOMOS_DA_DST: &[u8] = b"NOMOS_DA_AVAIL";
|
||||
|
||||
|
|
|
@ -105,6 +105,9 @@ mod tests {
|
|||
let verifier = &verifiers[i];
|
||||
let da_blob = DaBlob {
|
||||
column,
|
||||
column_idx: i
|
||||
.try_into()
|
||||
.expect("Column index shouldn't overflow the target type"),
|
||||
column_commitment: encoded_data.column_commitments[i],
|
||||
aggregated_column_commitment: encoded_data.aggregated_column_commitment,
|
||||
aggregated_column_proof: encoded_data.aggregated_column_proofs[i],
|
||||
|
|
|
@ -223,6 +223,9 @@ mod test {
|
|||
let verifier = &verifiers[i];
|
||||
let da_blob = DaBlob {
|
||||
column,
|
||||
column_idx: i
|
||||
.try_into()
|
||||
.expect("Column index shouldn't overflow the target type"),
|
||||
column_commitment: encoded_data.column_commitments[i],
|
||||
aggregated_column_commitment: encoded_data.aggregated_column_commitment,
|
||||
aggregated_column_proof: encoded_data.aggregated_column_proofs[i],
|
||||
|
|
|
@ -127,6 +127,7 @@ pub mod test {
|
|||
.send((
|
||||
0,
|
||||
DaBlob {
|
||||
column_idx: 0,
|
||||
column: Column(vec![]),
|
||||
column_commitment: Default::default(),
|
||||
aggregated_column_commitment: Default::default(),
|
||||
|
|
|
@ -97,6 +97,7 @@ mod test {
|
|||
Blob {
|
||||
blob_id: vec![],
|
||||
data: bincode::serialize(&DaBlob {
|
||||
column_idx: 0,
|
||||
column: Column(vec![]),
|
||||
column_commitment: Default::default(),
|
||||
aggregated_column_commitment: Default::default(),
|
||||
|
|
|
@ -261,6 +261,9 @@ fn test_verifier() {
|
|||
|
||||
let da_blob = DaBlob {
|
||||
column: column.clone(),
|
||||
column_idx: i
|
||||
.try_into()
|
||||
.expect("Column index shouldn't overflow the target type"),
|
||||
column_commitment: encoded_data.column_commitments[i],
|
||||
aggregated_column_commitment: encoded_data.aggregated_column_commitment,
|
||||
aggregated_column_proof: encoded_data.aggregated_column_proofs[i],
|
||||
|
|
Loading…
Reference in New Issue