stacks-network / stacks-network/stacks-core

read-only functions can not call trait functions even if the implementation uses a read-only function

Open
#1,981 11 comments 4 reactions 1 assignee View on GitHub

@obycode is already working on this.

Since Feb 22, 2023.

clarity icebox
Dominant language
Rust
Stars
3.1k
Forks
762
Avg merge
4d 6h
Merged PRs (30d)
76

Description

The following code

(define-read-only (symbol)
  (contract-call? 'ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.swapr symbol 'ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.plaid-token 'ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.stx-token)
)

generates an error expecting read-only statements, detected a writing operation. (i.e. WriteAttemptedInReadOnly) when deploying, even if contract-call? is calling an other define-read-only function.

This should be allowed.

Fix may be related to what is needed for https://github.com/blockstack/stacks-blockchain/issues/1641, and the 2 issues prevent using the RPC read-only call to call any function using contract-call (if you make the function define public then #1641 prevents you as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.