api icon indicating copy to clipboard operation
api copied to clipboard

Fix: Re-subscribe to chain updates on reconnection

Open F-OBrien opened this issue 1 year ago • 2 comments

Prevents issues with bad transaction signatures after chain updates following a temporary disconnect.

Long-standing API connections can experience temporary disconnects, e.g. throwing API-WS: disconnected from wss://localhost:9944/: 1006:: Abnormal Closure due to a network connection issue. Upon disconnect, the provider unsubscribes from updates to the runtime version. However, upon reconnection, the subscription is not recreated.

Currently due to the lack of resubscription transactions submitted following a prior disconnect and chain upgrade will result in bad transaction signatures due to an incorrect spec version, requiring the service to be restarted to resolve.

F-OBrien avatar Feb 17 '24 14:02 F-OBrien

Very odd that the CI tried to run the merge bot even though it wasn't triggered...

That being said will review this PR shortly.

TarikGul avatar Mar 04 '24 16:03 TarikGul

@TarikGul I've rebased the commit. Let me know if you've any questions on it.

F-OBrien avatar Mar 22 '24 14:03 F-OBrien

@TarikGul just following up on this again.

F-OBrien avatar May 14 '24 17:05 F-OBrien

@F-OBrien Thanks for pinging me again. I promise to have it fully reviewed this week. There are a few side affects I wanted to look into, but I promise to prioritize this :)

TarikGul avatar May 14 '24 17:05 TarikGul

Im mostly confident to merge this, I am just running this against some benchmarks for historical blocks, to ensure this doesn't create a regression.

TarikGul avatar May 28 '24 17:05 TarikGul

Tested it pretty thoroughly locally myself. LGTM, thanks for the patience, and the PR!

TarikGul avatar May 28 '24 18:05 TarikGul

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

polkadot-js-bot avatar May 30 '24 19:05 polkadot-js-bot