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

view_state stopped working #281

Closed
Tarnadas opened this issue Jul 10, 2023 · 8 comments
Closed

view_state stopped working #281

Tarnadas opened this issue Jul 10, 2023 · 8 comments

Comments

@Tarnadas
Copy link

Tarnadas commented Jul 10, 2023

Hey,

I have a script to deploy my contract.
As preparation I read all keys to clean up storage for a redeployment and I use workspaces for this.
However just recently the call to view_state returns an error:

Error: unable to fulfill the query request

Caused by:
    error while parsing method call result: [data did not match any variant of untagged enum QueryResponse]

I changed my code to manually call the RPC server via this query and it works:

{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "query",
  "params": {
    "request_type": "view_state",
    "finality": "final",
    "account_id": "app4.orderly-spot.testnet",
    "prefix_base64": ""
  }
}

So it seems like the error must be in the workspaces crate.

@frol
Copy link
Collaborator

frol commented Jul 30, 2023

@Tarnadas Did you compile your contract / workspaces-rs project with Rust <= 1.69? See this issue for more details: near/nearcore#9143

@Tarnadas
Copy link
Author

Hey @frol,
yes I'm aware of the issue and use Rust 1.69.
But why should the Rust version that I use for compilation affect this? Isn't workspaces doing an RPC call and not doing anything on chain in my case?

@frol
Copy link
Collaborator

frol commented Jul 31, 2023

@Tarnadas If you use workspaces-rs to compile your smart contract, it will compile it with whatever Rust compiler it finds and deploy it (actually, hard to tell without looking at the code of the test you wrote), and then it will fail to be executed on nearcore.

@Tarnadas
Copy link
Author

Ah ok, that makes it clear. But I don't use workspaces to compile my code. I have a build script and just load the wasm file for deployment.

In this particular case I don't use workspaces for integration tests, but instead I have a deploy program for testnet. I read the existing contract state to delete existing keys and do a deployment afterwards.

@frol
Copy link
Collaborator

frol commented Jul 31, 2023

@Tarnadas If you don't use workspaces-rs, submit your issue somewhere it belongs to and provide more details with the code you run, otherwise it is impossible to help you.

@Tarnadas
Copy link
Author

I wrote in the issue that I use ‘view_state‘ from workspaces:
https://docs.rs/workspaces/0.7.0/workspaces/struct.Worker.html#method.view_state

@ghost
Copy link

ghost commented Nov 7, 2023

Is this issue still relevant, If it is stale we can close it.

@frol
Copy link
Collaborator

frol commented Nov 16, 2023

@Tarnadas Please, try using the latest near-workspaces 0.9 release and feel free to reopen this issue if it still fails for you

@frol frol closed this as completed Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants