Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2962 #2964

Merged
merged 4 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed

- On NodeJS, the usage of `hrtime` has been replaced with `performance.now()`. While this doesn't change anything for NodeJS users, Deno users that were importing smoldot through the <https://esm.sh> website will no longer get an error due to Deno's compatibility layer not supporting `hrtime`. As a reminder, smoldot is also published on the Deno/x registry and using <https://esm.sh> is unnecessary. ([#2964](https://github.com/paritytech/smoldot/pull/2964))
- Fix the `ext_crypto_ecdsa_verify_version_1` and `ext_crypto_ecdsa_verify_prehashed_version_1` host functions mixing their parameters and thus always failing. ([#2955](https://github.com/paritytech/smoldot/pull/2955))

## 0.7.5 - 2022-10-31
Expand Down
5 changes: 2 additions & 3 deletions bin/wasm-node/javascript/src/index-nodejs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Connection, ConnectionError, ConnectionConfig } from './instance/instan
import { WebSocket } from 'ws';
import { inflate } from 'pako';

import { hrtime } from 'node:process';
import { performance } from 'node:perf_hooks';
import { createConnection as nodeCreateConnection } from 'node:net';
import type { Socket as TcpSocket } from 'node:net';
import { randomFillSync } from 'node:crypto';
Expand Down Expand Up @@ -59,8 +59,7 @@ export function start(options?: ClientOptions): Client {
return Promise.resolve(inflate(Buffer.from(input, 'base64')))
},
performanceNow: () => {
const time = hrtime();
return ((time[0] * 1e3) + (time[1] / 1e6));
return performance.now()
},
getRandomValues: (buffer) => {
if (buffer.length >= 65536)
Expand Down