Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,21 @@ jobs:
- uses: namespacelabs/nscloud-cache-action@v1
with:
cache: rust
# CI always operates on the entire workspace
- run: cargo switcheroo disable
# Fail fast if a workspace crate is missing from every preset and from
# the exclusion list — prevents silent gaps in feature-powerset coverage.
- name: Check preset coverage
run: ./scripts/check_preset_coverage.sh
shell: bash
# Compose the set of crates we ship (excludes demo-rollup binary,
# benchmarks, soak-testing, and fuzzing to keep the feature-powerset
# search space manageable).
- name: Compose default-members for hack
run: |
cargo switcheroo set default
cargo switcheroo add zkvms
cargo switcheroo add ethereum
cargo switcheroo add celestia
cargo switcheroo add demo-stf
shell: bash
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
- name: cargo hack
Expand Down Expand Up @@ -225,8 +238,21 @@ jobs:
- uses: namespacelabs/nscloud-cache-action@v1
with:
cache: rust
# CI always operates on the entire workspace
- run: cargo switcheroo disable
# Fail fast if a workspace crate is missing from every preset and from
# the exclusion list — prevents silent gaps in feature-powerset coverage.
- name: Check preset coverage
run: ./scripts/check_preset_coverage.sh
shell: bash
# Compose the set of crates we ship (excludes demo-rollup binary,
# benchmarks, soak-testing, and fuzzing to keep the feature-powerset
# search space manageable).
- name: Compose default-members for hack
run: |
cargo switcheroo set default
cargo switcheroo add zkvms
cargo switcheroo add ethereum
cargo switcheroo add celestia
cargo switcheroo add demo-stf
shell: bash
- name: cargo hack
run: make check-features-default-targets
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ members = [
"crates/web3",
"python/py_sovereign_web3/rust"
, "crates/utils/sov-evm-test-utils"]
default-members = ["crates/rollup-interface", "crates/adapters/mock-da", "crates/adapters/mock-zkvm", "crates/full-node/sov-blob-sender", "crates/full-node/sov-db", "crates/full-node/sov-sequencer", "crates/full-node/sov-ledger-apis", "crates/full-node/sov-rollup-apis", "crates/full-node/sov-stf-runner", "crates/full-node/sov-metrics", "crates/full-node/sov-api-spec", "crates/full-node/full-node-configs", "crates/utils/sov-rest-utils", "crates/utils/nearly-linear", "crates/utils/sov-zkvm-utils", "crates/utils/sov-build", "crates/module-system/hyperlane", "crates/module-system/sov-cli", "crates/module-system/sov-modules-stf-blueprint", "crates/module-system/sov-modules-rollup-blueprint", "crates/module-system/sov-modules-macros", "crates/module-system/sov-kernels", "crates/module-system/sov-state", "crates/module-system/sov-modules-api", "crates/module-system/sov-address", "crates/utils/sov-test-utils", "crates/utils/sov-evm-test-utils", "crates/module-system/module-implementations/sov-accounts", "crates/module-system/module-implementations/sov-bank", "crates/module-system/module-implementations/sov-chain-state", "crates/module-system/module-implementations/sov-blob-storage", "crates/module-system/module-implementations/sov-evm", "crates/module-system/module-implementations/sov-paymaster", "crates/module-system/module-implementations/sov-prover-incentives", "crates/module-system/module-implementations/sov-attester-incentives", "crates/module-system/module-implementations/sov-sequencer-registry", "crates/module-system/module-implementations/sov-value-setter", "crates/module-system/module-implementations/sov-revenue-share", "crates/module-system/module-implementations/sov-synthetic-load", "crates/module-system/module-implementations/module-template", "crates/module-system/module-implementations/integration-tests", "crates/module-system/sov-capabilities", "crates/module-system/module-implementations/sov-uniqueness", "crates/utils/sov-node-client", "crates/universal-wallet/schema", "crates/universal-wallet/macros", "crates/universal-wallet/macro-helpers", "crates/utils/workspace-hack", "crates/web3", "python/py_sovereign_web3/rust", "crates/module-system/module-implementations/extern/hyperlane-solana-register"]
default-members = ["crates/rollup-interface", "crates/adapters/mock-da", "crates/adapters/mock-zkvm", "crates/full-node/sov-blob-sender", "crates/full-node/sov-db", "crates/full-node/sov-db-types", "crates/full-node/sov-sequencer", "crates/full-node/sov-ledger-apis", "crates/full-node/sov-rollup-apis", "crates/full-node/sov-stf-runner", "crates/full-node/sov-metrics", "crates/full-node/sov-api-spec", "crates/full-node/full-node-configs", "crates/utils/sov-rest-utils", "crates/utils/nearly-linear", "crates/utils/sov-zkvm-utils", "crates/utils/sov-build", "crates/utils/sov-proxy-utils", "crates/module-system/hyperlane", "crates/module-system/sov-cli", "crates/module-system/sov-modules-stf-blueprint", "crates/module-system/sov-modules-rollup-blueprint", "crates/module-system/sov-modules-macros", "crates/module-system/sov-kernels", "crates/module-system/sov-state", "crates/module-system/sov-modules-api", "crates/module-system/sov-address", "crates/module-system/sov-solana-offchain-auth", "crates/utils/sov-test-utils", "crates/utils/sov-evm-test-utils", "crates/module-system/module-implementations/sov-accounts", "crates/module-system/module-implementations/sov-bank", "crates/module-system/module-implementations/sov-chain-state", "crates/module-system/module-implementations/sov-blob-storage", "crates/module-system/module-implementations/sov-evm", "crates/module-system/module-implementations/sov-paymaster", "crates/module-system/module-implementations/sov-operator-incentives", "crates/module-system/module-implementations/sov-prover-incentives", "crates/module-system/module-implementations/sov-attester-incentives", "crates/module-system/module-implementations/sov-sequencer-registry", "crates/module-system/module-implementations/sb-session-registry", "crates/module-system/module-implementations/sb-blacklist", "crates/module-system/module-implementations/sov-value-setter", "crates/module-system/module-implementations/sov-revenue-share", "crates/module-system/module-implementations/sov-synthetic-load", "crates/module-system/module-implementations/sov-test-modules", "crates/module-system/module-implementations/sov-test-state-consistency", "crates/module-system/module-implementations/module-template", "crates/module-system/module-implementations/integration-tests", "crates/module-system/sov-capabilities", "crates/module-system/module-implementations/sov-uniqueness", "crates/utils/sov-node-client", "crates/universal-wallet/schema", "crates/universal-wallet/macros", "crates/universal-wallet/macro-helpers", "crates/utils/workspace-hack", "crates/web3", "python/py_sovereign_web3/rust", "crates/module-system/module-implementations/extern/hyperlane-solana-register"]
[workspace.package]
version = "0.3.0"
edition = "2021"
Expand Down
93 changes: 93 additions & 0 deletions scripts/check_preset_coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/usr/bin/env bash
# Drift guard for switcheroo presets.
#
# Asserts that every workspace member (per `cargo metadata`) is referenced by
# at least one preset under scripts/switcheroo/presets/ (excluding `_backup`)
# OR by the explicit exclusion list at scripts/switcheroo/excluded.json.
#
# Also asserts that no preset/excluded entry points at a path that is not a
# workspace member (catches typos like the stale `sov-soak-lib`).
#
# Fails with a non-zero exit code (and an actionable message) if either
# invariant is violated. Intended to run as a pre-flight step in the cargo-hack
# CI jobs so a newly added crate cannot be silently omitted from feature-
# powerset coverage.

