- Mar 31, 2025
-
-
HEME Clement authored
-
- Mar 19, 2025
-
-
HEME Clement authored
-
- Jan 28, 2025
-
-
STEVAN Antoine authored
mainly fixes a few typos and improves `algebra` and `semi_avid` tests ## changelog - fix some typos and notes in the documentation - test more cases for `algebra::split_data_into_field_elements` and `algebra::merge_elements_into_bytes`, more data lengths and more modulus respectively - remove a useless `::<Vec<_>>` on a `collect` in `fec` - `semi_avid::tests` - refactor `bls12-381` into a constant - write an "_attack_" function to alter a particular block, `attack<F, G>(block: Block<F, G>, c: usize, base: u128, pow: u64) -> Block<F, G>` - pass a list of attacks, i.e. `attacks: Vec<(usize, usize, u128, u64)>`, to `verify_with_errors_template`, use the same as the previous hardcoded one - pass a list of "_recodings_", i.e. `recodings: Vec<Vec<usize>>`, to `verify_recoding_template` and assert the number of blocks, e.g. `vec![vec![2, 3], vec![3, 5]]` means that recoding 2 and 3 together should verify, and same with 3 and 5, and also that there must be at least 6 blocks - pass a list of "_recodings_", i.e. `recodings: Vec<(Vec<Vec<usize>>, bool)>`, to `end_to_end_with_recoding_template` and assert the number of blocks and the number of source shards, e.g. `vec![(vec![vec![0, 1], vec![2], vec![3]], true)]` means that trying to decode with blocks 2, 3 and a recoded block from 0 and 1 should work, and also that there must be at least 4 blocks and at most 3 source shards - pass `k` and `n` to `run_template`
-
- Sep 23, 2024
-
-
STEVAN Antoine authored
## changelog - _semi\_avid_, _kzg_ and _aplonk_ examples have been added - the `fs` module has been hidden behind an `fs` feature - the `conversions` module has been properly hidden behind the `test` config feature - the documentation has been completed - some error messages have been improved > **Note** > > the documentation of aPlonK has been left as-is for now
-
- Aug 06, 2024
-
-
STEVAN Antoine authored
`algebra`, `field` and `linalg` were doing extremely similar things before... this MR merges them into a single module `algebra` - old `algebra` and `field` are at the root of the new `algebra` - old `linalg` is now `algebra::linalg` all references to these have been fixed in the rest of the codebase and the features have been tuned to work fine.
-
- Aug 01, 2024
-
-
STEVAN Antoine authored
## changelog - `src/main.rs` has been moved to a new crate: `bins/saclin` which stands for **S**emi-**A**VID **CLI** in **N**ushell - dependencies of `komodo` have been fixed - Nushell and Rust tests have been split in the Makefile: by default, only Rust tests will run locally and Nushell tests and examples can be run manually if desired. The CI will still run everything. - the README has been updated - test images have been moved to `assets/` - the majority of the old `./nu-utils/` module have been moved to internals of `./benchmarks/` and imports have been fixed - `cargo.nu` has been moved to `./bins/` and a new `./bins/README.md` mentions it - `./bins/saclin/` has been created and should be a self-contained Rust crate + Nushell module
-
- Jul 31, 2024
-
-
STEVAN Antoine authored
- 1c9077f6 add documentation to the errors - c388cbbb better FEC doc - 8d58278d doc of `zk.nb_elements_in_setup`
-
- Jun 07, 2024
-
-
STEVAN Antoine authored
this will - recode for $\#steps \in [10, 20, 100]$ - at $t = 0$, $k$ random shards among the $n$ encoded will be selected at random - at $t \geq 1$, all $k$ shards will be used to recode $k$ brand new shards - make sure the last set of $k$ shards recoded $\#steps$ together can decode the data ## example with $(k, n) = (3, 5)$ and $\#steps = 3$ - $(s_i)_{1 \leq i \leq k}$ are the $k$ source shards - $(e_j)_{1 \leq j \leq n}$ are the $n$ encoded shards - $(m_i)_{1 \leq i \leq k}$ are the $k$ randomly selected shards - $(n_i)_{1 \leq i \leq k}$ are the shards after step $1$ - $(o_i)_{1 \leq i \leq k}$ are the shards after step $2$ - $(p_i)_{1 \leq i \leq k}$ are the shards after step $3$ - the $(p_i)_{1 \leq i \leq k}$ will be used for decoding ```mermaid graph TD; s1 --> e1; s1 --> e2; s1 --> e3; s1 --> e4; s1 --> e5; s2 --> e1; s2 --> e2; s2 --> e3; s2 --> e4; s2 --> e5; s3 --> e1; s3 --> e2; s3 --> e3; s3 --> e4; s3 --> e5; e1 --> m1; e3 --> m2; e4 --> m3; m1 --> n1; m1 --> n2; m1 --> n3; m2 --> n1; m2 --> n2; m2 --> n3; m3 --> n1; m3 --> n2; m3 --> n3; n1 --> o1; n1 --> o2; n1 --> o3; n2 --> o1; n2 --> o2; n2 --> o3; n3 --> o1; n3 --> o2; n3 --> o3; o1 --> p1; o1 --> p2; o1 --> p3; o2 --> p1; o2 --> p2; o2 --> p3; o3 --> p1; o3 --> p2; o3 --> p3; ```
-
STEVAN Antoine authored
- pass `n` to `try_all_decoding_combinations` and don't try to decode when shards have been recoded ($\#shards > n$) and there are no recoded shards in the $k$ combination under review ($\max(is) < n$) - pass `recoding_steps` and `should_not_be_decodable` as arguments to `end_to_end_with_recoding_template` - fix $n = 5$ => this leads to tests that run in less than 10sec again - add $(k, n) = (8, 10)$ => tests still run in less than 13sec - split recoding scenarii into "_simple_" and "_chain_" - show indices in a "_pretty_" format, i.e. showing indices greater than $n$ as `(n)`, `(n + 1)`, ...
-
- Jun 06, 2024
-
-
STEVAN Antoine authored
- `komodo::linalg::Matrix::random` is tested - `komodo::linalg::Matrix::inverse` is tested on more matrix sizes, from $1$ to $20$ random matrices - `komodo::field` tests have been double-checked - pure "recoding" tests from `komodo::fec` have been double-checked - `end_to_end` and `end_to_end_with_recoding` now runs for $k \in [3, 5]$ and $\rho \in [\frac{1}{2}, \frac{1}{3}]$ with $n = \lfloor \frac{k}{\rho} \rfloor$ - all "_$k$ among $n + t$_" combinations are tested with `try_all_decoding_combinations`, possibly with some removals in case recoding is involved with `is_inside` >
**Important** > on my machine, `make test` goes from less than 8sec on latest `main` to around 40sec with this MR
-
- May 27, 2024
-
-
STEVAN Antoine authored
makes sure - "inbreeding" experiment quits when there are less than $k$ shards - `fec::decode` returns `KomodoError::TooFewShards` when no shards are provided
-
- Apr 12, 2024
-
-
STEVAN Antoine authored
## changelog - rename the `encode` function to `prove` and have it take _shards_ instead of an _encoding matrix_: this is to isolate the "encoding" process inside the `fec` module and leave the main `komodo::prove` only compute the "proof", i.e. the commits of the data from ```rust fn encode<F, G, P>( bytes: &[u8], encoding_mat: &Matrix<F>, powers: &Powers<F, G>, ) -> Result<Vec<Block<F, G>>, KomodoError> ``` to ```rust fn prove<F, G, P>( bytes: &[u8], powers: &Powers<F, G>, k: usize, ) -> Result<Vec<Commitment<F, G>>, KomodoError> ``` - rename `fec::Shard.combine` to `fec::Shard.recode_with` to get rid of "combine" - rename `fec::recode` to `fec::recode_with_coeffs` to show that this version takes a list of coefficients - rename `Block.commit` to `Block.proof`: "commit" should be "commits" and it's usually refered to as "proof" - split `prove` further into `prove` and `build`: `prove` now outputs a `Vec<Commitment<F>>`, `build` simply takes a `Vec<Shard<F>>` and a `Vec<Commitment<F>>` and outputs a `Vec<Block<F>>` - add `fec::recode_random` that does the "shard" part of `recode` to wrap around `fec::recode_with_coeffs` - remove `R: RngCore` from the signature of `zk::setup`, to avoid having to pass a generic `_` annotation everywhere `zk::setup` is used, same change has been applied to `recode` and the `generate_random_powers` in `main.rs` from ```rust fn setup<R: RngCore, F: PrimeField, G: CurveGroup<ScalarField = F>>( max_degree: usize, rng: &mut R, ) -> Result<Powers<F, G>, KomodoError> { ``` to ```rust fn setup<F: PrimeField, G: CurveGroup<ScalarField = F>>( max_degree: usize, rng: &mut impl RngCore, ) -> Result<Powers<F, G>, KomodoError> { ``` ### some extra minor changes - remove some useles generic type annotations, e.g. `prove::<F, G, P>` can become a simpler `prove` most of the time, i.e. when there is at least one generic annotation somewhere in the scope
-
- Apr 11, 2024
-
-
STEVAN Antoine authored
## changelog * eb1b1381 don't use a T in the lib `run_template` test * fbd503c6 remove the useless unwrap and TODO * b550d712 remove some pub * 339c3038 remove useless `.iter()` * 537993f0 remove useless `.add(...)` * d7720907 remove hiding_bound from timer in commit * eecab5a6 move `commit` to inlined `zk::batch_commit`
-
- Apr 08, 2024
-
-
STEVAN Antoine authored
should address #8 ## changelog - move the internal `rng` to an argument of type `R: RngCore` for the following functions - `recode` in `lib.rs` - `linalg::Matrix::random` - `generate_random_setup` in `main.rs` - make sure - `ark_std::test_rng` is only used in tests modules - `rand::thread_rng` is used in benchmarks, examples and `main.rs`
-
- Apr 04, 2024
-
-
STEVAN Antoine authored
as per title, this is a minor MR that just makes sure the imports are consistent across modules. in order - `std` - `ark_...` - others - `komodo` or `crate` or `super`
-
STEVAN Antoine authored
## changelog - remove `ark-poly-commit` from the dependencies - remove the old `setup.rs` - add temporary `foo.rs` which define (some details are ommited for brevity) - `struct Powers<F, G>` - `struct Commitment<F, G>` - `fn build_powers<F, G>(...) -> Powers<F, G>` - `fn commit<F, G, P>(powers: &Powers<F, G>, polynomial: &P) -> Commitment<F, G>` - tests - `foo.rs` is then renamed to `setup.rs` - two new `KomodoError` variants have been created to replace `ark_poly_commit::Error` - `DegreeIsZero` - `TooFewPowersInTrustedSetup(usize, usize)` - finally, all the past mentions to `E: Pairing` and `setup::random` have been replaced with `F, G` and `setup::build_powers` respectively
-
- Mar 26, 2024
-
-
STEVAN Antoine authored
> **Note** > this MR is best reviewed commit by commit, it's hopefully clear enough. > **Note** > waiting for dragoon/komodo!47 to land ## changelog - add missing format to the `KomodoError`s - rename `fec::Shard::bytes` to `fec::Shard::data` because these are no _bytes_ - rename the `blocks: Vec<Shard<E>>` argument of `fec::decode` to `shards` - refactor the tests of `fec` and `lib.rs` - remove the `batch_verify` function entirely as it's pretty useless - simplify the `linalg::Matrix::random` function - add tests for the function in the `setup` module - add documentation where it was missing
-
STEVAN Antoine authored
this MR - adds `criterion` as a dependency - creates a new `benches/recoding.rs` benchmark file - makes the following `pub`lic - `fec::combine` - `field` and `field::split_data_into_field_elements` ## example results | bytes | shards | k | mean (us) | | ------- | ------ | -- | --------- | | 1 | 2 | 2 | 0.127 | | 1 | 2 | 4 | 0.179 | | 1 | 2 | 8 | 0.283 | | 1 | 2 | 16 | 0.504 | | 1 | 4 | 2 | 0.346 | | 1 | 4 | 4 | 0.506 | | 1 | 4 | 8 | 0.823 | | 1 | 4 | 16 | 1.451 | | 1 | 8 | 2 | 0.789 | | 1 | 8 | 4 | 1.155 | | 1 | 8 | 8 | 1.89 | | 1 | 8 | 16 | 3.383 | | 1 | 16 | 2 | 1.669 | | 1 | 16 | 4 | 2.478 | | 1 | 16 | 8 | 4.023 | | 1 | 16 | 16 | 7.147 | | 1024 | 2 | 2 | 1.02 | | 1024 | 2 | 4 | 1.076 | | 1024 | 2 | 8 | 1.172 | | 1024 | 2 | 16 | 1.395 | | 1024 | 4 | 2 | 2.981 | | 1024 | 4 | 4 | 3.15 | | 1024 | 4 | 8 | 3.453 | | 1024 | 4 | 16 | 4.089 | | 1024 | 8 | 2 | 6.907 | | 1024 | 8 | 4 | 7.244 | | 1024 | 8 | 8 | 7.969 | | 1024 | 8 | 16 | 9.452 | | 1024 | 16 | 2 | 15.169 | | 1024 | 16 | 4 | 16.14 | | 1024 | 16 | 8 | 17.086 | | 1024 | 16 | 16 | 20.266 | | 1048576 | 2 | 2 | 1470.966 | | 1048576 | 2 | 4 | 1097.899 | | 1048576 | 2 | 8 | 1091.298 | | 1048576 | 2 | 16 | 1091.544 | | 1048576 | 4 | 2 | 3274.852 | | 1048576 | 4 | 4 | 3272.68 | | 1048576 | 4 | 8 | 3251.877 | | 1048576 | 4 | 16 | 3272.872 | | 1048576 | 8 | 2 | 7582.074 | | 1048576 | 8 | 4 | 7599.012 | | 1048576 | 8 | 8 | 7584.59 | | 1048576 | 8 | 16 | 7569.575 | | 1048576 | 16 | 2 | 16274.986 | | 1048576 | 16 | 4 | 16303.905 | | 1048576 | 16 | 8 | 16313.429 | | 1048576 | 16 | 16 | 16310.305 |
-
- Jan 30, 2024
-
-
STEVAN Antoine authored
this MR allows to give any number of blocks to recode them. this is a convenience to avoid combining the blocks pair-wise and create intermediate and useless blocks, e.g. by defining the following Nushell command with the `komodo.nu` module ```bash def "komodo full-recode" []: list<string> -> string { let blocks = $in match ($blocks | length) { 0 => { return null }, 1 => { return $blocks.0 }, } $blocks | skip 1 | reduce --fold $blocks.0 {|it, acc| komodo combine $it $acc} } ``` one can now do directly ```bash komodo combine ...(komodo ls) ``` which will create a single new fully recoded block! ## changelog - new `fec::combine` that takes a list of shards and their coefficients and combines them, returns `None` if the slices are empty or not of the same length ```rust pub(super) combine<E: Pairing>( shards: &[Shard<E>], coeffs: &[E::ScalarField], ) -> Option<Shard<E>> ``` - modified `recode` that takes any number of blocks and returns an `Option` if there is none ```rust pub recode<E: Pairing>(blocks: &[Block<E>]) -> Result<Option<Block<E>>, KomodoError> ``` - the `komodo combine` command from `komodo.nu` can now take any number of blocks, even 0 by giving a nice error
-
- Jan 23, 2024
-
-
STEVAN Antoine authored
## changelog - add `--encoding-method` to `komodo prove` - pass the encoding matrix to `encode` and `fec::encode` instead of `k` and `n`, these two parameters can be extracted without further check by looking at the shape of the encoding matrix - the global recoding vector is now extracted from the encoding matrix instead of recomputing it (see new `Matrix::get_col` implementation) - `linalg` and `Matrix::{random, vandermonde}` have been made public (see new `Matrix::random` implementation) - the computation of `Matrix::vandermonde` has been optimized
-
- Jan 19, 2024
-
-
STEVAN Antoine authored
should close #2 this MR - uses the matrix representation of FEC encoding to create both `Shard`s and `Block`s - `fec::encode` will encode shards with a Vandermonde matrix - `encode` will use `fec::encode` - use of `Matrix::transpose` has been reduced in `fec::encode` thanks to swapping the encoding matrix product (thanks @j.detchart for findind this) - `fec::encode` does not require `transpose: bool` anymore as the encoding process has been homogenize throughout the code base - useless `field::build_interleaved_polynomials` have been removed - `prove` has been merged into `encode`
-
STEVAN Antoine authored
this MR combines the encoding and the recoding processes into a single one, expressed as the shard linear combination. this allows to not recompute the encoding matrix each time, whether it's explicit during decoding or implicit during shard verification.
-
- Jan 17, 2024
-
-
STEVAN Antoine authored
in this MR - all `unwrap`s and `expect`s have been removed from any `.rs` module that is not `main.rs` => the goal is to never panic from inside the library and let `main.rs` handle the errors - in `main.rs` the new `throw_error` function is used to return a message on `stderr` and exit the runtime with a code => then `komodo.nu` picks it up and gives a nicer error to the user - the internals of `komodo.nu` also have been greatly simplified without feature changes > **Note** > because `throw_error` does not return anything and some of the places where there might be errors in `main.rs` need to return a value, some `unwrap_or_else` need to have an `unreachable!` statement in them to show the compiler it's ok if there's no value on the `Err` branch > > it would be nice to find a better way of doing this
-
- Jan 16, 2024
-
-
STEVAN Antoine authored
## changelog - add an `inspect` command to `komodo` through `main.rs` - remove the useless `Shard.mul` implementation and tests - because `i` is a `u128`, use `i.to_le_bytes()` instead of `[i as u8]` in calls to `E::ScalarField::from_le_bytes_mod_order` - add to `tests/cli.nu` the cases tha should fail - merge together the tests in `lib.rs`, e.g. `verify_2`, `verify_4` and `verify_6` become a simpler `verification` - add some documentation and NOTEs - `impl`ement `Display` for `Block` to dump it to `stdout` - print more detailed test cases when a test fails
-
STEVAN Antoine authored
- should close dragoon/komodo#3 - based on top of dragoon/komodo!12 > **Note** > - commits containing "_DEBUG_" will be removed once this is done > - this MR is based on dragoon/komodo!12 and will be rebased on top of `main` once dragoon/komodo!12 lands i think this is best [reviewed commit by commit](dragoon/komodo!13 (58cec473))
-
STEVAN Antoine authored
this MR uses a simpler `Vec` of `E::ScalarField` to represent a linear combination. the rest of the crate has been fixed accordingly. the goal is to let Arkworks do as much work as possible, fixing part of #2. - `one_more` removed from `field::split_data_into_field_elements` in 5531b31a - `one_less` removed from `field::merge_elements_into_bytes` in 5761b784 ## examples let's say we have at most $k = 3$ source shards, called $s_0$, $s_1$ and $s_2$ respectively. this first means that all linear combinations will be at most of length 3. if a new shard $s$ is a linear combination of the source shards, e.g. $s = \alpha s_0 + \beta s_1 + \gamma s_2$, where $\alpha$, $\beta$ and $\gamma$ are scalar elements of an elliptic curve, then the linear combination in the code will be ```rust vec![alpha, beta, gamma] ``` > **Note** > the right of the vector can be truncated to remove zero elements that are not part of the linear combination and don't add any extra useful information. > the left stays mandatory. e.g. we create two times a linear combination with a single one set to $1$ and the rest to $0$ with the following snippet ```rust let mut linear_combination = Vec::new(); linear_combination.resize(i + 1, E::ScalarField::zero()); linear_combination[i] = E::ScalarField::one(); ```
-
- Dec 06, 2023
-
-
STEVAN Antoine authored
# changelog - add a `transpose` boolean switch to `fec::decode` - add end to end tests that should reflect the real case scenario of `komodo.nu`
-
STEVAN Antoine authored
should fix #1 ## changelog - don't transpose back the decoded shard matrix - pad the field elements in the test - run the tests from the min number of bytes to the full length
-
STEVAN Antoine authored
this should simplify the `fec.rs` test module by removing the long hardcoded vector of bytes.
-
STEVAN Antoine authored
# 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$
-
STEVAN Antoine authored
# changelog - rename `LinalgError` to a more general `KomodoError` - move `KomodoError` to `error.rs` module - add a `TooFewShard(usize, usize)` variant
-
STEVAN Antoine authored
follow up to !3 ## description in !3, to make Clippy happy, `expect` was replace with `unwrap_or_else`, but that suppresses the message of the underlying error, which is not great... this MR reverts this part of !3 and allows `clippy::expect_fun_call`.
-
STEVAN Antoine authored
# changelog - make the FEC decoding test more generic by accepting bytes and encoding by itself - define a large `BYTES` constant that holds _random_ bytes - calls the template on a slice of `BYTES`
-
STEVAN Antoine authored
# changelog - add a `one_less` argument to `field::merge_elements_into_bytes` to mirror the `one_more` from `field::split_data_into_field_elements` - add a `linalg` module which defines - a `pub LinalgError` enum - a `pub(super) Matrix` structure implement for any `ark_ff::Field`, e.g. `<Bls12_381 as Pairing>::ScalarField` - `pub(super) Matrix::vandermonde` - `pub(super) Matrix::from_vec_vec` - `pub(super) Matrix::invert` - `pub(super) Matrix::mul` - `pub(super) Matrix::transpose` - everything is tested extensively - modify `fec.rs` to use `linalg::Matrix` instead of `reed-solomon-erasure` => tests still pass - remove the dependency to [`reed-solomon-erasure`](https://github.com/jdetchart/reed-solomon-erasure) completely
-
- Dec 05, 2023
-
-
STEVAN Antoine authored
-
- Dec 01, 2023
-
-
STEVAN Antoine authored
-
STEVAN Antoine authored
-
STEVAN Antoine authored
-
STEVAN Antoine authored
-
- Nov 30, 2023
-
-
STEVAN Antoine authored
-