software-mansion/starknet.py

[BUG] get_block not working anymore

marcelkb opened this issue · 2 comments

What happened

The method call await client.get_block("latest") is not working anymore with FullNodeClient
{'l1_gas_price': {'price_in_fri': ['Missing data for required field.']}, 'l1_data_gas_price': ['Missing data for required field.'], 'l1_da_mode': ['Missing data for required field.']}
are missing

Stack trace

 in wait_gas_starknet
    block_data = await client.get_block("latest")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\venv\Lib\site-packages\starknet_py\net\full_node_client.py", line 120, in get_block
    return cast(StarknetBlock, StarknetBlockSchema().load(res, unknown=EXCLUDE))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\...\venv\Lib\site-packages\marshmallow\schema.py", line 722, in load
    return self._do_load(
           ^^^^^^^^^^^^^^
  File "C:\...\venv\Lib\site-packages\marshmallow\schema.py", line 909, in _do_load
    raise exc
marshmallow.exceptions.ValidationError: {'l1_gas_price': {'price_in_fri': ['Missing data for required field.']}, 'l1_data_gas_price': ['Missing data for required field.'], 'l1_da_mode': ['Missing data for required field.']}

Steps to reproduce

  1. client = FullNodeClient(node_url=random.choice(RPC["starknet"]["rpc"]))
  2. call client.get_block("latest")

SDK Version

0.21.0

Python version

3.11

What operating system are you using?

Windows

Is there an existing issue for this?

  • I have searched the existing issues and verified no issue exits for this problem.

Hi @marcelkb
All the fields l1_gas_price, l1_data_gas_price, and l1_da_mode are required. It seems that the node you're currently using might be running an outdated RPC version. Please verify the RPC version of the node. If it is different from 0.7.0 or 0.7.1, you should update the node or switch to another one that supports these versions. If you still believe the problem lies with starknet.py, feel free to reopen the issue.

@ddoktorski
changing to "https://starknet-mainnet.public.blastapi.io/rpc/v0_7"
and using the newest version of the lib fixes the problem.
thanks for your support