rust-bitcoin / rust-bitcoin/rust-miniscript

`sanity_check` methods throughout the codebase shouldn't be part of the API

Open
#653 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
426
Forks
200
Avg merge
7d 17h
Merged PRs (30d)
8

Description

Actually I'll just file an issue. There are a lot of sanity_check methods in the code, many of which are not called from within the library, and at least one has a doc example suggesting to use it to check "whether all spend paths are accessible in the Bitcoin network".

So we need to re-assess all these functions and see if they can be pulled into the type system somehow so you simply can't create the objects without running the (non-pub) methods.

Originally posted by @apoelstra in https://github.com/rust-bitcoin/rust-miniscript/pull/652#discussion_r1514517762

Contributor guide

Open the contributing guide

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.

Research direction

Start by inventorying the sanity_check methods throughout the codebase and reviewing the linked pull-request discussion, including the documentation example about Bitcoin spend paths. Determine which methods are externally callable and which invariants should instead be enforced by the type system; done means the API no longer exposes inappropriate checks and object validity is handled consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.