Skip to content

Commit

Permalink
Add Ledger support
Browse files Browse the repository at this point in the history
  • Loading branch information
JuaniRios committed Sep 11, 2024
1 parent bade02e commit 6734b0c
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 7 deletions.
54 changes: 54 additions & 0 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 @@ -119,6 +119,7 @@ frame-system = { version = "35.0.0", default-features = false }
frame-system-rpc-runtime-api = { version = "33.0.0", default-features = false }
frame-system-benchmarking = { version = "35.0.0", default-features = false }
frame-try-runtime = { version = "0.41.0", default-features = false }
frame-metadata-hash-extension = { version = "0.3.0", default-features = false }
sp-api = { version = "33.0.0", default-features = false }
sp-debug-derive = { version = "14.0.0", default-features = false }
sp-std = { version = "14.0.0", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ itertools.workspace = true
pallet-democracy.workspace = true
pallet-scheduler.workspace = true
pallet-treasury.workspace = true
frame-metadata-hash-extension.workspace = true

# Runtimes
polkadot-runtime.workspace = true
Expand Down
1 change: 1 addition & 0 deletions integration-tests/src/tests/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ fn dispenser_signed_extensions_pass_for_new_account() {
pallet_dispenser::extensions::CheckNonce::<PolimecRuntime>::from(0u32),
frame_system::CheckWeight::<PolimecRuntime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<PolimecRuntime>::from(0u64.into()).into(),
frame_metadata_hash_extension::CheckMetadataHash::<PolimecRuntime>::new(true),
);
assert_err!(
extra.validate(&who, &paid_call, &paid_call.get_dispatch_info(), 0),
Expand Down
14 changes: 9 additions & 5 deletions runtimes/polimec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ version.workspace = true
workspace = true

[build-dependencies]
substrate-wasm-builder.workspace = true
substrate-wasm-builder = { workspace = true, optional = true }

[dependencies]
parity-scale-codec = { workspace= true, default-features = false, features = [
Expand Down Expand Up @@ -184,6 +184,8 @@ std = [
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
"substrate-wasm-builder",
"frame-metadata-hash-extension/std"
]

runtime-benchmarks = [
Expand Down Expand Up @@ -277,9 +279,11 @@ try-runtime = [
# 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 = [
"pallet-funding/on-chain-release-build",
"sp-api/disable-logging",
]
on-chain-release-build = [ "sp-api/disable-logging", "pallet-funding/on-chain-release-build", "metadata-hash" ]

development-settings = [ "shared-configuration/development-settings" ]

# Enable the metadata hash generation in the wasm-builder
metadata-hash = [
"substrate-wasm-builder?/metadata-hash",
]
13 changes: 11 additions & 2 deletions runtimes/polimec/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

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

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

/// The wasm builder is deactivated when compiling
/// this crate for wasm to speed up the compilation.
#[cfg(not(feature = "std"))]
fn main() {}
2 changes: 2 additions & 0 deletions runtimes/polimec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pub type SignedExtra = (
Runtime,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
);

/// Unchecked extrinsic type as expected by this runtime.
Expand Down Expand Up @@ -901,6 +902,7 @@ where
pallet_dispenser::extensions::SkipCheckIfFeeless::from(
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
),
frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(true),
);
let raw_payload = generic::SignedPayload::new(call, extra)
.map_err(|e| {
Expand Down

0 comments on commit 6734b0c

Please sign in to comment.