From 6be75d58606040b25f915473f4e8b1607cc7ca5e Mon Sep 17 00:00:00 2001 From: Krisztian Kovacs Date: Tue, 5 Apr 2022 09:32:33 +0200 Subject: [PATCH 1/3] fix(py): fix imports for cairo-lang 0.8.1 --- py/src/call.py | 4 ++-- py/src/generate_test_global_tree.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/py/src/call.py b/py/src/call.py index 1d2dcf5ebe..2ab3885c1f 100644 --- a/py/src/call.py +++ b/py/src/call.py @@ -229,7 +229,7 @@ def check_schema(connection): def resolve_block(connection, at_block): - from starkware.starknet.business_logic.state import BlockInfo + from starkware.starknet.business_logic.state.state import BlockInfo if at_block == "latest": # latest is questionable, but the rust side cannot use it at the moment at least, @@ -420,7 +420,7 @@ async def do_call( Returns the retdata from the call, which is the only property needed by the RPC api. """ - from starkware.starknet.business_logic.state import ( + from starkware.starknet.business_logic.state.state import ( SharedState, StateSelector, ) diff --git a/py/src/generate_test_global_tree.py b/py/src/generate_test_global_tree.py index 297a5db2d5..13aa46a00a 100644 --- a/py/src/generate_test_global_tree.py +++ b/py/src/generate_test_global_tree.py @@ -33,7 +33,7 @@ async def generate_root_and_nodes(input): from starkware.starkware_utils.commitment_tree.patricia_tree.patricia_tree import ( PatriciaTree, ) - from starkware.starknet.business_logic.state_objects import ContractState + from starkware.starknet.business_logic.state.objects import ContractState from copy import deepcopy # still create this for the ffc it creates. From d209b136d0fa7a97d06fc0428ba5fad21e333ee0 Mon Sep 17 00:00:00 2001 From: Krisztian Kovacs Date: Tue, 5 Apr 2022 13:46:48 +0200 Subject: [PATCH 2/3] fix(py): specify default gas price for BlockInfo Required for cairo-lang 0.8.1 compatibility. --- py/src/call.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py/src/call.py b/py/src/call.py index 2ab3885c1f..f523d581fe 100644 --- a/py/src/call.py +++ b/py/src/call.py @@ -230,6 +230,7 @@ def check_schema(connection): def resolve_block(connection, at_block): from starkware.starknet.business_logic.state.state import BlockInfo + from starkware.starknet.definitions.general_config import DEFAULT_GAS_PRICE if at_block == "latest": # latest is questionable, but the rust side cannot use it at the moment at least, @@ -258,7 +259,7 @@ def resolve_block(connection, at_block): # NOTE: this assumes the rust side to serialize starknet_blocks::timestamp as compatible # for blocks before 0.7.0 return ( - BlockInfo(block_number, block_time), + BlockInfo(block_number, block_time, DEFAULT_GAS_PRICE), global_root, ) except Exception: From 23d5c622fd76b72e266ff2b91fc73c3bc722440f Mon Sep 17 00:00:00 2001 From: Krisztian Kovacs Date: Tue, 5 Apr 2022 14:53:14 +0200 Subject: [PATCH 3/3] fix(py): upgrade cairo-lang to 0.8.1 --- py/requirements-dev.in | 2 +- py/requirements-dev.txt | 2 +- py/src/call.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/py/requirements-dev.in b/py/requirements-dev.in index 86c671958c..0d8fe8d66e 100644 --- a/py/requirements-dev.in +++ b/py/requirements-dev.in @@ -1,5 +1,5 @@ # see README.md -cairo-lang==0.8.0 +cairo-lang==0.8.1 # We don't use rlp directly, however this needs to be defined for it to help pip-compile eth-rlp==0.2.1 pip-tools==6.4.0 diff --git a/py/requirements-dev.txt b/py/requirements-dev.txt index 66194595aa..1b6660f588 100644 --- a/py/requirements-dev.txt +++ b/py/requirements-dev.txt @@ -25,7 +25,7 @@ black==21.12b0 # via -r requirements-dev.in cachetools==5.0.0 # via cairo-lang -cairo-lang==0.8.0 +cairo-lang==0.8.1 # via -r requirements-dev.in certifi==2021.10.8 # via requests diff --git a/py/src/call.py b/py/src/call.py index f523d581fe..bffcc44a97 100644 --- a/py/src/call.py +++ b/py/src/call.py @@ -46,7 +46,7 @@ def check_cairolang_version(): import pkg_resources version = pkg_resources.get_distribution("cairo-lang").version - return version == "0.8.0" + return version == "0.8.1" def do_loop(connection, input_gen, output_file):