Skip to content

Commit 8e26ecb

Browse files
enable spec shaking v2 by default
1 parent 857c058 commit 8e26ecb

File tree

6 files changed

+16
-30
lines changed

6 files changed

+16
-30
lines changed

.github/workflows/test-with-openzeppelin-stellar-contracts.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
fail-fast: false
3737
matrix:
3838
working-directory: ${{ fromJSON(needs.collect-crates.outputs.dirs) }}
39-
experimental_spec_shaking_v2: [true, false]
4039
defaults:
4140
run:
4241
working-directory: stellar-contracts/${{ matrix.working-directory }}
@@ -77,15 +76,6 @@ jobs:
7776
sed -i 's|'"$crate"' = { \(.*\)version = "[^"]*"\(.*\)|'"$crate"' = { \1path = "'"$rel_path"'" \2|g' Cargo.toml
7877
done
7978
80-
- name: Enable experimental_spec_shaking_v2 feature
81-
if: matrix.experimental_spec_shaking_v2
82-
working-directory: stellar-contracts
83-
run: |
84-
# Add feature to path-patched entries with existing features
85-
sed -i '/soroban-sdk = {.*path = /s|features = \[|features = ["experimental_spec_shaking_v2", |' Cargo.toml
86-
# Add features field to path-patched entries without features
87-
sed -i '/soroban-sdk = {.*path = /{/features/!s| }|, features = ["experimental_spec_shaking_v2"] }|}' Cargo.toml
88-
8979
- name: Diff
9080
run: (! git diff --exit-code) || (echo 'A diff is expected'; exit 1)
9181

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

10494
- name: Upload WASM artifacts
10595
if: steps.check-if-contract.outputs.is-a-contract == 'true'

.github/workflows/test-with-soroban-examples.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
fail-fast: false
4242
matrix:
4343
working-directory: ${{ fromJSON(needs.collect-examples.outputs.dirs) }}
44-
experimental_spec_shaking_v2: [true, false]
4544
defaults:
4645
run:
4746
working-directory: soroban-examples/${{ matrix.working-directory }}
@@ -93,17 +92,6 @@ jobs:
9392
done
9493
done
9594
96-
- name: Enable experimental_spec_shaking_v2 feature
97-
if: matrix.experimental_spec_shaking_v2
98-
working-directory: soroban-examples
99-
run: |
100-
find . -name Cargo.toml | while read -r file; do
101-
# Add feature to path-patched entries with existing features
102-
sed -i '/soroban-sdk = {.*path = /s|features = \[|features = ["experimental_spec_shaking_v2", |' "$file"
103-
# Add features field to path-patched entries without features
104-
sed -i '/soroban-sdk = {.*path = /{/features/!s| }|, features = ["experimental_spec_shaking_v2"] }|}' "$file"
105-
done
106-
10795
- name: Diff
10896
run: (! git diff --exit-code) || (echo 'A diff is expected'; exit 1)
10997

@@ -115,7 +103,7 @@ jobs:
115103

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

120108
- name: Upload WASM artifacts
121109
uses: actions/upload-artifact@v4

soroban-sdk/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ ark-bls12-381 = { version = "0.5", default-features = false, features = ["curve"
6464
ark-ff = { version = "0.5", default-features = false }
6565

6666
[features]
67+
default = ["experimental_spec_shaking_v2"]
6768
alloc = []
6869
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"]
6970
experimental_spec_shaking_v2 = ["soroban-sdk-macros/experimental_spec_shaking_v2"]

soroban-sdk/src/_features.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@
2626
//! [`Address::from_payload`][crate::Address::from_payload]) that are easy to
2727
//! misuse. Use with care.
2828
//!
29-
//! ## `experimental_spec_shaking_v2`
29+
//! ## `experimental_spec_shaking_v2` (default)
3030
//!
3131
//! Enables v2 spec shaking, an improved mechanism for controlling which type,
32-
//! event, and function definitions appear in a contract's spec.
32+
//! event, and function definitions appear in a contract's spec. This feature is
33+
//! enabled by default.
3334
//!
34-
//! ### Spec Shaking v1 (default, no feature flag)
35+
//! This feature is no longer experimental. It was previously introduced as an
36+
//! experimental opt-in feature and is now being rolled out as the default. The
37+
//! original feature name `experimental_spec_shaking_v2` is preserved for
38+
//! backwards compatibility. The feature is expected to be removed in v27, at
39+
//! which point spec shaking v2 will be always on.
40+
//!
41+
//! ### Spec Shaking v1 (disabled by default, use `default-features = false`)
3542
//!
3643
//! - Lib imports (via `contractimport!`): exported
3744
//! - Wasm imports (via `contractimport!`): not exported
@@ -40,7 +47,7 @@
4047
//! - All events: exported
4148
//! - All functions: exported
4249
//!
43-
//! ### Spec Shaking v2 (this feature)
50+
//! ### Spec Shaking v2 (default)
4451
//!
4552
//! - Everything exported (types, events, functions, imports)
4653
//! - Unused entries shaken out using dead code / spec elimination

tests/spec_shaking_v1/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
1212
doctest = false
1313

1414
[dependencies]
15-
soroban-sdk = {path = "../../soroban-sdk"}
15+
soroban-sdk = {path = "../../soroban-sdk", default-features = false}
1616
test_spec_lib = {path = "../spec_lib"}
1717

1818
[dev-dependencies]

tests/spec_shaking_v2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
1212
doctest = false
1313

1414
[dependencies]
15-
soroban-sdk = {path = "../../soroban-sdk", features = ["experimental_spec_shaking_v2"]}
15+
soroban-sdk = {path = "../../soroban-sdk"}
1616
test_spec_lib = {path = "../spec_lib"}
1717

1818
[dev-dependencies]

0 commit comments

Comments
 (0)