From ed4e17980eda54a83f8f226a29c1386015ff5268 Mon Sep 17 00:00:00 2001 From: Ross Bulat Date: Mon, 2 Dec 2024 00:07:25 +0700 Subject: [PATCH] Revert "feat(light client): Use wss boot nodes only (#2345)" This reverts commit 02e778d1731c405cb9ff955b49fc6a91645f3cdc. --- packages/app/src/api/index.ts | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/packages/app/src/api/index.ts b/packages/app/src/api/index.ts index 55c1fb24a4..2a806cafca 100644 --- a/packages/app/src/api/index.ts +++ b/packages/app/src/api/index.ts @@ -111,32 +111,16 @@ export class Api { const smMetadata = getLightClientMetadata(this.#chainType, this.network); const { chainSpec: relayChainSpec } = await smMetadata.relay.fn(); - // Filter non-encrypted boot nodes in production. - const wssRelayChainSpec = - import.meta.env.MODE === 'development' - ? relayChainSpec - : this.wssBootNodesOnly(relayChainSpec); - let chain; if (this.#chainType === 'relay') { - chain = smoldot.addChain({ - chainSpec: wssRelayChainSpec, - }); + chain = smoldot.addChain({ chainSpec: relayChainSpec }); this.#apiClient = createClient(getSmProvider(chain)); } else { const { chainSpec: paraChainSpec } = await smMetadata!.para!.fn(); - // Filter non-encrypted boot nodes in production. - const wssParaChainSpec = - import.meta.env.MODE === 'development' - ? paraChainSpec - : this.wssBootNodesOnly(paraChainSpec); - chain = smoldot.addChain({ - chainSpec: this.wssBootNodesOnly(wssParaChainSpec), + chainSpec: paraChainSpec, potentialRelayChains: [ - await smoldot.addChain({ - chainSpec: wssRelayChainSpec, - }), + await smoldot.addChain({ chainSpec: relayChainSpec }), ], }); this.#apiClient = createClient(getSmProvider(chain)); @@ -277,12 +261,4 @@ export class Api { this.dispatchEvent(this.ensureEventStatus('disconnected')); } } - - wssBootNodesOnly(spec: string) { - const filtered = Object.assign({}, JSON.parse(spec)); - filtered.bootNodes = filtered.bootNodes.filter((node: string) => - /\/wss\//.test(node) - ); - return JSON.stringify(filtered); - } }