Skip to content

Commit

Permalink
add substrate no-std test
Browse files Browse the repository at this point in the history
add full crypto to grandpa

test substrate branch

cargo fmt

fix CI

fix .toml

fix toml once again

update lock

make taplo happy

taplo fmt
  • Loading branch information
haerdib committed Mar 10, 2023
1 parent 199dbc0 commit 8226d3b
Show file tree
Hide file tree
Showing 27 changed files with 451 additions and 780 deletions.
342 changes: 217 additions & 125 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ ws = { version = "0.9.2", optional = true, features = ["ssl"] }

# Substrate no_std dependencies
frame-metadata = { default-features = false, git = "https://github.com/paritytech/frame-metadata", features = ["v14", "serde_full", "decode"] }
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 = { default-features = false, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" }
sp-runtime = { default-features = false, features = ["full_crypto", "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 }
Expand All @@ -53,7 +56,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]
Expand All @@ -75,8 +78,11 @@ std = [
# substrate no_std
"frame-metadata/std",
"sp-core/std",
"sp-rpc/std",
"sp-runtime/std",
"sp-runtime-interface/std",
"sp-storage/std",
"sp-version/std",
# substrate std
"frame-support",
# local deps
Expand Down
10 changes: 5 additions & 5 deletions client-keystore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions compose-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
log = { version = "0.4.14", default-features = false }

# 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", "serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" }
sp-runtime = { default-features = false, features = ["full_crypto", "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, git = "https://github.com/paritytech/substrate.git", features = ["full_crypto"], branch = "master" }
sp-application-crypto = { default-features = false, git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives", features = ["full_crypto", "serde"] }

# local
ac-primitives = { path = "../primitives", default-features = false }
Expand Down
20 changes: 10 additions & 10 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ tokio = { version = "1.16", 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 = "..", features = ["tungstenite-client", "ws-client", "staking-xt"] }
10 changes: 6 additions & 4 deletions node-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ serde_json = { version = "1.0.79", default-features = false, features = ["alloc"

# substrate
frame-metadata = { default-features = false, git = "https://github.com/paritytech/frame-metadata", features = ["v14", "serde_full", "decode"] }
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 }
Expand All @@ -47,6 +48,7 @@ std = [
"frame-metadata/std",
"sp-core/std",
"sp-runtime/std",
"sp-storage/std",
# no_std support
"sp-application-crypto/std",
"sp-runtime-interface/std",
Expand Down
2 changes: 1 addition & 1 deletion node-api/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion node-api/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 12 additions & 10 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ 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, git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime = { 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-core = { default-features = false, features = ["full_crypto", "serde"], git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" }
sp-runtime = { default-features = false, features = ["full_crypto", "serde"], 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" }

# 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" }
node-template-runtime = { git = "https://github.com/haerdib/substrate.git", branch = "add-serde-feature-to-primitives" }

[features]
default = ["std"]
Expand All @@ -44,6 +45,7 @@ std = [
"sp-runtime/std",
"sp-staking/std",
"sp-version/std",
"sp-weights/std",
# substrate std
"frame-system",
"pallet-assets",
Expand Down
4 changes: 0 additions & 4 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ extern crate alloc;
pub use extrinsic_params::*;
pub use extrinsics::*;
pub use pallet_traits::*;
pub use rpc_numbers::*;
pub use rpc_params::RpcParams;
pub use serde_impls::*;
pub use types::*;

pub mod extrinsic_params;
pub mod extrinsics;
pub mod pallet_traits;
pub mod rpc_numbers;
pub mod rpc_params;
pub mod serde_impls;
pub mod types;
4 changes: 2 additions & 2 deletions primitives/src/pallet_traits/pallet_staking_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub trait StakingConfig: FrameSystemConfig {
type SessionsPerEra: Get<SessionIndex>;
type BondingDuration: Get<EraIndex>;
type SlashDeferDuration: Get<EraIndex>;
type SlashCancelOrigin;
type AdminOrigin;
type SessionInterface;
type EraPayout;
type NextNewSession;
Expand Down Expand Up @@ -89,7 +89,7 @@ where
type SessionsPerEra = T::SessionsPerEra;
type BondingDuration = T::BondingDuration;
type SlashDeferDuration = T::SlashDeferDuration;
type SlashCancelOrigin = T::SlashCancelOrigin;
type AdminOrigin = T::AdminOrigin;
type SessionInterface = T::SessionInterface;
type EraPayout = T::EraPayout;
type NextNewSession = T::NextNewSession;
Expand Down
113 changes: 0 additions & 113 deletions primitives/src/rpc_numbers.rs

This file was deleted.

Loading

0 comments on commit 8226d3b

Please sign in to comment.