Skip to content

Commit c7d07cf

Browse files
authored
Add feature flag support for Rococo vs Polkadot (init) (#35)
* Add feature flag support for Rococo vs Polkadot (init) * Change wasm32-unknown-unknown to wasm32v1-none * Do we need experimental? * Nits
1 parent 4d62cca commit c7d07cf

File tree

15 files changed

+245
-65
lines changed

15 files changed

+245
-65
lines changed

.github/workflows/check.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
cache-all-crates: true
5252

5353
- name: Cargo check
54-
run: cargo check
54+
run: cargo check --workspace
5555

5656
check-benchmarking:
5757
name: Cargo check (benchmarking)
@@ -70,10 +70,13 @@ jobs:
7070
cache-on-failure: true
7171
cache-all-crates: true
7272

73-
- name: Cargo check (benchmarking)
74-
run: >
75-
cd node &&
76-
cargo check --features=runtime-benchmarks
73+
- name: Cargo check (Rococo) (benchmarking)
74+
run: |
75+
cargo check --workspace --features=rococo,runtime-benchmarks
76+
77+
#- name: Cargo check (Polkadot) (benchmarking)
78+
# run: |
79+
# cargo check --workspace --features=polkadot,runtime-benchmarks
7780

7881
test:
7982
name: Test
@@ -93,6 +96,17 @@ jobs:
9396
cache-on-failure: true
9497
cache-all-crates: true
9598

96-
# TODO: enable `--all-features`.
9799
- name: Run tests
98-
run: cargo test --workspace
100+
run: |
101+
cargo test --workspace
102+
cargo test --workspace --features=runtime-benchmarks
103+
104+
- name: Run (Rococo) runtime tests
105+
run: |
106+
cargo test -p polkadot-bulletin-chain-runtime --features=rococo
107+
cargo test -p polkadot-bulletin-chain-runtime --features=rococo,runtime-benchmarks
108+
109+
#- name: Run (Polkadot) runtime tests
110+
# run: |
111+
# cargo test -p polkadot-bulletin-chain-runtime --features=polkadot
112+
# cargo test -p polkadot-bulletin-chain-runtime --features=polkadot,runtime-benchmarks

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
- name: Install Rust
8585
run: |
8686
rustup update stable --no-self-update
87-
rustup target add wasm32-unknown-unknown
87+
rustup target add wasm32v1-none
8888
8989
- name: Install linux dependencies
9090
if: (matrix.os == '' || startsWith(matrix.os, 'ubuntu'))

Cargo.lock

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ repository = "https://github.com/zdave-parity/polkadot-bulletin-chain.git"
55

66
[workspace.dependencies]
77
array-bytes = { version = "6.1" }
8+
cfg-if = { version = "1.0" }
89
clap = { version = "4.2.5" }
910
codec = { package = "parity-scale-codec", version = "3.7.5", default-features = false }
1011
futures = { version = "0.3.21" }
@@ -15,8 +16,8 @@ scale-info = { version = "2.11.6", default-features = false }
1516
serde = { version = "1.0.126" }
1617
serde_json = { version = "1.0.132", default-features = false }
1718
static_assertions = { version = "1.1" }
18-
try-runtime-cli = { version = "0.42" }
1919
tracing = { version = "0.1.41", default-features = false }
20+
try-runtime-cli = { version = "0.42" }
2021

2122
[workspace]
2223
resolver = "2"
@@ -29,4 +30,6 @@ members = [
2930
"runtime",
3031
]
3132
[profile.release]
33+
# Polkadot runtime requires unwinding.
34+
opt-level = 3
3235
panic = "unwind"

node/Cargo.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ try-runtime-cli = { optional = true, workspace = true }
6767
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
6868

6969
[features]
70-
default = []
70+
default = [
71+
# TODO: temporary let's activate rococo by default
72+
"rococo",
73+
]
7174
# Dependencies that are only required if runtime benchmarking should be built.
7275
runtime-benchmarks = [
7376
"frame-benchmarking-cli/runtime-benchmarks",
@@ -83,7 +86,9 @@ try-runtime = [
8386
"frame-system/try-runtime",
8487
"polkadot-bulletin-chain-runtime/try-runtime",
8588
"sp-runtime/try-runtime",
86-
"try-runtime-cli?/try-runtime",
89+
"try-runtime-cli/try-runtime",
8790
]
88-
# To bridge with Rococo Bridge Hub instead of Polkadot Bridge Hub
91+
# To bridge with Rococo Bridge Hub
8992
rococo = ["polkadot-bulletin-chain-runtime/rococo"]
93+
# To bridge with PeoplePolkadot
94+
polkadot = ["polkadot-bulletin-chain-runtime/polkadot"]

pallets/common/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ codec = { workspace = true }
1515
scale-info = { features = ["derive"], workspace = true }
1616

1717
polkadot-sdk-frame = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", default-features = false, features = [
18-
"experimental",
1918
"runtime",
2019
] }
2120

