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

Commit

Permalink
Improve default cairo1 compiler error (#465)
Browse files Browse the repository at this point in the history
* test.sh: Increase maxprocesses from 8 to 10 [skip ci]
  • Loading branch information
FabijanC authored May 10, 2023
1 parent c7ddd4c commit c2842f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ set -eu

# Using dist=loadfile because currently some tests might have certain collisions
# namely dump tests which do a clean up and potentially remove dumps created by other tests
CMD="poetry run pytest --numprocesses=auto --maxprocesses=8 --dist=loadfile -vv ${1:-test/}"
CMD="poetry run pytest --numprocesses=auto --maxprocesses=10 --dist=loadfile -vv ${1:-test/}"
echo $CMD
$CMD
21 changes: 17 additions & 4 deletions starknet_devnet/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from starkware.starknet.services.api.contract_class.contract_class_utils import (
compile_contract_class,
)
from starkware.starkware_utils.error_handling import StarkException

from starknet_devnet.util import StarknetDevnetException

Expand All @@ -30,10 +31,22 @@ class DefaultContractClassCompiler(ContractClassCompiler):
"""Uses the default internal cairo-lang compiler"""

def compile_contract_class(self, contract_class: ContractClass) -> CompiledClass:
return compile_contract_class(
contract_class,
compiler_args="--add-pythonic-hints --allowed-libfuncs-list-name experimental_v0.1.0",
)
custom_err_msg = "\nFailed compilation from Sierra to Casm! Read more about starting Devnet with --cairo-compiler-manifest"

try:
return compile_contract_class(
contract_class,
compiler_args="--add-pythonic-hints --allowed-libfuncs-list-name experimental_v0.1.0",
)
except PermissionError as permission_error:
raise StarknetDevnetException(
code=StarknetErrorCode.COMPILATION_FAILED, message=custom_err_msg
) from permission_error
except StarkException as stark_exception:
raise StarknetDevnetException(
code=stark_exception.code,
message=stark_exception.message + custom_err_msg,
) from stark_exception


class CustomContractClassCompiler(ContractClassCompiler):
Expand Down

0 comments on commit c2842f3

Please sign in to comment.