From a20aa7877977679c13754c6e81ed526eecf7bfa7 Mon Sep 17 00:00:00 2001 From: Krisztian Kovacs Date: Tue, 21 Mar 2023 08:27:43 +0100 Subject: [PATCH 1/2] feat(py): upgrade to cairo-lang 0.11.0 --- py/pyproject.toml | 4 +- py/requirements-dev.txt | 63 ++++++++++++++++++++------------ py/src/pathfinder_worker/call.py | 2 +- 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/py/pyproject.toml b/py/pyproject.toml index 17d1ab671e..6630e2f801 100644 --- a/py/pyproject.toml +++ b/py/pyproject.toml @@ -8,9 +8,11 @@ version = "0.1.0" description = "Pathfinder Python worker subprocess" readme = "README.md" dependencies = [ - "cairo-lang == 0.11.0a2", + "cairo-lang == 0.11.0", "zstandard == 0.20.0", "cachetools == 5.3.0", + # required so that pip-compile can properly resolve dependencies + "web3 == 5.31.4", ] requires-python = ">=3.9" diff --git a/py/requirements-dev.txt b/py/requirements-dev.txt index 78eb6b9146..3db162734b 100644 --- a/py/requirements-dev.txt +++ b/py/requirements-dev.txt @@ -17,6 +17,8 @@ attrs==22.2.0 # aiohttp # jsonschema # pytest +base58==2.1.1 + # via multiaddr bitarray==2.7.3 # via eth-account black==22.10.0 @@ -27,7 +29,7 @@ cachetools==5.3.0 # via # cairo-lang # pathfinder-worker (pyproject.toml) -cairo-lang==0.11.0a2 +cairo-lang==0.11.0 # via pathfinder-worker (pyproject.toml) certifi==2022.12.7 # via requests @@ -40,35 +42,39 @@ click==8.1.3 # black # pip-tools cytoolz==0.12.1 - # via eth-utils + # via + # eth-keyfile + # eth-utils ecdsa==0.18.0 # via cairo-lang -eth-abi==4.0.0b2 +eth-abi==2.2.0 # via # eth-account # web3 -eth-account==0.8.0 +eth-account==0.5.9 # via web3 eth-hash[pycryptodome]==0.5.1 # via # cairo-lang # eth-utils # web3 -eth-keyfile==0.6.1 +eth-keyfile==0.5.1 # via eth-account -eth-keys==0.4.0 +eth-keys==0.3.4 # via # eth-account # eth-keyfile -eth-rlp==0.3.0 - # via eth-account -eth-typing==3.3.0 +eth-rlp==0.2.1 + # via + # eth-account + # web3 +eth-typing==2.3.0 # via # eth-abi # eth-keys # eth-utils # web3 -eth-utils==2.1.0 +eth-utils==1.9.5 # via # eth-abi # eth-account @@ -98,6 +104,8 @@ idna==3.4 # yarl iniconfig==2.0.0 # via pytest +ipfshttpclient==0.8.0a2 + # via web3 jsonschema==4.17.3 # via web3 lark==1.1.5 @@ -122,6 +130,8 @@ mpmath==1.3.0 # via # cairo-lang # sympy +multiaddr==0.0.9 + # via ipfshttpclient multidict==6.0.4 # via # aiohttp @@ -130,6 +140,8 @@ mypy-extensions==1.0.0 # via # black # typing-inspect +netaddr==0.8.0 + # via multiaddr numpy==1.24.2 # via cairo-lang packaging==23.0 @@ -137,10 +149,8 @@ packaging==23.0 # build # marshmallow # pytest -parsimonious==0.9.0 - # via - # eth-abi - # web3 +parsimonious==0.8.1 + # via eth-abi pathspec==0.11.1 # via black pip-tools==6.12.3 @@ -153,7 +163,7 @@ pluggy==1.0.0 # via pytest prometheus-client==0.16.0 # via cairo-lang -protobuf==4.22.1 +protobuf==3.19.5 # via web3 py==1.11.0 # via pytest @@ -178,16 +188,19 @@ pytest-asyncio==0.21.0 # via cairo-lang pyyaml==6.0 # via cairo-lang -regex==2022.10.31 - # via parsimonious requests==2.28.2 - # via web3 -rlp==3.0.0 + # via + # ipfshttpclient + # web3 +rlp==2.0.1 # via # eth-account # eth-rlp six==1.16.0 - # via ecdsa + # via + # ecdsa + # multiaddr + # parsimonious sympy==1.11.1 # via cairo-lang tomli==2.0.1 @@ -208,9 +221,13 @@ typing-inspect==0.8.0 # via marshmallow-dataclass urllib3==1.26.15 # via requests -web3==6.0.0 - # via cairo-lang -websockets==10.4 +varint==1.0.2 + # via multiaddr +web3==5.31.4 + # via + # cairo-lang + # pathfinder-worker (pyproject.toml) +websockets==9.1 # via web3 wheel==0.40.0 # via pip-tools diff --git a/py/src/pathfinder_worker/call.py b/py/src/pathfinder_worker/call.py index 81b5f7a89b..85948dd8fc 100644 --- a/py/src/pathfinder_worker/call.py +++ b/py/src/pathfinder_worker/call.py @@ -85,7 +85,7 @@ # used from tests, and the query which asserts that the schema is of expected version. EXPECTED_SCHEMA_REVISION = 30 -EXPECTED_CAIRO_VERSION = "0.11.0a2" +EXPECTED_CAIRO_VERSION = "0.11.0" # used by the sqlite adapter to communicate "contract state not found, nor was the patricia tree key" NOT_FOUND_CONTRACT_STATE = b'{"contract_hash": "0000000000000000000000000000000000000000000000000000000000000000", "nonce": "0x0", "storage_commitment_tree": {"height": 251, "root": "0000000000000000000000000000000000000000000000000000000000000000"}}' From ba468f2cd1db147e17c53bd9fa012f452f252402 Mon Sep 17 00:00:00 2001 From: Krisztian Kovacs Date: Tue, 21 Mar 2023 08:57:12 +0100 Subject: [PATCH 2/2] feat(py/call): fix up import and name changes for cairo-lang 0.11.0 --- py/src/pathfinder_worker/call.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/py/src/pathfinder_worker/call.py b/py/src/pathfinder_worker/call.py index 85948dd8fc..576ab27863 100644 --- a/py/src/pathfinder_worker/call.py +++ b/py/src/pathfinder_worker/call.py @@ -43,12 +43,12 @@ from starkware.starknet.business_logic.execution.execute_entry_point import ( ExecuteEntryPoint, ) + from starkware.starknet.business_logic.execution.objects import ( + ExecutionResourcesManager, + ) from starkware.starknet.business_logic.fact_state.patricia_state import ( PatriciaStateReader, ) - from starkware.starknet.business_logic.fact_state.state import ( - ExecutionResourcesManager, - ) from starkware.starknet.business_logic.state.state import BlockInfo, CachedState from starkware.starknet.definitions import fields, constants from starkware.starknet.definitions.constants import GasCost @@ -184,7 +184,7 @@ class Call(Command): pending_timestamp: int = field(metadata=fields.timestamp_metadata) contract_address: int = field(metadata=fields.contract_address_metadata) - calldata: List[int] = field(metadata=fields.call_data_as_hex_metadata) + calldata: List[int] = field(metadata=fields.calldata_as_hex_metadata) entry_point_selector: Optional[int] = field( default=None, metadata=fields.optional_entry_point_selector_metadata )