Skip to content

Commit 8b76e10

Browse files
author
José Molina Colmenero
authored
Merge pull request #274 from paritytech/refactor/restore-ledger-support
Revert "Merge pull request #268 from paritytech/revert/ledger-support"
2 parents 30785be + a64b8df commit 8b76e10

File tree

11 files changed

+79
-37
lines changed

11 files changed

+79
-37
lines changed

.github/workflows/build-deterministic-runtime.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
- name: Build ${{ matrix.runtime }} runtime
3333
id: srtool_build
3434
uses: chevdor/[email protected]
35+
env:
36+
# Includes metadata hash for production chains.
37+
BUILD_OPTS: "--features on-chain-release-build"
3538
with:
3639
chain: ${{ matrix.runtime }}
3740

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pallet-collator-staking = { git = "https://github.com/blockdeep/pallet-collator-
5858
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
5959
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
6060
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
61+
frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
6162
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
6263
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
6364
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
@@ -89,8 +90,6 @@ sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", tag = "pol
8990
sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
9091
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
9192
sc-network = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
92-
sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
93-
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
9493
sc-service = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
9594
sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
9695
sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
@@ -135,12 +134,8 @@ cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/pol
135134
cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
136135
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
137136
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
138-
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
139137
cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
140-
cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
141138
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
142-
cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
143-
cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
144139
parachain-info = { package = "staging-parachain-info", git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
145140
parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
146141

@@ -151,7 +146,6 @@ polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polk
151146
polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
152147
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
153148
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
154-
polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1" }
155149
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
156150
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }
157151
xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412-1", default-features = false }

node/Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ color-print = { workspace = true }
1515
futures = { workspace = true }
1616
jsonrpsee = { workspace = true }
1717
log = { workspace = true }
18-
parity-scale-codec = { workspace = true }
1918
serde = { workspace = true }
2019
serde_json = { workspace = true }
2120
hex-literal = { workspace = true }
@@ -36,9 +35,7 @@ sc-client-api = { workspace = true }
3635
sc-consensus = { workspace = true }
3736
sc-executor = { workspace = true }
3837
sc-network = { workspace = true }
39-
sc-network-sync = { workspace = true }
4038
sc-offchain = { workspace = true }
41-
sc-rpc = { workspace = true }
4239
sc-service = { workspace = true }
4340
sc-sysinfo = { workspace = true }
4441
sc-telemetry = { workspace = true }
@@ -63,7 +60,6 @@ substrate-prometheus-endpoint = { workspace = true }
6360
# Polkadot
6461
polkadot-cli = { workspace = true }
6562
polkadot-primitives = { workspace = true }
66-
polkadot-service = { workspace = true }
6763
xcm = { workspace = true, default-features = false }
6864

6965
# Cumulus
@@ -74,12 +70,8 @@ cumulus-client-consensus-common = { workspace = true }
7470
cumulus-client-collator = { workspace = true }
7571
cumulus-client-service = { workspace = true }
7672
cumulus-primitives-core = { workspace = true }
77-
cumulus-primitives-parachain-inherent = { workspace = true }
7873
cumulus-client-consensus-proposer = { workspace = true }
79-
cumulus-relay-chain-inprocess-interface = { workspace = true }
8074
cumulus-relay-chain-interface = { workspace = true }
81-
cumulus-relay-chain-minimal-node = { workspace = true }
82-
cumulus-relay-chain-rpc-interface = { workspace = true }
8375

8476
[build-dependencies]
8577
substrate-build-script-utils = { workspace = true }

runtime/mainnet/Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ account = { workspace = true, default-features = false }
3737
# Substrate
3838
frame-benchmarking = { workspace = true, default-features = false, optional = true }
3939
frame-executive = { workspace = true, default-features = false }
40+
frame-metadata-hash-extension = { workspace = true, default-features = false }
4041
frame-support = { workspace = true, default-features = false }
4142
frame-system = { workspace = true, default-features = false }
4243
frame-system-benchmarking = { workspace = true, default-features = false, optional = true }
@@ -238,3 +239,16 @@ try-runtime = [
238239
"parachain-info/try-runtime",
239240
"pallet-escrow/try-runtime",
240241
]
242+
243+
# Enable the metadata hash generation.
244+
#
245+
# This is hidden behind a feature because it increases the compile time.
246+
# The wasm binary needs to be compiled twice, once to fetch the metadata,
247+
# generate the metadata hash and then a second time with the
248+
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
249+
# extension.
250+
metadata-hash = ["substrate-wasm-builder/metadata-hash"]
251+
252+
# A convenience feature for enabling things when doing a build
253+
# for an on-chain release.
254+
on-chain-release-build = ["metadata-hash"]

runtime/mainnet/build.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
#[cfg(feature = "std")]
1+
#[cfg(all(feature = "std", feature = "metadata-hash"))]
22
fn main() {
3-
substrate_wasm_builder::WasmBuilder::new()
4-
.with_current_project()
5-
.export_heap_base()
6-
.import_memory()
3+
substrate_wasm_builder::WasmBuilder::init_with_defaults()
4+
.enable_metadata_hash("MYTH", 18)
75
.build()
86
}
97

8+
#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
9+
fn main() {
10+
substrate_wasm_builder::WasmBuilder::init_with_defaults().build()
11+
}
12+
1013
/// The wasm builder is deactivated when compiling
1114
/// this crate for wasm to speed up the compilation.
1215
#[cfg(not(feature = "std"))]

runtime/mainnet/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ pub type SignedExtra = (
112112
frame_system::CheckWeight<Runtime>,
113113
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
114114
cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim<Runtime>,
115+
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
115116
);
116117

117118
/// Unchecked extrinsic type as expected by this runtime.

runtime/testnet/Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ account = { workspace = true, default-features = false }
3636
# Substrate
3737
frame-benchmarking = { workspace = true, default-features = false, optional = true }
3838
frame-executive = { workspace = true, default-features = false }
39+
frame-metadata-hash-extension = { workspace = true, default-features = false }
3940
frame-support = { workspace = true, default-features = false }
4041
frame-system = { workspace = true, default-features = false }
4142
frame-system-benchmarking = { workspace = true, default-features = false, optional = true }
@@ -234,3 +235,16 @@ try-runtime = [
234235
"pallet-escrow/try-runtime",
235236
"pallet-myth-proxy/try-runtime",
236237
]
238+
239+
# Enable the metadata hash generation.
240+
#
241+
# This is hidden behind a feature because it increases the compile time.
242+
# The wasm binary needs to be compiled twice, once to fetch the metadata,
243+
# generate the metadata hash and then a second time with the
244+
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
245+
# extension.
246+
metadata-hash = ["substrate-wasm-builder/metadata-hash"]
247+
248+
# A convenience feature for enabling things when doing a build
249+
# for an on-chain release.
250+
on-chain-release-build = ["metadata-hash"]

runtime/testnet/build.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
#[cfg(feature = "std")]
1+
#[cfg(all(feature = "std", feature = "metadata-hash"))]
22
fn main() {
3-
substrate_wasm_builder::WasmBuilder::new()
4-
.with_current_project()
5-
.export_heap_base()
6-
.import_memory()
3+
substrate_wasm_builder::WasmBuilder::init_with_defaults()
4+
.enable_metadata_hash("MUSE", 18)
75
.build()
86
}
97

8+
#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
9+
fn main() {
10+
substrate_wasm_builder::WasmBuilder::init_with_defaults().build()
11+
}
12+
1013
/// The wasm builder is deactivated when compiling
1114
/// this crate for wasm to speed up the compilation.
1215
#[cfg(not(feature = "std"))]

runtime/testnet/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ pub type SignedExtra = (
107107
frame_system::CheckWeight<Runtime>,
108108
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
109109
cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim<Runtime>,
110+
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
110111
);
111112

112113
/// Unchecked extrinsic type as expected by this runtime.

0 commit comments

Comments
 (0)