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

starknet_getNonce on block_id=pending fails with starknet-devnet-rs 0.0.6 #474

Closed
2 tasks done
0xknwn opened this issue May 23, 2024 · 4 comments · Fixed by #480
Closed
2 tasks done

starknet_getNonce on block_id=pending fails with starknet-devnet-rs 0.0.6 #474

0xknwn opened this issue May 23, 2024 · 4 comments · Fixed by #480
Assignees
Labels
bug Something isn't working

Comments

@0xknwn
Copy link

0xknwn commented May 23, 2024

Describe the bug (observed vs expected behavior)

I am starting starknet-devnet-rs with the latest 0.0.6 (I tried both from docker and a cargo install) with --seed=0 and when I run a getNonce on the account that is publicized as available with block_id = pending. That is the command:

curl 0.0.0.0:5050/rpc -H 'content-type: application/json' -d '{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "starknet_getNonce",
    "params": {
        "block_id": "pending",
        "contract_address": "0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691"
    }
}'

I get:

{"jsonrpc":"2.0","id":2,"error":{"code":20,"message":"Contract not found"}}

Note that:

  • the same request with "block_id": "latest" works on v0.0.6
  • the same request with "block_id": "pending" works on v0.0.5
  • the same request with "block_id": "pending" (and an account that exists obviously) works on sepolia

The CLI output shows the account is correct and again it works with block_id is latest anyway.

Is it an intended behavior or is it a bug? starknet.js does an implicit getNonce on execute() and it does not provide any feature (except fixing the code) to change the block_id tag from pending to latest.

Not reproducible on testnet

  • This issue is only present on Devnet and cannot be reproduced on the alpha-sepolia testnet (check the box if true).

To Reproduce

see the description above:

  • run devnet 0.0.6
  • get a contract address that exists
  • run starknet_getNonce with the contract and block_id tag to pending

Devnet version

  • I am using Devnet version: 0.0.6
  • This happens with a dockerized Devnet (check the box if true).
  • This does not appear on the following Devnet version: 0.0.5

System specifications

I did it on docker AND on my OSX with the cargo install version of starknet-devnet. Same behavior on the 2. Thank you for your help

@0xknwn 0xknwn changed the title Cannot access contract/class with starknet-devnet-rs 0.0.6 starknet_getNonce on block_id=pending fails with starknet-devnet-rs 0.0.6 May 23, 2024
@FabijanC FabijanC added the bug Something isn't working label May 23, 2024
@FabijanC
Copy link
Contributor

Thank you for the clear description. @mikiw I assume it is related to your task. Can you TAL and see if your unreleased changes perhaps fix this?

@mikiw
Copy link
Contributor

mikiw commented May 23, 2024

Yes, it's related. I'll check that.

@mikiw mikiw self-assigned this May 23, 2024
@mikiw
Copy link
Contributor

mikiw commented May 23, 2024

@0xknwn this problem is related to this task #445 (point defaulting to the latest state in case calls are done on pending (and there is no pending)) and once it is merged it will work as expected. Unfortunately I can't give any estimates since we are preparing to conference.

With block on demand mode cargo run -- --seed 0 --blocks-on-demand pending state is queried correctly.

@mikiw mikiw linked a pull request May 23, 2024 that will close this issue
10 tasks
@FabijanC
Copy link
Contributor

Similar issue reported on Discord: https://discord.com/channels/793094838509764618/1245283649356566620

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
3 participants