Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

0.11.1 adaptations #472

Merged
merged 32 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ba50ba7
0.11.1a0 adoption
mikiw May 10, 2023
ca2a2e2
Fix linter and test errors
mikiw May 10, 2023
e04a744
some fixes
mikiw May 11, 2023
9741533
Update starknet_wrapper.py
mikiw May 11, 2023
cea41f2
Update test_general_workflow.py
mikiw May 11, 2023
1580936
some hash fixes
mikiw May 11, 2023
a9047c4
Merge branch 'master' into adapt-0.11.1
mikiw May 12, 2023
230254e
Fix get events
mikiw May 15, 2023
6b4f8fe
more hash fixes
mikiw May 15, 2023
df6eb5e
Update invoke_receipt_account_event.json
mikiw May 15, 2023
cbb3ede
Update postman_wrapper.py
mikiw May 16, 2023
0b8548a
update to 0.11.1
mikiw May 16, 2023
b570f65
update to 0.11.1.1
mikiw May 17, 2023
bf6e861
Update cairo_rs_py_patch.py
mikiw May 17, 2023
7430e74
format & isort .
mikiw May 17, 2023
7e27b90
gas fix
mikiw May 17, 2023
3541f65
some hash fixes
mikiw May 17, 2023
89aa891
some hash fixes
mikiw May 17, 2023
498a97c
hash fix
mikiw May 17, 2023
11d4957
some hash fixes
mikiw May 17, 2023
243c715
forke mode fix
mikiw May 17, 2023
e8b5e31
Update forked_state.py
mikiw May 17, 2023
ea8ff79
Update cairo_rs_py_patch.py
mikiw May 18, 2023
b6aec3b
fix hash and test on ci/cd
mikiw May 18, 2023
f488670
Update test_fork_feeder_gateway.py
mikiw May 18, 2023
63d0be6
Merge branch 'master' into adapt-0.11.1
mikiw May 18, 2023
c57cf67
Update poetry.lock
mikiw May 18, 2023
bbb8be7
Update run.md
mikiw May 18, 2023
9b93063
add DUMMY_PENDING_BLOCK_HASH
mikiw May 18, 2023
717ae05
Merge branch 'master' into adapt-0.11.1
mikiw May 19, 2023
8ea1e7c
Merge branch 'master' into adapt-0.11.1
FabijanC May 19, 2023
bd09abb
Merge branch 'master' into adapt-0.11.1
FabijanC May 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = ["starknet", "cairo", "testnet", "local", "server"]
python = ">=3.9,<3.10"
Flask = {extras = ["async"], version = "~2.0.3"}
flask-cors = "~3.0.10"
cairo-lang = "0.11.0.2"
cairo-lang = "0.11.1.1"
Werkzeug = "~2.0.3"
cloudpickle = "~2.1.0"
crypto-cpp-py = "~1.3.0"
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_dev_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi
if [ -z "$CAIRO_1_COMPILER_MANIFEST" ]; then
mkdir cairo-compiler
git clone [email protected]:starkware-libs/cairo.git cairo-compiler \
--branch v1.0.0-alpha.6 \
--branch v1.0.0-rc0 \
--single-branch
CAIRO_1_COMPILER_MANIFEST="cairo-compiler/Cargo.toml"

Expand Down
4 changes: 3 additions & 1 deletion starknet_devnet/cairo_rs_py_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@
get_deprecated_contract_class_struct,
load_program,
)
from starkware.starknet.core.os.deprecated_syscall_handler import (
DeprecatedBlSyscallHandler,
)
from starkware.starknet.core.os.syscall_handler import (
BusinessLogicSyscallHandler,
DeprecatedBlSyscallHandler,
SyscallHandlerBase,
)
from starkware.starknet.definitions.error_codes import StarknetErrorCode
Expand Down
4 changes: 2 additions & 2 deletions starknet_devnet/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

DEFAULT_ACCOUNTS = 10
DEFAULT_INITIAL_BALANCE = 10**21
DEFAULT_GAS_PRICE = 10**11
FabijanC marked this conversation as resolved.
Show resolved Hide resolved
DEFAULT_GAS_PRICE = 10**8

SUPPORTED_TX_VERSION = 1
SUPPORTED_RPC_TX_VERSION = 1
Expand All @@ -28,7 +28,7 @@
# poetry run python scripts/compute_compiled_class_hash.py \
# ~/.cache/pypoetry/virtualenvs/<YOUR_VENV>/lib/python3.9/site-packages/starkware/starknet/third_party/open_zeppelin/account.json
STARKNET_CLI_ACCOUNT_CLASS_HASH = (
0x6EA5324F5D3F919A7FF007ACFAD6C421D724CF0CBCF0F6105945565518A572
0x1D28D8D8874CEA14193F70EDCDF501F9AE137BE2A41E258A29CBD05558D8EB6
)

# starkware.starknet.public.abi.get_selector_from_name("replace_class")
Expand Down
2 changes: 1 addition & 1 deletion starknet_devnet/forked_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def get_forked_starknet(
gas_price=gas_price,
),
state_reader=state_reader,
contract_class_cache={},
compiled_class_cache={},
),
general_config=build_devnet_general_config(chain_id),
)
Expand Down
2 changes: 0 additions & 2 deletions starknet_devnet/general_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
build_general_config,
)

