2

We had a big problem after upgrading weight -> weight v2.

I understood that weight v2 uses refTime and proofSize. However, I wonder if there is a way to properly look up these two values.

We are using sidecar(send Tx) and tx-wrapper-core(sign Tx).

And I saw this post. Is this code also available in multisig, not contract?

give thanks in advance

1 Answer 1

3
  • You can create your asMulti call with some default values for reftime and proofsize.
  • An example would be to set at your new weight the same RefTime as found in your old weight and for proofsize a default value like 0.
  • Then use the corresponding runtime call to get a more accurate estimation of these parameters.
  • An example can be found in the multisig example of txwrapper-core.
  • There, the maxweight in the asMulti is set to these values.
  • We can then copy the serialized signed tx (in the txwrapper example is called txAsMulti) that is printed and use the runtime call queryInfo from TransactionPaymentApi to get more accurate estimation for reftime and proofsize.
    • we can call this either from pjs-apps link
    • or sidecar's /transaction/fee-estimate endpoint which uses the same call

For the asMulti call of this txwrapper example, I use the below curl command

curl -X 'POST' \
  'http://127.0.0.1:8080/transaction/fee-estimate' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "tx": "0x950384008eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a480160cf28a7cdac2e4a10883a22bf40cf764417418591fc2bd72800340c6f7edd774d7f1eb158ab004f0e920db9dabbe041c081585c18610f39d4cc274b371df187150000001e0102000890b5ab205c6974c9ea841be688864633dc9ca8a357843eeacf2314649965fe22d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d010200000003000000050300e659a7a1628cdd93febc04a4e0646ea20e9f5f0ce097d9a05290d4a9e054df4e0f00c029f73d54050280969800"
}'

and the result I will receive (while connected to Polkadot)

{"weight":{"refTime":"886228054","proofSize":"6811"},"class":"Normal","partialFee":"249232647"}%

which is the same result that I get from pjs apps.

Last, a great resource to get more information on weights is the Deep Dive in Weights which I absolutely recommend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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