Introduce Polkadot-Sdk developer_hub (#2102)

This PR introduces the new crate `developer_hub` into the polkadot-sdk
repo. The vision for the developer-hub crate is detailed in [this
document](https://docs.google.com/document/d/1XLLkFNE8v8HLvZpI2rzsa8N2IN1FcKntc8q-Sc4xBAk/edit?usp=sharing).

<img width="1128" alt="Screenshot 2023-11-02 at 10 45 48"
src="https://github.com/paritytech/polkadot-sdk/assets/5588131/1e12b60f-fef5-42c4-8503-a3ba234077c3">


Other than adding the new crate, it also does the following: 

* Remove the `substrate` crate, as there is now a unique umbrella crate
for multiple things in `developer_hub::polkadot_sdk`.
* (backport candidate) A minor change to `frame-support` macros that
allows `T::RuntimeOrigin` to also be acceptable as the origin type.
* (backport candidate) A minor change to `frame-system` that allows us
to deposit events at genesis because now the real genesis config is
generated via wasm, and we can safely assume `cfg!(feature = "std")`
means only testing. related to #62.
* (backport candidate) Introduces a small `read_events_for_pallet` to
`frame_system` for easier event reading in tests.
* From https://github.com/paritytech/polkadot-sdk-docs/issues/31, it
takes action on improving the `pallet::call` docs.
* From https://github.com/paritytech/polkadot-sdk-docs/issues/31, it
takes action on improving the `UncheckedExtrinsic` docs.

## Way Forward

First, a version of this is deployed temporarily
[here](https://blog.kianenigma.nl/polkadot-sdk/developer_hub/index.html).
I will keep it up to date on a daily basis.

### This Pull Request

I see two ways forward: 

1. We acknowledge that everything in `developer-hub` is going to be WIP,
and merge this asap. We should not yet use links to this crate anywhere.
2. We make this be the feature branch, make PRs against this, and either
gradually backport it, or only merge to master once it is done.

I am personally in favor of option 1. If we stick to option 2, we need a
better way to deploy a staging version of this to gh-pages.

### Issue Tracking

The main issues related to the future of `developer_hub` are: 

- https://github.com/paritytech/polkadot-sdk-docs/issues/31
- https://github.com/paritytech/polkadot-sdk-docs/issues/4
- https://github.com/paritytech/polkadot-sdk-docs/issues/26 
- https://github.com/paritytech/polkadot-sdk-docs/issues/32
- https://github.com/paritytech/polkadot-sdk-docs/issues/36


### After This Pull Request

- [ ] create a redirect for
https://paritytech.github.io/polkadot-sdk/master/substrate/
- [x] analytics 
- [ ] link checker
- [ ] the matter of publishing, and how all of these relative links for
when we do, that is still an open question. There is section on this in
the landing page.
- [ ] updated https://paritytech.github.io/

---------

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: Juan Girini <juangirini@gmail.com>
Co-authored-by: bader y <ibnbassem@gmail.com>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
Co-authored-by: James Wilson <james@jsdw.me>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
This commit is contained in:
Kian Paimani
2023-11-30 14:15:46 +03:00
committed by GitHub
parent 180a6ad9b0
commit eaf1bc5633
96 changed files with 3409 additions and 470 deletions
+23 -13
View File
@@ -15,10 +15,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! > Made for [![polkadot]](https://polkadot.network)
//!
//! [polkadot]: https://img.shields.io/badge/polkadot-E6007A?style=for-the-badge&logo=polkadot&logoColor=white
//!
//! # FRAME
//!
//! ```no_compile
@@ -34,14 +30,21 @@
//! > **F**ramework for **R**untime **A**ggregation of **M**odularized **E**ntities: Substrate's
//! > State Transition Function (Runtime) Framework.
//!
//! ## Documentation
//!
//! See [`polkadot_sdk::frame`](../developer_hub/polkadot_sdk/frame_runtime/index.html).
//!
//! ## Warning: Experimental
//!
//! This crate and all of its content is experimental, and should not yet be used in production.
//!
//! ## Getting Started
//! ## Underlying dependencies
//!
//! TODO: link to `developer_hub::polkadot_sdk::frame`. The `developer_hub` hasn't been published
//! yet, this can be updated once it is linkable.
//! This crate is an amalgamation of multiple other crates that are often used together to compose a
//! pallet. It is not necessary to use it, and it may fall short for certain purposes.
//!
//! In short, this crate only re-exports types and traits from multiple sources. All of these
//! sources are listed (and re-exported again) in [`deps`].
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg(feature = "experimental")]
@@ -54,9 +57,19 @@
/// `#[pallet::bar]` inside the mod.
pub use frame_support::pallet;
pub use frame_support::pallet_macros::{import_section, pallet_section};
/// The logging library of the runtime. Can normally be the classic `log` crate.
pub use log;
/// A list of all macros used within the main [`pallet`] macro.
///
/// Note: All of these macros are "stubs" and not really usable outside `#[pallet] mod pallet { ..
/// }`. They are mainly provided for documentation and IDE support.
pub mod pallet_macros {
pub use frame_support::{derive_impl, pallet, pallet_macros::*};
}
/// The main prelude of FRAME.
///
/// This prelude should almost always be the first line of code in any pallet or runtime.
@@ -78,9 +91,6 @@ pub mod prelude {
/// Pallet prelude of `frame-support`.
///
/// Note: this needs to revised once `frame-support` evolves.
// `frame-support` will be break down https://github.com/paritytech/polkadot-sdk/issues/127 and its reexports will
// most likely change. These wildcard reexportings can be optimized once `frame-support` has
// changed.
#[doc(no_inline)]
pub use frame_support::pallet_prelude::*;
@@ -156,6 +166,9 @@ pub mod runtime {
/// Types to define your runtime version.
pub use sp_version::{create_runtime_str, runtime_version, RuntimeVersion};
/// Macro to implement runtime APIs.
pub use sp_api::impl_runtime_apis;
#[cfg(feature = "std")]
pub use sp_version::NativeVersion;
}
@@ -180,9 +193,6 @@ pub mod runtime {
pub use sp_inherents::{CheckInherentsResult, InherentData};
pub use sp_runtime::ApplyExtrinsicResult;
/// Macro to implement runtime APIs.
pub use sp_api::impl_runtime_apis;
pub use frame_system_rpc_runtime_api::*;
pub use sp_api::{self, *};
pub use sp_block_builder::*;