Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 1 addition & 11 deletions .github/workflows/test-with-openzeppelin-stellar-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
fail-fast: false
matrix:
working-directory: ${{ fromJSON(needs.collect-crates.outputs.dirs) }}
experimental_spec_shaking_v2: [true, false]
defaults:
run:
working-directory: stellar-contracts/${{ matrix.working-directory }}
Expand Down Expand Up @@ -77,15 +76,6 @@ jobs:
sed -i 's|'"$crate"' = { \(.*\)version = "[^"]*"\(.*\)|'"$crate"' = { \1path = "'"$rel_path"'" \2|g' Cargo.toml
done

- name: Enable experimental_spec_shaking_v2 feature
if: matrix.experimental_spec_shaking_v2
working-directory: stellar-contracts
run: |
# Add feature to path-patched entries with existing features
sed -i '/soroban-sdk = {.*path = /s|features = \[|features = ["experimental_spec_shaking_v2", |' Cargo.toml
# Add features field to path-patched entries without features
sed -i '/soroban-sdk = {.*path = /{/features/!s| }|, features = ["experimental_spec_shaking_v2"] }|}' Cargo.toml

- name: Diff
run: (! git diff --exit-code) || (echo 'A diff is expected'; exit 1)

Expand All @@ -99,7 +89,7 @@ jobs:
- name: Set artifact name
if: steps.check-if-contract.outputs.is-a-contract == 'true'
id: artifact-name
run: echo "name=wasm-$(echo ${{ matrix.working-directory }} | sed 's/\//-/g')${{ matrix.experimental_spec_shaking_v2 && '-spec-shaking-v2' || '' }}" | tee -a $GITHUB_OUTPUT
run: echo "name=wasm-$(echo ${{ matrix.working-directory }} | sed 's/\//-/g')" | tee -a $GITHUB_OUTPUT

- name: Upload WASM artifacts
if: steps.check-if-contract.outputs.is-a-contract == 'true'
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/test-with-soroban-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
fail-fast: false
matrix:
working-directory: ${{ fromJSON(needs.collect-examples.outputs.dirs) }}
experimental_spec_shaking_v2: [true, false]
defaults:
run:
working-directory: soroban-examples/${{ matrix.working-directory }}
Expand Down Expand Up @@ -93,17 +92,6 @@ jobs:
done
done

- name: Enable experimental_spec_shaking_v2 feature
if: matrix.experimental_spec_shaking_v2
working-directory: soroban-examples
run: |
find . -name Cargo.toml | while read -r file; do
# Add feature to path-patched entries with existing features
sed -i '/soroban-sdk = {.*path = /s|features = \[|features = ["experimental_spec_shaking_v2", |' "$file"
# Add features field to path-patched entries without features
sed -i '/soroban-sdk = {.*path = /{/features/!s| }|, features = ["experimental_spec_shaking_v2"] }|}' "$file"
done

- name: Diff
run: (! git diff --exit-code) || (echo 'A diff is expected'; exit 1)

Expand All @@ -115,7 +103,7 @@ jobs:

- name: Set artifact name
id: artifact-name
run: echo "name=wasm-$(echo ${{ matrix.working-directory }} | sed 's/\//-/g')${{ matrix.experimental_spec_shaking_v2 && '-spec-shaking-v2' || '' }}" | tee -a $GITHUB_OUTPUT
run: echo "name=wasm-$(echo ${{ matrix.working-directory }} | sed 's/\//-/g')" | tee -a $GITHUB_OUTPUT

- name: Upload WASM artifacts
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions soroban-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ark-bls12-381 = { version = "0.5", default-features = false, features = ["curve"
ark-ff = { version = "0.5", default-features = false }

[features]
default = ["experimental_spec_shaking_v2"]
alloc = []
testutils = ["soroban-sdk-macros/testutils", "soroban-env-host/testutils", "soroban-ledger-snapshot/testutils", "dep:ed25519-dalek", "dep:arbitrary", "dep:derive_arbitrary", "dep:ctor", "dep:soroban-ledger-snapshot"]
experimental_spec_shaking_v2 = ["soroban-sdk-macros/experimental_spec_shaking_v2"]
Expand Down
15 changes: 11 additions & 4 deletions soroban-sdk/src/_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@
//! [`Address::from_payload`][crate::Address::from_payload]) that are easy to
//! misuse. Use with care.
//!
//! ## `experimental_spec_shaking_v2`
//! ## `experimental_spec_shaking_v2` (default)
//!
//! Enables v2 spec shaking, an improved mechanism for controlling which type,
//! event, and function definitions appear in a contract's spec.
//! event, and function definitions appear in a contract's spec. This feature is
//! enabled by default.
//!
//! ### Spec Shaking v1 (default, no feature flag)
//! This feature is no longer experimental. It was previously introduced as an
//! experimental opt-in feature and is now being rolled out as the default. The
//! original feature name `experimental_spec_shaking_v2` is preserved for
//! backwards compatibility. The feature is expected to be removed in v27, at
//! which point spec shaking v2 will be always on.
//!
//! ### Spec Shaking v1 (disabled by default, use `default-features = false`)
//!
//! - Lib imports (via `contractimport!`): exported
//! - Wasm imports (via `contractimport!`): not exported
Expand All @@ -40,7 +47,7 @@
//! - All events: exported
//! - All functions: exported
//!
//! ### Spec Shaking v2 (this feature)
//! ### Spec Shaking v2 (default)
//!
//! - Everything exported (types, events, functions, imports)
//! - Unused entries shaken out using dead code / spec elimination
Expand Down
2 changes: 1 addition & 1 deletion tests/spec_shaking_v1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]
doctest = false

[dependencies]
soroban-sdk = {path = "../../soroban-sdk"}
soroban-sdk = {path = "../../soroban-sdk", default-features = false}
test_spec_lib = {path = "../spec_lib"}

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion tests/spec_shaking_v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]
doctest = false

[dependencies]
soroban-sdk = {path = "../../soroban-sdk", features = ["experimental_spec_shaking_v2"]}
soroban-sdk = {path = "../../soroban-sdk"}
test_spec_lib = {path = "../spec_lib"}

[dev-dependencies]
Expand Down
Loading