set -euo pipefail

ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PRESETS_DIR="$ROOT/scripts/switcheroo/presets"
EXCLUDED_FILE="$ROOT/scripts/switcheroo/excluded.json"

if ! command -v jq >/dev/null 2>&1; then
echo "error: jq is required" >&2
exit 2
fi

# Workspace members (relative to workspace root, no trailing /Cargo.toml).
mapfile -t workspace_members < <(
cargo metadata --no-deps --format-version 1 --manifest-path "$ROOT/Cargo.toml" \
| jq -r --arg root "$ROOT" '
.packages[]
| .manifest_path
| sub("^" + $root + "/"; "")
| sub("/Cargo.toml$"; "")
' \
| sort -u
)

# Union of all preset entries (skip _backup.json — it is not a real preset).
mapfile -t covered < <(
for preset in "$PRESETS_DIR"/*.json; do
case "$(basename "$preset")" in
_*.json) continue ;;
esac
jq -r '.[]' "$preset"
done | sort -u
)

# Excluded entries (always allowlisted).
if [[ -f "$EXCLUDED_FILE" ]]; then
mapfile -t excluded < <(jq -r '.[]' "$EXCLUDED_FILE" | sort -u)
else
excluded=()
fi

accounted_for=$(printf '%s\n' "${covered[@]}" "${excluded[@]}" | sort -u)

# Violation 1: a workspace member that is neither covered nor excluded.
missing=$(comm -23 <(printf '%s\n' "${workspace_members[@]}") <(printf '%s\n' "$accounted_for"))

# Violation 2: a preset/excluded entry that does not correspond to a workspace
# member (stale path or typo).
stale_sources=$(printf '%s\n' "${covered[@]}" "${excluded[@]}" | sort -u)
stale=$(comm -23 <(printf '%s\n' "$stale_sources") <(printf '%s\n' "${workspace_members[@]}"))

status=0

if [[ -n "$missing" ]]; then
echo "error: workspace members not covered by any preset or excluded:" >&2
while IFS= read -r path; do
echo " - $path" >&2
done <<<"$missing"
echo >&2
echo "Add each to scripts/switcheroo/presets/<domain>.json, or to" >&2
echo "scripts/switcheroo/excluded.json if it should not be checked by hack." >&2
status=1
fi

if [[ -n "$stale" ]]; then
echo "error: preset or excluded.json entries reference non-existent workspace members:" >&2
while IFS= read -r path; do
echo " - $path" >&2
done <<<"$stale"
echo >&2
echo "Fix the typo, or remove the entry if the crate has been deleted." >&2
status=1
fi

if [[ $status -eq 0 ]]; then
echo "preset coverage: OK (${#workspace_members[@]} workspace members accounted for)"
fi

exit $status
10 changes: 10 additions & 0 deletions scripts/switcheroo/excluded.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
"scripts/switcheroo",
"crates/universal-wallet/fuzz",
"crates/utils/sov-evm-soak-testing",
"examples/demo-rollup/stf/demo-stf-json-client",
"examples/demo-rollup/sov-soak-testing",
"examples/demo-rollup/tests/prover/sov-aggregated-proof",
"examples/demo-rollup/provers/risc0",
"examples/demo-rollup/provers/sp1"
]
3 changes: 3 additions & 0 deletions scripts/switcheroo/presets/celestia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
"crates/adapters/celestia"
]
8 changes: 8 additions & 0 deletions scripts/switcheroo/presets/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"crates/adapters/mock-zkvm",
"crates/full-node/sov-blob-sender",
"crates/full-node/sov-db",
"crates/full-node/sov-db-types",
"crates/full-node/sov-sequencer",
"crates/full-node/sov-ledger-apis",
"crates/full-node/sov-rollup-apis",
Expand All @@ -15,6 +16,7 @@
"crates/utils/nearly-linear",
"crates/utils/sov-zkvm-utils",
"crates/utils/sov-build",
"crates/utils/sov-proxy-utils",
"crates/module-system/hyperlane",
"crates/module-system/sov-cli",
"crates/module-system/sov-modules-stf-blueprint",
Expand All @@ -24,6 +26,7 @@
"crates/module-system/sov-state",
"crates/module-system/sov-modules-api",
"crates/module-system/sov-address",
"crates/module-system/sov-solana-offchain-auth",
"crates/utils/sov-test-utils",
"crates/utils/sov-evm-test-utils",
"crates/module-system/module-implementations/sov-accounts",
Expand All @@ -32,12 +35,17 @@
"crates/module-system/module-implementations/sov-blob-storage",
"crates/module-system/module-implementations/sov-evm",
"crates/module-system/module-implementations/sov-paymaster",
"crates/module-system/module-implementations/sov-operator-incentives",
"crates/module-system/module-implementations/sov-prover-incentives",
"crates/module-system/module-implementations/sov-attester-incentives",
"crates/module-system/module-implementations/sov-sequencer-registry",
"crates/module-system/module-implementations/sb-session-registry",
"crates/module-system/module-implementations/sb-blacklist",
"crates/module-system/module-implementations/sov-value-setter",
"crates/module-system/module-implementations/sov-revenue-share",
"crates/module-system/module-implementations/sov-synthetic-load",
"crates/module-system/module-implementations/sov-test-modules",
"crates/module-system/module-implementations/sov-test-state-consistency",
"crates/module-system/module-implementations/module-template",
"crates/module-system/module-implementations/integration-tests",
"crates/module-system/sov-capabilities",
Expand Down
4 changes: 4 additions & 0 deletions scripts/switcheroo/presets/demo-stf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
"examples/demo-rollup/stf",
"examples/demo-rollup/stf/stf-declaration"
]
6 changes: 4 additions & 2 deletions scripts/switcheroo/presets/ethereum.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[
"crates/full-node/sov-ethereum",
"crates/full-node/sov-eth-dev-signer",
"crates/utils/sov-evm-soak-testing",
"crates/utils/sov-evm-test-utils",
"crates/full-node/sov-eth-dev-generator",
"crates/utils/sov-rpc-eth-types",
"crates/utils/sov-eth-client",
"crates/module-system/sov-eip712-auth",
"crates/module-system/module-implementations/sov-evm"
]
2 changes: 1 addition & 1 deletion scripts/switcheroo/presets/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"examples/demo-rollup/rest-api-load-testing",
"examples/demo-rollup/sov-benchmarks",
"examples/demo-simple-stf",
"crates/utils/sov-soak-lib"
"crates/utils/sov-soak-testing-lib"
]
8 changes: 8 additions & 0 deletions scripts/switcheroo/presets/members.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"crates/adapters/mock-zkvm",
"crates/full-node/sov-blob-sender",
"crates/full-node/sov-db",
"crates/full-node/sov-db-types",
"crates/full-node/sov-sequencer",
"crates/full-node/sov-ledger-apis",
"crates/full-node/sov-rollup-apis",
Expand All @@ -15,6 +16,7 @@
"crates/utils/nearly-linear",
"crates/utils/sov-zkvm-utils",
"crates/utils/sov-build",
"crates/utils/sov-proxy-utils",
"crates/module-system/hyperlane",
"crates/module-system/sov-cli",
"crates/module-system/sov-modules-stf-blueprint",
Expand All @@ -24,6 +26,7 @@
"crates/module-system/sov-state",
"crates/module-system/sov-modules-api",
"crates/module-system/sov-address",
"crates/module-system/sov-solana-offchain-auth",
"crates/utils/sov-test-utils",
"crates/utils/sov-evm-test-utils",
"crates/module-system/module-implementations/sov-accounts",
Expand All @@ -32,12 +35,17 @@
"crates/module-system/module-implementations/sov-blob-storage",
"crates/module-system/module-implementations/sov-evm",
"crates/module-system/module-implementations/sov-paymaster",
"crates/module-system/module-implementations/sov-operator-incentives",
"crates/module-system/module-implementations/sov-prover-incentives",
"crates/module-system/module-implementations/sov-attester-incentives",
"crates/module-system/module-implementations/sov-sequencer-registry",
"crates/module-system/module-implementations/sb-session-registry",
"crates/module-system/module-implementations/sb-blacklist",
"crates/module-system/module-implementations/sov-value-setter",
"crates/module-system/module-implementations/sov-revenue-share",
"crates/module-system/module-implementations/sov-synthetic-load",
"crates/module-system/module-implementations/sov-test-modules",
"crates/module-system/module-implementations/sov-test-state-consistency",
"crates/module-system/module-implementations/module-template",
"crates/module-system/module-implementations/integration-tests",
"crates/module-system/sov-capabilities",
Expand Down
Loading