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

at-block function can't take a contract-call even though the called function is a read-only function #2953

Closed
friedger opened this issue Nov 29, 2021 · 4 comments
Labels

Comments

@friedger
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
I would like to lookup a historical value, like the last-token-id of a SIP 9 NFT

Clarinet check complains with
at-block closures expect read-only statements, but detected a writing operation

Testnet rejects a simple contract as well
https://explorer.stacks.co/txid/0xbec570e026fd9bf43984b768bb891645fe120c176c25070b34015fe939717917?chain=testnet

Describe the solution you'd like
Allow contract-call functions in the at-block function if the called function is a read-only function.

Maybe even discard changes if it is not a read-only function.

Describe alternatives you've considered
Do it off-chain

Additional context
#1981
#1641

@jcnelson
Copy link
Member

jcnelson commented Nov 29, 2021

I don't think that's the reason this transaction failed. From my node's log:

DEBG [1638176409.507845] [src/chainstate/stacks/db/transactions.rs:1131] [chains-coordinator] Process transaction bec570e026fd9bf43984b768bb891645fe120c176c25070b34015fe939717917 (SmartContract)                                                                                                                             
DEBG [1638176409.507993] [src/vm/database/clarity_db.rs:1524] [chains-coordinator] Fetching account balance, principal: ST2PABAF9FTAJYNFZH93XENAJ8FVY99RRM4DF2YCW                                                                                                                                                              
DEBG [1638176409.511770] [src/vm/ast/parser/mod.rs:523] [chains-coordinator] Closing parenthesis expected (4, 92)                                                                                                                                                                                                              
ERRO [1638176409.511791] [src/chainstate/stacks/db/transactions.rs:995] [chains-coordinator] Runtime error in contract analysis for ST2PABAF9FTAJYNFZH93XENAJ8FVY99RRM4DF2YCW.minor-green-constrictor: Parse(ParseError { err: ClosingParenthesisUnexpected, pre_expressions: None, diagnostic: Diagnostic { level: Error, mess
age: "Tried to close list which isn't open.", spans: [], suggestion: None } })

Looks like there's a typo in your contract.

@jcnelson
Copy link
Member

If Clarinet is telling you that this contract is failing because of a read-only violation, then there's a bug in Clarinet. It should have warned you about the typo first.

@jcnelson
Copy link
Member

jcnelson commented Dec 7, 2021

Going to go ahead and close this. Please re-open if you get a chance to re-try this.

@jcnelson jcnelson closed this as completed Dec 7, 2021
@blockstack-devops
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@stacks-network stacks-network locked as resolved and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants