-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
chore: remove got dependency #6497
Closed
Closed
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
bb7bb0b
Changed got to fetch in file.ts
HiroyukiNaito d34d763
Align the valuable name
HiroyukiNaito 492f12a
Completed changing module got to fetch in file.ts
HiroyukiNaito 357c37a
Changed All files got to fetch
HiroyukiNaito ca99c0c
Update packages/cli/src/util/file.ts
HiroyukiNaito 883fca8
Update packages/cli/src/util/file.ts
HiroyukiNaito 0174d36
Delete got package by yarn remove command
HiroyukiNaito 39c4bd1
Delete
HiroyukiNaito 5bbc97c
Delete downloadOrCopyFile(pathDest: string, urlOrPathSrc: string): P…
HiroyukiNaito d573a50
Update packages/cli/test/utils/simulation/beacon_clients/lighthouse.ts
HiroyukiNaito cbdd24b
Update packages/cli/test/utils/simulation/beacon_clients/lodestar.ts
HiroyukiNaito 193ad5a
Changed Fetch error
HiroyukiNaito e9d8b77
Changed to return Buffer.from(await res.arrayBuffer());
HiroyukiNaito fe41173
Edited downloadTestFile
HiroyukiNaito 273f5c5
Changed some codes
HiroyukiNaito ad0bdf1
Merge remote-tracking branch 'upstream/unstable' into unstable
HiroyukiNaito 087589f
Added Error check logic
HiroyukiNaito ae3f92c
Changed for PR
HiroyukiNaito 56f644b
Delete a unused function downloadFilefunction downloadFile in files.ts
HiroyukiNaito 2b2e1e1
Alighed Error message
HiroyukiNaito fcaf7ea
Added fetch "@lodestar/api";
HiroyukiNaito e92c5ba
Deleted (err instanceof FetchError && err.code !== "ECONNREFUSED") logic
HiroyukiNaito ba0b674
added HealthStatus
HiroyukiNaito a44139e
Added Utility function for postEthRpc
HiroyukiNaito 19c016c
Changed Error handling
HiroyukiNaito 0ce433a
Lint fix
HiroyukiNaito f775aff
Mistakely deleted lint restored.
HiroyukiNaito e90a890
Lint corrected
HiroyukiNaito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,8 +1,7 @@ | ||||||||||||||||||
import fs from "node:fs"; | ||||||||||||||||||
import got from "got"; | ||||||||||||||||||
import {ENR} from "@chainsafe/enr"; | ||||||||||||||||||
import {SLOTS_PER_EPOCH} from "@lodestar/params"; | ||||||||||||||||||
import {ApiError, getClient} from "@lodestar/api"; | ||||||||||||||||||
import {ApiError, getClient, fetch} from "@lodestar/api"; | ||||||||||||||||||
import {getStateTypeFromBytes} from "@lodestar/beacon-node"; | ||||||||||||||||||
import {ChainConfig, ChainForkConfig} from "@lodestar/config"; | ||||||||||||||||||
import {Checkpoint} from "@lodestar/types/phase0"; | ||||||||||||||||||
|
@@ -102,13 +101,20 @@ export function getGenesisFileUrl(network: NetworkName): string | null { | |||||||||||||||||
* Fetches the latest list of bootnodes for a network | ||||||||||||||||||
* Bootnodes file is expected to contain bootnode ENR's concatenated by newlines | ||||||||||||||||||
*/ | ||||||||||||||||||
export async function fetchBootnodes(network: NetworkName): Promise<string[]> { | ||||||||||||||||||
|
||||||||||||||||||
class FetchBootFileError extends Error {} | ||||||||||||||||||
|
||||||||||||||||||
async function fetchBootnodes(network: NetworkName): Promise<string[]> { | ||||||||||||||||||
const bootnodesFileUrl = getNetworkData(network).bootnodesFileUrl; | ||||||||||||||||||
if (bootnodesFileUrl === null) { | ||||||||||||||||||
return []; | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
const bootnodesFile = await got.get(bootnodesFileUrl).text(); | ||||||||||||||||||
//const res = await fetch(bootnodesFileUrl); | ||||||||||||||||||
const res = await fetch("https://example-example-e.com/notfound"); | ||||||||||||||||||
if (!res.ok) { | ||||||||||||||||||
throw new FetchBootFileError(`Error fetching bootnodes file: Status Code ${res.status} (${res.statusText})`); | ||||||||||||||||||
} | ||||||||||||||||||
const bootnodesFile = await res.text(); | ||||||||||||||||||
return parseBootnodesFile(bootnodesFile); | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
|
@@ -121,8 +127,13 @@ export async function getNetworkBootnodes(network: NetworkName): Promise<string[ | |||||||||||||||||
const bootEnrs = await fetchBootnodes(network); | ||||||||||||||||||
bootnodes.push(...bootEnrs); | ||||||||||||||||||
} catch (e) { | ||||||||||||||||||
// eslint-disable-next-line no-console | ||||||||||||||||||
console.error(`Error fetching latest bootnodes: ${(e as Error).stack}`); | ||||||||||||||||||
if (e instanceof FetchBootFileError) { | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I added the logic, the nested Error mesage resolved.
Suggested change
The message becomes
|
||||||||||||||||||
// eslint-disable-next-line no-console | ||||||||||||||||||
console.error(`${(e as Error).stack}`); | ||||||||||||||||||
} else { | ||||||||||||||||||
// eslint-disable-next-line no-console | ||||||||||||||||||
console.error(`Error fetching latest bootnodes: ${(e as Error).stack}`); | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I move the CustomError to the file?
lodestar/packages/utils/src/errors.ts
Line 13 in b5712a6