starkware-libs / cairo-lang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

starknet deploy_account get an error

liuyepiaoxiang opened this issue · comments

Environment

Ubuntu 20.0
python version:3.9.10
cario-lang version:cairo_lang-0.10.3-py3.9.egg-info
web3 version: web3-6.0.0

Excepted

When I try to run starknet deploy_account after starknet new_account,I got an error with

Error: AttributeError: type object 'Web3' has no attribute 'fromWei'

If I use pip install web3==5 after pip install cario-lang,
When I tried to run starknet new_account with an error

Traceback (most recent call last):
  File "/home/ubuntu/.pyenv/versions/stark/bin/starknet", line 9, in <module>
    from starkware.starknet.cli.starknet_cli import main  # noqa
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starknet/cli/starknet_cli.py", line 35, in <module>
    from starkware.starknet.services.api.feeder_gateway.feeder_gateway_client import (
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py", line 7, in <module>
    from starkware.starknet.services.api.feeder_gateway.request_objects import (
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starknet/services/api/feeder_gateway/request_objects.py", line 7, in <module>
    from starkware.starknet.business_logic.execution.execute_entry_point import ExecuteEntryPoint
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starknet/business_logic/execution/execute_entry_point.py", line 24, in <module>
    from starkware.starknet.business_logic.utils import (
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starknet/business_logic/utils.py", line 14, in <module>
    from starkware.starknet.business_logic.execution.os_usage import get_additional_os_resources
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starknet/business_logic/execution/os_usage.py", line 24, in <module>
    os_resources: OsResources = OsResources.loads(
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starkware_utils/serializable_dataclass.py", line 32, in loads
    return cls.Schema().loads(json_data=data)
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/marshmallow/schema.py", line 756, in loads
    return self.load(data, many=many, partial=partial, unknown=unknown)
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/marshmallow_dataclass/__init__.py", line 769, in load
    return clazz(**all_loaded)
  File "<string>", line 5, in __init__
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starkware_utils/validated_dataclass.py", line 25, in __post_init__
    self.validate_dataclass()
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starkware_utils/validated_dataclass.py", line 28, in validate_dataclass
    self.validate_types()
  File "/home/ubuntu/.pyenv/versions/3.9.10/envs/stark/lib/python3.9/site-packages/starkware/starkware_utils/validated_dataclass.py", line 124, in validate_types
    typeguard.check_type(
TypeError: check_type() got an unexpected keyword argument 'argname'

I am getting the same error regarding check_type
With or without venv (cairo_venv) it is still the same

Happy to open another ticket if required.

Environment:

MacOS 12.6.3 arch x86_64
Python 3.9.16 (through pyenv)

Last stack call:

File "/Users/user/.pyenv/versions/3.9.16/lib/python3.9/site-packages/starkware/starkware_utils/validated_dataclass.py", line 124, in validate_types
    typeguard.check_type(
TypeError: check_type() got an unexpected keyword argument 'argname'

As a workaround I fixed this error by running:
pip3.9 install starknet-devnet

I can only assume that typeguard version of a dependency helped there.
Probably this will fix it as well

pip3.9 install --upgrade --force-reinstall -v "typeguard===2.13.3"

Now I am facing the error metnioned initially in this ticket:

Error: AttributeError: type object 'Web3' has no attribute 'fromWei

Running Python console and importing Web3 seems that the function available is from_wei instead of camelcased fromWei so I only assume that cairo requires an older Web3 version (before 6.0.0b5) and this breaks.

@liuyepiaoxiang Fixed this by running

pip3.9 install --upgrade --force-reinstall -v "web3===5.31.1"

The fix is messy overall and since Web3 has breaking changes in stable v6.0.0, cairo-cli would be nice to also use v6.0.0. The specific call is being used here and here but the new version has other breaking changes as well

cc @liorgold2