1

In my srtool output:

== Compressed
 Version          : [object]
 Metadata         : V14
 Size             : 707.47 KB (724453 bytes)
 Compression      : 81.25%
 setCode          : 0x486de0c2390e07f91cdb69b9eb174dd052e93e1e3d1baa67095ca8e1cc9a0c6b
 authorizeUpgrade : 0xfb2e5fabe6c05d7580582ded90ce2cbf7a2022c5f7e385dff6d615ef84e65cbe
 IPFS             : QmRyZbLd7oPZNvrx6jbMZKJCwTdvhhrPzGvBGjFzWbE9t1
 BLAKE2_256       : 0xea3f3649925bc59d3bbfeddde0fabf2da880d696be15a17a7f410b1b1dd084fd
 Wasm             : ./runtime/target/srtool/release/wbuild/kabocha-runtime/kabocha_runtime.compact.compressed.wasm

I would like to upgrade parachain:

The srtool output has the hash already for me:

 authorizeUpgrade : 0xfb2e5fabe6c05d7580582ded90ce2cbf7a2022c5f7e385dff6d615ef84e65cbe

But if i hash compact compressed file like this:

enter image description here

As you can see i get the blake_256 hash provided in the output:

BLAKE2_256       : 0xea3f3649925bc59d3bbfeddde0fabf2da880d696be15a17a7f410b1b1dd084fd

Which one should i use? I am assuming that what has been hashed by srtool is either a differently compressed file, or it is using a different hasher.

1
  • 1
    You are confusing 2 hashes, the one of the runtime itself and the one of the call to authorize the upgrade for that specific runtime. Say the hash of the runtime is H. The authorizeUpgrade returned by srtool is the hash of the call: ``` parachainSystem.authorizeUpgrade(H) ``` and not H itself.
    – Chevdor
    Nov 24 at 10:01

1 Answer 1

1

Why do we introduce srtool?

It's because we want a deterministic result.

Your host, rust-toolchain, or something else could affect the generated bytes.

With srtool, in a fixed docker, a fixed rust toolchain. We can always get the same result.


Use blake2-256. https://github.com/darwinia-network/darwinia-parachain/blob/cdc46c6920d7680b0eda1bbec4ebe613c40cba82/.github/workflows/release.yml#L192-L193

2
  • hi there, i know why i am using srtool. But i want to know whats the best hash to use when i enactAuthorize on the parachain. The one srtool provides, or by uploading the file of the compact compressed wasm to polkadot js? i think im going to go with my second approach. But i want to know where the enactAuthorize hash provided by srtool has come from. Nov 23 at 18:31
  • 3
    The blake2 hash from srtool should be the same with the uploading-WASM calculated hash from PolkadotApps Nov 24 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.