Skip to content

Commit

Permalink
Allow cairo1BinDir with dockerized plugin (#408)
Browse files Browse the repository at this point in the history
* [skip testnet]
  • Loading branch information
FabijanC committed Sep 14, 2023
1 parent 6c12294 commit ad1a41d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,6 @@ extendEnvironment((hre) => {
hre.config.paths.cairoPaths || [],
hre
);

if (hre.config.starknet.cairo1BinDir) {
throw new StarknetPluginError(
`cairo1BinDir cannot be used with dockerized plugin.
Remove cairo1BinDir to use the default dockerized cairo1 compiler OR specify a local venv.`
);
}
}
});

Expand Down Expand Up @@ -232,8 +225,8 @@ task("starknet-compile", "Compiles Starknet (Cairo 1) contracts")
)
.addOptionalParam(
"cairo1BinDir",
"Allows to specify locally installed cairo1 compiler directory.\n" +
"e.g. --cairo1-bin-dir 'path/to/binDir' or can also be set on hardhat.config.ts file."
"Allows specifying your local cairo compiler target directory; also configurable via `cairo1BinDir` in hardhat.config.ts file.\n" +
"e.g. --cairo1-bin-dir 'path/to/cairo/target/release'"
)
.addFlag("replaceIds", "Replaces sierra ids with human-readable ones.")
.addOptionalParam(
Expand Down
2 changes: 1 addition & 1 deletion www/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $ npx hardhat starknet-compile [PATH...] [--add-pythonic-hints] [--single-file]

Compiles Starknet Cairo 1 contracts in the provided path. Paths can be files and directories. Currently, contracts importing other contracts are not supported (until this is supported, you may try to use [Scarb](https://github.com/software-mansion/scarb) and modifying its artifacts to be compatible with this plugin).

In [venv mode](#existing-virtual-environment), you can use a custom compiler by providing the path of the directory holding binaries to `--cairo1-bin-dir` or to the `cairo1BinDir` option in your config file. E.g. if your cairo compiler repository is in `/path/to/cairo` and you built the compiler with `cargo build --bin starknet-compile --bin starknet-sierra-compile --release`, the path should be `/path/to/cairo/target/release`.
Custom local compiler can be specified by providing the path of the directory holding compiler binaries (`starknet-compile` and `starknet-sierra-compile`) to `--cairo1-bin-dir` or to the `cairo1BinDir` option in your config file. E.g. if your cairo compiler repository is in `/path/to/cairo` and you built the compiler with `cargo build --bin starknet-compile --bin starknet-sierra-compile --release`, the path would be `/path/to/cairo/target/release`.

If neither `--cairo1-bin-dir` nor `cairo1BinDir` is set, the plugin will automatically download a compiler version it is adapted to. To download a specific version, set `compilerVersion` in `hardhat.config.ts` to a semver string matching one of the [official releases](https://github.com/starkware-libs/cairo/releases).

Expand Down

0 comments on commit ad1a41d

Please sign in to comment.