Remove panicking code

Open
#112 6 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@MuhtasimTanmoy is already working on this.

Since Jun 4, 2025.

Assessment

This issue has not been assessed yet.

Description

good first issue

In general, WSTS shouldn't panic in unless it is used in such a way where the user is put on notice that it could panic. This ticket is about changing this code base in such a way where we either document the fact that a function can panic if called incorrectly, or change function signatures to bubble up errors.

Here is an example of some offending code:

https://github.com/stacks-sbtc/wsts/blob/71536bf56ce300eaaf91f312442ea2c9698097e5/src/v2.rs#L509-L512

We shouldn't assert! here, but return a Result or Option. Similarly, we shouldn't use array access.

We do the same thing here:
https://github.com/stacks-sbtc/wsts/blob/71536bf56ce300eaaf91f312442ea2c9698097e5/src/v1.rs#L54-L58
and here.

https://github.com/stacks-sbtc/wsts/blob/89b850f1f69fcb9606fd9b35c3546fcb3f88ded9/src/state_machine/signer/mod.rs#L184

I haven't searched for array access, it may happen in other places.

Update: When I find more, I'll add them here:

Dominant language
Rust
Stars
34
Forks
19
Avg merge
9h 19m
Merged PRs (30d)
12

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xoloki/wsts

All issues in xoloki/wsts

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.