pallets/relayer-set/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ log = { workspace = true, default-features = true }
1515
scale-info = { features = ["derive"], workspace = true }
1616

1717
polkadot-sdk-frame = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", default-features = false, features = [
18-
"experimental",
1918
"runtime",
2019
] }
2120

pallets/transaction-storage/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ log = { workspace = true, default-features = true }
1919
scale-info = { features = ["derive"], workspace = true }
2020

2121
polkadot-sdk-frame = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", default-features = false, features = [
22-
"experimental",
2322
"runtime",
2423
] }
2524
sp-transaction-storage-proof = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", default-features = false }

pallets/validator-set/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ log = { workspace = true, default-features = true }
1111
scale-info = { features = ["derive"], workspace = true }
1212

1313
polkadot-sdk-frame = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", default-features = false, features = [
14-
"experimental",
1514
"runtime",
1615
] }
1716
sp-staking = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", default-features = false }

runtime/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ repository = "https://github.com/paritytech/polkadot-bulletin-chain/"
1212
targets = ["x86_64-unknown-linux-gnu"]
1313

1414
[dependencies]
15+
cfg-if = { workspace = true }
1516
codec = { workspace = true, features = ["derive"] }
1617
log = { workspace = true }
1718
scale-info = { features = ["derive"], workspace = true }
@@ -80,11 +81,12 @@ xcm = { default-features = false, git = "https://github.com/paritytech/polkadot-
8081
xcm-builder = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", package = "staging-xcm-builder" }
8182
xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", package = "staging-xcm-executor" }
8283

83-
# TODO: just to pass `--features runtime-benchmarks`
84+
# TODO: just to pass `--features runtime-benchmarks` or `--features try-runtime`
8485
pallet-xcm = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
8586
pallet-staking = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
8687
sp-staking = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
8788
parachains-common = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
89+
pallet-revive = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602" }
8890

8991
[build-dependencies]
9092
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk.git", rev = "db5e645422ccf952018a3c466a33fef477858602", optional = true }
@@ -163,6 +165,7 @@ std = [
163165
"xcm/std",
164166

165167
"pallet-bridge-relayers/std",
168+
"pallet-revive?/std",
166169
"pallet-staking?/std",
167170
"pallet-xcm?/std",
168171
"parachains-common?/std",
@@ -202,6 +205,7 @@ runtime-benchmarks = [
202205
"xcm-executor/runtime-benchmarks",
203206
"xcm/runtime-benchmarks",
204207

208+
"pallet-revive?/runtime-benchmarks",
205209
"pallet-staking/runtime-benchmarks",
206210
"pallet-xcm/runtime-benchmarks",
207211
"parachains-common/runtime-benchmarks",
@@ -227,7 +231,8 @@ try-runtime = [
227231

228232
"pallet-bridge-relayers/try-runtime",
229233
"pallet-relayer-set/try-runtime",
230-
"pallet-staking?/try-runtime",
234+
"pallet-revive/try-runtime",
235+
"pallet-staking/try-runtime",
231236
"pallet-transaction-payment/try-runtime",
232237
"pallet-transaction-storage/try-runtime",
233238
"pallet-validator-set/try-runtime",
@@ -237,3 +242,4 @@ try-runtime = [
237242
"sp-runtime/try-runtime",
238243
]
239244
rococo = []
245+
polkadot = []

0 commit comments

Comments
 (0)