Skip to content

Commit

Permalink
fix: use our version of fast-stable-stringify everywhere (#2504)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher authored Apr 17, 2024
1 parent e4475ef commit 18d6b56
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 26 deletions.
8 changes: 8 additions & 0 deletions .changeset/strong-pandas-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@solana/web3.js": patch
"@solana/web3.js-experimental": patch
"@solana/rpc-subscriptions": patch
"@solana/rpc": patch
---

Replaced `fast-stable-stringify` with our fork
2 changes: 1 addition & 1 deletion packages/library-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
"@noble/curves": "^1.2.0",
"@noble/hashes": "^1.3.3",
"@solana/buffer-layout": "^4.0.1",
"@solana/fast-stable-stringify": "workspace:*",
"agentkeepalive": "^4.5.0",
"bigint-buffer": "^1.1.5",
"bn.js": "^5.2.1",
"borsh": "^0.7.0",
"bs58": "^4.0.1",
"buffer": "6.0.3",
"fast-stable-stringify": "^1.0.0",
"jayson": "^4.1.0",
"node-fetch": "^2.7.0",
"rpc-websockets": "^7.5.1",
Expand Down
8 changes: 2 additions & 6 deletions packages/library-legacy/src/connection.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import fastStableStringify from '@solana/fast-stable-stringify';
import HttpKeepAliveAgent, {
HttpsAgent as HttpsKeepAliveAgent,
} from 'agentkeepalive';
import bs58 from 'bs58';
import {Buffer} from 'buffer';
// @ts-ignore
import fastStableStringify from 'fast-stable-stringify';
import type {Agent as NodeHttpAgent} from 'http';
import {Agent as NodeHttpsAgent} from 'https';
import {
Expand Down Expand Up @@ -6291,10 +6290,7 @@ export class Connection {
args: IWSRequestParams,
): ClientSubscriptionId {
const clientSubscriptionId = this._nextClientSubscriptionId++;
const hash = fastStableStringify(
[subscriptionConfig.method, args],
true /* isArrayProp */,
);
const hash = fastStableStringify([subscriptionConfig.method, args]);
const existingSubscription = this._subscriptionsByHash[hash];
if (existingSubscription === undefined) {
this._subscriptionsByHash[hash] = {
Expand Down
4 changes: 2 additions & 2 deletions packages/rpc-subscriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@
],
"dependencies": {
"@solana/errors": "workspace:*",
"@solana/fast-stable-stringify": "workspace:*",
"@solana/functional": "workspace:*",
"@solana/rpc-subscriptions-api": "workspace:*",
"@solana/rpc-subscriptions-spec": "workspace:*",
"@solana/rpc-subscriptions-transport-websocket": "workspace:*",
"@solana/rpc-transformers": "workspace:*",
"@solana/rpc-types": "workspace:*",
"fast-stable-stringify": "^1.0.0"
"@solana/rpc-types": "workspace:*"
},
"bundlewatch": {
"defaultCompression": "gzip",
Expand Down
4 changes: 1 addition & 3 deletions packages/rpc-subscriptions/src/rpc-subscriptions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fastStableStringify from '@solana/fast-stable-stringify';
import { pipe } from '@solana/functional';
import type { SolanaRpcSubscriptionsApi, SolanaRpcSubscriptionsApiUnstable } from '@solana/rpc-subscriptions-api';
import { createSolanaRpcSubscriptionsApi } from '@solana/rpc-subscriptions-api';
Expand All @@ -7,9 +8,6 @@ import {
type RpcSubscriptionsTransport,
} from '@solana/rpc-subscriptions-spec';
import { ClusterUrl } from '@solana/rpc-types';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import fastStableStringify from 'fast-stable-stringify';

import { DEFAULT_RPC_CONFIG } from './rpc-default-config';
import type { RpcSubscriptionsFromTransport } from './rpc-subscriptions-clusters';
Expand Down
4 changes: 2 additions & 2 deletions packages/rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@
],
"dependencies": {
"@solana/errors": "workspace:*",
"@solana/fast-stable-stringify": "workspace:*",

This comment has been minimized.

Copy link
@jossaviv

jossaviv Apr 17, 2024

I think this needs to be revisited.

Many people having issues installing the package

"@solana/functional": "workspace:*",
"@solana/rpc-api": "workspace:*",
"@solana/rpc-spec": "workspace:*",
"@solana/rpc-transformers": "workspace:*",
"@solana/rpc-transport-http": "workspace:*",
"@solana/rpc-types": "workspace:*",
"fast-stable-stringify": "^1.0.0"
"@solana/rpc-types": "workspace:*"
},
"bundlewatch": {
"defaultCompression": "gzip",
Expand Down
4 changes: 1 addition & 3 deletions packages/rpc/src/rpc-request-deduplication.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import fastStableStringify from 'fast-stable-stringify';
import fastStableStringify from '@solana/fast-stable-stringify';

function isJsonRpcPayload(payload: unknown): payload is Readonly<{ method: string; params: unknown }> {
if (payload == null || typeof payload !== 'object' || Array.isArray(payload)) {
Expand Down
19 changes: 10 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 18d6b56

Please sign in to comment.