-
Notifications
You must be signed in to change notification settings - Fork 280
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
Minimalistic runtime #608
Minimalistic runtime #608
Conversation
This is a guide to creating a minimalistic runtime for forkless chain upgrades in cases where the block length is too small.
@shibshib: This is awesome, thanks for contributing ! Will take a closer look over the next few days. I'll also make the changes to have it render with our Gatsby setup. Then it should be good to go. At first glance it looks thorough and well articulated. Well done. P.S.: This guide makes you sound like a survivor from a runtime rescue mission 😆 ! Thanks for sharing your experience, its super valuable. |
Thank you @sacha-l ! And it was absolutely a rescue mission, because we would have had to restart the chain otherwise 😄 |
Added warning label.
|
||
## Related resources [optional - add links as needed] | ||
2. Comment out some unneeded configs and functions. Things like `native_version()`, `frame_benchmarking`, and `pallet_transaction_payment_rpc_runtime_api` can all be removed. |
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.
frame_benchmarking
is not part of the final wasm, unless if you are mistakenly enabling its feature. Under correct circumstances, removing it should not affect the wasm size at all.
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.
Interesting, I'll add this in.
//frame_system::CheckTxVersion<Runtime>, | ||
// frame_system::CheckGenesis<Runtime>, | ||
// frame_system::CheckEra<Runtime>, | ||
// frame_system::CheckNonce<Runtime>, | ||
// frame_system::CheckWeight<Runtime>, | ||
// pallet_transaction_payment::ChargeTransactionPayment<Runtime> |
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.
might be worth mentioning that removing some of these makes your chain be easily attackable. I would personally NOT remove these in your scenario. You need some of these to keep the chain safe.
For example, not checking the Nonce is basically suicide if any pallet is active to end-users.
Or not checking the Genesis hash makes you vulnerable to long-range attacks.
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.
@kianenigma Agree with you it's rather dangerous. However in the article we do mention that this minimalist runtime should be followed immediately by another upgrade that will bring back your original code. I will add an update to the article to mention your points.
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.
Interesting story! Thanks for sharing it.
All in all, I would also add that I think if you want to strip down your runtime, you probably do NOT want to remove system pallet and its signed extensions. You can and should remove all other pallets, do the maintenance needed, then bring them back.
Reviewer comments addressed.
Hey @shibshib - the |
This is a guide to creating a minimalistic runtime for forkless chain upgrades in cases where the block length is too small.