Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds CheckMetadata SignedExtension to Coretime Parachains (Rococo and Westend) #4738

Merged
Merged
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
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions cumulus/parachains/runtimes/coretime/coretime-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ serde = { optional = true, features = ["derive"], workspace = true, default-feat
# Substrate
frame-benchmarking = { optional = true, workspace = true }
frame-executive = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
frame-system-benchmarking = { optional = true, workspace = true }
Expand Down Expand Up @@ -94,6 +95,7 @@ std = [
"cumulus-primitives-utility/std",
"frame-benchmarking?/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
Expand Down Expand Up @@ -202,3 +204,11 @@ try-runtime = [
fast-runtime = [
"rococo-runtime-constants/fast-runtime",
]

# Enable the metadata hash generation in the wasm builder.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# A feature that should be enabled when the runtime should be built for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller, like logging for example.
on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"]
24 changes: 15 additions & 9 deletions cumulus/parachains/runtimes/coretime/coretime-rococo/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(feature = "std")]
#[cfg(all(not(feature = "metadata-hash"), feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
substrate_wasm_builder::WasmBuilder::build_using_defaults();

substrate_wasm_builder::WasmBuilder::init_with_defaults()
.set_file_name("fast_runtime_binary.rs")
.enable_feature("fast-runtime")
.build();
}

#[cfg(all(feature = "metadata-hash", feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("ROC", 12)
.build();

substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.set_file_name("fast_runtime_binary.rs")
.enable_feature("fast-runtime")
.import_memory()
.export_heap_base()
.enable_metadata_hash("ROC", 12)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

/// Unchecked extrinsic type as expected by this runtime.
Expand Down Expand Up @@ -146,7 +147,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_version: 1_013_000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
transaction_version: 2,
state_version: 1,
};

Expand Down
10 changes: 10 additions & 0 deletions cumulus/parachains/runtimes/coretime/coretime-westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ serde = { optional = true, features = ["derive"], workspace = true, default-feat
# Substrate
frame-benchmarking = { optional = true, workspace = true }
frame-executive = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
frame-system-benchmarking = { optional = true, workspace = true }
Expand Down Expand Up @@ -94,6 +95,7 @@ std = [
"cumulus-primitives-utility/std",
"frame-benchmarking?/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
Expand Down Expand Up @@ -199,3 +201,11 @@ try-runtime = [
fast-runtime = [
"westend-runtime-constants/fast-runtime",
]

# Enable the metadata hash generation in the wasm builder.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# A feature that should be enabled when the runtime should be built for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller, like logging for example.
on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"]
24 changes: 15 additions & 9 deletions cumulus/parachains/runtimes/coretime/coretime-westend/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(feature = "std")]
#[cfg(all(not(feature = "metadata-hash"), feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
substrate_wasm_builder::WasmBuilder::build_using_defaults();

substrate_wasm_builder::WasmBuilder::init_with_defaults()
.set_file_name("fast_runtime_binary.rs")
.enable_feature("fast-runtime")
.build();
}

#[cfg(all(feature = "metadata-hash", feature = "std"))]
fn main() {
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("WND", 12)
.build();

substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.set_file_name("fast_runtime_binary.rs")
.enable_feature("fast-runtime")
.import_memory()
.export_heap_base()
.enable_metadata_hash("WND", 12)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

/// Unchecked extrinsic type as expected by this runtime.
Expand Down Expand Up @@ -145,7 +146,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_version: 1_013_000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
transaction_version: 2,
state_version: 1,
};

Expand Down
18 changes: 18 additions & 0 deletions prdoc/pr_4738.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Add CheckMetadata SignedExtension to Rococo and Westend Coretime chains

doc:
- audience: Runtime User
description: |
This brings support for the new Ledger app and similar hardware wallets to the Coretime
Chain on Rococo and Westend. These hardware wallets will be able to decode the transaction
using the metadata. The runtime will ensure that the metadata used for this decoding process
is correct and that the online wallet did not try to trick you.

crates:
- name: coretime-rococo-runtime
bump: major
- name: coretime-westend-runtime
bump: major
Loading