diff --git a/README.md b/README.md index d988bb33c..13e997679 100644 --- a/README.md +++ b/README.md @@ -644,6 +644,8 @@ poetry run pytest test/ # for a single file poetry run pytest test/:: # for a single test case ``` +In case of problems with `test_postman` test on Mac please see https://stackoverflow.com/a/52230415. + ### Development - Check versioning consistency ``` diff --git a/starknet_devnet/__init__.py b/starknet_devnet/__init__.py index 3e1b2cc3b..9f0e2eb87 100644 --- a/starknet_devnet/__init__.py +++ b/starknet_devnet/__init__.py @@ -2,13 +2,16 @@ Contains the server implementation and its utility classes and functions. """ import sys +from copy import copy from starkware.crypto.signature.fast_pedersen_hash import pedersen_hash +from starkware.starknet.services.api.contract_class import ContractClass from crypto_cpp_py.cpp_bindings import cpp_hash __version__ = "0.3.2" + def patched_pedersen_hash(left: int, right: int) -> int: """ Pedersen hash function written in c++ @@ -24,3 +27,14 @@ def patched_pedersen_hash(left: int, right: int) -> int: "pedersen_hash", patched_pedersen_hash, ) + + +# Deep copy of a ContractClass takes a lot of time, but it should never be mutated. +def simpler_copy(self, memo): # pylint: disable=unused-argument + """ + A dummy implementation of ContractClass.__deepcopy__ + """ + return copy(self) + + +setattr(ContractClass, "__deepcopy__", simpler_copy)