arkworks-rs / arkworks-rs/poly-commit
Odd usage/API of PolynomialCommitment trait associated error
- Dominant language
- Rust
- Stars
- 440
- Forks
- 160
- PR merge metrics
- No merged PRs in 30d
Description
Hey!
I've been with the `ark-poly-commit` library.
And I have my `Error` enum where inside I have an `ArkPolyCommit` error variant.
The issue is that seems I can't do:
```rust
pub fn universal_setup(
max_degree: usize,
rng: &mut R,
) -> Result, MyError> {
PC::setup(max_degree, None, rng)
.map_err(|err| ark_poly_commit::Error::from)?
}
```
Nor
```rust
pub fn universal_setup(
max_degree: usize,
rng: &mut R,
) -> Result, MyError> {
PC::setup(max_degree, None, rng)?
}
```
And I have the `From for MyError` ofc.
The issue I see is that `PolynomialCommitment` has an associated Error type. And although the associated trait bounds seem correct. I can't make it work as requires me to add generics in all my errors where this should not be necessary.
See: https://github.com/arkworks-rs/poly-commit/blob/master/src/lib.rs#L174
Wondering how does people sort this out without ugly solutions like https://github.com/ZK-Garage/plonk/blob/master/plonk-core/src/error.rs#L96-L107.
Ideally, can't we remove the `Error` type from the trait and just leave the regular error? This would make integration within enums much easier.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.