smoldot 2.0.32 → 2.0.34

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.
@@ -364,8 +364,10 @@ function startLocalInstance(config, wasmModule, eventCallback) {
364
364
  peekJsonRpcResponse: (chainId) => {
365
365
  if (!state.instance)
366
366
  return null;
367
- const mem = new Uint8Array(state.instance.exports.memory.buffer);
368
367
  const responseInfo = state.instance.exports.json_rpc_responses_peek(chainId) >>> 0;
368
+ // Note that the memory must be created after calling the Wasm function, otherwise
369
+ // it might be invalidated if it is grown.
370
+ const mem = new Uint8Array(state.instance.exports.memory.buffer);
369
371
  const ptr = buffer.readUInt32LE(mem, responseInfo) >>> 0;
370
372
  const len = buffer.readUInt32LE(mem, responseInfo + 4) >>> 0;
371
373
  // `len === 0` means "queue is empty" according to the API.