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

Minimalistic runtime #608

Closed

Conversation

shibshib
Copy link

This is a guide to creating a minimalistic runtime for forkless chain upgrades in cases where the block length is too small.

This is a guide to creating a minimalistic runtime for forkless chain upgrades in cases where the block length is too small.
@sacha-l
Copy link

sacha-l commented Nov 26, 2021

@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.

@shibshib
Copy link
Author

shibshib commented Nov 26, 2021

Thank you @sacha-l ! And it was absolutely a rescue mission, because we would have had to restart the chain otherwise 😄

Added warning label.
@shibshib shibshib requested a review from kianenigma November 30, 2021 21:34

## 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.
Copy link
Contributor

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.

Copy link
Author

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.

Comment on lines +70 to +75
//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>
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

@kianenigma kianenigma left a 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.
@nuke-web3
Copy link
Contributor

Hey @shibshib - the main branch has moved, and now we would want to ask @lisa-parity if this should live in the new docs. If you think so please open a new PR targeting the new docs site? Or at least an issue to flag that we should bring this in as new content 🙏

cc @kianenigma @sacha-l

@nuke-web3 nuke-web3 closed this Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants