stacks-network / stacks-network/stacks-core
Assert to check invariants and abort contract call
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.1k
- Forks
- 762
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 76
Description
Clarity should have an assert construct that aborts the contract call when an invariant predicate is false.
Assertions are common in programming languages, including other Lisp dialects: Clojure has assert; Common Lisp has assert; Scheme has assert; Typed Racket has with-asserts;
Clarity already have an asserts! form, but instead of aborting the contract call, it returns an error from the current function. This is a foot gun for Clarity developers, inviting security flaws such as failing to handle severe errors. It is also inflexible, limiting assertions to functions that return a result type.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue identifies the existing asserts! form but names no files, tests, or implementation entry point. Start by locating the Clarity language implementation and the current asserts! behavior, then trace how contract-call aborts are represented. Done means an assert construct aborts the contract call when its predicate is false.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100