Skip to content

unwrap in Iden3calc lib #350

@sydhds

Description

@sydhds

Got this error message using Zerokit 0.9:

thread '<unnamed>' panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rln-0.9.0/src/circuit/iden3calc.rs:41:73:
called `Result::unwrap()` on an `Err` value: Custom { kind: InvalidData, error: DecodeError { description: "invalid wire type: EndGroup (expected LengthDelimited)", stack: [("Node", "node")] } }
stack backtrace:
   0:     0x560a64652812 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hdcfcb6d4c8489523
   1:     0x560a644e4e23 - core::fmt::write::h8a494366950f23bb
   2:     0x560a6465175f - std::io::Write::write_fmt::h6556609fca33d0b1
   3:     0x560a64652672 - std::sys::backtrace::BacktraceLock::print::hb2a626a81e06b2dc
   4:     0x560a646520a9 - std::panicking::default_hook::{{closure}}::h4f78485264f12d10
   5:     0x560a64651a94 - std::panicking::default_hook::h2c66fc99e962531d
   6:     0x560a64651412 - std::panicking::rust_panic_with_hook::h33ac55f64bbd807d
   7:     0x560a64690718 - std::panicking::begin_panic_handler::{{closure}}::h30e7cb89678a57fe
   8:     0x560a64690679 - std::sys::backtrace::__rust_end_short_backtrace::hed60f27456c16ced
   9:     0x560a646936ac - __rustc[de2ca18b4c54d5b8]::rust_begin_unwind
  10:     0x560a644e387f - core::panicking::panic_fmt::h62f63d096dd276af
  11:     0x560a644e9505 - core::result::unwrap_failed::h95bc3f5a607b2c95
  12:     0x560a64599a8d - rln::circuit::iden3calc::calc_witness::hfc937de7db39610c
  13:     0x560a64591f29 - rln::protocol::generate_proof::h240401cd65764d19
  14:     0x560a6445f6d5 - <rayon_core::job::HeapJob<BODY> as rayon_core::job::Job>::execute::h90494476d3f3bbc7
  15:     0x560a6451a13a - rayon_core::registry::WorkerThread::wait_until_cold::h9ef9b4a8e79ae50c
  16:     0x560a645194d5 - std::sys::backtrace::__rust_begin_short_backtrace::h3ececc9df1319d1b
  17:     0x560a6451beeb - core::ops::function::FnOnce::call_once{{vtable.shim}}::hb1616392576d2aab
  18:     0x560a64693b3f - std::sys::pal::unix::thread::Thread::new::thread_start::hb6e99e73da4d28f8
  19:     0x7fa38689caa4 - <unknown>
  20:     0x7fa386929c6c - <unknown>
  21:                0x0 - <unknown>
Rayon: detected unexpected panic; aborting

After looking at the code, there are some unwrap in iden3calc lib. Would be nice to have proper error handling here :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions