-
Notifications
You must be signed in to change notification settings - Fork 81
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
Fix: Local runtime upgrade scripts #1308
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.
question 👀
scripts/js/upgrade/index.js
Outdated
@@ -4,16 +4,24 @@ const fs = require('fs') | |||
const util = require('util'); | |||
const exec = util.promisify(require('child_process').exec); | |||
|
|||
const PREIMAGE_LENGTH_BOUND = 34; |
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.
How are these values obtained or updatable based on what in the future?
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.
I.e, are these values always the same for any pre-image proposing authorising a runtime upgrade? Or do we need to keep changing them? If so, what's the best way to do that? I am 90% we don't, but just want to double check.
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.
I will definitely improve the name to something like AUTHORIZE_UPGRADE_PREIMAGE_LENGTH_BOUND
. Regarding the value itself: The WASM code of authorize_upgrade(code)
is hashed with H256
which encoded to 32 bytes. I remember to have tried with 32 as bound as well and failed, so I suppose the other two are some wrapper bytes.
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.
Hope 71da5cd brings sufficient clarity
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.
My question is not a blocker, if you have tested these changes and the code looks fine so it's good to go for me.
scripts/js/upgrade/index.js
Outdated
// 39 from edemocracy.xternalProposeMajority(Lookup(H256, 34))) | ||
// 42 from democracy.fastTrack(H256, ...) | ||
// 1 from utility.batchAll | ||
// 2 extra |
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.
I guess the "2 extra" bytes is the first for the pallet index and the second for the extrinsic index?
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.
Makes sense to me!
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.
scripts/js/upgrade/index.js
Outdated
// Needs to be >= 34 | ||
// 32 bytes from the encoding of the H256 hashed WASM blob | ||
// 2 for extra stuff | ||
const AUTHORIZE_UPGRADE_PREIMAGE_LENGTH_BOUND = 34; |
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.
Leaving this one here and I feel this is really something missing in the polkadot dev ecosystem: https://ruudvanasseldonk.com/2022/03/20/please-put-units-in-names
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.
Totally agree and applied in 860e281
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.
Left a nugget but again not a blocker for me. Thanks for fixing this and taking the suggestions in 🏄♂️
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.
❤️
Description
./scripts/js
to latest version, reducing peer dependency spam in the consolePreImage
pallet in Update polkadot v0.9.32 #1115 as a result of Bound uses ofCall
paritytech/substrate#11649proofSize
in weights v2How to test
Checklist: