NethermindEth/horus-checker

`horus-compile` raises a `typeguard` runtime error on Python 3.9

langfield opened this issue · 1 comments

See below.

(horus39) mal@computer:~/pkgs/horus-checker$ horus-compile annotated.cairo --output compiled.json --spec_output spec.json
Traceback (most recent call last):
  File "/home/mal/conda/envs/horus39/bin/horus-compile", line 8, in <module>
    sys.exit(run())
  File "/home/mal/pkgs/horus-checker/horus-compile/src/horus/compiler/horus_compile.py", line 412, in run
    main(sys.argv[1:])
  File "/home/mal/pkgs/horus-checker/horus-compile/src/horus/compiler/horus_compile.py", line 396, in main
    preprocessed = horus_compile_common(
  File "/home/mal/pkgs/horus-checker/horus-compile/src/horus/compiler/horus_compile.py", line 225, in horus_compile_common
    pass_manager = pass_manager_factory(args, module_reader)
  File "/home/mal/pkgs/horus-checker/horus-compile/src/horus/compiler/horus_compile.py", line 375, in pass_manager_factory
    return horus_pass_manager(
  File "/home/mal/pkgs/horus-checker/horus-compile/src/horus/compiler/horus_compile.py", line 115, in horus_pass_manager
    manager = starknet_pass_manager(
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starknet/compiler/starknet_pass_manager.py", line 33, in starknet_pass_manager
    hint_whitelist = None if disable_hint_validation else get_hints_whitelist()
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starknet/security/hints_whitelist.py", line 9, in get_hints_whitelist
    return HintsWhitelist.from_dir(dirname=WHILTELIST_DIR)
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starknet/security/secure_hints.py", line 110, in from_dir
    whitelists = [
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starknet/security/secure_hints.py", line 111, in <listcomp>
    cls.from_file(filename=os.path.join(dirname, x))
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starknet/security/secure_hints.py", line 103, in from_file
    return cls.loads(data=fp.read())
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starkware_utils/serializable_dataclass.py", line 32, in loads
    return cls.Schema().loads(json_data=data)
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/marshmallow/schema.py", line 756, in loads
    return self.load(data, many=many, partial=partial, unknown=unknown)
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/marshmallow_dataclass/__init__.py", line 639, in load
    all_loaded = super().load(data, many=many, **kwargs)
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/marshmallow/schema.py", line 722, in load
    return self._do_load(
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/marshmallow/schema.py", line 861, in _do_load
    result = self._deserialize(
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/marshmallow/schema.py", line 664, in _deserialize
    value = self._call_and_store(
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/marshmallow/schema.py", line 500, in _call_and_store
    value = getter_func(data)
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/marshmallow/schema.py", line 661, in <lambda>
    getter = lambda val: field_obj.deserialize(
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/marshmallow/fields.py", line 370, in deserialize
    output = self._deserialize(value, attr, data, **kwargs)
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starknet/security/secure_hints.py", line 77, in _deserialize
    entries = [HintsWhitelistEntry.Schema().load(entry) for entry in value]
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starknet/security/secure_hints.py", line 77, in <listcomp>
    entries = [HintsWhitelistEntry.Schema().load(entry) for entry in value]
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/marshmallow_dataclass/__init__.py", line 644, in load
    return clazz(**all_loaded)
  File "<string>", line 5, in __init__
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starkware_utils/validated_dataclass.py", line 24, in __post_init__
    self.validate_dataclass()
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starkware_utils/validated_dataclass.py", line 27, in validate_dataclass
    self.validate_types()
  File "/home/mal/conda/envs/horus39/lib/python3.9/site-packages/starkware/starkware_utils/validated_dataclass.py", line 123, in validate_types
    typeguard.check_type(
TypeError: check_type() got an unexpected keyword argument 'argname'

Easily fixed by pinning typeguard == 2.13.3. See requirements.txt file in starkware-libs/cairo-lang.