from .constants import SUPPORTED_TX_VERSION
from .fee_token import FeeToken


Expand All @@ -34,7 +33,6 @@ def build_devnet_general_config(chain_id: StarknetChainId):
"chain_id": chain_id.value,
"fee_token_address": hex(FeeToken.ADDRESS),
},
"tx_version": SUPPORTED_TX_VERSION,
FabijanC marked this conversation as resolved.
Show resolved Hide resolved
"tx_commitment_tree_height": constants.TRANSACTION_COMMITMENT_TREE_HEIGHT,
"validate_max_n_steps": DEFAULT_VALIDATE_MAX_STEPS,
}
Expand Down
2 changes: 0 additions & 2 deletions starknet_devnet/postman_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import Tuple

from starkware.eth.eth_test_utils import EthAccount, EthContract
from starkware.eth.web3_wrapper import web3_contract_create_filter_fix
from starkware.solidity.utils import load_nearby_contract
from starkware.starknet.business_logic.transaction.objects import InternalL1Handler
from starkware.starknet.definitions.error_codes import StarknetErrorCode
Expand Down Expand Up @@ -199,7 +198,6 @@ def __init__(

# Create a filter to collect LogMessageToL2 events.
w3_contract = self.mock_starknet_messaging_contract.w3_contract
web3_contract_create_filter_fix(w3_contract.events.LogMessageToL2)
FabijanC marked this conversation as resolved.
Show resolved Hide resolved
self.message_to_l2_filter = w3_contract.events.LogMessageToL2.create_filter(
fromBlock=LATEST_BLOCK_ID
)
Expand Down
3 changes: 1 addition & 2 deletions starknet_devnet/predeployed_contract_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def deploy(self):
starknet: Starknet = self.starknet_wrapper.starknet

# declare
starknet.state.state.contract_classes[self.class_hash] = self.contract_class
starknet.state.state.compiled_classes[self.class_hash] = self.contract_class

# pylint: disable=protected-access
self.starknet_wrapper._contract_classes[self.class_hash] = self.contract_class
Expand All @@ -51,5 +51,4 @@ async def deploy(self):
state=starknet.state,
abi=self.contract_class.abi,
contract_address=self.address,
deploy_call_info=None,
)
6 changes: 3 additions & 3 deletions starknet_devnet/starknet_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ async def update_pending_state( # pylint: disable=too-many-arguments
)

