hirosystems / clarinet

Write, test and deploy high-quality smart contracts to the Stacks blockchain and Bitcoin.
https://hiro.so/clarinet
GNU General Public License v3.0
293 stars 130 forks source link

Commented code fails `clarinet check` #679

Closed whoabuddy closed 1 year ago

whoabuddy commented 1 year ago

We ran into some errors in this PR and in an attempt to get at least clarinet check to pass, commented out some of the offending code lines.

The weird part is even after commenting them out, they are causing clarinet check to fail!

Example of code before that fails because the contract is missing:

(define-public (execute (sender principal))
    (begin
        ;; tests success of setting sunset height
        (try! (contract-call? .ccd002-treasury-mia set-allowed-list
            (list
                {token: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ccext-governance-token-mia, enabled: false}
                {token: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ccext-governance-token-nyc, enabled: true}
            )
        ))
        (ok true)
    )
)

Example of updated code that still fails with the same error:

(define-public (execute (sender principal))
    (ok true)
)

;; (impl-trait .proposal-trait.proposal-trait)

;; (define-public (execute (sender principal))
;;  (begin
        ;; tests success of setting sunset height
;;      (try! (contract-call? .ccd002-treasury-mia set-allowed-list
;;          (list
;;              {token: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ccext-governance-token-mia, enabled: false}
;;              {token: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ccext-governance-token-nyc, enabled: true}
;;          )
;;      ))
;;      (ok true)
;;  )
;; )

Error reported by clarinet check that includes the comments:

error: use of unresolved contract 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ccd002-treasury-mia'
--> contracts/proposals/ccip-test-treasury-003.clar:16:6
;;      (begin
     ^~~~~
;;              (try! (contract-call? .ccd002-treasury-mia set-allowed-list
;;                      (list
;;                              {token: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ccext-governance-token-mia, enabled: false}
;;                              {token: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.ccext-governance-token-nyc, enabled: true}
;;                      )
     ^
;;              (ok true)
     ^~~~~~~~~
obycode commented 1 year ago

Thanks for reporting! I'm looking into this now.

obycode commented 1 year ago

This is a known issue in the old (current) parser. See https://github.com/stacks-network/stacks-blockchain/issues/3124. It is fixed in 2.1 with the new parser.

obycode commented 1 year ago

Closing this issue since it will be fixed in 2.1.