stacks-core icon indicating copy to clipboard operation
stacks-core copied to clipboard

[clarity] Calling non-existent contract within `define-read-only` yields wrong error

Open MicaiahReid opened this issue 1 year ago • 1 comments

Describe the bug If you make a contract-call? to an undefined contract within a define-read-only block, the error is expecting read-only statements, detected a writing operation rather than indicating that the contract being called does not exist.

Steps To Reproduce Create a contract with the following:

(define-read-only (call-ok-true)
    (ok (contract-call? does_not_exist ok-true)))

Note the error expecting read-only statements, detected a writing operation, rather than something like contract does_not_exist is not defined

Expected behavior To receive a contract does_not_exist is not defined error

Environment (please complete the following information):

  • Currently, clarinet is built using the clarity package from this commit: https://github.com/stacks-network/stacks-core/commit/45843513a

MicaiahReid avatar Feb 13 '24 16:02 MicaiahReid

This is just a side effect of the fact that the read-only checker runs before the type-checker. I don't think this is necessarily a problem.

obycode avatar Aug 09 '24 19:08 obycode