Skip to content

Fix gasless poll vote dedupe and exclude staking-engine delegation from totals#73

Open
adamgoth wants to merge 4 commits intofeature/subgraphs-migrationfrom
subgraph-migration-fixes
Open

Fix gasless poll vote dedupe and exclude staking-engine delegation from totals#73
adamgoth wants to merge 4 commits intofeature/subgraphs-migrationfrom
subgraph-migration-fixes

Conversation

@adamgoth
Copy link
Collaborator

Summary

This fixes three correctness regressions introduced by the Envio aggregate migration:

  • Gasless poll votes are now deduped and weighted by the mapped delegate address
  • Per-delegate SKY and delegator totals no longer include staking-engine rows
  • Delegation summary metrics once again exclude staking-engine rows

Changes

  • Normalize poll voter addresses before dedupe and voting-power lookup so gasless Arbitrum votes collapse correctly with the delegate's mainnet vote
  • Restore filtered delegation data on delegate list queries and use it to compute displayed skyDelegated
  • Detect staking-engine delegation separately so delegatorCount can subtract the special row without relying on the truncated delegations relation length
  • Reintroduce a paginated Delegation query for summary metrics with staking-engine addresses excluded
  • Add regression tests for:
    • Mapped gasless vote dedupe and weight preservation
    • Delegation metrics pagination with staking-engine exclusion

- Updated `fetchDelegationMetrics` to paginate through delegations and calculate total delegated amounts and delegator counts.
- Introduced new GraphQL query `allDelegationsPaginated` to fetch delegations while excluding staking engine addresses.
- Added unit tests for `fetchDelegationMetrics` to ensure correct pagination and calculations.
- Refactored `fetchDelegatesPaginated` to use the new total delegated calculation and delegator count logic.
@vercel
Copy link

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sky-governance-portal Ready Ready Preview, Comment Mar 16, 2026 1:38pm

Request Review

- Updated VoterData and VoterWithWeight interfaces to make the address property optional.
- Introduced a helper function to retrieve voter addresses, accommodating cases where the address may not be directly available.
- Adjusted mapping functions to utilize the new address retrieval logic, ensuring consistent handling of voter addresses across different chains.
- Updated GraphQL queries in `allArbitrumVoters`, `allMainnetVoters`, and `voteAddressSkyWeightsAtTime` to use named queries for improved clarity.
- Enhanced `fetchVotesByAddressForPoll` to handle potential undefined values for poll start and end dates, ensuring robust data handling.
- Adjusted vote retrieval logic to default to empty arrays when no votes are found, improving resilience against missing data.
- Modified `fetchDelegationMetrics` to aggregate total delegated amounts and delegator counts, accounting for staking engine delegations.
- Updated GraphQL queries to fetch delegates and staking engine delegations, enhancing data retrieval efficiency.
- Adjusted unit tests to reflect changes in metrics calculation and ensure accurate results.
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.

1 participant