Skip to content

Commit

Permalink
Merge pull request #2903 from w3f/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
ironoa committed Apr 26, 2024
2 parents ce9a906 + c200468 commit ec20e19
Show file tree
Hide file tree
Showing 17 changed files with 182 additions and 184 deletions.
2 changes: 1 addition & 1 deletion apps/1kv-backend/templates/kusama-otv-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
source:
repoURL: https://w3f.github.io/helm-charts/
chart: otv-backend
targetRevision: v3.2.0
targetRevision: v3.2.1
plugin:
env:
- name: HELM_VALUES
Expand Down
2 changes: 1 addition & 1 deletion apps/1kv-backend/templates/polkadot-otv-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
source:
repoURL: https://w3f.github.io/helm-charts/
chart: otv-backend
targetRevision: v3.2.0
targetRevision: v3.2.1
plugin:
env:
- name: HELM_VALUES
Expand Down
4 changes: 2 additions & 2 deletions charts/otv-backend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
description: 1K Validators Backend
name: otv-backend
version: v3.2.0
appVersion: v3.2.0
version: v3.2.1
appVersion: v3.2.1
apiVersion: v2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"@bull-board/koa": "^5.15.0",
"@koa/router": "^12.0.1",
"@octokit/rest": "^20.0.2",
"@polkadot/api": "^10.12.2",
"@polkadot/api": "^11.0.2",
"@polkadot/keyring": "^12.6.2",
"@types/cron": "^2.4.0",
"@types/jest": "^29.5.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1kv/common",
"version": "3.2.0",
"version": "3.2.1",
"description": "Services for running the Thousand Validator Program.",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/db/queries/Validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ export const getValidatorActiveEras = async (
// return the number of eras
export const getIdentityValidatorActiveEras = async (
address: string,
validatorSets: ValidatorSet[],
): Promise<number> => {
const identityAddresses = await getIdentityAddresses(address);
let count = 0;
const validatorSets = await getAllValidatorSets();
for (const era of validatorSets) {
if (
era.validators.some((validator) => identityAddresses.includes(validator))
Expand Down
10 changes: 6 additions & 4 deletions packages/common/src/scorekeeper/NumNominations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ export const autoNumNominations = async (
);

// Query the staking info of the validator set
const query = await api?.derive.staking.electedInfo();
const { info } = query;
const { info } = await api?.derive.staking.electedInfo({
withExposureMeta: true,
});

const totalStakeAmounts = [];

// add formatted totals to list
for (const validator of info) {
const { exposure } = validator;
const { total, own, others } = exposure;
const { exposureMeta } = validator;
if (!exposureMeta?.isSome) continue;
const { total } = exposureMeta.value;

const totalValue = total.unwrap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const eraStatsJob = async (
updated: Date.now(),
});

for (let i = currentEra; i > 20; i--) {
for (let i = currentEra; i > currentEra - 20; i--) {
if (await queries.validatorSetExistsForEra(i)) {
continue;
}
Expand Down
4 changes: 3 additions & 1 deletion packages/common/src/utils/Validators.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { allCandidates, setRank } from "../db/queries";
import { allCandidates, getAllValidatorSets, setRank } from "../db/queries";
import { queries } from "../index";

// Sets all validators ranks
export const setValidatorRanks = async () => {
const candidates = await allCandidates();
const validatorSets = await getAllValidatorSets();
for (const candidate of candidates) {
const identityRank = await queries.getIdentityValidatorActiveEras(
candidate.stash,
validatorSets,
);
await setRank(candidate.stash, identityRank);
}
Expand Down
1 change: 1 addition & 0 deletions packages/common/test/utils/Validators.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ describe("setValidatorRanks", () => {

const subNumEras = await getIdentityValidatorActiveEras(
"HkJjBkX8fPBFJvTtAbUDKWZSsMrNFuMc7TrT8BqVS5YhZXg",
validatorSets,
);
expect(subNumEras).toBe(5);

Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1kv/core",
"version": "3.2.0",
"version": "3.2.1",
"description": "Services for running the Thousand Validator Program.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/gateway/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1kv/gateway",
"version": "3.2.0",
"version": "3.2.1",
"description": "Services for running the Thousand Validator Program.",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
7 changes: 0 additions & 7 deletions packages/gateway/src/services/Validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,3 @@ export const getValidatorsNumActiveEras = async (
const eras = await queries.getValidatorActiveEras(stash);
return eras;
};

export const getIdentityValidatorNumActiveEras = async (
stash: string,
): Promise<any> => {
const eras = await queries.getIdentityValidatorActiveEras(stash);
return eras;
};
2 changes: 1 addition & 1 deletion packages/scorekeeper-status-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@1kv/scorekeeper-status-ui",
"private": true,
"version": "3.2.0",
"version": "3.2.1",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion packages/telemetry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1kv/telemetry",
"version": "3.2.0",
"version": "3.2.1",
"description": "Services for running the Thousand Validator Program.",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@1kv/worker",
"version": "3.2.0",
"version": "3.2.1",
"description": "Services for running the Thousand Validator Program.",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
Loading

0 comments on commit ec20e19

Please sign in to comment.