Skip to content
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

v3.1.4 #2709

Merged
merged 14 commits into from
Mar 6, 2024
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.1.3
targetRevision: v3.1.4
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.1.3
targetRevision: v3.1.4
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.1.3
appVersion: v3.1.3
version: v3.1.4
appVersion: v3.1.4
apiVersion: v2
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.1.3",
"version": "3.1.4",
"description": "Services for running the Thousand Validator Program.",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
17 changes: 12 additions & 5 deletions packages/common/src/nominator/NominatorTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,20 @@ export const sendProxyTx = async (
}

const namedTargets = await Promise.all(
targets.map(async (val) => {
const name = await queries.getIdentityName(val);
const kyc = await queries.isKYC(val);
const scoreResult = await queries.getLatestValidatorScore(val);
targets.map(async (target) => {
const kyc = await queries.isKYC(target);
let name = await queries.getIdentityName(target);
if (!name) {
name =
(await nominator.chaindata.getFormattedIdentity(target))?.name ||
"";
}

const scoreResult = await queries.getLatestValidatorScore(target);
const score = scoreResult && scoreResult.total ? scoreResult.total : 0;

return {
address: val,
stash: target,
name: name || "",
kyc: kyc || false,
score: score,
Expand Down
5 changes: 4 additions & 1 deletion packages/common/src/nominator/nominator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class Nominator extends EventEmitter {
return this._status;
};

public async updateNominatorStatus(newStatus: NominatorStatus) {
public async updateNominatorStatus(newStatus?: NominatorStatus) {
// Always update on-chain data for status
const nominatorInfo = await getNominatorChainInfo(this);
const {
Expand All @@ -113,6 +113,9 @@ export default class Nominator extends EventEmitter {
}

public async shouldNominate(): Promise<boolean> {
// refresh the nominator status with the latest on-chain data
await this.updateNominatorStatus();

const stash = await this.stash();
const isBonded = await this.chaindata.isBonded(stash);
const [bonded, err] = await this.chaindata.getDenomBondedAmount(stash);
Expand Down
28 changes: 17 additions & 11 deletions packages/common/src/scorekeeper/Round.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,32 @@ export const startRound = async (
scorekeeperLabel,
);
for (const nom of nominatorGroups) {
const shouldNominate = await nom.shouldNominate();
if (!shouldNominate) {
const nominatorStatus: NominatorStatus = {
state: NominatorState.Nominating,
status: `[${index}/${allCandidates.length}] ${candidate.name} ${isValid ? "✅ " : "❌"}`,
updated: Date.now(),
stale: false,
};
await nom.updateNominatorStatus(nominatorStatus);
}
}
}

for (const nom of nominatorGroups) {
const shouldNominate = await nom.shouldNominate();
if (shouldNominate) {
const nominatorStatus: NominatorStatus = {
state: NominatorState.Nominating,
status: `[${index}/${allCandidates.length}] ${candidate.name} ${isValid ? "✅ " : "❌"}`,
status: `Scoring Candidates...`,
updated: Date.now(),
stale: false,
};
await nom.updateNominatorStatus(nominatorStatus);
}
}

for (const nom of nominatorGroups) {
const nominatorStatus: NominatorStatus = {
state: NominatorState.Nominating,
status: `Scoring Candidates...`,
updated: Date.now(),
stale: false,
};
await nom.updateNominatorStatus(nominatorStatus);
}

// Score all candidates
await constraints.scoreAllCandidates();

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.1.3",
"version": "3.1.4",
"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.1.3",
"version": "3.1.4",
"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/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.1.3",
"version": "3.1.4",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion packages/scorekeeper-status-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ const App = () => {
theme="polkadot"
/>
{target.name
? `${target.name}`
? `[${target.score?.toFixed(0)}] ${target.name}`
: `${truncateAddress(target.stash)}`}{" "}
{target.kyc && (
<FiCheckCircle
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.1.3",
"version": "3.1.4",
"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.1.3",
"version": "3.1.4",
"description": "Services for running the Thousand Validator Program.",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down