Skip to content

Commit

Permalink
Merge pull request #94 from MinaFoundation/feature/worker-heartbeat-a…
Browse files Browse the repository at this point in the history
…dmin

Feature/worker heartbeat admin
  • Loading branch information
iluxonchik authored Dec 19, 2024
2 parents 9213e8f + e168c08 commit 58fd131
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pgt-web-app",
"version": "0.1.24",
"version": "0.1.25",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/services/OCVApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface OCVVoteResponse {
positive_stake_weight: string;
negative_stake_weight: string;
vote_status: string;
eligible: boolean;
elegible: boolean;
votes: OCVVote[];
}

Expand Down
18 changes: 9 additions & 9 deletions src/services/ProposalStatusMoveService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ interface ProposalWithVotes extends ProposalWithVotesBase {

interface MoveResult {
newStatus: ProposalStatus;
ocvEligible: boolean;
ocvElegible: boolean;
reviewerVotesGiven: number;
reviewerVotesRequired: number;
}
Expand Down Expand Up @@ -107,13 +107,13 @@ export class ProposalStatusMoveService {

const numReviewerApprovals = this.countValidApprovals(proposal);
const ocvData = proposal.OCVConsiderationVote?.voteData as OCVVoteResponse | undefined;
const isEligible = ocvData?.eligible ?? false;
const isElegible = ocvData?.elegible ?? false;

const thresholdReviewerApprovals = this.config.considerationPhase.minReviewerApprovals;

return {
newStatus,
ocvEligible: isEligible,
ocvElegible: isElegible,
reviewerVotesGiven: numReviewerApprovals,
reviewerVotesRequired: thresholdReviewerApprovals
};
Expand Down Expand Up @@ -158,24 +158,24 @@ export class ProposalStatusMoveService {
const approvalCount = this.countValidApprovals(proposal);
const isMinApprovals = approvalCount >= this.config.considerationPhase.minReviewerApprovals;
const ocvData = proposal.OCVConsiderationVote?.voteData as OCVVoteResponse | undefined;
const ocvEligible = ocvData?.eligible ?? false;
const ocvElegible = ocvData?.elegible ?? false;

logger.info(`OCV data: ${JSON.stringify(ocvData)}`);
logger.info(`Proposal ${proposal.id} should move to DELIBERATION. Approval count: ${approvalCount}, min approvals: ${this.config.considerationPhase.minReviewerApprovals}, OCV eligible: ${ocvEligible}`);
logger.info(`Proposal ${proposal.id} should move to DELIBERATION. Approval count: ${approvalCount}, min approvals: ${this.config.considerationPhase.minReviewerApprovals}, OCV elegible: ${ocvElegible}`);

return isMinApprovals || ocvEligible;
return isMinApprovals || ocvElegible;
}

private async shouldMoveBackToConsideration(proposal: ProposalWithVotes): Promise<boolean> {
const approvalCount = this.countValidApprovals(proposal);
const isMinApprovals = approvalCount >= this.config.considerationPhase.minReviewerApprovals;
const ocvData = proposal.OCVConsiderationVote?.voteData as OCVVoteResponse | undefined;
const ocvEligible = ocvData?.eligible ?? false;
const ocvElegible = ocvData?.elegible ?? false;

logger.info(`OCV data: ${JSON.stringify(ocvData)}`);
logger.info(`Proposal ${proposal.id} should move back to CONSIDERATION. Approval count: ${approvalCount}, min approvals: ${this.config.considerationPhase.minReviewerApprovals}, OCV eligible: ${ocvEligible}`);
logger.info(`Proposal ${proposal.id} should move back to CONSIDERATION. Approval count: ${approvalCount}, min approvals: ${this.config.considerationPhase.minReviewerApprovals}, OCV elegible: ${ocvElegible}`);

return !isMinApprovals && !ocvEligible;
return !isMinApprovals && !ocvElegible;
}

private countValidApprovals(proposal: ProposalWithVotes): number {
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/ocv-vote-counting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ async function processProposals() {

if (moveResult) {
const voteInfo: ProposalVoteInfo = {
ocv_eligible: moveResult.ocvEligible,
ocv_eligible: moveResult.ocvElegible,
reviewer_votes_given: moveResult.reviewerVotesGiven,
reviewer_votes_required: moveResult.reviewerVotesRequired
};
Expand Down

0 comments on commit 58fd131

Please sign in to comment.