-
Notifications
You must be signed in to change notification settings - Fork 9
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
Create mermaid diagram for FRAME section #280
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks overall correct to me, @kianenigma would be the best one to ask here.
@dawnkelly09 I gave this one a shot. I like how it looks, but I feel that we need to add the following to help users understand that those pallets are not the only ones that can be added; they are just examples: graph TB
subgraph sg1[Client/Host]
direction LR
A[JSON-RPC]
B[libp2p]
C[Transaction Pool]
D[Block Builder]
E[Database]
F[Host Functions]
end
subgraph sg2[Runtime]
direction LR
G[Runtime API]
H[Executive]
I[frame_support::runtime]
subgraph sg3[Pallets]
direction TB
J[System]
K[Staking]
L[Balances]
M[GRANDPA]
N[...]
end
end
However, I do agree with @CrackTheCode016 and feel that @kianenigma's input would be valuable here to determine whether this diagram is accurate. Note: After getting Kian's input, I can circle back on this to see if the diagram requires any style modifications or not :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do slightly better, let's iterate one more time based on the resources I provided, thanks!
@nhussein11 Updated this so it's the diagram showing the larger group of pallets and then the selected group to create a runtime. Definitely needs some styling if you can help with that. @0xLucca mentioned: "This runtime could be link to the solochain-template as it mimics the pallets included in that runtime" but, I'm not sure I can make the mermaid clickable? I added a "tip" admonition but feel free to change things if you know how to link from the diagram or think of a better way to share that info. Thank you for your help! |
end | ||
AP --> SP | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay but it is missing the configurable aspect of pallets. Maybe something like:
graph TD
subgraph "FRAME Pallets"
B[Balances Pallet]
S[Staking Pallet]
G[Governance Pallet]
T[Treasury Pallet]
C[Contracts Pallet]
style B fill:#99ccff,stroke:#333,color:#000
style S fill:#99ccff,stroke:#333,color:#000
style G fill:#99ccff,stroke:#333,color:#000
style T fill:#99ccff,stroke:#333,color:#000
style C fill:#99ccff,stroke:#333,color:#000
end
subgraph "Custom Runtime"
R[Your Runtime] --> MB[Modified Balances]
R --> MS[Modified Staking]
R --> CP[Custom Pallet]
MB -.-> B
MS -.-> S
style R fill:#ff9966,stroke:#333,stroke-width:2px,color:#000
style MB fill:#cce6ff,stroke:#333,color:#000
style MS fill:#cce6ff,stroke:#333,color:#000
style CP fill:#ffcccc,stroke:#333,color:#000
end
subgraph "Configuration"
MB --> C1["Custom Config:
- Modified weights
- Custom parameters
- Added features"]
MS --> C2["Custom Config:
- Modified rewards
- Custom rules
- Added validations"]
style C1 fill:#f2f2f2,stroke:#333,color:#000
style C2 fill:#f2f2f2,stroke:#333,color:#000
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@UtkarshBhardwaj007 I like this! Maybe we can add this diagram as a complement to the one we have now and follow up on that in a new PR. Since this is the introduction to the Polkadot SDK, I think explaining it at a high level is a good idea, especially since the diagrams are easy to understand and digest for those onboarding to Polkadot. This iteration was trying to address this comment: #280 (comment)
Long story short, I'd suggest we use your diagram in another section (maybe on the same page but below) and keep the diagram as simple as possible at first, then get into more technical details as the documentation progresses. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I don't mind. However, the 2 diagrams are not so different. This is the diagram you have in the PR:
graph LR
subgraph SP["<b style='font-size:18px;'>Runtime</b>"]
direction LR
S1[Timestamp]~~~S2[Aura]~~~S3[GRANDPA]
S4[Balances]~~~S5[Transaction\nPayment]~~~S6[Sudo]
end
subgraph AP["<b style='font-size:18px;'>FRAME Pallets</b>"]
direction LR
A1[Aura]~~~A2[BABE]~~~A3[GRANDPA]~~~A4[Transaction\nPayment]
B1[Identity]~~~B2[Balances]~~~B3[Sudo]~~~B4[EVM]
C1[Timestamp]~~~C2[Assets]~~~C3[Contracts]~~~C4[and more...]
end
AP --> SP
The only additions I am proposing is to somehow indicate that the pallets are customisable. A simple line over the arrow (--->
) or a change in colour in your diagram should do the trick.
I'd suggest we use your diagram in another section (maybe on the same page but below)
You don't need to keep my diagram. It is the same thing just a different representation. I'd recommend to chose one and add some text and/or colours to annotate the diagrams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, we talked with Luca and see that maybe we can do something like this to showcase the customizable aspect:
@UtkarshBhardwaj007 WDYT?
The code of the diagram would be like:
graph LR
subgraph SP["<b style='font-size:18px;'>Runtime</b>"]
direction LR
Timestamp ~~~ Aura ~~~ GRANDPA
Balances ~~~ TransactionPayment ~~~ Sudo
subgraph Timestamp["Timestamp"]
SS1[Custom Config]
end
subgraph Aura["Aura"]
SS2[Custom Config]
end
subgraph GRANDPA["GRANDPA"]
SS3[Custom Config]
end
subgraph Balances["Balances"]
SS4[Custom Config]
end
subgraph TransactionPayment["Transaction Payment"]
SS5[Custom Config]
end
subgraph Sudo["Sudo"]
SS6[Custom Config]
end
style Timestamp stroke:#FF69B4
style Aura stroke:#FF69B4
style GRANDPA stroke:#FF69B4
style Balances stroke:#FF69B4
style TransactionPayment stroke:#FF69B4
style Sudo stroke:#FF69B4
style SS1 stroke-dasharray: 5
style SS2 stroke-dasharray: 5
style SS3 stroke-dasharray: 5
style SS4 stroke-dasharray: 5
style SS5 stroke-dasharray: 5
style SS6 stroke-dasharray: 5
end
subgraph AP["<b style='font-size:18px;'>FRAME Pallets</b>"]
direction LR
A1[Aura]~~~A2[BABE]~~~A3[GRANDPA]~~~A4[Transaction\nPayment]
B1[Identity]~~~B2[Balances]~~~B3[Sudo]~~~B4[EVM]
C1[Timestamp]~~~C2[Assets]~~~C3[Contracts]~~~C4[and more...]
end
AP --> SP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Although the colours from the code snippet look a bit different from the image you shared (See below).
graph LR
subgraph SP["<b style='font-size:18px;'>Runtime</b>"]
direction LR
Timestamp ~~~ Aura ~~~ GRANDPA
Balances ~~~ TransactionPayment ~~~ Sudo
subgraph Timestamp["Timestamp"]
SS1[Custom Config]
end
subgraph Aura["Aura"]
SS2[Custom Config]
end
subgraph GRANDPA["GRANDPA"]
SS3[Custom Config]
end
subgraph Balances["Balances"]
SS4[Custom Config]
end
subgraph TransactionPayment["Transaction Payment"]
SS5[Custom Config]
end
subgraph Sudo["Sudo"]
SS6[Custom Config]
end
style Timestamp stroke:#FF69B4
style Aura stroke:#FF69B4
style GRANDPA stroke:#FF69B4
style Balances stroke:#FF69B4
style TransactionPayment stroke:#FF69B4
style Sudo stroke:#FF69B4
style SS1 stroke-dasharray: 5
style SS2 stroke-dasharray: 5
style SS3 stroke-dasharray: 5
style SS4 stroke-dasharray: 5
style SS5 stroke-dasharray: 5
style SS6 stroke-dasharray: 5
end
subgraph AP["<b style='font-size:18px;'>FRAME Pallets</b>"]
direction LR
A1[Aura]~~~A2[BABE]~~~A3[GRANDPA]~~~A4[Transaction\nPayment]
B1[Identity]~~~B2[Balances]~~~B3[Sudo]~~~B4[EVM]
C1[Timestamp]~~~C2[Assets]~~~C3[Contracts]~~~C4[and more...]
end
AP --> SP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's likely because the gh processor doesn't have the same css settings as we do in the polkadot-mkdocs
repo. If you copy and paste the diagram into the develop/parachains/intro-polkadot-sdk.md
page, you should see all the styles applied.
This PR adds a first draft mermaid diagram for the FRAME section.
@nhussein11 can you improve this one as well? I'm not sure how I feel about this current version.