Skip to content

Commit

Permalink
fix(smoldot): update to smoldot 2.0.30 (polkadot-api#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala authored Aug 16, 2024
1 parent 13c9ad4 commit e657d78
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 101 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@
"@rollup/plugin-node-resolve": "^15.2.3",
"@vitest/coverage-v8": "^2.0.5",
"husky": "^9.1.4",
"lint-staged": "^15.2.8",
"lint-staged": "^15.2.9",
"prettier": "^3.3.3",
"rollup": "^4.20.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
"tslib": "^2.6.3",
"tsup": "^8.2.4",
"turbo": "^2.0.12",
"turbo": "^2.0.14",
"typescript": "^5.5.4",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.0.5"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,md}": "prettier --write"
},
"packageManager": "[email protected].0+sha512.dc09430156b427f5ecfc79888899e1c39d2d690f004be70e05230b72cb173d96839587545d09429b55ac3c429c801b4dc3c0e002f653830a420fa2dd4e3cf9cf"
"packageManager": "[email protected].1+sha512.faf344af2d6ca65c4c5c8c2224ea77a81a5e8859cbc4e06b1511ddce2f0151512431dd19e6aff31f2c6a8f5f2aced9bd2273e1fed7dd4de1868984059d2c4247"
}
1 change: 1 addition & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Fixes [#632](https://github.com/polkadot-api/polkadot-api/issues/632): rare race-condition when following a submitted transaction, which caused a runtime error. [#638](https://github.com/polkadot-api/polkadot-api/pull/638)
- `smoldot`: Update smoldot to `2.0.30`

## 1.0.0 - 2024-08-15

Expand Down
2 changes: 1 addition & 1 deletion packages/json-rpc/sm-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
"smoldot": ">=2"
},
"devDependencies": {
"smoldot": "2.0.29"
"smoldot": "2.0.30"
}
}
4 changes: 4 additions & 0 deletions packages/smoldot/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixed

- Update smoldot to `2.0.30`

## 0.3.1 - 2024-08-12

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/smoldot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@
},
"dependencies": {
"@types/node": "^22.2.0",
"smoldot": "2.0.29"
"smoldot": "2.0.30"
}
}
14 changes: 14 additions & 0 deletions packages/smoldot/src/from-node-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const startFromWorker = (
worker: Worker,
options: SmoldotOptions = {},
): Client => {
worker.setMaxListeners(0)
sendToWorker(worker, {
type: "start",
value: options,
Expand All @@ -30,6 +31,19 @@ export const startFromWorker = (
})

const chain: Chain = {
jsonRpcResponses: {
next: async () =>
sendToWorker(worker, {
type: "chain",
value: {
id,
type: "receiveIterable",
},
}),
[Symbol.asyncIterator]() {
return this
},
},
nextJsonRpcResponse() {
return sendToWorker(worker, {
type: "chain",
Expand Down
8 changes: 7 additions & 1 deletion packages/smoldot/src/node-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface ChainMsg {
id: number
} & (
| {
type: "remove" | "receive"
type: "remove" | "receive" | "receiveIterable"
}
| {
type: "send"
Expand Down Expand Up @@ -98,6 +98,12 @@ async function handleChainMessage(msg: ChainMsg, id: number) {
value: await chain.nextJsonRpcResponse(),
})
break
case "receiveIterable":
parentPort?.postMessage({
id,
value: await chain.jsonRpcResponses.next(),
})
break
case "send":
chain.sendJsonRpc(msg.value.value)
break
Expand Down
Loading

0 comments on commit e657d78

Please sign in to comment.