-
Notifications
You must be signed in to change notification settings - Fork 14
Updates to the VHS connection-manager #392
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
Changes from all commits
eec0a2a
244500e
f6d7a4b
3531af5
563bb61
003afbe
f71a4a3
8920da2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| ValidatorKeys, | ||
| Ballot, | ||
| Chain, | ||
| LedgerHashIndex, | ||
| } from '../shared/types' | ||
| import { getLists, overlaps } from '../shared/utils' | ||
| import logger from '../shared/utils/logger' | ||
|
|
@@ -268,7 +269,7 @@ | |
| */ | ||
| private async calculateValidatorAgreement( | ||
| signing_key: string, | ||
| ledger_hashes: Set<string>, | ||
| ledger_hashes: Set<LedgerHashIndex>, | ||
| incomplete: boolean, | ||
| ): Promise<void> { | ||
| const master_key = await signingToMaster(signing_key) | ||
|
|
@@ -284,24 +285,38 @@ | |
| await updateDailyAgreement(validator_keys) | ||
| } | ||
|
|
||
| /** | ||
|
Check failure on line 288 in src/connection-manager/agreement.ts
|
||
| * Calculate the agreement score for the last hour of validations. | ||
| * | ||
| * @param validator_keys - Signing keys of validations for one validator. | ||
| * @param validations - Set of ledger_hashes validated by signing_key. | ||
| * @param ledgers - Set of ledger_hashes validated by network. | ||
|
Check failure on line 293 in src/connection-manager/agreement.ts
|
||
| * @param incomplete - Is this agreement score incomplete. | ||
| * @returns Void. | ||
| */ | ||
| private async calculateHourlyAgreement( | ||
| validator_keys: ValidatorKeys, | ||
| validations: Map<string, number>, | ||
| ledgers: Set<string>, | ||
| ledgerHashIndexMap: Set<LedgerHashIndex>, | ||
| incomplete: boolean, | ||
| ): Promise<void> { | ||
| // obtain ledger_hashes validated by the network, strip out the ledger_index info for agreement calculation purposes | ||
| let ledgers = new Set<string>() | ||
|
Check failure on line 304 in src/connection-manager/agreement.ts
|
||
| for(const value of ledgerHashIndexMap) { | ||
|
Check failure on line 305 in src/connection-manager/agreement.ts
|
||
| ledgers.add(value.ledger_hash) | ||
| } | ||
| const missed = setDifference(ledgers, validations) | ||
| const validated = setIntersection(ledgers, validations) | ||
|
|
||
| if(validator_keys.master_key == 'nHU4bLE3EmSqNwfL4AP1UZeTNPrSPPP6FXLKXo2uqfHuvBQxDVKd' || validator_keys.signing_key == 'n9LbM9S5jeGopF5J1vBDoGxzV6rNS8K1T5DzhNynkFLqR9N2fywX') { | ||
|
Check failure on line 311 in src/connection-manager/agreement.ts
|
||
| console.log('DEBUG: XRPL Mainnet received the following ledgers: ', Array.from(ledgerHashIndexMap)) | ||
|
Check failure on line 312 in src/connection-manager/agreement.ts
|
||
| console.log('DEBUG: Number of Validations received by the Ripple validator: ', validations.size) | ||
|
Check failure on line 313 in src/connection-manager/agreement.ts
|
||
| console.log('DEBUG: Validations received by the Ripple validator: <ignore the second value, which is the timestamp>', validations) | ||
|
Check failure on line 314 in src/connection-manager/agreement.ts
|
||
|
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. Logger has 4 different logging level This comment applies to all log statements added in this PR. |
||
| console.log('DEBUG: Missed ledgers: ', missed) | ||
|
Check warning on line 315 in src/connection-manager/agreement.ts
|
||
| console.log('DEBUG: Validated ledgers: ', validated) | ||
|
Check warning on line 316 in src/connection-manager/agreement.ts
|
||
| console.log('DEBUG: Incomplete: ', incomplete) | ||
|
Check warning on line 317 in src/connection-manager/agreement.ts
|
||
| } | ||
|
|
||
| const agreement: AgreementScore = { | ||
| validated: validated.size, | ||
| missed: missed.size, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,10 @@ let jobsStarted = false | |
| * @param networkName - The name of the network. | ||
| * @returns The first UNL in the list of UNLs for the network. | ||
| */ | ||
| async function getFirstUNL(networkName: string): Promise<string> { | ||
| export async function getFirstUNL(networkName: string): Promise<string> { | ||
| if (!networkName) { | ||
| return Promise.reject(new Error('Network name is empty')) | ||
| } | ||
| const networks = await getNetworks() | ||
| const network = networks.filter((ntwk) => ntwk.id === networkName)[0] | ||
| return network.unls[0] | ||
|
|
@@ -96,9 +99,13 @@ export async function updateUNLManifests(): Promise<void> { | |
| * @param network - The network to update. | ||
| * @returns A promise that resolves to void once all UNL validators are saved. | ||
| */ | ||
| async function updateUNLManifestNetwork(network: string): Promise<void> { | ||
| export async function updateUNLManifestNetwork(network: string): Promise<void> { | ||
| // TODO: In an ideal scenario, the networks table should not contain undefined network.id rows | ||
|
Collaborator
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. network.id will never be undefined since it's the primary key, so insert would fail if id is not set |
||
| if (!network) { | ||
| return Promise.reject(new Error('Network string should not be empty')) | ||
| } | ||
| try { | ||
| log.info('Fetching UNL...') | ||
| log.info('Fetching Manifests for network: ' + network + '. Identified UNL: ' + await getFirstUNL(network)) | ||
| const unl: UNLBlob = await fetchValidatorList(await getFirstUNL(network)) | ||
| const promises: Array<Promise<void>> = [] | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Can you fix all the alerts and the failed build?