Summary
In a workspace containing both executable targets and starknet-contract targets, it's impossible to compile executables because the [cairo] enable-gas setting cannot be configured per-package.
Current Behavior
When a workspace contains:
- A package with executable targets (requires
enable-gas = false)
- A package with starknet-contract targets (requires
enable-gas = true)
Running scarb execute on the executable fails with:
error: executable target cannot be compiled with enabled gas calculation
The warning message confirms the limitation:
warn: in context of a workspace, only the `cairo` set in the workspace manifest is applied,
but the `falcon` package also defines `cairo` in the manifest
Reproduction
Workspace Scarb.toml:
[workspace]
members = ["packages/*"]
Package A (packages/falcon/Scarb.toml) with executable:
[package]
name = "falcon"
version = "0.1.0"
edition = "2024_07"
[cairo]
enable-gas = false
[[target.executable]]
name = "bench_ntt_bounded_int"
function = "falcon::programs::bench_ntt_bounded_int::main"
sierra = true
Package B (packages/test-contract/Scarb.toml) with contract:
[package]
name = "test_contract"
version = "0.1.0"
edition = "2024_07"
[[target.starknet-contract]]
sierra = true
casm = true
[dependencies]
falcon = { path = "../falcon" }
Running:
scarb execute --executable-name bench_ntt_bounded_int --package falcon
Fails because the package-level enable-gas = false is ignored.
Expected Behavior
One of:
- Per-package
[cairo] settings should be respected in workspaces
- Or
enable-gas could be configurable per-target type (executables vs contracts)
- Or at minimum,
--package flag should use that package's [cairo] settings
Environment
- scarb version: 2.15.1
- OS: Linux
Workaround
Currently the only workaround is to move the executable package outside the workspace, which breaks the dependency relationship.
Summary
In a workspace containing both executable targets and starknet-contract targets, it's impossible to compile executables because the
[cairo]enable-gassetting cannot be configured per-package.Current Behavior
When a workspace contains:
enable-gas = false)enable-gas = true)Running
scarb executeon the executable fails with:The warning message confirms the limitation:
Reproduction
Workspace
Scarb.toml:Package A (
packages/falcon/Scarb.toml) with executable:Package B (
packages/test-contract/Scarb.toml) with contract:Running:
Fails because the package-level
enable-gas = falseis ignored.Expected Behavior
One of:
[cairo]settings should be respected in workspacesenable-gascould be configurable per-target type (executables vs contracts)--packageflag should use that package's[cairo]settingsEnvironment
Workaround
Currently the only workaround is to move the executable package outside the workspace, which breaks the dependency relationship.