question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fail to decode types with ApiPromise that exists across a runtime upgrade

See original GitHub issue

High level overview:

Instances of Sidecar alive while polkadot went from v18 -> v23 could not decode blocks after the runtime upgrade that had RewardDestination enum in them. I recreated this issue by simulating a runtime upgrade from v22 -> v23 in a local test-net. Further, I saw similar phenomena in the apps UI where the submit extrinsic for setPaye did not update with the new RewardDestination

Sidecar version: commit 57324a632b94d770d2f8ca5e7100e47d4ea11281 (branch zeke-log-2 which is the current open logging PR and has the current polkadot-js beta installed)

How I re-created the error:

  • got a docker compose up and running of a 2 validator, 3 node local test net. all nodes running polkadot v22, but modified to have the sudo pallet.
  • connected sidecar to the Annie validator node
  • submitted a setPayee transaction for Bob and checked that correctly it changed in the accounts/{accountId}/staking-info route
  • intermittently checked the /runtime/spec route to ensure spec version was changing as expected
  • made a call to set code with the polkadot wasm file from the v0.8.23 release
  • then I tried to setPayee for Bob but saw the options did not update (no Account(accountId)). So I refreshed the apps page and then saw the Account(accountId) show up. I then was able to successfully submit the transaction. I think this is important because it re-established the WS connection and everything corrected - which is the same behavior Sidecar always exhibits with these types of errors.
  • I checked the block using Sidecar ( see /blocks/98 in logs, I call it twice and then call blocks/97, which works) and it failed to decode the RewardDestination enum.

I am attaching logs from Sidecar. The logs include http request/response summaries, stack dumps, and RPC logging from polkadot-js/api using NODE_ENV=test.

Logs: set-code-sas.log

My .env file for Sidecar:

SAS_SUBSTRATE_WS_URL=ws://127.0.0.1:9946

SAS_LOG_FILE_USE=true
SAS_LOG_CONSOLE_LEVEL=debug
SAS_LOG_FILE_PATH=./logs/set-code-sas.log
SAS_LOG_FILE_STRIP_ANSI=true
SAS_LOG_FILE_LEVEL=debug
SAS_LOG_FILE_COUNT=100

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jacogrcommented, Sep 16, 2020

The apps UI has no ticket like that - it is part of my ongoing long-term registry overhaul there which I clean up bit by bit, component by component.

The issue is that initially all apps types were global. Then we introduced the registry concept to make it self contained. So with that scenario the apps UI took the same approach with a global registry to “get it to work without rewriting the whole app”.

So it really does not handle upgrades. It is better now that it doesn’t crash anymore (so the “refresh this now” popup is not there and even allows you now to send “the same txs without new types”.)

TL;DR registries are per API instance, in the case of the apps UI it is not.

0reactions
polkadot-js-botcommented, Jun 3, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

Read more comments on GitHub >

github_iconTop Results From Across the Web

type decode error after runtime upgrade · Issue #4557 - GitHub
After runtime upgrade, polkadot apps and all other polkadot.js based tools will throw some type decoding error. Our current suggestion is to ...
Read more >
decodeBool cannot fail, but may cr… | Apple Developer Forums
I have coded a value in a class. When I decode, it should be a Bool, but it may be an Object (if...
Read more >
Errors and How to Resolve Them - Polkadot Wiki
Here's how to find out the detailed error description through Polkadot-JS ... setCode to do a runtime upgrade directly, without voting).
Read more >
Extending types - polkadot{.js}
Additionally, when a type is mismatched between the node and the API, the decoding can fail, yielding issues such as Could not convert...
Read more >
Further adventures with Substrate and Ink
In ink, AccountId , along with some other types, ... and printed the result we could see that the call was returning a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found