Skip to content

Commit

Permalink
remove leftover, add row unitttest
Browse files Browse the repository at this point in the history
  • Loading branch information
fl0rek committed Jan 12, 2024
1 parent 5271942 commit dca605b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
26 changes: 26 additions & 0 deletions types/src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,30 @@ mod tests {
assert_eq!(share[NS_SIZE..], data);
}
}

#[test]
// TODO:
// fully testing protobuf deserialisation requires leopard codec, to generate parity shares.
// By asserting that we've reached `unimplemented!`, we rely on implementation detail to
// check whether protobuf, RowId and Share deserialisations were successful (but can't check
// the actual data)
// Once we have leopard codec, remove `should_panic` to enable full test functionality
#[should_panic(expected = "not implemented")]
fn test_validate() {
let eds_json = include_str!("../test_data/shwap_samples/eds.json");
let eds: ExtendedDataSquare = serde_json::from_str(eds_json).unwrap();
let dah_json = include_str!("../test_data/shwap_samples/dah.json");
let dah: DataAvailabilityHeader = serde_json::from_str(dah_json).unwrap();

let index = 1;
let row = Row {
row_id: RowId {
block_height: 1,
index,
},
shares: eds.row(index.into()).unwrap(),
};

row.validate(&dah).unwrap();
}
}
2 changes: 0 additions & 2 deletions types/src/share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ pub struct Share {
pub data: [u8; appconsts::SHARE_SIZE],
}

impl Share {}

impl Share {
/// Create a new [`Share`] from raw bytes.
///
Expand Down

0 comments on commit dca605b

Please sign in to comment.