-
-
Notifications
You must be signed in to change notification settings - Fork 69
Feat: (Health check) Check alt_ip if web domain is not accessible
#768
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
Open
graycraft
wants to merge
74
commits into
dev
Choose a base branch
from
feature/alternative-ip
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 61 commits
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
4cc61a5
feat(lib/nodes/abstract.node.ts): request a node by IP if domain is n…
graycraft 64e79a0
feat(lib/nodes/): request a node by IP if domain is not available
graycraft 3828ade
feat(lib/nodes/eth/EthNode.ts): request a node by IP if domain is not…
graycraft 4ce93cb
chore(src/lib/nodes/): import `NodeInfo` interface instead of explici…
graycraft 259d74c
chore(src/lib/nodes/): rename `this.alt_ip` to `this.altIp`
graycraft 9a5e3af
refactor(src/lib/nodes/): remove mapping of endpoint properties
graycraft 8b50ec2
fix(src/lib/nodes/): add `baseURL` detection for `get` requests
graycraft 32674e8
chore(src/lib/nodes/): add `console.info` for debugging domain-IP swi…
graycraft df7ac0d
refactor(src/lib/nodes/eth/Eth{Client,Node}.ts): create 2 clients in …
graycraft 086cec5
refactor(src/lib/nodes/): split Eth node clients to main and alt
graycraft f3578ad
refactor(src/lib/nodes/): move base URL detection logic to `getBaseUR…
graycraft 1ab8aa2
refactor(src/lib/nodes/abstract.node.ts): simplify domain-IP switch l…
graycraft c94387c
refactor(src/lib/nodes/): rename property to `preferDomain` and inver…
graycraft 8010ea0
refactor(src/lib/nodes/abstract.node.ts): rename property to `availab…
graycraft 1a78ec5
fix(src/{lib/nodes/,store/modules/{erc20,eth}}): create a new client …
graycraft 4be85c4
perf(src/lib/nodes/eth/EthNode.ts): return cached clients
graycraft 9f6bc2e
refactor(src/lib/nodes/eth/EthNode.ts): return main client if `altIp`…
graycraft 2e7236e
refactor(src/lib/nodes/eth/EthClient.ts): rename `getClientInstance` …
graycraft c011741
refactor(src/lib/nodes): do not check node URL on client initialization
graycraft b574708
refactor(src/lib/nodes/eth-indexer/EthIndexer.ts): do not check node …
graycraft d24aa2b
chore(src/lib/nodes): remove type definition of `baseURL`
graycraft 69e7556
refactor(src/lib/nodes): move `getBaseURL` method to the abstract nod…
graycraft d4e96b0
refactor(src/lib/nodes/{abstract.client.ts,eth/EthClient.ts}): move `…
graycraft 9d7df2b
chore(src/lib/nodes/abstract.node.ts): return `this` context of node …
graycraft caa984f
test(src/lib/nodes/__tests__/): add tests for Ethereum nodes
graycraft 7527cee
Merge branch 'dev' into feature/alternative-ip
graycraft 463d175
Merge branch 'dev' into feature/alternative-ip
graycraft 417afe1
feat(src/lib/nodes/abstract.node.ts): update URL components of a node…
graycraft 7fbe7a0
chore(src/lib/nodes/abstract.node.ts): debug additional parameters fo…
graycraft abedafd
chore(src/lib/nodes/abstract.node.ts): debug messages for `startHealt…
graycraft b63eb13
docs(src/lib/nodes/abstract.node.ts): do not return node instance
graycraft ce031ae
fix(src/lib/nodes/abstract.node.ts): satisfy URL constructor requirem…
graycraft ae08a9d
fix(src/lib/nodes/abstract.node.ts): update health check logic in acc…
graycraft 4afc731
chore(src/lib/nodes/abstract.node.ts): print healthcheck messages ver…
graycraft c16535e
fix(src/lib/nodes/abstract.node.ts): healthcheck messages text
graycraft 0cbb116
fix(src/lib/nodes/abstract.node.ts): `firstDomainAttempt` property sw…
graycraft 85fb7a1
fix(src/lib/nodes/abstract.node.ts): perform healthcheck only if a no…
graycraft a777fb3
fix(src/lib/nodes/abstract.node.ts): update `hasSupportedProtocol` af…
graycraft 49b06ff
fix(src/lib/nodes/abstract.node.ts): enable `hasSupportedProtocol` if…
graycraft c9f1239
Merge branch 'dev' into feature/alternative-ip
graycraft 0c6d1c4
chore(release-notes.md): add entry with PR #768 to improvements
graycraft da80374
fix(src/lib/nodes/abstract.node.ts): count connections and check prot…
graycraft 68051ec
fix(src/lib/nodes/abstract.node.ts): check alt IP if defined and prot…
graycraft f7edc8c
fix(src/lib/nodes/abstract.node.ts): `connectionCount` and `preferDom…
graycraft d95c97d
fix(src/lib/nodes/abstract.node.ts): `this.altIp` instead of `checkAl…
graycraft 3d54318
Merge remote-tracking branch 'origin/dev' into feature/alternative-ip
S-FrontendDev ee29448
feat(src/lib/nodes/abstract.node.ts): reset HealthCheck status if a n…
graycraft aed69d5
refactor(src/lib/nodes/abstract.node.ts): rename `connectionCount` to…
graycraft c989b17
fix(src/lib/nodes/abstract.node.ts): increment `healthcheckCount` if …
graycraft 1b771fe
chore(src/lib/nodes/abstract.node.ts): output alternative IP and URL …
graycraft 56fc4c6
chore(src/lib/nodes/abstract.node.ts): remove debugging message from …
graycraft 4b29aa7
fix(src/lib/nodes/abstract.node.ts): reset `healthcheckInProgress` af…
graycraft baab6f5
fix(src/lib/nodes/abstract.node.ts): reset `height` and `outOfSync` a…
graycraft 37528e3
fix(src/lib/nodes/abstract.node.ts): set `outOfSync` to `false`, not …
graycraft 49e04b8
fix(src/lib/nodes/abstract.node.ts): not reset `healthcheckInProgress…
graycraft 49d9756
fix(src/lib/nodes/abstract.node.ts): check health if a node is online…
graycraft 2fb2dce
fix(src/lib/nodes/abstract.node.ts): behavior according to the revise…
graycraft d166a47
fix(src/lib/nodes/abstract.node.ts): detecting insecure requests supp…
graycraft c32fb90
feat(src/lib/nodes/abstract.node.ts): mark a blocked HTTP node as off…
graycraft 8622105
fix(src/lib/nodes/abstract.node.ts): invert logic of `isHttpBlocked` …
graycraft aea613c
Merge remote-tracking branch 'origin/dev' into feature/alternative-ip
S-FrontendDev ad6abeb
style(src/lib/nodes/abstract.node.ts): add trailing commas
graycraft bdda8b5
feat(src/lib/nodes/abstract.node.ts): if connection lost repeat URL/I…
graycraft eee2431
chore(src/lib/nodes/abstract.node.ts): log message about successful c…
graycraft 100cc3f
fix(src/lib/nodes/abstract.node.ts): persistently save connection typ…
graycraft 8993697
fix(src/lib/nodes/abstract.node.ts): temporaly consider node offline …
graycraft 1c3ec3d
feat(store/modules/dev-tools): add Vuex store for ADAMANT Development…
graycraft 6571301
feat(store): add Vuex store for ADAMANT Development Tools
graycraft 57b56e3
feat(store/types/root-state): define `devTools` in root state
graycraft edcaed8
feat(store/plugins/localStorage): save `devTools` state to local storage
graycraft 06e400a
feat(src/locales/{en,ru}.json): add translation for `dev_screens.logg…
graycraft d855d1f
feat(views/devScreens/DevScreens): add dropdown for verbose logging
graycraft d36c88e
Merge branch 'feat/log-verbosity' into feature/alternative-ip
graycraft 4f50736
test(abstract.node.ts): output status update messages at debug level,…
graycraft 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
|
|
||
| import { EthNode } from '../../eth/EthNode.ts' | ||
|
|
||
| const nodeByDomain = new EthNode({ | ||
| alt_ip: 'http://95.216.114.252:44099', | ||
| url: 'https://ethnode2.adamant.im' | ||
| }), | ||
| nodeByIP = new EthNode({ | ||
| alt_ip: 'http://95.216.114.252:44099', | ||
| url: 'https://aaa.adamant.im' | ||
| }), | ||
| nodeOffline = new EthNode({ | ||
| alt_ip: 'http://111.111.111.111:44099', | ||
| url: 'https://aaa.adamant.im' | ||
| }) | ||
|
|
||
| describe('client', () => { | ||
| describe('by domain', () => { | ||
| it('get block number', async () => { | ||
| expect(await nodeByDomain.client().getBlockNumber()).toBeTypeOf('bigint') | ||
| }) | ||
| }) | ||
| describe('by IP', () => { | ||
| it('get block number', async () => { | ||
| try { | ||
| await nodeByIP.client().getBlockNumber() | ||
| } catch (error) { | ||
| expect(error).toEqual({ | ||
| message: | ||
| 'request to https://aaa.adamant.im/ failed, reason: getaddrinfo ENOTFOUND aaa.adamant.im', | ||
| type: 'system', | ||
| errno: 'ENOTFOUND', | ||
| code: 'ENOTFOUND' | ||
| }) | ||
| } | ||
| }) | ||
| }) | ||
| describe('offline', () => { | ||
| it('get block number', async () => { | ||
| try { | ||
| await nodeOffline.client().getBlockNumber() | ||
| } catch (error) { | ||
| expect(error).toEqual({ | ||
| message: | ||
| 'request to https://aaa.adamant.im/ failed, reason: getaddrinfo ENOTFOUND aaa.adamant.im', | ||
| type: 'system', | ||
| errno: 'ENOTFOUND', | ||
| code: 'ENOTFOUND' | ||
| }) | ||
| } | ||
| }) | ||
| }) | ||
| }) | ||
| describe('node', () => { | ||
| describe('by domain', () => { | ||
| it('start healthcheck', async () => { | ||
| const node = await nodeByDomain.startHealthcheck() | ||
|
|
||
| expect(node.altIp).toBe('http://95.216.114.252:44099') | ||
| expect(node.altIpAvailable).toBe(false) | ||
| expect(node.availableByDomain).toBe(true) | ||
| expect(node.hostname).toBe('ethnode2.adamant.im') | ||
| expect(node.online).toBe(true) | ||
| expect(node.preferDomain).toBe(true) | ||
| expect(node.url).toBe('https://ethnode2.adamant.im') | ||
| }) | ||
| }) | ||
| describe('by IP', () => { | ||
| it('start healthcheck', async () => { | ||
| const node = await nodeByIP.startHealthcheck() | ||
|
|
||
| expect(node.altIp).toBe('http://95.216.114.252:44099') | ||
| expect(node.altIpAvailable).toBe(false) | ||
| expect(node.availableByDomain).toBe(false) | ||
| expect(node.hostname).toBe('aaa.adamant.im') | ||
| expect(node.online).toBe(true) | ||
| expect(node.preferDomain).toBe(false) | ||
| expect(node.url).toBe('https://aaa.adamant.im') | ||
| }) | ||
| }) | ||
| describe('offline', () => { | ||
| it('start healthcheck', async () => { | ||
| const node = await nodeOffline.startHealthcheck() | ||
|
|
||
| expect(node.altIp).toBe('http://111.111.111.111:44099') | ||
| expect(node.altIpAvailable).toBe(false) | ||
| expect(node.availableByDomain).toBe(false) | ||
| expect(node.hostname).toBe('aaa.adamant.im') | ||
| expect(node.online).toBe(true) | ||
| expect(node.preferDomain).toBe(false) | ||
| expect(node.url).toBe('https://aaa.adamant.im') | ||
| }) | ||
| }) | ||
| }) |
This file contains hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.