-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 paritytech/polkadot-sdk-docs#31, it takes action on improving the `pallet::call` docs. * From paritytech/polkadot-sdk-docs#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: - paritytech/polkadot-sdk-docs#31 - paritytech/polkadot-sdk-docs#4 - paritytech/polkadot-sdk-docs#26 - paritytech/polkadot-sdk-docs#32 - paritytech/polkadot-sdk-docs#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 <[email protected]> Co-authored-by: Juan Girini <[email protected]> Co-authored-by: bader y <[email protected]> Co-authored-by: Sebastian Kunert <[email protected]> Co-authored-by: James Wilson <[email protected]> Co-authored-by: Michal Kucharczyk <[email protected]>
- Loading branch information
1 parent
180a6ad
commit eaf1bc5
Showing
96 changed files
with
3,410 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
[package] | ||
name = "developer-hub" | ||
description = "The one stop shop for developers of the polakdot-sdk" | ||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" | ||
homepage = "paritytech.github.io" | ||
repository.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
# This crate is not publish-able to crates.io for now because of docify. | ||
publish = false | ||
version = "0.0.1" | ||
|
||
[dependencies] | ||
# 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 = ["runtime", "experimental"] } | ||
pallet-examples = { path = "../substrate/frame/examples" } | ||
pallet-default-config-example = { path = "../substrate/frame/examples/default-config" } | ||
|
||
# How we build docs in rust-docs | ||
simple-mermaid = { git = "https://github.com/kianenigma/simple-mermaid.git", branch = "main" } | ||
docify = "0.2.6" | ||
|
||
# Polkadot SDK deps, typically all should only be scope such that we can link to their doc item. | ||
node-cli = { package = "staging-node-cli", path = "../substrate/bin/node/cli" } | ||
kitchensink-runtime = { path = "../substrate/bin/node/runtime" } | ||
chain-spec-builder = { package = "staging-chain-spec-builder", path = "../substrate/bin/utils/chain-spec-builder" } | ||
subkey = { path = "../substrate/bin/utils/subkey" } | ||
|
||
# Substrate | ||
sc-network = { path = "../substrate/client/network" } | ||
sc-rpc-api = { path = "../substrate/client/rpc-api" } | ||
sc-rpc = { path = "../substrate/client/rpc" } | ||
sc-client-db = { path = "../substrate/client/db" } | ||
sc-cli = { path = "../substrate/client/cli" } | ||
sc-consensus-aura = { path = "../substrate/client/consensus/aura" } | ||
sc-consensus-babe = { path = "../substrate/client/consensus/babe" } | ||
sc-consensus-grandpa = { path = "../substrate/client/consensus/grandpa" } | ||
sc-consensus-beefy = { path = "../substrate/client/consensus/beefy" } | ||
sc-consensus-manual-seal = { path = "../substrate/client/consensus/manual-seal" } | ||
sc-consensus-pow = { path = "../substrate/client/consensus/pow" } | ||
substrate-wasm-builder = { path = "../substrate/utils/wasm-builder" } | ||
|
||
# Cumulus | ||
cumulus-pallet-aura-ext = { path = "../cumulus/pallets/aura-ext" } | ||
cumulus-pallet-parachain-system = { path = "../cumulus/pallets/parachain-system", features = [ | ||
"parameterized-consensus-hook", | ||
] } | ||
parachain-info = { package = "staging-parachain-info", path = "../cumulus/parachains/pallets/parachain-info" } | ||
pallet-aura = { path = "../substrate/frame/aura", default-features = false } | ||
pallet-timestamp = { path = "../substrate/frame/timestamp" } | ||
|
||
# Primitives | ||
sp-io = { path = "../substrate/primitives/io" } | ||
sp-api = { path = "../substrate/primitives/api" } | ||
sp-core = { path = "../substrate/primitives/core" } | ||
sp-keyring = { path = "../substrate/primitives/keyring" } | ||
sp-runtime = { path = "../substrate/primitives/runtime" } | ||
|
||
[dev-dependencies] | ||
parity-scale-codec = "3.6.5" | ||
scale-info = "2.9.0" | ||
|
||
[features] | ||
experimental = [ "pallet-aura/experimental" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<script> | ||
window.addEventListener("DOMContentLoaded", (event) => { | ||
// if the crate is one that starts with `developer_hub` | ||
let crate_name = document.querySelector("#main-content > div > h1 > a:nth-child(1)"); | ||
if (!crate_name.textContent.startsWith("developer_hub")) { | ||
console.log("skipping -- not `developer_hub`"); | ||
return; | ||
} | ||
|
||
let sidebar = document.querySelector(".sidebar"); | ||
let headers = document.querySelectorAll("#main-content h2, #main-content h3, #main-content h4"); | ||
console.log(`detected developer_hub: headers: ${headers.length}`); | ||
|
||
let toc = document.createElement("div"); | ||
toc.classList.add("table-of-contents"); | ||
toc.appendChild(document.createElement("h2").appendChild(document.createTextNode("Table of Contents")).parentNode); | ||
|
||
// the first two headers are always junk | ||
headers.forEach(header => { | ||
let link = document.createElement("a"); | ||
link.href = "#" + header.id; | ||
link.textContent = header.textContent; | ||
link.className = header.tagName.toLowerCase(); | ||
toc.appendChild(link); | ||
}); | ||
|
||
sidebar.insertBefore(toc, sidebar.firstChild); | ||
console.log("injecting ToC"); | ||
}); | ||
</script> | ||
<style> | ||
.table-of-contents { | ||
margin-bottom: 1em; | ||
padding: 0.5em; | ||
} | ||
|
||
.table-of-contents a { | ||
display: block; | ||
margin: 0.2em 0; | ||
} | ||
|
||
.table-of-contents .h2 { | ||
font-weight: bold; | ||
margin-left: 0; | ||
} | ||
|
||
.table-of-contents .h3 { | ||
margin-left: 1em; | ||
} | ||
|
||
.table-of-contents .h4 { | ||
margin-left: 2em; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//! # Changing Consensus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//! # Cumulus Enabled Parachain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! # Polkadot Developer Hub Guides | ||
//! | ||
//! This crate contains a collection of guides that are foundational to the developers of | ||
//! Polkadot SDK. They common user-journeys that are traversed in the Polkadot ecosystem. | ||
/// Write your first simple pallet, learning the most most basic features of FRAME along the way. | ||
pub mod your_first_pallet; | ||
|
||
/// Writing your first real [runtime](`crate::reference_docs::wasm_meta_protocol`), and successfully | ||
/// compiling it to [WASM](crate::polkadot_sdk::substrate#wasm-build). | ||
pub mod your_first_runtime; | ||
|
||
/// Running the given runtime with a node. No specific consensus mechanism is used at this stage. | ||
pub mod your_first_node; | ||
|
||
/// How to change the consensus engine of both the node and the runtime. | ||
pub mod changing_consensus; | ||
|
||
/// How to enhance a given runtime and node to be cumulus-enabled, run it as a parachain and connect | ||
/// it to a relay-chain. | ||
pub mod cumulus_enabled_parachain; | ||
|
||
/// How to make a given runtime XCM-enabled, capable of sending messages (`Transact`) between itself | ||
/// and the relay chain to which it is connected. | ||
pub mod xcm_enabled_parachain; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//! # XCM Enabled Parachain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//! # Your first Node |
Oops, something went wrong.