Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add 'filter' annotation #73

Merged
merged 1 commit into from Jan 11, 2022
Merged

feat: add 'filter' annotation #73

merged 1 commit into from Jan 11, 2022

Conversation

obycode
Copy link
Member

@obycode obycode commented Jan 10, 2022

The filter annotation allows developers to tell the check-checker to
filter one or more inputs on an expression that cannot be detected as a
filter. This is useful when a check on some unrelated inputs indirectly
validates another input. For example:

(define-public (withdraw (amount uint))
    (begin
        ;; #[filter(amount)]
        (asserts! (is-eq tx-sender (var-get admin)) (err u400))
        (stx-transfer? amount (as-contract tx-sender) tx-sender)
    )
)

The filter annotation takes either a comma-separated list of parameter
names to filter, or a '*', which filters everything.

Resolves hirosystems/clarinet#822

The filter annotation allows developers to tell the check-checker to
filter one or more inputs on an expression that cannot be detected as a
filter. This is useful when a check on some unrelated inputs indirectly
validates another input. For example:

```clarity
(define-public (withdraw (amount uint))
    (begin
        ;; #[filter(amount)]
        (asserts! (is-eq tx-sender (var-get admin)) (err u400))
        (stx-transfer? amount (as-contract tx-sender) tx-sender)
    )
)
```

The filter annotation takes either a comma-separated list of parameter
names to filter, or a '*', which filters everything.

Resolves #72
@obycode obycode requested a review from lgalabru January 10, 2022 22:08
Copy link
Member

@lgalabru lgalabru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you for the extensive testing!

@obycode obycode merged commit 85f9abc into develop Jan 11, 2022
@obycode obycode deleted the feat/filter-annotation branch January 11, 2022 18:10
@blockstack-devops
Copy link
Collaborator

🎉 This PR is included in version 0.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add filter annotation to check-checker
3 participants