stacks-network / stacks-network/stacks-core
read-only functions can not call trait functions even if the implementation uses a read-only function
Open
@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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.