Skip to content

Commit

Permalink
Merge pull request #257 from paritytech/ledger-support
Browse files Browse the repository at this point in the history
Ledger support
  • Loading branch information
Moliholy authored Jan 9, 2025
2 parents b8cce99 + efab8af commit b01382f
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-deterministic-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- name: Build ${{ matrix.runtime }} runtime
id: srtool_build
uses: chevdor/[email protected]
env:
# Includes metadata hash for production chains.
BUILD_OPTS: "--features on-chain-release-build"
with:
chain: ${{ matrix.runtime }}

Expand Down
58 changes: 56 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pallet-myth-proxy = { path = "pallets/myth-proxy", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2407-2", default-features = false }
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2407-2" }
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2407-2", default-features = false }
frame-metadata-hash-extension = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2407-2", default-features = false }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2407-2", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2407-2", default-features = false }
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2407-2", default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion primitives/xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ pub struct SignedToAccountId20<Origin, AccountId, Network>(
sp_std::marker::PhantomData<(Origin, AccountId, Network)>,
);
impl<Origin: OriginTrait + Clone, AccountId: Into<[u8; 20]>, Network: Get<NetworkId>>
sp_runtime::traits::TryConvert<Origin, Location> for SignedToAccountId20<Origin, AccountId, Network>
sp_runtime::traits::TryConvert<Origin, Location>
for SignedToAccountId20<Origin, AccountId, Network>
where
Origin::PalletsOrigin: From<frame_system::RawOrigin<AccountId>>
+ TryInto<frame_system::RawOrigin<AccountId>, Error = Origin::PalletsOrigin>,
Expand Down
14 changes: 14 additions & 0 deletions runtime/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pallet-escrow = {workspace = true, default-features = false}
# Substrate
frame-benchmarking = { workspace = true, default-features = false, optional = true }
frame-executive = { workspace = true, default-features = false }
frame-metadata-hash-extension = { workspace = true, default-features = false }
frame-support = { workspace = true, default-features = false }
frame-system = { workspace = true, default-features = false }
frame-system-benchmarking = { workspace = true, default-features = false, optional = true }
Expand Down Expand Up @@ -226,3 +227,16 @@ try-runtime = [
"parachain-info/try-runtime",
"pallet-escrow/try-runtime",
]

# Enable the metadata hash generation.
#
# This is hidden behind a feature because it increases the compile time.
# The wasm binary needs to be compiled twice, once to fetch the metadata,
# generate the metadata hash and then a second time with the
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
# extension.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# A convenience feature for enabling things when doing a build
# for an on-chain release.
on-chain-release-build = ["metadata-hash"]
13 changes: 8 additions & 5 deletions runtime/mainnet/build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("MYTH", 18)
.build()
}

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

/// The wasm builder is deactivated when compiling
/// this crate for wasm to speed up the compilation.
#[cfg(not(feature = "std"))]
Expand Down
1 change: 1 addition & 0 deletions runtime/mainnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,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
14 changes: 14 additions & 0 deletions runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pallet-myth-proxy = { workspace = true, default-features = false }
# Substrate
frame-benchmarking = { workspace = true, default-features = false, optional = true }
frame-executive = { workspace = true, default-features = false }
frame-metadata-hash-extension = { workspace = true, default-features = false }
frame-support = { workspace = true, default-features = false }
frame-system = { workspace = true, default-features = false }
frame-system-benchmarking = { workspace = true, default-features = false, optional = true }
Expand Down Expand Up @@ -223,3 +224,16 @@ try-runtime = [
"pallet-escrow/try-runtime",
"pallet-myth-proxy/try-runtime",
]

# Enable the metadata hash generation.
#
# This is hidden behind a feature because it increases the compile time.
# The wasm binary needs to be compiled twice, once to fetch the metadata,
# generate the metadata hash and then a second time with the
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
# extension.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# A convenience feature for enabling things when doing a build
# for an on-chain release.
on-chain-release-build = ["metadata-hash"]
13 changes: 8 additions & 5 deletions runtime/testnet/build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("MUSE", 18)
.build()
}

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

/// The wasm builder is deactivated when compiling
/// this crate for wasm to speed up the compilation.
#[cfg(not(feature = "std"))]
Expand Down
1 change: 1 addition & 0 deletions runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,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

0 comments on commit b01382f

Please sign in to comment.