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 12, 2024
1 parent 20bda10 commit 2a14aa9
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 20 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
28 changes: 15 additions & 13 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 All @@ -88,6 +89,7 @@ std = [
"asset-hub-polkadot-runtime/std",
"cumulus-pallet-xcm/std",
"cumulus-primitives-core/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system/std",
"itertools/use_std",
Expand Down Expand Up @@ -142,40 +144,40 @@ std = [
development-settings = [ "polimec-runtime/development-settings" ]
runtime-benchmarks = [
"asset-hub-polkadot-runtime/runtime-benchmarks",
"polkadot-runtime/runtime-benchmarks",
"penpal-runtime/runtime-benchmarks",
"pallet-democracy/runtime-benchmarks",
"pallet-dispenser/runtime-benchmarks",
"pallet-elections-phragmen/runtime-benchmarks",
"pallet-funding/runtime-benchmarks",
"pallet-linear-release/runtime-benchmarks",
"pallet-parachain-staking/runtime-benchmarks",
"polimec-receiver/runtime-benchmarks",
"polimec-common/runtime-benchmarks",
"polimec-common-test-utils/runtime-benchmarks",
"polimec-runtime/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"orml-oracle/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-democracy/runtime-benchmarks",
"pallet-dispenser/runtime-benchmarks",
"pallet-elections-phragmen/runtime-benchmarks",
"pallet-funding/runtime-benchmarks",
"pallet-im-online/runtime-benchmarks",
"pallet-linear-release/runtime-benchmarks",
"pallet-membership/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-parachain-staking/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"penpal-runtime/runtime-benchmarks",
"polimec-common-test-utils/runtime-benchmarks",
"polimec-common/runtime-benchmarks",
"polimec-receiver/runtime-benchmarks",
"polimec-runtime/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"polkadot-runtime/runtime-benchmarks",
"polkadot-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks"
"xcm-executor/runtime-benchmarks",
]

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
2 changes: 1 addition & 1 deletion pallets/funding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"itertools/use_alloc",
"on-slash-vesting/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-linear-release/runtime-benchmarks",
Expand All @@ -114,7 +115,6 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"on-slash-vesting/runtime-benchmarks"
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
2 changes: 1 addition & 1 deletion pallets/on-slash-vesting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"sp-runtime/runtime-benchmarks"
"sp-runtime/runtime-benchmarks",
]
11 changes: 9 additions & 2 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 @@ -81,6 +81,7 @@ sp-std.workspace = true
sp-transaction-pool.workspace = true
sp-version.workspace = true
sp-genesis-builder.workspace = true
frame-metadata-hash-extension.workspace = true

# Polkadot
pallet-xcm.workspace = true
Expand Down Expand Up @@ -124,6 +125,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 @@ -181,6 +183,7 @@ std = [
"sp-std/std",
"sp-transaction-pool/std",
"sp-version/std",
"substrate-wasm-builder",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
Expand All @@ -197,6 +200,7 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"on-slash-vesting/runtime-benchmarks",
"orml-oracle/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
Expand Down Expand Up @@ -228,7 +232,6 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"on-slash-vesting/runtime-benchmarks"
]

try-runtime = [
Expand Down Expand Up @@ -279,8 +282,12 @@ try-runtime = [
# 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",
"pallet-funding/on-chain-release-build",
"sp-api/disable-logging",
]

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
2 changes: 1 addition & 1 deletion scripts/zombienet/polimec-paseo-local.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ chain_spec_path = "./scripts/zombienet/relay-chain-specs/paseo-local.plain.json"

[[parachains]]
id = 3344
chain = "polimec-paseo"
chain = "polimec-paseo-local"

[[parachains.collators]]
name = "collator1"
Expand Down

0 comments on commit 2a14aa9

Please sign in to comment.