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

Run static analysis as part of build/CI #72

Open
moodmosaic opened this issue Jul 18, 2024 · 0 comments
Open

Run static analysis as part of build/CI #72

moodmosaic opened this issue Jul 18, 2024 · 0 comments

Comments

@moodmosaic
Copy link

moodmosaic commented Jul 18, 2024

In addition to #70 (comment), here's some more output from running stacy-analyzer, which suggests that it should run as a build/CI step:

https://github.com/Trust-Machines/BNS-V2/blob/97be5fd93e7676f74bfca5aecdbd84008e52e474/contracts/BNS-V2.clar

Warning: Behavior of 'element-at' changed from Clarity1 to Clarity2, now outputs optional value.
     |
 207 |         (ok (unwrap! (element-at NAMESPACE-PRICE-TIERS (min u7 (- namespace-len u1))) ERR-UNWRAP))
     |                       ^^^^^^^^^^
     Note: Suggestion: use 'element-at?' to make this behavior explicit.

Warning: Behavior of 'element-at' changed from Clarity1 to Clarity2, now outputs optional value.
      |
 1402 |     (unwrap-panic (element-at buckets index))
      |                    ^^^^^^^^^^
      Note: Suggestion: use 'element-at?' to make this behavior explicit.

https://github.com/Trust-Machines/BNS-V2/blob/97be5fd93e7676f74bfca5aecdbd84008e52e474/contracts/BNS-V2.clar

Warning: Use of unwrap-panic.
     |
 360 |         (asserts! (is-eq contract-caller (unwrap-panic manager)) ERR-NOT-AUTHORIZED)
     |                                           ^^^^^^^^^^^^
     Note: Use unwrap! and handle the error.

Warning: Use of unwrap-panic.
      |
 1289 |         (map-set name-properties { name: name, namespace: namespace } (merge (unwrap-panic (map-get? name-properties { name: name, namespace: namespace })) {stx-burn: (try! (compute-name-price name (get price-function namespace-props)))}))
      |                                                                               ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

Warning: Use of unwrap-panic.
      |
 1330 |                         (if (< burn-block-height (unwrap-panic (get-renewal-height (unwrap-panic (get-id-from-bns name namespace)))))
      |                                                   ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

Warning: Use of unwrap-panic.
      |
 1330 |                         (if (< burn-block-height (unwrap-panic (get-renewal-height (unwrap-panic (get-id-from-bns name namespace)))))
      |                                                                                     ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

Warning: Use of unwrap-panic.
      |
 1331 |                             (+ (unwrap-panic (get-renewal-height (unwrap-panic (get-id-from-bns name namespace)))) lifetime)
      |                                 ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

Warning: Use of unwrap-panic.
      |
 1331 |                             (+ (unwrap-panic (get-renewal-height (unwrap-panic (get-id-from-bns name namespace)))) lifetime)
      |                                                                   ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

Warning: Use of unwrap-panic.
      |
 1402 |     (unwrap-panic (element-at buckets index))
      |      ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

Warning: Use of divide inside a multiplication. This could result in a precision loss.
      |
 1552 |         (ok (* (/ (* (get coeff price-function) (pow (get base price-function) exponent)) (max nonalpha-discount no-vowel-discount)) u10))
      |              ^
      Note: Try multiplication before division.

Warning: Use of unwrap-panic.
      |
 1631 |             (name-index (unwrap-panic (map-get? name-to-index {name: name, namespace: namespace})))
      |                          ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

Warning: Use of unwrap-panic.
      |
 1639 |             (asserts! (> (unwrap-panic (get created-at (map-get? name-preorders {hashed-salted-fqn: fqn, buyer: (unwrap-panic (get preordered-by name-props))}))) tx-sender-preorder-height) ERR-PREORDERED-BEFORE)
      |                           ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

Warning: Use of unwrap-panic.
      |
 1639 |             (asserts! (> (unwrap-panic (get created-at (map-get? name-preorders {hashed-salted-fqn: fqn, buyer: (unwrap-panic (get preordered-by name-props))}))) tx-sender-preorder-height) ERR-PREORDERED-BEFORE)
      |                                                                                                                  ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

Warning: Use of unwrap-panic.
      |
 1641 |             (asserts! (> (unwrap-panic (get registered-at name-props)) tx-sender-preorder-height) ERR-FAST-MINTED-BEFORE)
      |                           ^^^^^^^^^^^^
      Note: Use unwrap! and handle the error.

/cc @BowTiedRadone @wileyj

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

No branches or pull requests

1 participant