This repository was archived by the owner on Aug 22, 2025. It is now read-only.
refactor: use getScoresDirect to get scores in getVp#1771
Merged
wa0x6e merged 3 commits intofix-remove-delegation-from-getvpfrom Jul 3, 2025
Merged
refactor: use getScoresDirect to get scores in getVp#1771wa0x6e merged 3 commits intofix-remove-delegation-from-getvpfrom
getScoresDirect to get scores in getVp#1771wa0x6e merged 3 commits intofix-remove-delegation-from-getvpfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the getVp function to use the existing getScoresDirect helper, removes the old standalone implementation, and updates tests and snapshots accordingly.
- Remove legacy
getVpinsrc/utils/vp.tsand replace it with a new implementation insrc/utils.tsusinggetScoresDirect. - Update import paths and test descriptions in integration tests.
- Adjust snapshots to match the revised
describeblock naming.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/integration/utils.test.ts | Changed import to the new getVp location and updated test title |
| test/integration/snapshots/utils.test.ts.snap | Renamed snapshot key to match the updated describe block |
| src/utils/vp.ts | Removed legacy getVp implementation |
| src/utils.ts | Added new getVp implementation, updated imports and types |
Comments suppressed due to low confidence (2)
src/utils.ts:88
- The function
getProvideris used here but not imported in this file, which will cause a reference error. Please add an import, for example:
import { getProvider } from './utils'; getProvider(network),
src/utils.ts:77
- [nitpick] The parameter name
snapshotshadows the importedsnapshotmodule from@snapshot-labs/snapshot.js. Consider renaming the parameter (e.g., tosnapshotTag) to avoid confusion.
export async function getVp(
getScoresDirect to get scores in getVp
…re-direct-from-getvp
* fix: add address validation to getvp * fix: add addresses validations when getting scores * perf: --------- Co-authored-by: Chaitanya <yourchaitu@gmail.com>
wa0x6e
added a commit
that referenced
this pull request
Jul 3, 2025
* fix: remove delegation support from getVp * refactor: use `getScoresDirect` to get scores in `getVp` (#1771) * refactor: use getScoresDirect to fech getVp score * fix: add validations to `getVp` and `getScoresDirect` (#1772) * fix: add address validation to getvp * fix: add addresses validations when getting scores * perf: --------- Co-authored-by: Chaitanya <yourchaitu@gmail.com> --------- Co-authored-by: Chaitanya <yourchaitu@gmail.com> * fix: add back optional parameter for backward compatibility --------- Co-authored-by: Chaitanya <yourchaitu@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continuing on #1770
Since the delegation support dropping from
getVp, the core logic to get scores from strategies is the same asgetScoresDirectThis PR refactors
getVpto re-usegetScoresDirectas much as possible to retrieve score, and avoid duplication.Changes
getScoresDirectto get scoregetVpto utils.ts (file is becoming too small to warrant its own file)getScoresDirectdo not validate the addresses, we lose this feature also ongetVp(temporary)The next PR will focus on adding back the address validation to
getScoresDirect