paritytech / smoldot

Alternative client for Substrate-based chains.
GNU General Public License v3.0
309 stars 74 forks source link

REGISTRY: Error: Struct: failed on peers: u64:: Cannot decode value "3" at Struct.js:70 #785

Closed wirednkod closed 3 years ago

wirednkod commented 3 years ago

logger.js:63 2021-04-26 13:21:58 REGISTRY: Error: Struct: failed on peers: u64:: Cannot decode value "3" at Struct.js:70 at Array.reduce () at decodeStructFromObject (Struct.js:24) at decodeStruct (Struct.js:111) at new Struct (Struct.js:132) at new (Struct.js:150) at new Type (registry.js:340) at initType (createType.js:49) at createTypeUnsafe (createType.js:69) at RpcCore._formatOutput (index.js:394) apply @ logger.js:63 error @ logger.js:103 createTypeUnsafe @ createType.js:71 _formatOutput @ index.js:394 callWithRegistry @ index.js:262 async function (async) callWithRegistry @ index.js:261 (anonymous) @ index.js:268 Observable._trySubscribe @ Observable.ts:238 Observable.subscribe @ Observable.ts:219 ConnectableObservable.connect @ ConnectableObservable.ts:44 RefCountOperator.call @ refCount.ts:79 Observable.subscribe @ Observable.ts:214 (anonymous) @ Observable.ts:360 Observable.toPromise @ Observable.ts:358 (anonymous) @ Init.js:86 setInterval (async) value @ Init.js:85 async function (async) value @ Init.js:78 Init @ Init.js:152 Getters @ Getters.js:20 ApiBase @ index.js:40 ApiPromise @ index.js:235 create @ index.js:213 Detector.connect @ Detector.ts:33 async function (async) Detector.connect @ Detector.ts:25 kusama @ index.ts:25 (anonymous) @ index.ts:48 window.onload @ index.ts:50 load (async) 38rfC.regenerator-runtime/runtime @ index.ts:7 newRequire @ index.e935dae2.js:71 (anonymous) @ index.e935dae2.js:120 (anonymous) @ index.e935dae2.js:143 logger.js:63 2021-04-26 13:21:58 RPC-CORE: health(): Health:: createType(Health):: Struct: failed on peers: u64:: Cannot decode value "3"

tomaka commented 3 years ago

The error seems to indicate that PolkadotJS fails to decode the result of a system_health call.

Here's how smoldot reacts to a system_health call:

image

Here's how upstream Substrate reacts:

image

Apart from id being returned at the end (and obviously the number of peers being different), it's identical. Therefore I don't think it's a smoldot problem.

According the error, PolkadotJS seems to try decode the response as if it was SCALE-encoded, which it isn't.