return BlockStateUpdate(
block_hash=None,
block_hash=0,
FabijanC marked this conversation as resolved.
Show resolved Hide resolved
new_root=DUMMY_STATE_ROOT,
old_root=DUMMY_STATE_ROOT,
state_diff=state_diff,
Expand Down Expand Up @@ -400,7 +400,7 @@ async def declare(
compiled_class = external_tx.contract_class
tx_handler.explicitly_declared_old.append(class_hash)

state.state.contract_classes[compiled_class_hash] = compiled_class
state.state.compiled_classes[compiled_class_hash] = compiled_class
self._contract_classes[class_hash] = external_tx.contract_class

return class_hash, tx_handler.internal_tx.hash_value
Expand Down Expand Up @@ -932,7 +932,7 @@ async def get_nonce(
async def __predeclare_starknet_cli_account(self):
"""Predeclares the account class used by Starknet CLI"""
state = self.get_state().state
state.contract_classes[STARKNET_CLI_ACCOUNT_CLASS_HASH] = oz_account_class
state.compiled_classes[STARKNET_CLI_ACCOUNT_CLASS_HASH] = oz_account_class

async def __deploy_chargeable_account(self):
if await self.is_deployed(ChargeableAccount.ADDRESS):
Expand Down
4 changes: 2 additions & 2 deletions test/expected/deploy_function_invocation.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"0x5"
],
"caller_address": "0x0",
"class_hash": "0x2216379233d6f7c8890a730e164e069dafdd63edf0f0218dde8181b50fabd45",
"contract_address": "0x7f50463b43a30d3a60c004ab70bbf70f8ea2d16dbf802c952e94c8ef18646b2",
"class_hash": "0x4dd892c3bbcdbe25b6a4c77adb8363bfc02176c231f70f086970610bee84539",
"contract_address": "0x7c81e7744ed1745985c0d5947cf6c261a3d9fc95c309887649a975edd019945",
"entry_point_type": "CONSTRUCTOR",
"events": [],
"execution_resources": {
Expand Down
6 changes: 3 additions & 3 deletions test/expected/invoke_function_invocation.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"events": [],
"calldata": [
"0x1",
"0x7f50463b43a30d3a60c004ab70bbf70f8ea2d16dbf802c952e94c8ef18646b2",
"0x7c81e7744ed1745985c0d5947cf6c261a3d9fc95c309887649a975edd019945",
"0x362398bec32bc0ebb411203221a35a0301193a96f317ebe5e40be9f60d15320",
"0x0",
"0x2",
Expand All @@ -34,7 +34,7 @@
},
"messages": [],
"call_type": "CALL",
"class_hash": "0x2216379233d6f7c8890a730e164e069dafdd63edf0f0218dde8181b50fabd45",
"class_hash": "0x4dd892c3bbcdbe25b6a4c77adb8363bfc02176c231f70f086970610bee84539",
"result": [],
"events": [],
"calldata": [
Expand All @@ -44,7 +44,7 @@
"caller_address": "0x347be35996a21f6bf0623e75dbce52baba918ad5ae8d83b6f416045ab22961a",
"entry_point_type": "EXTERNAL",
"selector": "0x362398bec32bc0ebb411203221a35a0301193a96f317ebe5e40be9f60d15320",
"contract_address": "0x7f50463b43a30d3a60c004ab70bbf70f8ea2d16dbf802c952e94c8ef18646b2",
"contract_address": "0x7c81e7744ed1745985c0d5947cf6c261a3d9fc95c309887649a975edd019945",
"internal_calls": []
}
]
Expand Down
4 changes: 2 additions & 2 deletions test/expected/invoke_receipt_account_event.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"0x0",
"0xa"
],
"from_address": "0x6c9b52d3297d731eaea82dbfa4d20424855d498b8594b9442a1d4d5d995a5bd",
"from_address": "0x2d3c5f33198cf54a030e316ab2d9532e1c401d3c5a8b8a3962aeda6c1dcd260",
"keys": [
"0x3db3da4221c078e78bd987e54e1cc24570d89a7002cefa33e548d6c72c73f9d"
]
},
{
"data": [
"0x347be35996a21f6bf0623e75dbce52baba918ad5ae8d83b6f416045ab22961a",
"0xbebe7dec64b911aeffecc184afcefa6470e3b3652a1605e42d643e1ea9093d",
"0x4035e7e01f09b8bc746a549fdf1bafa8d975bdbc53d25646635d0ab58425f30",
"0x569ced8800",
"0x0"
],
Expand Down
6 changes: 3 additions & 3 deletions test/rpc/test_data/get_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ def parse_block_delimiter_parameter(


EVENT_FEE_ADDRESS = rpc_felt(
0xBEBE7DEC64B911AEFFECC184AFCEFA6470E3B3652A1605E42D643E1EA9093D
0x04035E7E01F09B8BC746A549FDF1BAFA8D975BDBC53D25646635D0AB58425F30
)
INVOKE_1_FEE_CHARGING_EVENT = [
rpc_felt(int(PREDEPLOYED_ACCOUNT_ADDRESS, 16)),
EVENT_FEE_ADDRESS,
rpc_felt(0x73B00ED0C000), # WEI
rpc_felt(0x01D9DB5F800), # WEI
rpc_felt(0),
]
INVOKE_2_FEE_CHARGING_EVENT = [
rpc_felt(int(PREDEPLOYED_ACCOUNT_ADDRESS, 16)),
EVENT_FEE_ADDRESS,
rpc_felt(0x015254FFDB4000), # WEI
rpc_felt(0x0569CED8800), # WEI
rpc_felt(0),
]

Expand Down
4 changes: 2 additions & 2 deletions test/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
)

EXPECTED_CLASS_HASH = (
"0x2216379233d6f7c8890a730e164e069dafdd63edf0f0218dde8181b50fabd45"
"0x4dd892c3bbcdbe25b6a4c77adb8363bfc02176c231f70f086970610bee84539"
)
# hash of contract at CONTRACT_1_PATH
EXPECTED_CLASS_1_HASH = (
"0x7c93b555d40b18537ae7107aaa26dce3f8658337f5be3f563955fd24b623fec"
"0x21c6a99e1947cd3526da50ed29f66e46a41c8e9e31761326739c6f3f9c2c5f7"
)

NONEXISTENT_TX_HASH = "0x99"
Expand Down
4 changes: 2 additions & 2 deletions test/test_fork_feeder_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@

DEPLOYMENT_INPUT = "10"
EXPECTED_DEPLOYMENT_ADDRESS = (
"0x03f37e0679b8c295373f6452c5c68c2de5ee661b77e02af5fe1a416ce9be93f7"
"0x1377433bcc53c639d2203c164d2004ba2522c59f902eab2662199a2c78b8e3f"
)
EXPECTED_INVOKE_HASH = (
"0x54dd317f451041c1d4f138538ee665bff505dbeeec575902122014b60d0ce06"
"0x26f966f10eb28d442650fb6f3829d3d9298812e00ef60583a496ece0bb45082"
)


Expand Down
2 changes: 1 addition & 1 deletion test/test_general_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_salty_deploy():
"""Test deploying with salt"""

expected_address = (
"0x6c9b52d3297d731eaea82dbfa4d20424855d498b8594b9442a1d4d5d995a5bd"
"0x2d3c5f33198cf54a030e316ab2d9532e1c401d3c5a8b8a3962aeda6c1dcd260"
)
contract_path = EVENTS_CONTRACT_PATH
inputs = None
Expand Down