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

run FEC decoding test in a loop (!6)

# changelog
- refactor $k$ and $n$ into variables
- run the decoding FEC test in a loop from $(k - 1) \rho + 1$ to $k \rho$, where $\rho$ is the curve number of bytes per scalar field element, e.g. $31$ for _BLS-12-381_
- add a _NOTE_ about having too few bytes and elements, i.e. below $(k - 1) \rho + 1$
- add a _FIXME_ about having too many bytes and elements, i.e. above $k \rho$
parent 338d131b
No related branches found
No related tags found
1 merge request!6run FEC decoding test in a loop
Pipeline #3768 passed with stages
in 1 minute and 49 seconds
...@@ -339,7 +339,14 @@ mod tests { ...@@ -339,7 +339,14 @@ mod tests {
#[test] #[test]
fn decoding() { fn decoding() {
decoding_template::<Bls12_381>(&BYTES[..63], 3, 5); let (k, n) = (3, 5);
let modulus_byte_size = <Bls12_381 as Pairing>::ScalarField::MODULUS_BIT_SIZE as usize / 8;
// NOTE: starting at `modulus_byte_size * (k - 1) + 1` to include at least _k_ elements
// FIXME: stopping at k elements, more yields crashes
for b in (modulus_byte_size * (k - 1) + 1)..=(modulus_byte_size * k) {
decoding_template::<Bls12_381>(&BYTES[..b], k, n);
}
} }
fn create_fake_shard<E: Pairing>( fn create_fake_shard<E: Pairing>(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment