diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efd42d44e..62f5035dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,23 @@ jobs: # Compile async example separately to enable async-mode cargo build --release -p ac-examples --example get_blocks_async --no-default-features, + # Test for no-std serde feature. + cargo build --release -p test-no-std --features application-crypto, + cargo build --release -p test-no-std --features arithmetic, + cargo build --release -p test-no-std --features beefy, + cargo build --release -p test-no-std --features babe, + cargo build --release -p test-no-std --features slots, + cargo build --release -p test-no-std --features core, + cargo build --release -p test-no-std --features finality-grandpa, + cargo build --release -p test-no-std --features mmr, + cargo build --release -p test-no-std --features npos-elections, + cargo build --release -p test-no-std --features runtime, + cargo build --release -p test-no-std --features storage, + cargo build --release -p test-no-std --features test-primitives, + cargo build --release -p test-no-std --features version, + cargo build --release -p test-no-std --features weights, + + # Clippy cargo clippy --workspace --exclude test-no-std -- -D warnings, cargo clippy --all-features --examples -- -D warnings, diff --git a/Cargo.lock b/Cargo.lock index c820a2c37..ca21576a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,6 +64,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-runtime-interface", + "sp-storage", ] [[package]] @@ -1110,7 +1111,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-support-procedural", @@ -1135,7 +1136,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-pallet-pov" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -1150,7 +1151,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1161,7 +1162,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -1178,7 +1179,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -1206,7 +1207,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "bitflags", "environmental", @@ -1239,7 +1240,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "Inflector", "cfg-expr", @@ -1255,7 +1256,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1267,7 +1268,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "proc-macro2", "quote", @@ -1277,7 +1278,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "log", @@ -1295,7 +1296,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -1310,7 +1311,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "sp-api", @@ -1319,7 +1320,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "parity-scale-codec", @@ -1916,7 +1917,7 @@ dependencies = [ [[package]] name = "kitchensink-runtime" version = "3.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-benchmarking-pallet-pov", @@ -1930,6 +1931,7 @@ dependencies = [ "log", "node-primitives", "pallet-alliance", + "pallet-asset-rate", "pallet-asset-tx-payment", "pallet-assets", "pallet-authority-discovery", @@ -2349,7 +2351,7 @@ dependencies = [ [[package]] name = "node-primitives" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-system", "parity-scale-codec", @@ -2362,7 +2364,7 @@ dependencies = [ [[package]] name = "node-template-runtime" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-executive", @@ -2559,7 +2561,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2576,10 +2578,24 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-asset-rate" +version = "4.0.0-dev" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2597,7 +2613,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2612,7 +2628,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -2628,7 +2644,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -2644,7 +2660,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -2658,7 +2674,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2671,7 +2687,7 @@ dependencies = [ "scale-info", "sp-application-crypto", "sp-consensus-babe", - "sp-consensus-vrf", + "sp-core", "sp-io", "sp-runtime", "sp-session", @@ -2682,7 +2698,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -2702,7 +2718,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2717,7 +2733,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2735,7 +2751,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2754,7 +2770,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2771,7 +2787,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "bitflags", "environmental", @@ -2800,7 +2816,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "bitflags", "parity-scale-codec", @@ -2813,7 +2829,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "proc-macro2", "quote", @@ -2823,7 +2839,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "assert_matches", "frame-benchmarking", @@ -2840,7 +2856,7 @@ dependencies = [ [[package]] name = "pallet-core-fellowship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2858,7 +2874,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2876,7 +2892,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -2899,7 +2915,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -2912,7 +2928,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2930,7 +2946,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -2948,7 +2964,7 @@ dependencies = [ [[package]] name = "pallet-glutton" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "blake2", "frame-benchmarking", @@ -2966,7 +2982,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -2989,7 +3005,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "enumflags2", "frame-benchmarking", @@ -3005,7 +3021,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3025,7 +3041,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3042,7 +3058,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -3056,7 +3072,7 @@ dependencies = [ [[package]] name = "pallet-lottery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3070,7 +3086,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3087,7 +3103,7 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "7.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3106,7 +3122,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3123,7 +3139,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3139,7 +3155,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "enumflags2", "frame-benchmarking", @@ -3157,7 +3173,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "pallet-nfts", @@ -3168,7 +3184,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3184,7 +3200,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -3201,7 +3217,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -3221,7 +3237,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -3232,7 +3248,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -3249,7 +3265,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -3273,7 +3289,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3290,7 +3306,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3305,7 +3321,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3323,7 +3339,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3338,7 +3354,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3356,7 +3372,7 @@ dependencies = [ [[package]] name = "pallet-remark" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3373,7 +3389,7 @@ dependencies = [ [[package]] name = "pallet-root-testing" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -3388,7 +3404,7 @@ dependencies = [ [[package]] name = "pallet-salary" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3406,7 +3422,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3423,7 +3439,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -3444,7 +3460,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3460,7 +3476,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -3474,7 +3490,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -3496,7 +3512,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3507,7 +3523,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "sp-api", @@ -3516,7 +3532,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3533,7 +3549,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -3547,7 +3563,7 @@ dependencies = [ [[package]] name = "pallet-template" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3559,7 +3575,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3577,7 +3593,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3596,7 +3612,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-support", "frame-system", @@ -3612,7 +3628,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -3624,7 +3640,7 @@ dependencies = [ [[package]] name = "pallet-transaction-storage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3644,7 +3660,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3661,7 +3677,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3676,7 +3692,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3692,7 +3708,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -3707,7 +3723,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-benchmarking", "frame-support", @@ -4231,7 +4247,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "array-bytes", "async-trait", @@ -4629,7 +4645,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "hash-db", "log", @@ -4649,7 +4665,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "Inflector", "blake2", @@ -4663,7 +4679,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "scale-info", @@ -4676,7 +4692,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "integer-sqrt", "num-traits", @@ -4690,7 +4706,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "scale-info", @@ -4703,7 +4719,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "sp-api", @@ -4715,7 +4731,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "async-trait", "futures", @@ -4730,7 +4746,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "async-trait", "parity-scale-codec", @@ -4748,10 +4764,9 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "async-trait", - "merlin", "parity-scale-codec", "scale-info", "serde", @@ -4759,7 +4774,6 @@ dependencies = [ "sp-application-crypto", "sp-consensus", "sp-consensus-slots", - "sp-consensus-vrf", "sp-core", "sp-inherents", "sp-keystore", @@ -4769,52 +4783,58 @@ dependencies = [ ] [[package]] -name = "sp-consensus-grandpa" +name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ - "finality-grandpa", - "log", + "lazy_static", "parity-scale-codec", "scale-info", "serde", "sp-api", "sp-application-crypto", "sp-core", - "sp-keystore", + "sp-io", + "sp-mmr-primitives", "sp-runtime", "sp-std", + "strum", ] [[package]] -name = "sp-consensus-slots" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +name = "sp-consensus-grandpa" +version = "4.0.0-dev" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ + "finality-grandpa", + "log", "parity-scale-codec", "scale-info", "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "sp-runtime", "sp-std", - "sp-timestamp", ] [[package]] -name = "sp-consensus-vrf" +name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "scale-info", - "schnorrkel", - "sp-core", - "sp-runtime", + "serde", "sp-std", + "sp-timestamp", ] [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "array-bytes", "bitflags", @@ -4833,6 +4853,7 @@ dependencies = [ "merlin", "parity-scale-codec", "parking_lot", + "paste", "primitive-types", "rand 0.8.5", "regex", @@ -4857,7 +4878,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "blake2b_simd", "byteorder", @@ -4871,7 +4892,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "proc-macro2", "quote", @@ -4882,7 +4903,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "proc-macro2", "quote", @@ -4892,7 +4913,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "environmental", "parity-scale-codec", @@ -4903,7 +4924,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -4918,7 +4939,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "bytes 1.4.0", "ed25519", @@ -4944,7 +4965,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "lazy_static", "sp-core", @@ -4955,13 +4976,11 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "futures", - "merlin", "parity-scale-codec", "parking_lot", - "schnorrkel", "serde", "sp-core", "sp-externalities", @@ -4971,7 +4990,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "thiserror", "zstd", @@ -4980,7 +4999,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -4991,7 +5010,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -5009,7 +5028,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "scale-info", @@ -5023,7 +5042,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "sp-api", "sp-core", @@ -5033,17 +5052,27 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "backtrace", "lazy_static", "regex", ] +[[package]] +name = "sp-rpc" +version = "6.0.0" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" +dependencies = [ + "rustc-hash", + "serde", + "sp-core", +] + [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "either", "hash256-std-hasher", @@ -5065,7 +5094,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "bytes 1.4.0", "impl-trait-for-tuples", @@ -5083,7 +5112,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "Inflector", "proc-macro-crate", @@ -5095,7 +5124,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "scale-info", @@ -5109,10 +5138,11 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "scale-info", + "serde", "sp-core", "sp-runtime", "sp-std", @@ -5121,7 +5151,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "hash-db", "log", @@ -5141,12 +5171,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "impl-serde", "parity-scale-codec", @@ -5156,10 +5186,24 @@ dependencies = [ "sp-std", ] +[[package]] +name = "sp-test-primitives" +version = "2.0.0" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-application-crypto", + "sp-core", + "sp-runtime", + "sp-std", +] + [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "async-trait", "futures-timer", @@ -5174,7 +5218,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "sp-std", @@ -5186,7 +5230,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "sp-api", "sp-runtime", @@ -5195,7 +5239,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "async-trait", "log", @@ -5211,7 +5255,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "ahash 0.8.3", "hash-db", @@ -5234,7 +5278,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "impl-serde", "parity-scale-codec", @@ -5251,7 +5295,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -5262,7 +5306,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -5276,7 +5320,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "parity-scale-codec", "scale-info", @@ -5381,8 +5425,11 @@ dependencies = [ "serde", "serde_json", "sp-core", + "sp-rpc", "sp-runtime", "sp-runtime-interface", + "sp-storage", + "sp-version", "tungstenite", "url", "ws", @@ -5420,7 +5467,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=master#4e93782c16f741cde18a8b98bd791838e03788fb" +source = "git+https://github.com/haerdib/substrate.git?branch=add-serde-feature-to-primitives#040126ee026b717da11248403cd76cc6f5f107a5" dependencies = [ "ansi_term", "build-helper", @@ -5504,7 +5551,22 @@ dependencies = [ "ac-node-api", "ac-primitives", "libc", + "sp-application-crypto", + "sp-arithmetic", + "sp-consensus-babe", + "sp-consensus-beefy", + "sp-consensus-grandpa", + "sp-consensus-slots", + "sp-core", "sp-io", + "sp-mmr-primitives", + "sp-npos-elections", + "sp-runtime", + "sp-runtime-interface", + "sp-storage", + "sp-test-primitives", + "sp-version", + "sp-weights", "substrate-api-client", ] @@ -5790,7 +5852,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if 0.1.10", "digest 0.10.6", - "rand 0.7.3", + "rand 0.8.5", "static_assertions", ] diff --git a/Cargo.toml b/Cargo.toml index e3b10f0f9..7994cd7b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,12 +44,15 @@ tungstenite = { version = "0.18.0", optional = true, features = ["native-tls"] } ws = { version = "0.9.2", optional = true, features = ["ssl"] } # Substrate no_std dependencies -sp-core = { default-features = false, features = ["full_crypto"], git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-runtime-interface = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-core = { default-features = false, features = ["full_crypto", "serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-rpc = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-runtime = { default-features = false, features = ["serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-runtime-interface = { default-features = false, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-storage = { default-features = false, features = ["serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-version = { default-features = false, features = ["serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } # substrate std / wasm only -frame-support = { optional = true, git = "https://github.com/paritytech/substrate.git", branch = "master" } +frame-support = { optional = true, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } # local deps ac-compose-macros = { path = "compose-macros", default-features = false } @@ -59,7 +62,7 @@ ac-primitives = { path = "primitives", default-features = false } [dev-dependencies] ac-node-api = { path = "node-api", features = ["mocks"] } -kitchensink-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +kitchensink-runtime = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } scale-info = { version = "2.1.1", features = ["derive"] } [features] @@ -103,6 +106,8 @@ std = [ "sp-core/std", "sp-runtime/std", "sp-runtime-interface/std", + "sp-storage/std", + "sp-version/std", # substrate std "frame-support", # local deps diff --git a/client-keystore/Cargo.toml b/client-keystore/Cargo.toml index d8dfe91ba..98d4f56e0 100644 --- a/client-keystore/Cargo.toml +++ b/client-keystore/Cargo.toml @@ -12,11 +12,11 @@ parking_lot = "0.12.0" serde_json = "1.0.79" # Substrate dependencies -sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-application-crypto = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +sc-keystore = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-application-crypto = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-core = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-keyring = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-keystore = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } [dev-dependencies] tempfile = "3.3.0" diff --git a/client-keystore/src/lib.rs b/client-keystore/src/lib.rs index 77935f63f..2d212cd2b 100644 --- a/client-keystore/src/lib.rs +++ b/client-keystore/src/lib.rs @@ -22,13 +22,10 @@ use parking_lot::RwLock; use sp_application_crypto::{AppCrypto, AppPair, IsWrappedBy}; use sp_core::{ - crypto::{ByteArray, ExposeSecret, KeyTypeId, Pair as CorePair, SecretString}, + crypto::{ByteArray, ExposeSecret, KeyTypeId, Pair as CorePair, SecretString, VrfSigner}, ecdsa, ed25519, sr25519, }; -use sp_keystore::{ - vrf::{make_transcript, VRFSignature, VRFTranscriptData}, - Error as TraitError, Keystore, KeystorePtr, -}; +use sp_keystore::{Error as TraitError, Keystore, KeystorePtr}; use std::{ collections::HashMap, fs::{self, File}, @@ -102,6 +99,20 @@ impl LocalKeystore { .map(|pair| pair.sign(msg)); Ok(signature) } + + fn vrf_sign( + &self, + key_type: KeyTypeId, + public: &T::Public, + transcript: &T::VrfInput, + ) -> std::result::Result, TraitError> { + let sig = self + .0 + .read() + .key_pair_by_type::(public, key_type)? + .map(|pair| pair.vrf_sign(transcript)); + Ok(sig) + } } impl Keystore for LocalKeystore { @@ -133,14 +144,9 @@ impl Keystore for LocalKeystore { &self, key_type: KeyTypeId, public: &sr25519::Public, - transcript_data: VRFTranscriptData, - ) -> std::result::Result, TraitError> { - let sig = self.0.read().key_pair_by_type::(public, key_type)?.map(|pair| { - let transcript = make_transcript(transcript_data); - let (inout, proof, _) = pair.as_ref().vrf_sign(transcript); - VRFSignature { output: inout.to_output(), proof } - }); - Ok(sig) + transcript: &sr25519::vrf::VrfTranscript, + ) -> std::result::Result, TraitError> { + self.vrf_sign::(key_type, public, transcript) } fn ed25519_public_keys(&self, key_type: KeyTypeId) -> Vec { diff --git a/examples/Cargo.toml b/examples/Cargo.toml index bfa0023c8..a8015bdee 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -14,16 +14,16 @@ tokio = { version = "1.24", features = ["rt-multi-thread", "macros", "time"] } wabt = "0.10.0" # Substrate dependencies -frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -kitchensink-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-identity = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-staking = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-core = { features = ["full_crypto"], git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-version = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +frame-support = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +frame-system = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +kitchensink-runtime = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-balances = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-identity = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-staking = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-core = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-keyring = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-runtime = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-version = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } # local deps substrate-api-client = { path = "..", default-features = false, features = ["jsonrpsee-client", "tungstenite-client", "ws-client", "staking-xt", "contracts-xt"] } diff --git a/node-api/Cargo.toml b/node-api/Cargo.toml index 46dba6bda..5e28c2c9f 100644 --- a/node-api/Cargo.toml +++ b/node-api/Cargo.toml @@ -22,12 +22,13 @@ serde = { version = "1.0.136", features = ["derive"], default-features = false } serde_json = { version = "1.0.79", default-features = false, features = ["alloc"] } # substrate -sp-core = { default-features = false, features = ["full_crypto"], git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-core = { default-features = false, features = ["full_crypto"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-runtime = { default-features = false, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-storage = { default-features = false, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } # need to add this for `no_std` -sp-application-crypto = { default-features = false, git = "https://github.com/paritytech/substrate.git", features = ["full_crypto"], branch = "master" } -sp-runtime-interface = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-application-crypto = { default-features = false, git = "https://github.com/haerdib/substrate.git", features = ["full_crypto"], branch = "add-serde-feature-to-primitives" } +sp-runtime-interface = { default-features = false, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } # local ac-primitives = { path = "../primitives", default-features = false } @@ -51,6 +52,7 @@ std = [ # substrate "sp-core/std", "sp-runtime/std", + "sp-storage/std", # no_std support "sp-application-crypto/std", "sp-runtime-interface/std", diff --git a/node-api/src/metadata.rs b/node-api/src/metadata.rs index ffbdc9698..ad44771e8 100644 --- a/node-api/src/metadata.rs +++ b/node-api/src/metadata.rs @@ -11,13 +11,13 @@ //! This file is mostly subxt. use crate::{alloc::borrow::ToOwned, storage::GetStorageTypes, Encoded}; -use ac_primitives::StorageKey; use codec::{Decode, Encode, Error as CodecError}; use frame_metadata::{ PalletConstantMetadata, RuntimeMetadata, RuntimeMetadataLastVersion, RuntimeMetadataPrefixed, StorageEntryMetadata, META_RESERVED, }; use scale_info::{form::PortableForm, PortableRegistry, Type}; +use sp_storage::StorageKey; #[cfg(feature = "std")] use serde::Serialize; diff --git a/node-api/src/storage.rs b/node-api/src/storage.rs index 9dc845f05..63bfd1636 100644 --- a/node-api/src/storage.rs +++ b/node-api/src/storage.rs @@ -14,12 +14,12 @@ //! For querying runtime storage. use crate::metadata::MetadataError; -use ac_primitives::StorageKey; use alloc::{borrow::ToOwned, vec::Vec}; use codec::Encode; use core::marker::PhantomData; use frame_metadata::{StorageEntryMetadata, StorageEntryType, StorageHasher}; use scale_info::form::PortableForm; +use sp_storage::StorageKey; #[derive(Clone, Debug, PartialEq, Eq, Ord, PartialOrd)] pub struct StorageValue { diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index a05407915..fee526ebb 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -19,26 +19,26 @@ serde = { version = "1.0", default-features = false, features = ["derive", "allo serde_json = { version = "1.0", default-features = false, features = ["alloc"] } # substrate no_std -sp-core = { default-features = false, features = ["full_crypto"], git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-core-hashing = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-runtime-interface = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-staking = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-version = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-core = { default-features = false, features = ["full_crypto", "serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-core-hashing = { default-features = false, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-runtime = { default-features = false, features = ["serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-runtime-interface = { default-features = false, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-staking = { default-features = false, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-version = { default-features = false, features = ["serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-weights = { default-features = false, features = ["serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } # need to add this for the app_crypto macro -sp-application-crypto = { default-features = false, features = ["full_crypto"], git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-application-crypto = { default-features = false, features = ["full_crypto"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } # substrate std / wasm only -frame-system = { optional = true, git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-assets = { optional = true, git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-balances = { optional = true, git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-contracts = { optional = true, git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-staking = { optional = true, git = "https://github.com/paritytech/substrate.git", branch = "master" } +frame-system = { optional = true, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-assets = { optional = true, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-balances = { optional = true, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-contracts = { optional = true, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-staking = { optional = true, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } [dev-dependencies] -node-template-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +node-template-runtime = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-keyring = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } [features] default = ["std"] @@ -58,8 +58,8 @@ std = [ "sp-runtime/std", "sp-staking/std", "sp-version/std", - # app_crypto macro "sp-application-crypto/std", + "sp-weights/std", # substrate std "frame-system", "pallet-assets", diff --git a/primitives/src/config/mod.rs b/primitives/src/config/mod.rs index 0a959bf3e..56e1a92f5 100644 --- a/primitives/src/config/mod.rs +++ b/primitives/src/config/mod.rs @@ -16,9 +16,11 @@ use core::{fmt::Debug, marker::PhantomData}; use codec::{Decode, Encode, FullCodec}; use serde::{de::DeserializeOwned, Serialize}; use sp_core::Pair; -use sp_runtime::traits::{AtLeast32Bit, AtLeast32BitUnsigned, MaybeSerializeDeserialize}; +use sp_runtime::traits::{ + AtLeast32Bit, AtLeast32BitUnsigned, Block, Hash as HashTrait, Header, MaybeSerializeDeserialize, +}; -use crate::{extrinsic_params, Block, Hasher, Header, SignExtrinsic}; +use crate::{extrinsic_params, SignExtrinsic}; pub use polkadot::*; pub use substrate_kitchensink::*; @@ -72,11 +74,11 @@ pub trait Config { type Signature: Debug + Encode + From<::Signature>; /// The hashing system (algorithm) being used in the runtime (e.g. Blake2). - type Hasher: Debug + Hasher; + type Hasher: Debug + HashTrait; /// The block header. type Header: Debug - + Header + + Header + Send + DeserializeOwned; diff --git a/primitives/src/config/substrate_kitchensink.rs b/primitives/src/config/substrate_kitchensink.rs index f326fe14c..e6926f643 100644 --- a/primitives/src/config/substrate_kitchensink.rs +++ b/primitives/src/config/substrate_kitchensink.rs @@ -8,14 +8,17 @@ //! https://github.com/paritytech/subxt/blob/ce0a82e3227efb0eae131f025da5f839d9623e15/subxt/src/config/substrate.rs use crate::{ - config::Config, types::AccountData, AssetTip, BlakeTwo256, ExtrinsicSigner, - GenericExtrinsicParams, SubstrateBlock, SubstrateHeader, SubstrateOpaqueExtrinsic, + config::Config, types::AccountData, AssetTip, ExtrinsicSigner, GenericExtrinsicParams, }; use codec::{Decode, Encode}; use core::fmt::Debug; pub use primitive_types::{H256, U256}; use sp_core::sr25519; -use sp_runtime::{AccountId32, MultiAddress, MultiSignature}; +use sp_runtime::{ + generic::{Block as SubstrateBlock, Header as SubstrateHeader}, + traits::BlakeTwo256, + AccountId32, MultiAddress, MultiSignature, OpaqueExtrinsic as SubstrateOpaqueExtrinsic, +}; /// Default set of commonly used types by Substrate kitchensink runtime. #[derive(Decode, Encode, Clone, Eq, PartialEq, Debug)] diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 7c4087afe..6b647aed9 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -22,16 +22,12 @@ extern crate alloc; // Re-export everything. pub use config::*; pub use extrinsics::*; -pub use rpc_numbers::*; pub use rpc_params::*; -pub use serde_impls::*; pub use traits::*; pub use types::*; pub mod config; pub mod extrinsics; -pub mod rpc_numbers; pub mod rpc_params; -pub mod serde_impls; pub mod traits; pub mod types; diff --git a/primitives/src/rpc_numbers.rs b/primitives/src/rpc_numbers.rs deleted file mode 100644 index a14bdb97e..000000000 --- a/primitives/src/rpc_numbers.rs +++ /dev/null @@ -1,113 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! A number type that can be serialized both as a number or a string that encodes a number in a -//! string. - -// Copied the whole file from substrate, as sp_rpc is not no_std compatible. -// https://github.com/paritytech/substrate/blob/cd2fdcf85eb96c53ce2a5d418d4338eb92f5d4f5/primitives/rpc/src/number.rs - -use core::fmt::Debug; -use primitive_types::U256; -use serde::{Deserialize, Serialize}; - -/// A number type that can be serialized both as a number or a string that encodes a number in a -/// string. -/// -/// We allow two representations of the block number as input. Either we deserialize to the type -/// that is specified in the block type or we attempt to parse given hex value. -/// -/// The primary motivation for having this type is to avoid overflows when using big integers in -/// JavaScript (which we consider as an important RPC API consumer). -#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] -#[serde(untagged)] -pub enum NumberOrHex { - /// The number represented directly. - Number(u64), - /// Hex representation of the number. - Hex(U256), -} - -impl Default for NumberOrHex { - fn default() -> Self { - Self::Number(Default::default()) - } -} - -impl NumberOrHex { - /// Converts this number into an U256. - pub fn into_u256(self) -> U256 { - match self { - NumberOrHex::Number(n) => n.into(), - NumberOrHex::Hex(h) => h, - } - } -} - -impl From for NumberOrHex { - fn from(n: u32) -> Self { - NumberOrHex::Number(n.into()) - } -} - -impl From for NumberOrHex { - fn from(n: u64) -> Self { - NumberOrHex::Number(n) - } -} - -impl From for NumberOrHex { - fn from(n: u128) -> Self { - NumberOrHex::Hex(n.into()) - } -} - -impl From for NumberOrHex { - fn from(n: U256) -> Self { - NumberOrHex::Hex(n) - } -} - -/// An error type that signals an out-of-range conversion attempt. -pub struct TryFromIntError(pub(crate) ()); - -impl TryFrom for u32 { - type Error = TryFromIntError; - fn try_from(num_or_hex: NumberOrHex) -> Result { - num_or_hex.into_u256().try_into().map_err(|_| TryFromIntError(())) - } -} - -impl TryFrom for u64 { - type Error = TryFromIntError; - fn try_from(num_or_hex: NumberOrHex) -> Result { - num_or_hex.into_u256().try_into().map_err(|_| TryFromIntError(())) - } -} - -impl TryFrom for u128 { - type Error = TryFromIntError; - fn try_from(num_or_hex: NumberOrHex) -> Result { - num_or_hex.into_u256().try_into().map_err(|_| TryFromIntError(())) - } -} - -impl From for U256 { - fn from(num_or_hex: NumberOrHex) -> U256 { - num_or_hex.into_u256() - } -} diff --git a/primitives/src/serde_impls.rs b/primitives/src/serde_impls.rs deleted file mode 100644 index acb8b39aa..000000000 --- a/primitives/src/serde_impls.rs +++ /dev/null @@ -1,889 +0,0 @@ -/* - Copyright 2019 Supercomputing Systems AG - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -//! Re-defintion of substrate primitives that do not implement -//! (De)Serialization in no_std. They can be converted to -//! the original substrate types with From / Into. -//! This may be omitted, if substrate allows serde impls also in no_std: https://github.com/paritytech/substrate/issues/12994 - -use crate::{Block, Hasher, Header}; -use alloc::{format, string::String, vec::Vec}; -use codec::{Decode, Encode, MaxEncodedLen}; -use impl_serde::serialize::{from_hex, FromHexError}; -use primitive_types::{H256, U256}; -use scale_info::TypeInfo; -use serde::{Deserialize, Serialize}; -use sp_core::RuntimeDebug; -use sp_runtime::{traits::Extrinsic, Justification}; -use sp_version::{ApiId, ApisVec}; - -/// Hex-serialized shim for `Vec`. -// https://github.com/paritytech/substrate/blob/5aaf5f42a7850f00b15a14f635b67061d831ac2d/primitives/core/src/lib.rs#L131 -#[derive(PartialEq, Eq, Clone, RuntimeDebug, Serialize, Deserialize, Hash, PartialOrd, Ord)] -pub struct Bytes(#[serde(with = "impl_serde::serialize")] pub Vec); - -impl From> for Bytes { - fn from(s: Vec) -> Self { - Bytes(s) - } -} - -impl core::str::FromStr for Bytes { - type Err = FromHexError; - - fn from_str(s: &str) -> Result { - from_hex(s).map(Bytes) - } -} - -impl From for sp_core::Bytes { - fn from(bytes: Bytes) -> Self { - Self(bytes.0) - } -} - -impl From for Bytes { - fn from(bytes: sp_core::Bytes) -> Self { - Self(bytes.0) - } -} - -/// Storage key. -// https://github.com/paritytech/substrate/blob/cd2fdcf85eb96c53ce2a5d418d4338eb92f5d4f5/primitives/storage/src/lib.rs#L41-L43 -#[derive( - PartialEq, - Eq, - RuntimeDebug, - Serialize, - Deserialize, - Hash, - PartialOrd, - Ord, - Clone, - Encode, - Decode, -)] -pub struct StorageKey(#[serde(with = "impl_serde::serialize")] pub Vec); - -impl From> for StorageKey { - fn from(s: Vec) -> Self { - StorageKey(s) - } -} - -impl AsRef<[u8]> for StorageKey { - fn as_ref(&self) -> &[u8] { - self.0.as_ref() - } -} - -impl From for sp_core::storage::StorageKey { - fn from(storage_key: StorageKey) -> Self { - Self(storage_key.0) - } -} - -impl From for StorageKey { - fn from(storage_key: sp_core::storage::StorageKey) -> Self { - Self(storage_key.0) - } -} - -/// Storage data associated to a [`StorageKey`]. -// https://github.com/paritytech/substrate/blob/cd2fdcf85eb96c53ce2a5d418d4338eb92f5d4f5/primitives/storage/src/lib.rs#L148-L150 -#[derive( - PartialEq, - Eq, - RuntimeDebug, - Serialize, - Deserialize, - Hash, - PartialOrd, - Ord, - Clone, - Encode, - Decode, - Default, -)] -pub struct StorageData(#[serde(with = "impl_serde::serialize")] pub Vec); - -impl From for sp_core::storage::StorageData { - fn from(storage_data: StorageData) -> Self { - Self(storage_data.0) - } -} - -impl From for StorageData { - fn from(storage_data: sp_core::storage::StorageData) -> Self { - Self(storage_data.0) - } -} - -/// Storage change set -#[derive(RuntimeDebug, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "camelCase")] -pub struct StorageChangeSet { - /// Block hash - pub block: Hash, - /// A list of changes - pub changes: Vec<(StorageKey, Option)>, -} - -impl From> for sp_core::storage::StorageChangeSet { - fn from(storage_change_set: StorageChangeSet) -> Self { - Self { - block: storage_change_set.block, - changes: storage_change_set - .changes - .iter() - .map(|(key, maybe_data)| { - (key.clone().into(), maybe_data.as_ref().map(|data| data.clone().into())) - }) - .collect(), - } - } -} - -impl From> for StorageChangeSet { - fn from(storage_change_set: sp_core::storage::StorageChangeSet) -> Self { - Self { - block: storage_change_set.block, - changes: storage_change_set - .changes - .into_iter() - .map(|(key, maybe_data)| { - let key: StorageKey = key.into(); - let maybe_data: Option = maybe_data.map(|data| data.into()); - (key, maybe_data) - }) - .collect(), - } - } -} - -/// Runtime version. -/// This should not be thought of as classic Semver (major/minor/tiny). -/// This triplet have different semantics and mis-interpretation could cause problems. -/// In particular: bug fixes should result in an increment of `spec_version` and possibly -/// `authoring_version`, absolutely not `impl_version` since they change the semantics of the -/// runtime. -// https://github.com/paritytech/substrate/blob/1b3ddae9dec6e7653b5d6ef0179df1af831f46f0/primitives/version/src/lib.rs#L152-L215 -// FIXME: For now RuntimeVersion conversion is not implemented to the substrate RuntimeVersion. -// It's a little more complicated because of the RuntimeString, which is different in no_std than in std mode. -#[derive( - Clone, PartialEq, Eq, Default, sp_runtime::RuntimeDebug, TypeInfo, Serialize, Deserialize, -)] -#[serde(rename_all = "camelCase")] -pub struct RuntimeVersion { - /// Identifies the different Substrate runtimes. There'll be at least polkadot and node. - /// A different on-chain spec_name to that of the native runtime would normally result - /// in node not attempting to sync or author blocks. - pub spec_name: String, - - /// Name of the implementation of the spec. This is of little consequence for the node - /// and serves only to differentiate code of different implementation teams. For this - /// codebase, it will be parity-polkadot. If there were a non-Rust implementation of the - /// Polkadot runtime (e.g. C++), then it would identify itself with an accordingly different - /// `impl_name`. - pub impl_name: String, - - /// `authoring_version` is the version of the authorship interface. An authoring node - /// will not attempt to author blocks unless this is equal to its native runtime. - pub authoring_version: u32, - - /// Version of the runtime specification. A full-node will not attempt to use its native - /// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, - /// `spec_version` and `authoring_version` are the same between Wasm and native. - pub spec_version: u32, - - /// Version of the implementation of the specification. Nodes are free to ignore this; it - /// serves only as an indication that the code is different; as long as the other two versions - /// are the same then while the actual code may be different, it is nonetheless required to - /// do the same thing. - /// Non-consensus-breaking optimizations are about the only changes that could be made which - /// would result in only the `impl_version` changing. - pub impl_version: u32, - - /// List of supported API "features" along with their versions. - #[serde( - serialize_with = "apis_serialize::serialize", - deserialize_with = "apis_serialize::deserialize" - )] - pub apis: ApisVec, - //pub apis: alloc::borrow::Cow<'static, [([u8; 8], u32)]>, - /// All existing dispatches are fully compatible when this number doesn't change. If this - /// number changes, then `spec_version` must change, also. - /// - /// This number must change when an existing dispatchable (module ID, dispatch ID) is changed, - /// either through an alteration in its user-level semantics, a parameter - /// added/removed/changed, a dispatchable being removed, a module being removed, or a - /// dispatchable/module changing its index. - /// - /// It need *not* change when a new module is added or when a dispatchable is added. - pub transaction_version: u32, - - /// Version of the state implementation used by this runtime. - /// Use of an incorrect version is consensus breaking. - pub state_version: u8, -} - -/// Abstraction over a substrate block and justification. -// https://github.com/paritytech/substrate/blob/fafc8e0ba8c98bd22b47913ded414e74a0fcb67f/primitives/runtime/src/generic/block.rs -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[serde(deny_unknown_fields)] -pub struct SignedBlock { - /// Full block. - pub block: Block, - /// Block justification. - pub justifications: Option, -} - -impl From> for SignedBlock { - fn from(signed_block: sp_runtime::generic::SignedBlock) -> Self { - Self { - block: signed_block.block, - justifications: signed_block.justifications.map(|justifactions| justifactions.into()), - } - } -} - -impl From> for sp_runtime::generic::SignedBlock { - fn from(signed_block: SignedBlock) -> Self { - Self { - block: signed_block.block, - justifications: signed_block.justifications.map(|justifactions| justifactions.into()), - } - } -} - -/// Collection of justifications for a given block, multiple justifications may -/// be provided by different consensus engines for the same block. -// https://github.com/paritytech/substrate/blob/fafc8e0ba8c98bd22b47913ded414e74a0fcb67f/primitives/runtime/src/lib.rs#L125-L127 -#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, Serialize, Deserialize)] -pub struct Justifications(pub Vec); - -impl From for Justifications { - fn from(justifications: sp_runtime::Justifications) -> Self { - let mut justification_vec = Vec::new(); - for justification in justifications.iter() { - justification_vec.push(justification.clone()); - } - Self(justification_vec) - } -} - -impl From for sp_runtime::Justifications { - fn from(justifications: Justifications) -> Self { - let first_justifaction = justifications.0[0].clone(); - let mut sp_runtime_justifications: sp_runtime::Justifications = first_justifaction.into(); - for justification in justifications.0 { - sp_runtime_justifications.append(justification); - } - sp_runtime_justifications - } -} - -/// The old (deprecated) weight type. -// https://github.com/paritytech/substrate/blob/d0540a79967cb06cd7598a4965c7c06afc788b0c/primitives/weights/src/lib.rs#L78 -#[derive( - Decode, - Encode, - PartialEq, - Eq, - Clone, - Copy, - RuntimeDebug, - Default, - TypeInfo, - Serialize, - Deserialize, -)] -#[serde(transparent)] -pub struct OldWeight(pub u64); - -/// New weight type. -// https://github.com/paritytech/substrate/blob/7bbfe737a180e548ace7e819099dcb62cf48fa11/primitives/weights/src/weight_v2.rs#L25-L36 -#[derive( - Encode, - Decode, - MaxEncodedLen, - TypeInfo, - Eq, - PartialEq, - Copy, - Clone, - RuntimeDebug, - Default, - Serialize, - Deserialize, -)] -pub struct Weight { - #[codec(compact)] - /// The weight of computational time used based on some reference hardware. - ref_time: u64, - #[codec(compact)] - /// The weight of storage space used by proof of validity. - proof_size: u64, -} - -impl Weight { - /// Set the reference time part of the weight. - pub const fn set_ref_time(mut self, c: u64) -> Self { - self.ref_time = c; - self - } - - /// Set the storage size part of the weight. - pub const fn set_proof_size(mut self, c: u64) -> Self { - self.proof_size = c; - self - } - - /// Return the reference time part of the weight. - pub const fn ref_time(&self) -> u64 { - self.ref_time - } - - /// Return the storage size part of the weight. - pub const fn proof_size(&self) -> u64 { - self.proof_size - } - - /// Construct [`Weight`] from weight parts, namely reference time and proof size weights. - pub const fn from_parts(ref_time: u64, proof_size: u64) -> Self { - Self { ref_time, proof_size } - } - - /// Construct [`Weight`] from the same weight for all parts. - pub const fn from_all(value: u64) -> Self { - Self { ref_time: value, proof_size: value } - } - - /// Return a [`Weight`] where all fields are zero. - pub const fn zero() -> Self { - Self { ref_time: 0, proof_size: 0 } - } -} - -impl From for Weight { - fn from(weight: sp_weights::Weight) -> Self { - Weight::from_parts(weight.ref_time(), weight.proof_size()) - } -} - -impl From for sp_weights::Weight { - fn from(weight: Weight) -> Self { - sp_weights::Weight::from_parts(weight.ref_time(), weight.proof_size()) - } -} - -// Copied from sp_version (only available in std in the substrate version). -// https://github.com/paritytech/substrate/blob/1b3ddae9dec6e7653b5d6ef0179df1af831f46f0/primitives/version/src/lib.rs#L392-L393 -mod apis_serialize { - use super::*; - use impl_serde::serialize as bytes; - use serde::{de, ser::SerializeTuple, Serializer}; - - #[derive(Serialize)] - struct ApiId<'a>(#[serde(serialize_with = "serialize_bytesref")] &'a super::ApiId, &'a u32); - - pub fn serialize(apis: &ApisVec, ser: S) -> Result - where - S: Serializer, - { - let len = apis.len(); - let mut seq = ser.serialize_tuple(len)?; - for (api, ver) in &**apis { - seq.serialize_element(&ApiId(api, ver))?; - } - seq.end() - } - - pub fn serialize_bytesref(&apis: &&super::ApiId, ser: S) -> Result - where - S: Serializer, - { - bytes::serialize(apis, ser) - } - - #[derive(Deserialize)] - struct ApiIdOwned(#[serde(deserialize_with = "deserialize_bytes")] super::ApiId, u32); - - pub fn deserialize<'de, D>(deserializer: D) -> Result - where - D: de::Deserializer<'de>, - { - struct Visitor; - impl<'de> de::Visitor<'de> for Visitor { - type Value = ApisVec; - - fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result { - formatter.write_str("a sequence of api id and version tuples") - } - - fn visit_seq(self, mut visitor: V) -> Result - where - V: de::SeqAccess<'de>, - { - let mut apis = Vec::new(); - while let Some(value) = visitor.next_element::()? { - apis.push((value.0, value.1)); - } - Ok(apis.into()) - } - } - deserializer.deserialize_seq(Visitor) - } - - pub fn deserialize_bytes<'de, D>(d: D) -> Result - where - D: de::Deserializer<'de>, - { - let mut arr = [0; 8]; - bytes::deserialize_check_len(d, bytes::ExpectedLen::Exact(&mut arr[..]))?; - Ok(arr) - } -} - -#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] -pub struct SubstrateOpaqueExtrinsic(Vec); - -impl SubstrateOpaqueExtrinsic { - /// Convert an encoded extrinsic to an `SubstrateOpaqueExtrinsic`. - pub fn from_bytes(mut bytes: &[u8]) -> Result { - Self::decode(&mut bytes) - } -} - -impl ::serde::Serialize for SubstrateOpaqueExtrinsic { - fn serialize(&self, seq: S) -> Result - where - S: ::serde::Serializer, - { - self.using_encoded(|bytes| ::impl_serde::serialize::serialize(bytes, seq)) - } -} - -impl<'a> ::serde::Deserialize<'a> for SubstrateOpaqueExtrinsic { - fn deserialize(de: D) -> Result - where - D: ::serde::Deserializer<'a>, - { - let r = impl_serde::serialize::deserialize(de)?; - Decode::decode(&mut &r[..]) - .map_err(|e| ::serde::de::Error::custom(format!("Decode error: {}", e))) - } -} - -impl Extrinsic for SubstrateOpaqueExtrinsic { - type Call = (); - type SignaturePayload = (); -} - -/// A generic Substrate block type, adapted from `sp_runtime::generic::Block`. -#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SubstrateBlock { - /// The block header. - pub header: H, - /// The accompanying extrinsics. - pub extrinsics: Vec, -} - -impl Block for SubstrateBlock -where - H: Header, - E: Extrinsic + Encode + Serialize, -{ - type Extrinsic = E; - type Header = H; - type Hasher = ::Hasher; - - fn header(&self) -> &Self::Header { - &self.header - } - fn extrinsics(&self) -> &[Self::Extrinsic] { - &self.extrinsics[..] - } - fn deconstruct(self) -> (Self::Header, Vec) { - (self.header, self.extrinsics) - } - fn new(header: Self::Header, extrinsics: Vec) -> Self { - SubstrateBlock { header, extrinsics } - } - fn encode_from(header: &Self::Header, extrinsics: &[Self::Extrinsic]) -> Vec { - (header, extrinsics).encode() - } -} - -// Copied from subxt. -// https://github.com/paritytech/subxt/blob/ce0a82e3227efb0eae131f025da5f839d9623e15/subxt/src/config/substrate.rs -/// A type that can hash values using the blaks2_256 algorithm. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode)] -pub struct BlakeTwo256; - -impl Hasher for BlakeTwo256 { - type Output = H256; - fn hash(s: &[u8]) -> Self::Output { - sp_core_hashing::blake2_256(s).into() - } -} - -/// A generic Substrate header type, adapted from `sp_runtime::generic::Header`. -/// The block number and hasher can be configured to adapt this for other nodes. -#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SubstrateHeader + TryFrom, H: Hasher> { - /// The parent hash. - pub parent_hash: H::Output, - /// The block number. - #[serde(serialize_with = "serialize_number", deserialize_with = "deserialize_number")] - #[codec(compact)] - pub number: N, - /// The state trie merkle root - pub state_root: H::Output, - /// The merkle root of the extrinsics. - pub extrinsics_root: H::Output, - /// A chain-specific digest of data useful for light clients or referencing auxiliary data. - pub digest: Digest, -} - -impl Header for SubstrateHeader -where - N: Copy + Into + Into + TryFrom + Encode, - H: Hasher + Encode, - SubstrateHeader: Encode, -{ - type Number = N; - type Hasher = H; - fn number(&self) -> Self::Number { - self.number - } -} - -/// Generic header digest. From `sp_runtime::generic::digest`. -#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, Serialize, Deserialize, Default)] -pub struct Digest { - /// A list of digest items. - pub logs: Vec, -} - -/// Digest item that is able to encode/decode 'system' digest items and -/// provide opaque access to other items. From `sp_runtime::generic::digest`. -#[derive(Debug, PartialEq, Eq, Clone)] -pub enum DigestItem { - /// A pre-runtime digest. - /// - /// These are messages from the consensus engine to the runtime, although - /// the consensus engine can (and should) read them itself to avoid - /// code and state duplication. It is erroneous for a runtime to produce - /// these, but this is not (yet) checked. - /// - /// NOTE: the runtime is not allowed to panic or fail in an `on_initialize` - /// call if an expected `PreRuntime` digest is not present. It is the - /// responsibility of a external block verifier to check this. Runtime API calls - /// will initialize the block without pre-runtime digests, so initialization - /// cannot fail when they are missing. - PreRuntime(ConsensusEngineId, Vec), - - /// A message from the runtime to the consensus engine. This should *never* - /// be generated by the native code of any consensus engine, but this is not - /// checked (yet). - Consensus(ConsensusEngineId, Vec), - - /// Put a Seal on it. This is only used by native code, and is never seen - /// by runtimes. - Seal(ConsensusEngineId, Vec), - - /// Some other thing. Unsupported and experimental. - Other(Vec), - - /// An indication for the light clients that the runtime execution - /// environment is updated. - /// - /// Currently this is triggered when: - /// 1. Runtime code blob is changed or - /// 2. `heap_pages` value is changed. - RuntimeEnvironmentUpdated, -} - -// From sp_runtime::generic, DigestItem enum indexes are encoded using this: -#[repr(u32)] -#[derive(Encode, Decode)] -enum DigestItemType { - Other = 0u32, - Consensus = 4u32, - Seal = 5u32, - PreRuntime = 6u32, - RuntimeEnvironmentUpdated = 8u32, -} -impl Encode for DigestItem { - fn encode(&self) -> Vec { - let mut v = Vec::new(); - - match self { - Self::Consensus(val, data) => { - DigestItemType::Consensus.encode_to(&mut v); - (val, data).encode_to(&mut v); - }, - Self::Seal(val, sig) => { - DigestItemType::Seal.encode_to(&mut v); - (val, sig).encode_to(&mut v); - }, - Self::PreRuntime(val, data) => { - DigestItemType::PreRuntime.encode_to(&mut v); - (val, data).encode_to(&mut v); - }, - Self::Other(val) => { - DigestItemType::Other.encode_to(&mut v); - val.encode_to(&mut v); - }, - Self::RuntimeEnvironmentUpdated => { - DigestItemType::RuntimeEnvironmentUpdated.encode_to(&mut v); - }, - } - - v - } -} -impl Decode for DigestItem { - fn decode(input: &mut I) -> Result { - let item_type: DigestItemType = Decode::decode(input)?; - match item_type { - DigestItemType::PreRuntime => { - let vals: (ConsensusEngineId, Vec) = Decode::decode(input)?; - Ok(Self::PreRuntime(vals.0, vals.1)) - }, - DigestItemType::Consensus => { - let vals: (ConsensusEngineId, Vec) = Decode::decode(input)?; - Ok(Self::Consensus(vals.0, vals.1)) - }, - DigestItemType::Seal => { - let vals: (ConsensusEngineId, Vec) = Decode::decode(input)?; - Ok(Self::Seal(vals.0, vals.1)) - }, - DigestItemType::Other => Ok(Self::Other(Decode::decode(input)?)), - DigestItemType::RuntimeEnvironmentUpdated => Ok(Self::RuntimeEnvironmentUpdated), - } - } -} - -/// Consensus engine unique ID. From `sp_runtime::ConsensusEngineId`. -pub type ConsensusEngineId = [u8; 4]; - -impl serde::Serialize for DigestItem { - fn serialize(&self, seq: S) -> Result - where - S: serde::Serializer, - { - self.using_encoded(|bytes| impl_serde::serialize::serialize(bytes, seq)) - } -} - -impl<'a> serde::Deserialize<'a> for DigestItem { - fn deserialize(de: D) -> Result - where - D: serde::Deserializer<'a>, - { - let r = impl_serde::serialize::deserialize(de)?; - Decode::decode(&mut &r[..]) - .map_err(|e| serde::de::Error::custom(format!("Decode error: {e}"))) - } -} - -fn serialize_number + TryFrom>( - val: &T, - s: S, -) -> Result -where - S: serde::Serializer, -{ - let u256: U256 = (*val).into(); - serde::Serialize::serialize(&u256, s) -} - -fn deserialize_number<'a, D, T: Copy + Into + TryFrom>(d: D) -> Result -where - D: serde::Deserializer<'a>, -{ - // At the time of writing, Smoldot gives back block numbers in numeric rather - // than hex format. So let's support deserializing from both here: - use crate::rpc_numbers::NumberOrHex; - let number_or_hex = NumberOrHex::deserialize(d)?; - let u256 = number_or_hex.into_u256(); - TryFrom::try_from(u256).map_err(|_| serde::de::Error::custom("Try from failed")) -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::UncheckedExtrinsicV4; - use codec::Encode; - use core::str::FromStr; - use node_template_runtime::{BalancesCall, RuntimeCall, SignedExtra}; - use primitive_types::H256; - use sp_core::crypto::Ss58Codec; - use sp_runtime::{testing::sr25519, AccountId32, MultiAddress, MultiSignature}; - - #[test] - fn from_substrate_bytes_to_bytes_works() { - let string = "0x12341560"; - let bytes = Bytes::from_str(string).unwrap(); - let substrate_bytes: sp_core::Bytes = bytes.clone().into(); - let original_bytes: Bytes = substrate_bytes.into(); - - assert_eq!(original_bytes, bytes); - } - - #[test] - fn from_substrate_storage_data_to_storage_data_works() { - let test_vec = "test_string".encode(); - let storage_data = StorageData(test_vec); - let substrate_storage_data: sp_core::storage::StorageData = storage_data.clone().into(); - let original_storage_data: StorageData = substrate_storage_data.into(); - - assert_eq!(original_storage_data, storage_data); - } - - #[test] - fn from_substrate_storage_key_to_storage_key_works() { - let test_vec = "test_string".encode(); - let storage_key = StorageKey(test_vec); - let substrate_storage_key: sp_core::storage::StorageKey = storage_key.clone().into(); - let original_storage_key: StorageKey = substrate_storage_key.into(); - - assert_eq!(original_storage_key, storage_key); - } - - #[test] - fn from_substrate_change_set_to_change_set_works() { - let test_vec = "test_data".encode(); - let storage_data = StorageData(test_vec); - let test_vec = "test_key".encode(); - let storage_key = StorageKey(test_vec); - let changes = vec![(storage_key, Some(storage_data))]; - let hash = H256::random(); - - let change_set = StorageChangeSet { block: hash, changes: changes.clone() }; - - let substrate_change_set: sp_core::storage::StorageChangeSet = change_set.into(); - let original_change_set: StorageChangeSet = substrate_change_set.into(); - - assert_eq!(original_change_set.block, hash); - assert_eq!(original_change_set.changes, changes); - } - - #[test] - fn from_substrate_justifications_to_justification_works() { - let encoded_justifcation = "test_string".encode(); - let consensus_engine_id: [u8; 4] = [1, 2, 3, 4]; - let justification: Justification = (consensus_engine_id, encoded_justifcation); - let justifications = Justifications(vec![justification]); - - let substrate_justifications: sp_runtime::Justifications = justifications.clone().into(); - let original_justifications: Justifications = substrate_justifications.into(); - - assert_eq!(original_justifications, justifications); - } - - #[test] - fn from_substrate_signed_block_to_signed_block_works() { - let block = "test_string".encode(); - let encoded_justifcation = "test_string".encode(); - let consensus_engine_id: [u8; 4] = [1, 2, 3, 4]; - let justification: Justification = (consensus_engine_id, encoded_justifcation); - let justifications = Some(Justifications(vec![justification])); - - let signed_block = SignedBlock { block, justifications }; - - let substrate_signed_block: sp_runtime::generic::SignedBlock> = - signed_block.clone().into(); - let original_signed_block: SignedBlock> = substrate_signed_block.into(); - - assert_eq!(original_signed_block, signed_block); - } - - #[test] - fn deserialize_header_works() { - let header_json = r#" - { - "digest": { - "logs": [] - }, - "extrinsicsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", - "number": 4, - "parentHash": "0xcb2690b2c85ceab55be03fc7f7f5f3857e7efeb7a020600ebd4331e10be2f7a5", - "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000" - } - "#; - - let header: SubstrateHeader = - serde_json::from_str(header_json).expect("valid block header"); - assert_eq!(header.number(), 4); - } - #[test] - fn deserialize_block_works() { - //header - let header = SubstrateHeader:: { - parent_hash: BlakeTwo256::hash(b"1000"), - number: 2000, - state_root: BlakeTwo256::hash(b"3000"), - extrinsics_root: BlakeTwo256::hash(b"4000"), - digest: Digest { logs: vec![] }, - }; - - //extrinsic - let bob: AccountId32 = - sr25519::Public::from_ss58check("5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty") - .unwrap() - .into(); - let bob = MultiAddress::Id(bob); - - let call1 = RuntimeCall::Balances(BalancesCall::force_transfer { - source: bob.clone(), - dest: bob.clone(), - value: 10, - }); - let xt1 = UncheckedExtrinsicV4::< - MultiAddress, - RuntimeCall, - MultiSignature, - SignedExtra, - >::new_unsigned(call1.clone()); - - //Block - let extrinsics = vec![xt1]; - let block = SubstrateBlock::new(header.clone(), extrinsics.clone()); - - //serialize - let json = serde_json::to_string(&block).expect("serializing failed"); - let block_des: SubstrateBlock< - SubstrateHeader, - UncheckedExtrinsicV4< - MultiAddress, - RuntimeCall, - MultiSignature, - SignedExtra, - >, - > = serde_json::from_str(&json).expect("deserializing failed"); - let header_des = block_des.header; - assert_eq!(header, header_des); - let extrinsics_des = block_des.extrinsics; - assert_eq!(extrinsics_des, extrinsics); - } -} diff --git a/primitives/src/types.rs b/primitives/src/types.rs index a2785b942..8cbe6cf76 100644 --- a/primitives/src/types.rs +++ b/primitives/src/types.rs @@ -160,7 +160,7 @@ impl FeeDetails { #[serde(rename_all = "camelCase")] #[serde(bound(serialize = "Balance: core::fmt::Display, Weight: Serialize"))] #[serde(bound(deserialize = "Balance: core::str::FromStr, Weight: Deserialize<'de>"))] -pub struct RuntimeDispatchInfo { +pub struct RuntimeDispatchInfo { /// Weight of this dispatch. pub weight: Weight, /// Class of this dispatch. diff --git a/src/api/api_client.rs b/src/api/api_client.rs index 0481cd531..4b6fc6be4 100644 --- a/src/api/api_client.rs +++ b/src/api/api_client.rs @@ -18,11 +18,13 @@ use crate::{ }; use ac_compose_macros::rpc_params; use ac_node_api::metadata::Metadata; -use ac_primitives::{Bytes, Config, ExtrinsicParams, RuntimeVersion, SignExtrinsic}; +use ac_primitives::{Config, ExtrinsicParams, SignExtrinsic}; use codec::Decode; use core::convert::TryFrom; use frame_metadata::RuntimeMetadataPrefixed; use log::{debug, info}; +use sp_core::Bytes; +use sp_version::RuntimeVersion; /// Api to talk with substrate-nodes /// diff --git a/src/api/mod.rs b/src/api/mod.rs index 1df1e822b..c057f372b 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -16,9 +16,9 @@ */ use ac_node_api::EventDetails; -use ac_primitives::Bytes; use alloc::{string::String, vec::Vec}; use serde::{Deserialize, Serialize}; +use sp_core::Bytes; pub use api_client::Api; pub use error::{Error, Result}; diff --git a/src/api/rpc_api/author.rs b/src/api/rpc_api/author.rs index 2af9dda7e..c7668d753 100644 --- a/src/api/rpc_api/author.rs +++ b/src/api/rpc_api/author.rs @@ -19,10 +19,12 @@ use crate::{ Api, ExtrinsicReport, TransactionStatus, XtStatus, }; use ac_compose_macros::rpc_params; -use ac_primitives::{config::Config, Bytes, Hasher, UncheckedExtrinsicV4}; +use ac_primitives::{config::Config, UncheckedExtrinsicV4}; use codec::Encode; use log::*; use serde::de::DeserializeOwned; +use sp_core::Bytes; +use sp_runtime::traits::Hash as HashTrait; pub type TransactionSubscriptionFor = ::Subscription>; diff --git a/src/api/rpc_api/chain.rs b/src/api/rpc_api/chain.rs index 86706bcbc..ca79d90eb 100644 --- a/src/api/rpc_api/chain.rs +++ b/src/api/rpc_api/chain.rs @@ -17,10 +17,11 @@ use crate::{ Error, }; use ac_compose_macros::rpc_params; -use ac_primitives::{config::Config, SignedBlock}; +use ac_primitives::config::Config; use alloc::vec::Vec; use log::*; use serde::de::DeserializeOwned; +use sp_runtime::generic::SignedBlock; #[maybe_async::maybe_async(?Send)] pub trait GetChainInfo { diff --git a/src/api/rpc_api/events.rs b/src/api/rpc_api/events.rs index f0a0dee44..e348e646f 100644 --- a/src/api/rpc_api/events.rs +++ b/src/api/rpc_api/events.rs @@ -18,12 +18,14 @@ use crate::{ }; use ac_compose_macros::rpc_params; use ac_node_api::{metadata::Metadata, EventDetails, EventRecord, Events, Phase}; -use ac_primitives::{config::Config, Block, Hasher, StorageChangeSet}; +use ac_primitives::config::Config; use alloc::{vec, vec::Vec}; use codec::{Decode, Encode}; use core::marker::PhantomData; use log::*; use serde::de::DeserializeOwned; +use sp_runtime::traits::{Block, Hash}; +use sp_storage::StorageChangeSet; pub type EventSubscriptionFor = EventSubscription<::Subscription>, Hash>; @@ -223,13 +225,18 @@ mod tests { use super::*; use crate::rpc::mocks::RpcClientMock; use ac_node_api::{metadata::Metadata, test_utils::*}; - use ac_primitives::{Bytes, PolkadotConfig, RuntimeVersion, SignedBlock, StorageData}; + use ac_primitives::PolkadotConfig; use codec::{Decode, Encode}; use frame_metadata::RuntimeMetadataPrefixed; use kitchensink_runtime::{BalancesCall, RuntimeCall, UncheckedExtrinsic}; use scale_info::TypeInfo; - use sp_core::{crypto::Ss58Codec, sr25519, H256}; - use sp_runtime::{generic::Block, AccountId32, MultiAddress}; + use sp_core::{crypto::Ss58Codec, sr25519, Bytes, H256}; + use sp_runtime::{ + generic::{Block, SignedBlock}, + AccountId32, MultiAddress, + }; + use sp_storage::StorageData; + use sp_version::RuntimeVersion; use std::{collections::HashMap, fs}; #[derive(Clone, Copy, Debug, PartialEq, Decode, Encode, TypeInfo)] diff --git a/src/api/rpc_api/frame_system.rs b/src/api/rpc_api/frame_system.rs index 59998b26e..9c0ef14fe 100644 --- a/src/api/rpc_api/frame_system.rs +++ b/src/api/rpc_api/frame_system.rs @@ -18,9 +18,10 @@ use crate::{ rpc::Request, }; use ac_compose_macros::rpc_params; -use ac_primitives::{config::Config, AccountInfo, StorageKey}; +use ac_primitives::{config::Config, AccountInfo}; use alloc::{string::String, vec::Vec}; use log::*; +use sp_storage::StorageKey; #[maybe_async::maybe_async(?Send)] pub trait GetAccountInformation { diff --git a/src/api/rpc_api/pallet_transaction_payment.rs b/src/api/rpc_api/pallet_transaction_payment.rs index 251508a9e..9959967b8 100644 --- a/src/api/rpc_api/pallet_transaction_payment.rs +++ b/src/api/rpc_api/pallet_transaction_payment.rs @@ -15,10 +15,10 @@ use crate::{ rpc::Request, }; use ac_compose_macros::rpc_params; -use ac_primitives::{ - config::Config, Bytes, FeeDetails, InclusionFee, NumberOrHex, RuntimeDispatchInfo, -}; +use ac_primitives::{config::Config, FeeDetails, InclusionFee, RuntimeDispatchInfo}; use core::str::FromStr; +use sp_core::Bytes; +use sp_rpc::number::NumberOrHex; /// Interface to common calls of the substrate transaction payment pallet. #[maybe_async::maybe_async(?Send)] diff --git a/src/api/rpc_api/state.rs b/src/api/rpc_api/state.rs index a2820104c..688f934f0 100644 --- a/src/api/rpc_api/state.rs +++ b/src/api/rpc_api/state.rs @@ -17,11 +17,12 @@ use crate::{ }; use ac_compose_macros::rpc_params; use ac_node_api::MetadataError; -use ac_primitives::{config::Config, StorageChangeSet, StorageData, StorageKey}; +use ac_primitives::config::Config; use alloc::{string::String, vec, vec::Vec}; use codec::{Decode, Encode}; use log::*; use serde::de::DeserializeOwned; +use sp_storage::{StorageChangeSet, StorageData, StorageKey}; pub type StorageChangeSetSubscriptionFor = ::Subscription>; diff --git a/src/extrinsic/contracts.rs b/src/extrinsic/contracts.rs index e4cb6ea4b..8e99b0f65 100644 --- a/src/extrinsic/contracts.rs +++ b/src/extrinsic/contracts.rs @@ -21,14 +21,21 @@ // FIXME: This module is currently outdated. See https://github.com/scs/substrate-api-client/issues/435. +#[cfg(feature = "std")] use crate::{api::Api, rpc::Request}; +#[cfg(feature = "std")] use ac_compose_macros::compose_extrinsic; +#[cfg(feature = "std")] use ac_primitives::{ - config::Config, extrinsic_params::ExtrinsicParams, extrinsics::CallIndex, SignExtrinsic, - UncheckedExtrinsicV4, + config::Config, extrinsic_params::ExtrinsicParams, SignExtrinsic, UncheckedExtrinsicV4, }; +#[cfg(feature = "std")] use alloc::vec::Vec; -use codec::{Compact, Encode}; +#[cfg(feature = "std")] +use codec::Encode; + +use ac_primitives::CallIndex; +use codec::Compact; pub const CONTRACTS_MODULE: &str = "Contracts"; pub const PUT_CODE: &str = "put_code"; diff --git a/src/lib.rs b/src/lib.rs index b94245541..c609b1e7d 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,8 +19,8 @@ extern crate alloc; -use ac_primitives::StorageKey; use sp_core::twox_128; +use sp_storage::StorageKey; pub use ac_compose_macros; pub use ac_node_api; diff --git a/test-no-std/Cargo.toml b/test-no-std/Cargo.toml index 18de4e025..daf9f3f9d 100644 --- a/test-no-std/Cargo.toml +++ b/test-no-std/Cargo.toml @@ -14,8 +14,46 @@ ac-node-api = { path = "../node-api", default-features = false, optional = true, ac-primitives = { path = "../primitives", default-features = false, optional = true, features = ["disable_target_static_assertions"] } substrate-api-client = { path = "..", default-features = false, optional = true, features = ["disable_target_static_assertions", "sync-api"] } +sp-application-crypto = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-arithmetic = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-consensus-babe = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-consensus-beefy = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-consensus-grandpa = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-consensus-slots = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-core = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde", "full_crypto"] } +sp-mmr-primitives = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-npos-elections = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-runtime = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-storage = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-test-primitives = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-version = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } +sp-weights = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, optional = true, features = ["serde"] } + # substrate dependencies -sp-io = { default-features = false, features = ["disable_oom", "disable_panic_handler"], git = "https://github.com/paritytech/substrate.git", branch = "master" } +sp-io = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, features = ["disable_oom", "disable_panic_handler"] } +sp-runtime-interface = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", default-features = false, features = ["disable_target_static_assertions"] } + +# sp-application-crypto = { path = "../../../haerdib/substrate/primitives/application-crypto", default-features = false, optional = true, features = ["serde"] } +# sp-arithmetic = { path = "../../../haerdib/substrate/primitives/arithmetic", default-features = false, optional = true, features = ["serde"] } +# sp-consensus-beefy = { path = "../../../haerdib/substrate/primitives/consensus/beefy", default-features = false, optional = true, features = ["serde"] } +# sp-consensus-babe = { path = "../../../haerdib/substrate/primitives/consensus/babe", default-features = false, optional = true, features = ["serde"] } +# sp-consensus-slots = { path = "../../../haerdib/substrate/primitives/consensus/slots", default-features = false, optional = true, features = ["serde"] } +# sp-core = { path = "../../../haerdib/substrate/primitives/core", default-features = false, optional = true, features = ["serde", "full_crypto"] } +# sp-consensus-grandpa = { path = "../../../haerdib/substrate/primitives/consensus/grandpa", default-features = false, optional = true, features = ["serde"] } +# sp-mmr-primitives = { path = "../../../haerdib/substrate/primitives/merkle-mountain-range", default-features = false, optional = true, features = ["serde"] } +# sp-npos-elections = { path = "../../../haerdib/substrate/primitives/npos-elections", default-features = false, optional = true, features = ["serde"] } +# sp-rpc = { path = "../../../haerdib/substrate/primitives/rpc", default-features = false, optional = true } +# sp-runtime = { path = "../../../haerdib/substrate/primitives/runtime", default-features = false, optional = true, features = ["serde"] } +# sp-serializer = { path = "../../../haerdib/substrate/primitives/serializer", default-features = false, optional = true } +# sp-storage = { path = "../../../haerdib/substrate/primitives/storage", default-features = false, optional = true, features = ["serde"] } +# sp-test-primitives = { path = "../../../haerdib/substrate/primitives/test-primitives", default-features = false, optional = true, features = ["serde"] } +# sp-version = { path = "../../../haerdib/substrate/primitives/version", default-features = false, optional = true, features = ["serde"] } +# sp-weights = { path = "../../../haerdib/substrate/primitives/weights", default-features = false, optional = true } +# # +# # +# # # substrate dependencies +# sp-io = { path = "../../../haerdib/substrate/primitives/io", default-features = false, features = ["disable_oom", "disable_panic_handler"] } +# sp-runtime-interface = { path = "../../../haerdib/substrate/primitives/runtime-interface", default-features = false, features = ["disable_target_static_assertions"] } [features] # It is better to test the no-std crates standalone (don't enable both features at the same time) because dependency @@ -24,3 +62,17 @@ api-client = ["substrate-api-client"] compose-macros = ["ac-compose-macros"] node-api = ["ac-node-api"] primitives = ["ac-primitives"] +application-crypto = ["sp-application-crypto"] +arithmetic = ["sp-arithmetic"] +beefy = ["sp-consensus-beefy"] +babe = ["sp-consensus-babe"] +slots = ["sp-consensus-slots"] +core = ["sp-core"] +finality-grandpa = ["sp-consensus-grandpa"] +mmr = ["sp-mmr-primitives"] +npos-elections = ["sp-npos-elections"] +runtime = ["sp-runtime"] +storage = ["sp-storage"] +test-primitives = ["sp-test-primitives"] +version = ["sp-version"] +weights = ["sp-weights"] diff --git a/test-no-std/src/main.rs b/test-no-std/src/main.rs index e20bc919f..89bbf8e6b 100644 --- a/test-no-std/src/main.rs +++ b/test-no-std/src/main.rs @@ -3,16 +3,6 @@ #![no_std] #![no_main] -#[cfg(not(any( - feature = "api-client", - feature = "node-api", - feature = "compose-macros", - feature = "primitives" -)))] -compile_error!( - "either feature \"api-client\", \"compose-macro\", or feature \"node-api\" must be enabled" -); - // DUTs #[cfg(feature = "api-client")] @@ -27,6 +17,51 @@ extern crate ac_node_api; #[cfg(feature = "primitives")] extern crate ac_primitives; +#[cfg(feature = "application-crypto")] +extern crate sp_application_crypto; + +#[cfg(feature = "arithmetic")] +extern crate sp_arithmetic; + +#[cfg(feature = "beefy")] +extern crate sp_consensus_beefy; + +#[cfg(feature = "babe")] +extern crate sp_consensus_babe; + +#[cfg(feature = "slots")] +extern crate sp_consensus_slots; + +#[cfg(feature = "core")] +extern crate sp_core; + +#[cfg(feature = "core")] +use sp_core::crypto::{Pair, Public, Ss58Codec}; + +#[cfg(feature = "finality-grandpa")] +extern crate sp_consensus_grandpa; + +#[cfg(feature = "mmr")] +extern crate sp_mmr_primitives; + +#[cfg(feature = "npos-elections")] +extern crate sp_npos_elections; + +#[cfg(feature = "runtime")] +extern crate sp_runtime; + +#[cfg(feature = "storage")] +extern crate sp_storage; + +#[cfg(feature = "test-primitives")] +extern crate sp_test_primitives; + +#[cfg(feature = "version")] +extern crate sp_version; + +#[cfg(feature = "weights")] +extern crate sp_weights; + // The libc crate allows importing functions from C. extern crate libc; use core::{ @@ -49,7 +84,6 @@ pub extern "C" fn main(_nargs: i32, _args: *const *const u8) -> i32 { unsafe { printf(b"Hello, World!\n" as *const u8); } - // Exit with a return status of 0. 0 } diff --git a/test-no-std/substrate.sh b/test-no-std/substrate.sh new file mode 100755 index 000000000..a93c02da7 --- /dev/null +++ b/test-no-std/substrate.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -euo pipefail + +echo "[+] Testing Application Crypto" +cargo build --release -p test-no-std --features application-crypto +echo "[+] Testing arithmetic" +cargo build --release -p test-no-std --features arithmetic +echo "[+] Testing beefy" +cargo build --release -p test-no-std --features beefy +echo "[+] Testing babe" +cargo build --release -p test-no-std --features babe +echo "[+] Testing slots" +cargo build --release -p test-no-std --features slots +echo "[+] Testing core" +cargo build --release -p test-no-std --features core +echo "[+] Testing finality-grandpa" +cargo build --release -p test-no-std --features finality-grandpa +echo "[+] Testing mmr" +cargo build --release -p test-no-std --features mmr +echo "[+] Testing npos-elections" +cargo build --release -p test-no-std --features npos-elections +echo "[+] Testing rpc" +cargo build --release -p test-no-std --features rpc +echo "[+] Testing runtime" +cargo build --release -p test-no-std --features runtime +echo "[+] Testing serializer" +cargo build --release -p test-no-std --features serializer +echo "[+] Testing test-primitives" +cargo build --release -p test-no-std --features test-primitives +echo "[+] Testing version" +cargo build --release -p test-no-std --features version +echo "[+] Testing weights" +cargo build --release -p test-no-std --features weights +echo "[+] Testing keystore" +cargo build --release -p test-no-std --features keystore diff --git a/testing/Cargo.toml b/testing/Cargo.toml index 4ad4a05fd..30ca89cc3 100644 --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -14,19 +14,19 @@ tokio = { version = "1.24", features = ["rt-multi-thread", "macros", "time"] } wabt = "0.10.0" # Substrate dependencies -frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -kitchensink-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +frame-support = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +frame-system = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +kitchensink-runtime = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } sp-core = { features = [ "full_crypto", -], git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-staking = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-version = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-identity = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -pallet-staking = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-keyring = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-runtime = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-staking = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +sp-version = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-balances = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-identity = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } +pallet-staking = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" } # local deps substrate-api-client = { path = "..", features = [