Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set zero power snapshot balance when balance aggregator doesn't return any balance for an address #1655

Open
aminlatifi opened this issue Jun 25, 2024 · 4 comments
Assignees
Labels
bug Something isn't working GIVeconomy issues related to the GIVeconomy product

Comments

@aminlatifi
Copy link
Member

impact-graph fills power snapshot balances by querying the balance aggregator as below

const balances =
await getPowerBalanceAggregatorAdapter().getAddressesBalance({
timestamp,
addresses,
});
const groupByWalletAddress = _.groupBy(batch, item =>
item.walletAddress.toLowerCase(),
);
const snapshotBalances = balances
.map(balance =>
groupByWalletAddress[balance.address.toLowerCase()].map(item => ({
balance: balance.balance,
powerSnapshotId: item.powerSnapshotId,
userId: item!.userId,
})),
)
.flat();
await addOrUpdatePowerSnapshotBalances(snapshotBalances);

When the balance aggregator doesn't have any balance for an address, it doesn't return anything for that one. In the current implementation, the power balance snapshot for that user will remain empty forever. We must identify when no balance is returned for an address and fill it with zero!

@aminlatifi aminlatifi added the bug Something isn't working label Jun 25, 2024
@aminlatifi aminlatifi transferred this issue from Giveth/giveth-dapps-v2 Jun 25, 2024
@aminlatifi
Copy link
Member Author

REf Giveth/giveth-dapps-v2#4326

@divine-comedian
Copy link
Collaborator

I think you're the tech lead for this one, assigning you @mohammadranjbarz

Also cc: @laurenluz for GIVeconomy Pm

@divine-comedian divine-comedian moved this from New Issues to Product Backlog in All-Devs Jul 7, 2024
@laurenluz
Copy link
Member

@aminlatifi was this done already?

@aminlatifi
Copy link
Member Author

@aminlatifi was this done already?

@laurenluz I am not informed if anything is done about it. @jainkrati Would be more informed.

@divine-comedian divine-comedian moved this from Product Backlog to In Progress in All-Devs Jul 16, 2024
@divine-comedian divine-comedian added the GIVeconomy issues related to the GIVeconomy product label Jul 16, 2024
@divine-comedian divine-comedian moved this from In Progress to Product Backlog in All-Devs Jul 16, 2024
@aminlatifi aminlatifi moved this from Product Backlog to Code Review/PR in All-Devs Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GIVeconomy issues related to the GIVeconomy product
Projects
Status: Code Review/PR
Development

No branches or pull requests

5 participants