Skip to content

Conversation

@wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Sep 29, 2025

In continuation to #567

This PR will add a new async script, which will periodically update votes' vp_value when necessary.

Flow

  • the script will fetch all votes with cb PENDING_COMPUTE (default value on vote creation), and compute a new vp_value, when the proposal vp_value_by_strategy is ready, as well as assign a new CB (FINAL when the vp_state is final, PENDING_FINAL otherwise)
  • When a new votes with overriding strategy is added, all the votes will be set to PENDING_COMPUTE
  • Those votes will be picked by the script again, and back to step 1

@wa0x6e wa0x6e requested a review from Copilot September 29, 2025 17:27
@wa0x6e wa0x6e changed the base branch from master to feat-get-proposal-vp-value-from-overlord September 29, 2025 17:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds asynchronous scripts to periodically update vote values based on proposal strategy values. It introduces new voting power value computation logic that relies on an external Overlord service and implements a multi-stage callback state system for managing value synchronization.

  • Adds new helper modules for refreshing proposal strategy values and vote VP values
  • Refactors vote value calculation to use separate array parameters instead of full objects
  • Introduces callback state constants and removes immediate VP value computation during vote creation

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/constants.ts Defines callback state constants for the new sync workflow
src/helpers/entityValue.ts Adds strategy value fetching from Overlord API and refactors vote value calculation
src/helpers/proposalStrategiesValue.ts Implements periodic refresh of proposal strategy values
src/helpers/votesVpValue.ts Implements periodic refresh of vote VP values
src/helpers/utils.ts Adds reusable JSON-RPC request utility function
src/helpers/shutter.ts Refactors to use the new JSON-RPC utility
src/writer/vote.ts Removes immediate VP value calculation, sets initial state for async processing
src/writer/proposal.ts Adds callback state initialization and logging improvement
src/index.ts Registers the new refresh functions to run on startup
test/unit/helpers/entityValue.test.ts Updates tests to match refactored function signature
test/integration/writer/proposal.test.ts Reorganizes imports alphabetically
package.json Updates Node.js types version
.env.example Adds Overlord URL configuration and fixes typo

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@wa0x6e wa0x6e changed the title feat: add async script to set vote vp value feat(overlord): add async script to set vote vp value Sep 29, 2025
@wa0x6e wa0x6e force-pushed the feat-set-vote-vp-value branch 2 times, most recently from ff181ca to 5725853 Compare September 29, 2025 20:03
@wa0x6e wa0x6e requested a review from Copilot September 30, 2025 21:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@wa0x6e wa0x6e requested a review from bonustrack September 30, 2025 21:53
Base automatically changed from feat-get-proposal-vp-value-from-overlord to master September 30, 2025 22:28
@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 13.67521% with 202 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/helpers/votesVpValue.ts 0.00% 70 Missing and 1 partial ⚠️
src/helpers/proposalStrategiesValue.ts 0.00% 69 Missing and 1 partial ⚠️
src/helpers/utils.ts 7.31% 38 Missing ⚠️
src/helpers/entityValue.ts 51.85% 13 Missing ⚠️
src/index.ts 0.00% 4 Missing ⚠️
src/scores.ts 33.33% 2 Missing ⚠️
src/writer/vote.ts 33.33% 2 Missing ⚠️
src/helpers/shutter.ts 50.00% 1 Missing ⚠️
src/writer/proposal.ts 80.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wa0x6e wa0x6e force-pushed the feat-set-vote-vp-value branch from f9e1fb7 to 9a00146 Compare October 1, 2025 17:43
@wa0x6e wa0x6e force-pushed the feat-set-vote-vp-value branch from f5e3468 to a7daf1c Compare October 1, 2025 19:32
@wa0x6e wa0x6e force-pushed the feat-set-vote-vp-value branch from a7daf1c to 1926816 Compare October 1, 2025 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants