smoldot 2.0.33 → 2.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -361,8 +361,10 @@ export function startLocalInstance(config, wasmModule, eventCallback) {
361
361
  peekJsonRpcResponse: (chainId) => {
362
362
  if (!state.instance)
363
363
  return null;
364
- const mem = new Uint8Array(state.instance.exports.memory.buffer);
365
364
  const responseInfo = state.instance.exports.json_rpc_responses_peek(chainId) >>> 0;
365
+ // Note that the memory must be created after calling the Wasm function, otherwise
366
+ // it might be invalidated if it is grown.
367
+ const mem = new Uint8Array(state.instance.exports.memory.buffer);
366
368
  const ptr = buffer.readUInt32LE(mem, responseInfo) >>> 0;
367
369
  const len = buffer.readUInt32LE(mem, responseInfo + 4) >>> 0;
368
370
  // `len === 0` means "queue is empty" according to the API.
@@ -386,7 +388,7 @@ export function startLocalInstance(config, wasmModule, eventCallback) {
386
388
  console.assert(disableJsonRpc || jsonRpcMaxPendingRequests != 0, "invalid jsonRpcMaxPendingRequests value passed to local-instance::addChain");
387
389
  // `add_chain` unconditionally allocates a chain id. If an error occurs, however, this chain
388
390
  // id will refer to an *erroneous* chain. `chain_is_ok` is used below to determine whether it
389
- // has succeeeded or not.
391
+ // has succeeded or not.
390
392
  state.bufferIndices[0] = new TextEncoder().encode(chainSpec);
391
393
  state.bufferIndices[1] = new TextEncoder().encode(databaseContent);
392
394
  const potentialRelayChainsEncoded = new Uint8Array(potentialRelayChains.length * 4);
@@ -351,7 +351,7 @@ export interface AddChainOptions {
351
351
  * inspecting the chain specification of that parachain (i.e. the `chainSpec` field).
352
352
  *
353
353
  * This poses a problem in situations where the same client is shared between multiple different
354
- * applications: multiple applications could add mutiple different chains with the same `id`,
354
+ * applications: multiple applications could add multiple different chains with the same `id`,
355
355
  * creating an ambiguity, or an application could register malicious chains with small variations
356
356
  * of a popular chain's `id` and try to benefit from a typo in a legitimate application's
357
357
  * `relayChain`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smoldot",
3
- "version": "2.0.33",
3
+ "version": "2.0.35",
4
4
  "description": "Light client that connects to Polkadot and Substrate-based blockchains",
5
5
  "contributors": [
6
6
  "Parity Technologies <admin@parity.io>",