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

Add documentation around FRAME Origin #3362

Merged
merged 29 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1ffe06c
add origin related articles
kianenigma Feb 15, 2024
bb3dffe
make it build
kianenigma Feb 15, 2024
39fac87
add macro docs as well
kianenigma Feb 15, 2024
c863d75
add diagram
kianenigma Feb 15, 2024
acad0ea
fix mmd path
kianenigma Feb 15, 2024
8d047fb
Master.into()
kianenigma Feb 16, 2024
552ba03
Apply suggestions from code review
kianenigma Feb 20, 2024
26a9dfa
prettify the docs page a bit
kianenigma Feb 20, 2024
e2a24bc
Merge branch 'kiz-origin-docs' of github.com:paritytech/polkadot-sdk …
kianenigma Feb 20, 2024
f71e3a7
fmt
kianenigma Feb 20, 2024
0fc5df9
fmt agian
kianenigma Feb 20, 2024
9ae0336
Merge branch 'master' into kiz-origin-docs
kianenigma Feb 20, 2024
ba1d800
Apply suggestions from code review
kianenigma Feb 23, 2024
e5bcfef
fix
kianenigma Feb 23, 2024
83a936f
Merge branch 'master' of github.com:paritytech/polkadot-sdk into kiz-…
kianenigma Feb 23, 2024
bc00706
Update docs/sdk/src/reference_docs/mod.rs
kianenigma Feb 23, 2024
b817e84
fmt
kianenigma Feb 23, 2024
e9746a9
Merge branch 'kiz-origin-docs' of github.com:paritytech/polkadot-sdk …
kianenigma Feb 23, 2024
1c90dba
Merge branch 'master' into kiz-origin-docs
kianenigma Feb 23, 2024
6cd3f4d
Merge branch 'master' into kiz-origin-docs
kianenigma Feb 25, 2024
c09b833
Update docs/sdk/src/reference_docs/frame_origin.rs
kianenigma Feb 25, 2024
95ccf8e
Update docs/sdk/src/reference_docs/mod.rs
kianenigma Feb 26, 2024
4e18167
Update docs/sdk/src/reference_docs/frame_origin.rs
kianenigma Feb 26, 2024
7e99fb8
Update docs/sdk/src/reference_docs/frame_origin.rs
kianenigma Feb 26, 2024
51feebe
Merge branch 'master' into kiz-origin-docs
kianenigma Feb 26, 2024
86750f3
Merge branch 'master' into kiz-origin-docs
kianenigma Feb 27, 2024
4d60745
fix test
kianenigma Feb 27, 2024
f300f0b
fmt
kianenigma Feb 27, 2024
bd52990
try and fix rustdocs build
kianenigma Feb 27, 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
9 changes: 9 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions docs/mermaid/outer_runtime_types.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
flowchart LR
RuntimeCall --"TryInto"--> PalletCall
PalletCall --"Into"--> RuntimeCall
20 changes: 15 additions & 5 deletions docs/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ 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 = ["experimental", "runtime"] }
frame = { path = "../../substrate/frame", features = [
"experimental",
"runtime",
] }
pallet-examples = { path = "../../substrate/frame/examples" }
pallet-default-config-example = { path = "../../substrate/frame/examples/default-config" }

Expand Down Expand Up @@ -52,7 +55,18 @@ cumulus-pallet-parachain-system = { path = "../../cumulus/pallets/parachain-syst
] }
parachain-info = { package = "staging-parachain-info", path = "../../cumulus/parachains/pallets/parachain-info" }
pallet-aura = { path = "../../substrate/frame/aura", default-features = false }

# Pallets and FRAME internals
pallet-timestamp = { path = "../../substrate/frame/timestamp" }
pallet-balances = { path = "../../substrate/frame/balances" }
pallet-transaction-payment = { path = "../../substrate/frame/transaction-payment" }
pallet-utility = { path = "../../substrate/frame/utility" }
pallet-multisig = { path = "../../substrate/frame/multisig" }
pallet-proxy = { path = "../../substrate/frame/proxy" }
pallet-authorship = { path = "../../substrate/frame/authorship" }
pallet-collective = { path = "../../substrate/frame/collective" }
pallet-democracy = { path = "../../substrate/frame/democracy" }
frame-system = { path = "../../substrate/frame/system" }

