Skip to content

Commit c675735

Browse files
authored
fix: correctly apply subaccount filtering for historical votes in storage (#2650)
## Description of Changes a conditional check in storage fails when subaccount is 0 (falsy in JS), causing it to evaluate to false and skip the filtering logic. This in turns returns the votes for each subaccount, so voting in one account will incorrectly evaluate each subaccount as already voted. This seems to have been an issue since the reactor in #2557 which exposed this issue. However, this appears to be an edge case that only arises when voting is initiated from a subaccount first, and then followed by an attempt to vote with the main account—rather than the other way around. ## Related Issue #2648 ## Checklist Before Requesting Review - [x] I have ensured that any relevant minifront changes do not cause the existing extension to break.
1 parent b119f0b commit c675735

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.changeset/upset-ads-find.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@penumbra-zone/storage': patch
3+
---
4+
5+
correctly applies subaccount filtering in storage layer for LQT voting logic

packages/storage/src/indexed-db/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,10 @@ export class IndexedDb implements IndexedDbInterface {
460460
epoch.toString(),
461461
);
462462

463-
const filtered = subaccount
464-
? tournamentVotes.filter(vote => vote.subaccount === subaccount)
465-
: tournamentVotes;
463+
const filtered =
464+
subaccount === undefined
465+
? tournamentVotes
466+
: tournamentVotes.filter(vote => vote.subaccount === subaccount);
466467

467468
return filtered.map(tournamentVote => ({
468469
incentivizedAsset: AssetId.fromJson(tournamentVote.incentivizedAsset, { typeRegistry }),

0 commit comments

Comments
 (0)