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

Renames frame crate to polkadot-sdk-frame #3813

Merged
merged 32 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d8e6233
Initial changes
gupnik Mar 22, 2024
0e2f694
Further changes
gupnik Mar 26, 2024
5a2ec92
Adds PrDoc
gupnik Mar 26, 2024
458205d
Fmt
gupnik Mar 26, 2024
ca90b7f
Fixes frame example
gupnik Mar 26, 2024
550ab70
Fixes stg
gupnik Mar 26, 2024
6c9cb60
Fixes path
gupnik Mar 26, 2024
9cc892f
Fixes template
gupnik Mar 26, 2024
1eb6cfc
Updates doc links
gupnik Mar 26, 2024
33a6590
Updates doc links
gupnik Mar 26, 2024
0866b5f
Fmt
gupnik Mar 26, 2024
7aeb3d9
Merge branch 'master' into gupnik/frame-crate-rename
codekitz Mar 26, 2024
42df1ac
Fixes doc link
gupnik Mar 26, 2024
fd6bad2
Fixes doc link
gupnik Mar 26, 2024
7bdb934
Fixes doc link and taplo
gupnik Mar 26, 2024
2cf4e20
Adds ability to use either frame or polkadot-sdk-frame
gupnik Apr 1, 2024
7192bcc
Uses renamed crate in docs
gupnik Apr 1, 2024
77912f9
Uses renamed crate in template
gupnik Apr 1, 2024
69f5bbe
Merge branch 'master' of github.com:paritytech/polkadot-sdk into gupn…
gupnik Apr 1, 2024
ba183b3
Removes changes in docs
gupnik Apr 1, 2024
01cd2c8
Removes changes in example
gupnik Apr 1, 2024
23f9c12
Removes changes in template node
gupnik Apr 1, 2024
8161793
Removes changes in stg
gupnik Apr 1, 2024
3971887
Adds bump in prdoc
gupnik Apr 1, 2024
c6333be
Update substrate/frame/support/procedural/tools/src/lib.rs
codekitz Apr 1, 2024
2dbd88d
Update substrate/frame/support/procedural/tools/src/lib.rs
codekitz Apr 1, 2024
f81bacb
Update substrate/utils/frame/rpc/support/src/lib.rs
codekitz Apr 1, 2024
c117a87
Addresses review comments
gupnik Apr 1, 2024
174bd64
Fmt
gupnik Apr 1, 2024
749eec3
Adds test and updates docs
gupnik Apr 3, 2024
40daf88
Merge branch 'master' of github.com:paritytech/polkadot-sdk into gupn…
gupnik Apr 3, 2024
8af848e
Fmt
gupnik Apr 3, 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
70 changes: 35 additions & 35 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion docs/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ workspace = true
# Needed for all FRAME-based code
parity-scale-codec = { version = "3.0.0", default-features = false }
scale-info = { version = "2.6.0", default-features = false }
frame = { path = "../../substrate/frame", features = [
polkadot-sdk-frame = { path = "../../substrate/frame", features = [
gupnik marked this conversation as resolved.
Show resolved Hide resolved
"experimental",
"runtime",
] }
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "frame"
version = "0.0.1-dev"
name = "polkadot-sdk-frame"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/examples/frame-crate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }

frame = { path = "../..", default-features = false, features = ["experimental", "runtime"] }
polkadot-sdk-frame = { path = "../..", default-features = false, features = ["experimental", "runtime"] }


[features]
default = ["std"]
std = ["codec/std", "frame/std", "scale-info/std"]
std = ["codec/std", "polkadot-sdk-frame/std", "scale-info/std"]
6 changes: 3 additions & 3 deletions substrate/frame/examples/frame-crate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use frame::prelude::*;
use polkadot_sdk_frame::prelude::*;

#[frame::pallet(dev_mode)]
#[polkadot_sdk_frame::pallet(dev_mode)]
pub mod pallet {
use super::*;

Expand Down Expand Up @@ -46,7 +46,7 @@ pub mod pallet {
#[cfg(test)]
mod tests {
use crate::pallet as my_pallet;
use frame::testing_prelude::*;
use polkadot_sdk_frame::testing_prelude::*;

construct_runtime!(
pub enum Runtime {
Expand Down
8 changes: 4 additions & 4 deletions substrate/frame/support/procedural/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,9 @@ pub fn storage_alias(attributes: TokenStream, input: TokenStream) -> TokenStream
"{}::macro_magic",
match generate_access_from_frame_or_crate("frame-support") {
Ok(path) => Ok(path),
Err(_) => generate_access_from_frame_or_crate("frame"),
Err(_) => generate_access_from_frame_or_crate("polkadot-sdk-frame"),
}
.expect("Failed to find either `frame-support` or `frame` in `Cargo.toml` dependencies.")
.expect("Failed to find either `frame-support` or `polkadot-sdk-frame` in `Cargo.toml` dependencies.")
.to_token_stream()
.to_string()
)
Expand Down Expand Up @@ -1181,9 +1181,9 @@ pub fn pallet_section(attr: TokenStream, tokens: TokenStream) -> TokenStream {
"{}::macro_magic",
match generate_access_from_frame_or_crate("frame-support") {
Ok(path) => Ok(path),
Err(_) => generate_access_from_frame_or_crate("frame"),
Err(_) => generate_access_from_frame_or_crate("polkadot-sdk-frame"),
}
.expect("Failed to find either `frame-support` or `frame` in `Cargo.toml` dependencies.")
.expect("Failed to find either `frame-support` or `polkadot-sdk-frame` in `Cargo.toml` dependencies.")
.to_token_stream()
.to_string()
)
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/support/procedural/tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn generate_crate_access(unique_id: &str, def_crate: &str) -> TokenStream {
/// We want to know if whatever the `path` takes us to, is exported from `frame` or not. In that
/// case `path` would start with `frame`, something like `frame::x::y:z`.
pub fn is_using_frame_crate(path: &syn::Path) -> bool {
path.segments.first().map(|s| s.ident == "frame").unwrap_or(false)
path.segments.first().map(|s| s.ident == "polkadot-sdk-frame").unwrap_or(false)
}

/// Generate the crate access for the crate using 2018 syntax.
Expand Down Expand Up @@ -114,7 +114,7 @@ pub fn generate_hidden_includes(unique_id: &str, def_crate: &str) -> TokenStream
/// Generates the path to the frame crate deps.
fn get_frame_crate_path(def_crate: &str) -> Option<syn::Path> {
// This does not work if the frame crate is renamed.
if let Ok(FoundCrate::Name(name)) = crate_name(&"frame") {
if let Ok(FoundCrate::Name(name)) = crate_name(&"polkadot-sdk-frame") {
let path = format!("{}::deps::{}", name, def_crate.to_string().replace("-", "_"));
Some(syn::parse_str::<syn::Path>(&path).expect("is a valid path; qed"))
} else {
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/support/test/stg_frame_crate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
frame = { path = "../../..", default-features = false, features = ["experimental", "runtime"] }
polkadot-sdk-frame = { path = "../../..", default-features = false, features = ["experimental", "runtime"] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }

[features]
default = ["std"]
std = ["codec/std", "frame/std", "scale-info/std"]
std = ["codec/std", "polkadot-sdk-frame/std", "scale-info/std"]
2 changes: 1 addition & 1 deletion substrate/frame/support/test/stg_frame_crate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// ! A basic pallet to test it compiles along with a runtime using it when `frame_system` and
// `frame_support` are reexported by a `frame` crate.

use frame::deps::{frame_support, frame_system};
use polkadot_sdk_frame::deps::{frame_support, frame_system};

#[frame_support::pallet]
pub mod pallet {
Expand Down
2 changes: 1 addition & 1 deletion substrate/primitives/api/proc-macro/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn generate_crate_access() -> TokenStream {
quote!(#renamed_name::__private)
},
Err(e) =>
if let Ok(FoundCrate::Name(name)) = crate_name(&"frame") {
if let Ok(FoundCrate::Name(name)) = crate_name(&"polkadot-sdk-frame") {
let path = format!("{}::deps::sp_api::__private", name);
let path = syn::parse_str::<syn::Path>(&path).expect("is a valid path; qed");
quote!( #path )
Expand Down
2 changes: 1 addition & 1 deletion templates/minimal/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ substrate-frame-rpc-system = { path = "../../../substrate/utils/frame/rpc/system

# Once the native runtime is gone, there should be little to no dependency on FRAME here, and
# certainly no dependency on the runtime.
frame = { path = "../../../substrate/frame", features = [
polkadot-sdk-frame = { path = "../../../substrate/frame", features = [
"experimental",
"runtime",
] }
Expand Down
2 changes: 1 addition & 1 deletion templates/minimal/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn development_config() -> Result<ChainSpec, String> {

/// Configure initial storage state for FRAME pallets.
fn testnet_genesis() -> Value {
use frame::traits::Get;
use polkadot_sdk_frame::traits::Get;
use runtime::interface::{Balance, MinimumBalance};
let endowment = <MinimumBalance as Get<Balance>>::get().max(1) * 1000;
let balances = AccountKeyring::iter()
Expand Down
4 changes: 2 additions & 2 deletions templates/minimal/pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = [
scale-info = { version = "2.10.0", default-features = false, features = [
"derive",
] }
frame = { path = "../../../../substrate/frame", default-features = false, features = [
polkadot-sdk-frame = { path = "../../../../substrate/frame", default-features = false, features = [
"experimental",
"runtime",
] }


[features]
default = ["std"]
std = ["codec/std", "frame/std", "scale-info/std"]
std = ["codec/std", "polkadot-sdk-frame/std", "scale-info/std"]
8 changes: 4 additions & 4 deletions templates/minimal/pallets/template/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
//! A shell pallet built with [`frame`].
//! A shell pallet built with [`polkadot_sdk_frame`].

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

use frame::prelude::*;
use polkadot_sdk_frame::deps::frame_support;

// Re-export all pallet parts, this is needed to properly import the pallet into the runtime.
pub use pallet::*;

#[frame::pallet]
#[frame_support::pallet]
pub mod pallet {
use super::*;

#[pallet::config]
pub trait Config: frame_system::Config {}
pub trait Config: polkadot_sdk_frame::deps::frame_system::Config {}

#[pallet::pallet]
pub struct Pallet<T>(_);
Expand Down
4 changes: 2 additions & 2 deletions templates/minimal/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ parity-scale-codec = { version = "3.0.0", default-features = false }
scale-info = { version = "2.6.0", default-features = false }

# this is a frame-based runtime, thus importing `frame` with runtime feature enabled.
frame = { path = "../../../substrate/frame", default-features = false, features = [
polkadot-sdk-frame = { path = "../../../substrate/frame", default-features = false, features = [
"experimental",
"runtime",
] }
Expand All @@ -44,7 +44,7 @@ std = [
"parity-scale-codec/std",
"scale-info/std",

"frame/std",
"polkadot-sdk-frame/std",

"pallet-balances/std",
"pallet-sudo/std",
Expand Down
8 changes: 4 additions & 4 deletions templates/minimal/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

use frame::{
use polkadot_sdk_frame::{
deps::frame_support::{
genesis_builder_helper::{build_config, create_default_config},
weights::{FixedFee, NoFee},
Expand Down Expand Up @@ -111,7 +111,7 @@ impl pallet_transaction_payment::Config for Runtime {

impl pallet_minimal_template::Config for Runtime {}

type Block = frame::runtime::types_common::BlockOf<Runtime, SignedExtra>;
type Block = polkadot_sdk_frame::runtime::types_common::BlockOf<Runtime, SignedExtra>;
type Header = HeaderFor<Runtime>;

type RuntimeExecutive =
Expand Down Expand Up @@ -238,10 +238,10 @@ 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_frame::deps::frame_system;

pub type Block = super::Block;
pub use frame::runtime::types_common::OpaqueBlock;
pub use polkadot_sdk_frame::runtime::types_common::OpaqueBlock;
pub type AccountId = <Runtime as frame_system::Config>::AccountId;
pub type Nonce = <Runtime as frame_system::Config>::Nonce;
pub type Hash = <Runtime as frame_system::Config>::Hash;
Expand Down
Loading