Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Add tutorial to perform forkless runtime upgrade #26

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

JoshOrndorff
Copy link
Contributor

This PR introduces a new tutorial that picks up at the end of the start-your-frist-substrate-chain tutorial and takes the user through the process of performing two runtime upgrades. In the first upgrade they add an extrinsic and bump the spec version. In the second upgrade, they rename storage, migrate storage, and bump the spec version.

I consider this a rough draft. (There is even a TODO in there still). I'd like feedback from @danforbes as the owner of the tutorials. Feedback on any part of the tutorail is totally welcome as are commits pushed directly to this branch. Some specific things to think about.

  • Should we suggest that the user has already completed the build-a-dapp tutorial? A user could probably finish this tutorial without completing that one, but they will understand the pallet code better if they've completed that one.
  • Is this too much content for a single tutorial?
  • I cited Ricardo's talk at the beginning, but then ended up not following the exact same flow he did because we already have a tutorial for the PoE dapp.

Copy link
Contributor

@riusricardo riusricardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far it LGTM. I'll take another look and follow it to validate the results 👍

Copy link
Contributor

@danforbes danforbes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see this tutorial down-scoped a bit with respect to the number of procedures that the participant is guided through (namely, I think we should remove the storage migration section), and elaborated a bit with respect to the concepts that remain. I think this tutorial does a pretty good job of walking the user through the mechanics of the steps, but I think there are some missed opportunities to demonstrate the fundamental concepts that underpin Substrate development; I do agree that this tutorial should be early on in the user journey because I think the concepts it encapsulates are so foundational to where we want to take them next. I think there should be 3 key concepts: runtime is part of consensus, the meaning of all the different versions and why we just change one, executing a dispatch as Root using Sudo.

@danforbes
Copy link
Contributor

Adding @joepetrowski as a reviewer.

@danforbes
Copy link
Contributor

I like that this tutorial is split up across several pages as opposed to one big index.md like the tutorial to add the Contracts pallet 👍


Once the upgrade transaction is included in a block, you should see a notification in the UI saying the a runtime upgrade has been performed, and the UI will need to be refreshed. Once you've refreshed, you can navigate to the "Extrinsics" tab, select "Template Module" from the dropdown, and see that our new extrinsic, `clear_value` is now available.

Congratulations, you've upgraded your blockchain's runtime! Traditionally the process of upgrading a blockchain would have required a coordinated effort from all (or at least most) of the node operators in the network. But in this case, you have performed the upgrade in a single transaction without even causing a fork!
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a tricky one. On the one hand I think the text is good and emphasizes the point of the tutorial: substrate fixes the whole hard fork mess. On the other hand though it almost seems like sudo is what makes this so easy, which is not the correct message.
The text clearly mentions Democracy and Collective above but I think it's worth repeating here that for a production blockchain, upgrading the runtime is not something a single entity can do at a whim?

I am not sure that newcomers to the blockchain space fully realize what a clusterfuck hard forks are in classical blockchains and how hard it is to get right.

@JoshOrndorff
Copy link
Contributor Author

Thanks for the proofing and contribution @dvdplm. I'm fine with a separate PR as you did in this case or with github suggestions. And for these kinds of changes where you fixed stuff that was just wrong, I'm fine with pushing directly to my PR branch.

Does @danforbes or anyone else have interest in taking this one over? Dan, I'm fine with the suggestions you made. I just want to push back a little on cutting the storage upgrades. In general upgrades will require them and omitting that part sets users up to say, "I followed the tutorial on forkless upgrades and now my state is corrupted." That being said, if you do take this one over, it's totally up to you.

@danforbes
Copy link
Contributor

I am fine with taking this over, Joshy. Any particular reason you're looking for someone else to pick this up?

@riusricardo
Copy link
Contributor

riusricardo commented May 15, 2020

I want to suggest to split the tutorial and use part of it in POE.
We could introduce runtime upgrades on the POE tutorial and keep them in a basic level. This brings the advantage of teaching something more in that tutorial without adding to much complexity. It remains quite basic if we use the sudo without weights.
The second tutorial which refers to this PR, could be more advanced and we can introduce new concepts like the data migration and scheduled upgrades.
I see a lot of value if we split it in 2 ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants