Skip to content
Snippets Groups Projects
Commit d039128d authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

fix decoding on empty shards and when less than $k$ (dragoon/komodo!110)

makes sure
- "inbreeding" experiment quits when there are less than $k$ shards
- `fec::decode` returns `KomodoError::TooFewShards` when no shards are provided
parent d594d917
No related branches found
No related tags found
1 merge request!110fix decoding on empty shards and when less than $k$
Pipeline #5243 passed
...@@ -158,6 +158,10 @@ where ...@@ -158,6 +158,10 @@ where
pb.set_style(sty.clone()); pb.set_style(sty.clone());
pb.set_message("main"); pb.set_message("main");
for t in 0..=max_t { for t in 0..=max_t {
if shards.len() < k {
break;
}
if measurement_schedule(t) { if measurement_schedule(t) {
let inbreeding = measure_inbreeding(&shards, k, nb_measurements, &mp, &sty, rng); let inbreeding = measure_inbreeding(&shards, k, nb_measurements, &mp, &sty, rng);
println!("{}", inbreeding); println!("{}", inbreeding);
......
...@@ -160,6 +160,10 @@ pub fn encode<F: PrimeField>( ...@@ -160,6 +160,10 @@ pub fn encode<F: PrimeField>(
/// > - if there are too few shards /// > - if there are too few shards
/// > - if there are linear dependencies between shards /// > - if there are linear dependencies between shards
pub fn decode<F: PrimeField>(shards: Vec<Shard<F>>) -> Result<Vec<u8>, KomodoError> { pub fn decode<F: PrimeField>(shards: Vec<Shard<F>>) -> Result<Vec<u8>, KomodoError> {
if shards.is_empty() {
return Err(KomodoError::TooFewShards(0, 0));
}
let k = shards[0].k; let k = shards[0].k;
let np = shards.len(); let np = shards.len();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment