Skip to content

Commit

Permalink
bump version to v2.6.91 (#2048)
Browse files Browse the repository at this point in the history
* bump version to v2.6.91
  • Loading branch information
wpank authored Oct 23, 2022
1 parent e87ae03 commit 4548eaa
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 58 deletions.
2 changes: 1 addition & 1 deletion charts/otv-backend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: 1K Validators Backend
name: otv-backend
version: v2.6.90
version: v2.6.91
apiVersion: v2
2 changes: 1 addition & 1 deletion charts/otv-backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resources:

image:
repo: web3f/otv-backend
tag: 2.6.90
tag: 2.6.91

certificate:
enabled: true
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ services:
- 8000:8000
expose:
- 8000
restart: always
command: telemetry_core --listen 0.0.0.0:8000 --expose-node-ips --feed-timeout 60
networks:
testing_net:
Expand Down
4 changes: 2 additions & 2 deletions helmfile.d/10-otv-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ releases:
namespace: kusama
{{ if eq .Environment.Name "production" }}
chart: w3f/otv-backend
version: v2.6.90
version: v2.6.91
{{ else }}
chart: ../charts/otv-backend
{{ end }}
Expand All @@ -30,7 +30,7 @@ releases:
namespace: polkadot
{{ if eq .Environment.Name "production" }}
chart: w3f/otv-backend
version: v2.6.90
version: v2.6.91
{{ else }}
chart: ../charts/otv-backend
{{ end }}
Expand Down
5 changes: 5 additions & 0 deletions helmfile.d/config/kusama/otv-backend-prod.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2889,6 +2889,11 @@ config: |
"name": "ERN VENTURES-02",
"stash": "Gjv9ZGF9Sz5GEixULU7Dmq7z8zVRmQFj2Y31qfpwbhsvo76",
"riotHandle": "@ernventures:matrix.org"
},
{
"name": "GROUP_THERAPY",
"stash": "GcS4cm9Zuk1EYAm3N92TXgUGAhG18Y4g9niZ4Pz1Ak9fu3C",
"riotHandle": "@agt_staking:matrix.org"
}
],
"forceRound": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/ApiHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ApiHandler extends EventEmitter {
logger.warn("The API has an error");
console.log(error);
});
await api.isReadyOrError;
await api.isReadyOrError.catch(logger.error);
return api;
}
}
Expand Down
44 changes: 7 additions & 37 deletions packages/common/src/constraints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ export class OTV implements Constraints {
: 0;

// Scale bonding based on the 5th and 85th percentile
const scaleonded =
const scaleBonded =
scaledDefined(
candidate.bonded ? candidate.bonded : 0,
bondedValues,
0.05,
0.85
) || 0;
const bondedScore = scaleonded * this.BONDED_WEIGHT;
const bondedScore = scaleBonded * this.BONDED_WEIGHT;

const scaledOffline =
scaled(candidate.offlineAccumulated, offlineValues) || 0;
Expand Down Expand Up @@ -483,24 +483,6 @@ export class OTV implements Constraints {
const scaledDemocracyScore =
scaled(totalDemocracyScore, democracyValues) * this.DEMOCRACY_WEIGHT;

logger.info(`${candidate.name} inclusionScore ${inclusionScore}`);
logger.info(`${candidate.name} spanInclusionScore ${spanInclusionScore}`);
logger.info(`${candidate.name} faultsScore ${faultsScore}`);
logger.info(`${candidate.name} discoveredScore ${discoveredScore}`);
logger.info(`${candidate.name} nominatedScore ${nominatedScore}`);
logger.info(`${candidate.name} rankScore ${rankScore}`);
logger.info(`${candidate.name} unclaimedScore ${unclaimedScore}`);
logger.info(`${candidate.name} bondedScore ${bondedScore}`);
logger.info(`${candidate.name} locationScore ${locationScore}`);
logger.info(`${candidate.name} councilStakeScore ${councilStakeScore}`);
logger.info(
`${candidate.name} scaledDemocracyScore ${scaledDemocracyScore}`
);
logger.info(`${candidate.name} offlineScore ${offlineScore}`);
logger.info(
`${candidate.name} nominatorStakeScore ${nominatorStakeScore}`
);

const aggregate =
inclusionScore +
spanInclusionScore +
Expand All @@ -511,19 +493,19 @@ export class OTV implements Constraints {
unclaimedScore +
bondedScore +
locationScore +
// regionScore +
// countryScore +
// providerScore +
councilStakeScore +
scaledDemocracyScore +
offlineScore +
// delegationScore +
nominatorStakeScore;

const randomness = 1 + Math.random() * 0.15;

const total = aggregate * randomness || 0;

logger.info(`aggregate: ${aggregate}`);
logger.info(`randomness: ${randomness}`);
logger.info(`total: ${total}`);

const score = {
total: total,
aggregate: aggregate,
Expand Down Expand Up @@ -615,11 +597,6 @@ export class OTV implements Constraints {
> {
logger.info(`(OTV::processCandidates) Processing candidates`);

const [activeEraIndex, eraErr] = await this.chaindata.getActiveEraIndex();
if (eraErr) {
throw eraErr;
}

const good: Set<Types.CandidateData> = new Set();
const bad: Set<{ candidate: Types.CandidateData; reason: string }> =
new Set();
Expand All @@ -631,14 +608,7 @@ export class OTV implements Constraints {
);
continue;
}
const {
name,
offlineSince,
stash,
skipSelfStake,
offlineAccumulated,
unclaimedEras,
} = candidate;
const { name, stash, skipSelfStake, offlineAccumulated } = candidate;
/// Ensure the commission wasn't raised/
const [commission, err] = await this.chaindata.getCommission(stash);
/// If it errors we assume that a validator removed their validator status.
Expand Down
6 changes: 6 additions & 0 deletions packages/common/src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ export class Db {
});
}
}

process.on("SIGINT", async () => {
logger.info("Shutting down mongodb connection.....");
await mongoose.connection.close();
process.exit(0);
});
2 changes: 1 addition & 1 deletion packages/common/src/db/queries/Candidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export const reportOnline = async (

if (data.offlineSince && data.offlineSince !== 0) {
logger.info(
`Online node ${data.name} was offline since: ${data.offlineSince}`
`Online node ${data.name} with id ${telemetryId} was offline since: ${data.offlineSince}`
);
// The node was previously offline.
const timeOffline = now - data.offlineSince;
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,10 @@ program

program.version(version);
program.parse(process.argv);

const signals = ["SIGHUP", "SIGINT", "SIGTERM"];
for (const signal of signals) {
process.on(signal, () => {
logger.info(`process received a ${signal} signal`);
});
}
4 changes: 2 additions & 2 deletions packages/gateway/src/controllers/Accounting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { response } from "./index";

export default class AccountingController {
public static async getAccounting(context: any): Promise<void> {
const stash = context.params.stash;
const address = context.params.address;

response(context, 200, await AccountingService.findAccounting(stash));
response(context, 200, await AccountingService.findAccounting(address));
}
}
6 changes: 3 additions & 3 deletions packages/gateway/src/controllers/Candidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { response } from "./index";

export default class CandidateController {
public static async getCandidate(context: any): Promise<void> {
const stash = context.params.stash;
const address = context.params.address;

response(context, 200, await CandidateService.getCandidate(stash));
response(context, 200, await CandidateService.getCandidate(address));
}

public static async getCandidates(context: any): Promise<void> {
Expand All @@ -17,7 +17,7 @@ export default class CandidateController {
}

public static async getNominatorStake(context: any): Promise<void> {
const address = context.params.stash;
const address = context.params.address;

response(context, 200, await CandidateService.getNominatorStake(address));
}
Expand Down
4 changes: 2 additions & 2 deletions packages/gateway/src/controllers/Nominator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class NominatorController {
}

public static async getNominator(context: any): Promise<void> {
const stash = context.params.stash;
response(context, 200, await NominatorService.getNominator(stash));
const address = context.params.address;
response(context, 200, await NominatorService.getNominator(address));
}
}
4 changes: 2 additions & 2 deletions packages/gateway/src/controllers/Score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as ScoreService from "../services/Score";

export default class ScoreController {
public static async getScore(context: any): Promise<void> {
const { stash } = context.params;
response(context, 200, await ScoreService.getScore(stash));
const { address } = context.params;
response(context, 200, await ScoreService.getScore(address));
}

public static async getScoreMetadata(context: any): Promise<void> {
Expand Down
8 changes: 4 additions & 4 deletions packages/gateway/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ const router = new Router();

const API = {
BullBoard: "/bull",
Accounting: "/accounting/:stash",
Candidate: "/candidate/:stash",
Accounting: "/accounting/:address",
Candidate: "/candidate/:address",
GetCandidates: "/candidates",
GetNodes: "/nodes",
GetNominators: "/nominators",
GetNominator: "/nominator/:stash",
GetNominator: "/nominator/:address",
GetNominations: "/nominations",
GetNominatorNominations: "/nominations/:address/:last",
GetBotClaimEvents: "/claims",
Health: "/healthcheck",
EraPoints: "/erapoints/:stash",
EraPoints: "/erapoints/:address",
TotalEraPoints: "/totalerapoints",
LastNomination: "/lastnomination",
ProxyTxs: "/proxytxs",
Expand Down
17 changes: 16 additions & 1 deletion packages/gateway/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,22 @@ export default class Server {
this.app.use(serverAdapter.registerPlugin());
}
logger.info(`Now listening on ${this.port}`);
this.app.listen(this.port);
const server = this.app.listen(this.port);
}
}
}

// process.on("SIGTERM", () => {
// console.log("received SIGTERM");
//
// console.log("waiting for %d sec to close server", WAIT_BEFORE_SERVER_CLOSE);
//
// setTimeout(() => {
// console.log("calling server close");
//
// server.close(() => {
// console.log("server closed, exit");
// process.exit(0);
// });
// }, WAIT_BEFORE_SERVER_CLOSE * 1000);
// });
1 change: 0 additions & 1 deletion packages/telemetry/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ export default class TelemetryClient {

const name = details[0];

logger.info(`(TELEMETRY) Reporting ${name} OFFLINE`);
this.beingReported.set(name, true);
await queries.reportOffline(id, name, now);
this.beingReported.set(name, false);
Expand Down

0 comments on commit 4548eaa

Please sign in to comment.