# Primitives
sp-io = { path = "../../substrate/primitives/io" }
Expand All @@ -64,9 +78,5 @@ sp-runtime = { path = "../../substrate/primitives/runtime" }
# XCM
xcm = { package = "staging-xcm", path = "../../polkadot/xcm" }

[dev-dependencies]
parity-scale-codec = "3.6.5"
scale-info = "2.9.0"

[features]
experimental = ["pallet-aura/experimental"]
9 changes: 4 additions & 5 deletions docs/sdk/src/guides/your_first_pallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@
//!
//! Recall that within our pallet, (almost) all blocks of code are generic over `<T: Config>`. And,
//! because `trait Config: frame_system::Config`, we can get access to all items in `Config` (or
//! `frame_system::Config`) using `T::NameOfItem`. This is all within the boundaries of how Rust
//! traits and generics work. If unfamiliar with this pattern, read
//! `frame_system::Config`) using `T::NameOfItem`. This is all within the boundaries of how
//! Rust traits and generics work. If unfamiliar with this pattern, read
//! [`crate::reference_docs::trait_based_programming`] before going further.
//!
//! Crucially, a typical FRAME runtime contains a `struct Runtime`. The main role of this `struct`
Expand Down Expand Up @@ -270,7 +270,7 @@
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", config_v2)]
//!
//! > These `Runtime*` types are better explained in
//! > [`crate::reference_docs::frame_composite_enums`].
//! > [`crate::reference_docs::frame_runtime_types`].
//!
//! Then, we can rewrite the `transfer` dispatchable as such:
#![doc = docify::embed!("./src/guides/your_first_pallet/mod.rs", transfer_v2)]
Expand All @@ -285,15 +285,14 @@
//! [`crate::guides::your_first_pallet::pallet_v2::tests::runtime_v2::RuntimeEvent`].
//!
//!
//!
//! ## What Next?
//!
//! The following topics where used in this guide, but not covered in depth. It is suggested to
//! study them subsequently:
//!
//! - [`crate::reference_docs::safe_defensive_programming`].
//! - [`crate::reference_docs::frame_origin`].
//! - [`crate::reference_docs::frame_composite_enums`].
//! - [`crate::reference_docs::frame_runtime_types`].
//! - The pallet we wrote in this guide was using `dev_mode`, learn more in
//! [`frame::pallet_macros::config`].
//! - Learn more about the individual pallet items/macros, such as event and errors and call, in
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//! - Start by learning about the the [`polkadot_sdk`], its structure and context.
//! - Then, head over the [`guides`]. This modules contains in-depth guides about the most important
//! user-journeys of the Polkadot SDK.
//! - Whilst reading the guides, you might find back-links to [`crate::reference_docs`].
//! - Whilst reading the guides, you might find back-links to [`reference_docs`].
//! - Finally, <https://paritytech.github.io> is the parent website of this crate that contains the
//! list of further tools related to the Polkadot SDK.
//!
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/src/meta_contributing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
//! * Before even getting started, what is with all of this `<T: Config>`? We link to
//! [`crate::reference_docs::trait_based_programming`].
//! * First, the name. Why is this called `pallet::call`? This goes back to `enum Call`, which is
//! explained in [`crate::reference_docs::frame_composite_enums`]. Build on top of this!
//! explained in [`crate::reference_docs::frame_runtime_types`]. Build on top of this!
//! * Then, what is `origin`? Just an account id? [`crate::reference_docs::frame_origin`].
//! * Then, what is `DispatchResult`? Why is this called *dispatch*? Probably something that can be
//! explained in the documentation of [`frame::prelude::DispatchResult`].
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/src/reference_docs/extrinsic_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
//! runtimes, a call is represented as an enum of enums, where the outer enum represents the FRAME
//! pallet being called, and the inner enum represents the call being made within that pallet, and
//! any arguments to it. Read more about the call enum
//! [here][crate::reference_docs::frame_composite_enums].
//! [here][crate::reference_docs::frame_runtime_types].
//!
//! FRAME `Call` enums are automatically generated, and end up looking something like this:
#![doc = docify::embed!("./src/reference_docs/extrinsic_encoding.rs", call_data)]
Expand Down
1 change: 0 additions & 1 deletion docs/sdk/src/reference_docs/frame_composite_enums.rs

This file was deleted.

Loading
Loading