Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

failed to declare contract which is compiled by "Scarb" #11

Open
Ljiacheng opened this issue May 11, 2023 · 2 comments
Open

failed to declare contract which is compiled by "Scarb" #11

Ljiacheng opened this issue May 11, 2023 · 2 comments

Comments

@Ljiacheng
Copy link

Ljiacheng commented May 11, 2023

I build a contract which is compiled by Scarb. And I get a file named "hello_HelloStarknet.sierra.json" with command scarb --release build for example.
When I use command starknet declare --contract target/release/hello_HelloStarknet.sierra.json, I get this error:

scarb version:

scarb 0.2.0-alpha.2 (f9c07ce68 2023-05-05)
cairo: 1.0.0-rc0 (https://crates.io/crates/cairo-lang-compiler/1.0.0-rc0)

starknet version:

starknet 0.11.0.2
Sending the transaction with max_fee: 0.000001 ETH (1378300000000 WEI).
Got BadRequest while trying to access https://alpha4.starknet.io/gateway/add_transaction. Status code: 500; text: {"code": "StarknetErrorCode.COMPILATION_FAILED", "message": "Compilation failed. Error: Invalid Sierra program.\n"}.
Traceback (most recent call last):
  File "/home/ljc/cairo_venv_v11/lib/python3.9/site-packages/services/external_api/client.py", line 187, in _send_request
    return await self._parse_response(
  File "/home/ljc/cairo_venv_v11/lib/python3.9/site-packages/services/external_api/client.py", line 231, in _parse_response
    raise BadRequest(status_code=response.status, text=text)
services.external_api.client.BadRequest: HTTP error ocurred. Status: 500. Text: {"code": "StarknetErrorCode.COMPILATION_FAILED", "message": "Compilation failed. Error: Invalid Sierra program.\n"}
Error: BadRequest: HTTP error ocurred. Status: 500. Text: {"code": "StarknetErrorCode.COMPILATION_FAILED", "message": "Compilation failed. Error: Invalid Sierra program.\n"}
@Ljiacheng
Copy link
Author

By the way, with a file tree:

.
├── Scarb.toml
├── cairo_project.toml
└── src
    ├── hello_starknet.cairo
    ├── interface.cairo
    └── lib.cairo

I don't known how to build a [contract].json file with "starknet-compile"

@asoong
Copy link

asoong commented Jun 15, 2023

You can follow these steps to pull a more recent version of the cairo package which includes the compiler but use 1003d5d14c09191bbfb64ee318d1975584b3c819 instead of the documented commit sha.

Don't forget to apply the troubleshooting section as needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants