Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use umbrella crate for minimal template #5155

Merged
merged 59 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
275b4d3
Use umbrella crate for minimal template
pgherveou Jul 26, 2024
6630adc
Add missing cargo changes
pgherveou Jul 26, 2024
93d6364
format cargo.toml with taplo
pgherveou Jul 26, 2024
694294d
Update cargo.toml formatting (2)
pgherveou Jul 26, 2024
a7c49f0
remove minimal/Cargo.toml
pgherveou Jul 26, 2024
b6d704d
Update cargo.toml
pgherveou Jul 26, 2024
64910cf
Add experimental feature flag
pgherveou Jul 26, 2024
1ef3029
Fix minimal template pallet::config check
pgherveou Jul 28, 2024
59167aa
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
pgherveou Jul 28, 2024
d96d3b2
a few fixes from kian
kianenigma Aug 13, 2024
4341776
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 13, 2024
8cea3d8
fix toml
kianenigma Aug 13, 2024
122d3f2
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 14, 2024
ce2238c
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 15, 2024
0cdcdcf
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pg/u…
kianenigma Aug 15, 2024
472c7d9
fix and prdoc
kianenigma Aug 15, 2024
24d5e5c
Merge branch 'pg/use-umbrella-crate-for-minimal-template' of github.c…
kianenigma Aug 15, 2024
903ab6f
Merge branch 'master' of github.com:paritytech/polkadot-sdk into pg/u…
kianenigma Aug 16, 2024
4a4e46a
docs
kianenigma Aug 16, 2024
53fa677
fix feature
kianenigma Aug 16, 2024
24cf78c
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 16, 2024
e9cbcb3
Test fix CI clippy job
pgherveou Aug 20, 2024
525abf6
Tweak experimental flag for tests
pgherveou Aug 20, 2024
4a60415
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
pgherveou Aug 20, 2024
9b71984
Fix clippy
pgherveou Aug 21, 2024
ea08cc2
Fix clippy 2
pgherveou Aug 21, 2024
4867813
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
pgherveou Aug 21, 2024
9f60b3a
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 21, 2024
9867d6b
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 22, 2024
3e5f624
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 23, 2024
6a9ad9e
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
pgherveou Aug 23, 2024
3f88968
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 23, 2024
09fd0a5
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 25, 2024
055ee73
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 26, 2024
9076909
use no-default-features for anyhow
pgherveou Aug 26, 2024
e987766
taplo fix
pgherveou Aug 26, 2024
0f5e103
fix revive
pgherveou Aug 26, 2024
6093140
Do not add pallet-contracts when arch = riscv
pgherveou Aug 26, 2024
5d270ac
fixed anyhow dep
pgherveou Aug 26, 2024
3ede08d
Fix prdoc
pgherveou Aug 26, 2024
69968aa
Patch generate-umbrella for crate that do not support riscv
pgherveou Aug 26, 2024
7b1d5e6
Add missing pallet prdoc complains about
pgherveou Aug 26, 2024
bb7f6f9
add missing :
pgherveou Aug 26, 2024
2829fc5
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 26, 2024
3bc01aa
fix fmt
pgherveou Aug 26, 2024
69d998e
fix missing default features
pgherveou Aug 26, 2024
f87dd47
Revert "fix missing default features"
pgherveou Aug 27, 2024
1dc603d
Update Cargo.toml
pgherveou Aug 27, 2024
5928b87
fixes
pgherveou Aug 27, 2024
f6c0d2b
fix
pgherveou Aug 27, 2024
4f4256a
Rollback changes and update polkadot-sdk feature flags
pgherveou Aug 27, 2024
6c3f759
Update substrate/frame/revive/src/wasm/runtime.rs
pgherveou Aug 27, 2024
6fc20c3
rollback package.metadata.polkadot-sdk changes
pgherveou Aug 27, 2024
4677583
use runtime-full instead of runtime
pgherveou Aug 27, 2024
7031a43
Update umbrella
pgherveou Aug 27, 2024
80f4dd0
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
kianenigma Aug 27, 2024
5eff776
Update features runtime
pgherveou Aug 27, 2024
bb30654
Merge branch 'master' into pg/use-umbrella-crate-for-minimal-template
pgherveou Aug 28, 2024
fac0344
Update Cargo.lock
pgherveou Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 3 additions & 32 deletions Cargo.lock

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

31 changes: 1 addition & 30 deletions templates/minimal/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,7 @@ futures-timer = { workspace = true }
jsonrpsee = { features = ["server"], workspace = true }
serde_json = { workspace = true, default-features = true }

sc-cli = { workspace = true, default-features = true }
sc-executor = { workspace = true, default-features = true }
sc-network = { workspace = true, default-features = true }
sc-service = { workspace = true, default-features = true }
sc-telemetry = { workspace = true, default-features = true }
sc-transaction-pool = { workspace = true, default-features = true }
sc-transaction-pool-api = { workspace = true, default-features = true }
sc-consensus = { workspace = true, default-features = true }
sc-consensus-manual-seal = { workspace = true, default-features = true }
sc-rpc-api = { workspace = true, default-features = true }
sc-basic-authorship = { workspace = true, default-features = true }
sc-offchain = { workspace = true, default-features = true }
sc-client-api = { workspace = true, default-features = true }

sp-timestamp = { workspace = true, default-features = true }
sp-keyring = { workspace = true, default-features = true }
sp-api = { workspace = true, default-features = true }
sp-blockchain = { workspace = true, default-features = true }
sp-block-builder = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
sp-runtime = { workspace = true, default-features = true }

substrate-frame-rpc-system = { workspace = true, default-features = true }

# Once the native runtime is gone, there should be little to no dependency on FRAME here, and
# certainly no dependency on the runtime.
frame = { features = [
"experimental",
"runtime",
], workspace = true, default-features = true }
polkadot-sdk = { workspace = true, features = ["node"] }
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
minimal-template-runtime = { workspace = true }

[build-dependencies]
Expand Down
7 changes: 5 additions & 2 deletions templates/minimal/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
// limitations under the License.

use minimal_template_runtime::{BalancesConfig, SudoConfig, WASM_BINARY};
use sc_service::{ChainType, Properties};
use polkadot_sdk::{
sc_service::{ChainType, Properties},
sp_keyring::AccountKeyring,
*,
};
use serde_json::{json, Value};
use sp_keyring::AccountKeyring;

/// This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec;
Expand Down
2 changes: 1 addition & 1 deletion templates/minimal/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use sc_cli::RunCmd;
use polkadot_sdk::{sc_cli::RunCmd, *};

#[derive(Debug, Clone)]
pub enum Consensus {
Expand Down
3 changes: 1 addition & 2 deletions templates/minimal/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use crate::{
cli::{Cli, Subcommand},
service,
};
use sc_cli::SubstrateCli;
use sc_service::PartialComponents;
use polkadot_sdk::{sc_cli::SubstrateCli, sc_service::PartialComponents, *};

#[cfg(feature = "try-runtime")]
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
Expand Down
2 changes: 1 addition & 1 deletion templates/minimal/node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ mod command;
mod rpc;
mod service;

fn main() -> sc_cli::Result<()> {
fn main() -> polkadot_sdk::sc_cli::Result<()> {
command::run()
}
11 changes: 7 additions & 4 deletions templates/minimal/node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@

use jsonrpsee::RpcModule;
use minimal_template_runtime::interface::{AccountId, Nonce, OpaqueBlock};
use sc_transaction_pool_api::TransactionPool;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use polkadot_sdk::{
sc_transaction_pool_api::TransactionPool,
sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata},
*,
};
use std::sync::Arc;

pub use sc_rpc_api::DenyUnsafe;
pub use polkadot_sdk::sc_rpc_api::DenyUnsafe;

/// Full client dependencies.
pub struct FullDeps<C, P> {
Expand Down Expand Up @@ -57,7 +60,7 @@ where
C::Api: substrate_frame_rpc_system::AccountNonceApi<OpaqueBlock, AccountId, Nonce>,
P: TransactionPool + 'static,
{
use substrate_frame_rpc_system::{System, SystemApiServer};
use polkadot_sdk::substrate_frame_rpc_system::{System, SystemApiServer};
let mut module = RpcModule::new(());
let FullDeps { client, pool, deny_unsafe } = deps;

Expand Down
15 changes: 9 additions & 6 deletions templates/minimal/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@

use futures::FutureExt;
use minimal_template_runtime::{interface::OpaqueBlock as Block, RuntimeApi};
use sc_client_api::backend::Backend;
use sc_executor::WasmExecutor;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_runtime::traits::Block as BlockT;
use polkadot_sdk::{
sc_client_api::backend::Backend,
sc_executor::WasmExecutor,
sc_service::{error::Error as ServiceError, Configuration, TaskManager},
sc_telemetry::{Telemetry, TelemetryWorker},
sc_transaction_pool_api::OffchainTransactionPoolFactory,
sp_runtime::traits::Block as BlockT,
*,
};
use std::sync::Arc;

use crate::cli::Consensus;
Expand Down
15 changes: 4 additions & 11 deletions templates/minimal/pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,11 @@ publish = false
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { features = [
"derive",
], workspace = true }
scale-info = { features = [
"derive",
], workspace = true }
frame = { features = [
"experimental",
"runtime",
], workspace = true }
codec = { features = ["derive"], workspace = true }
scale-info = { features = ["derive"], workspace = true }
polkadot-sdk = { workspace = true, default-features = false, features = ["runtime", "experimental"] }


[features]
default = ["std"]
std = ["codec/std", "frame/std", "scale-info/std"]
std = ["codec/std", "polkadot-sdk/std", "scale-info/std"]
3 changes: 2 additions & 1 deletion templates/minimal/pallets/template/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#![cfg_attr(not(feature = "std"), no_std)]

use frame::prelude::*;
use polkadot_sdk::{polkadot_sdk_frame as frame, polkadot_sdk_frame::prelude::*};

// Re-export all pallet parts, this is needed to properly import the pallet into the runtime.
pub use pallet::*;
Expand All @@ -15,6 +15,7 @@ pub mod pallet {
use super::*;

#[pallet::config]
#[pallet::disable_frame_system_supertrait_check]
pgherveou marked this conversation as resolved.
Show resolved Hide resolved
pub trait Config: frame_system::Config {}

#[pallet::pallet]
Expand Down
34 changes: 3 additions & 31 deletions templates/minimal/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,19 @@ publish = false
[dependencies]
codec = { workspace = true }
scale-info = { workspace = true }

# this is a frame-based runtime, thus importing `frame` with runtime feature enabled.
frame = { features = [
"experimental",
"runtime",
], workspace = true }

# pallets that we want to use
pallet-balances = { workspace = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }

# genesis builder that allows us to interact with runtime genesis config
sp-genesis-builder = { workspace = true }
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
sp-runtime = { features = ["serde"], workspace = true }
polkadot-sdk = { workspace = true, features = ["runtime"] }

# local pallet templates
pallet-minimal-template = { workspace = true }

[build-dependencies]
substrate-wasm-builder = { optional = true, workspace = true, default-features = true }
polkadot-sdk = { optional = true, workspace = true, features = ["substrate-wasm-builder"] }

[features]
default = ["std"]
std = [
"codec/std",
"scale-info/std",

"frame/std",

"pallet-balances/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",

"polkadot-sdk/std",
"pallet-minimal-template/std",

"sp-genesis-builder/std",
"sp-runtime/std",
"substrate-wasm-builder",
]
2 changes: 1 addition & 1 deletion templates/minimal/runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
fn main() {
#[cfg(feature = "std")]
{
substrate_wasm_builder::WasmBuilder::build_using_defaults();
polkadot_sdk::substrate_wasm_builder::WasmBuilder::build_using_defaults();
}
}
28 changes: 16 additions & 12 deletions templates/minimal/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,24 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
extern crate alloc;

use alloc::{vec, vec::Vec};
use frame::{
deps::frame_support::{
genesis_builder_helper::{build_state, get_preset},
runtime,
weights::{FixedFee, NoFee},
},
prelude::*,
runtime::{
apis::{
self, impl_runtime_apis, ApplyExtrinsicResult, CheckInherentsResult,
ExtrinsicInclusionMode, OpaqueMetadata,
use polkadot_sdk::{
polkadot_sdk_frame as frame,
polkadot_sdk_frame::{
deps::frame_support::{
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
genesis_builder_helper::{build_state, get_preset},
runtime,
weights::{FixedFee, NoFee},
},
prelude::*,
runtime::{
apis::{
self, impl_runtime_apis, ApplyExtrinsicResult, CheckInherentsResult,
ExtrinsicInclusionMode, OpaqueMetadata,
},
prelude::*,
},
},
*,
};

/// The runtime version.
Expand Down Expand Up @@ -296,7 +300,7 @@ impl_runtime_apis! {
// https://github.com/paritytech/substrate/issues/10579#issuecomment-1600537558
pub mod interface {
use super::Runtime;
use frame::deps::frame_system;
use polkadot_sdk::{polkadot_sdk_frame as frame, *};

pub type Block = super::Block;
pub use frame::runtime::types_common::OpaqueBlock;
Expand Down
Loading