Skip to content
Snippets Groups Projects
Forked from Dragoon / Komodo
Source project has a limited visibility.
STEVAN Antoine's avatar
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
a3c1639a
History
Name Last commit Last update