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

Closed
aminlatifi opened this issue Jun 25, 2024 · 9 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
@MoeNick
Copy link
Member

MoeNick commented Jan 13, 2025

@aminlatifi is it reviewed?

@aminlatifi
Copy link
Member Author

@aminlatifi is it reviewed?

Yes, merged

@divine-comedian
Copy link
Collaborator

@aminlatifi is this issue done or does it require some QA or approval?

@aminlatifi
Copy link
Member Author

@aminlatifi is this issue done or does it require some QA or approval?

It's merged to staging to address Giveth/giveth-dapps-v2#4326
On your call

@divine-comedian
Copy link
Collaborator

OK! @laurenluz I think you need to be the one to approve if this issue is Done, if not then what is required?

CarlosQ96 added a commit that referenced this issue Jan 27, 2025
* throw error on un-vouching the givbackseligible projects

* update message

* optimize the approveMultipleProjects

* make projects verified if they become givbacksEligible

* prevent approve or reject draft projects

* fix records

* fix conditions

* use redirectUrl

* fix tests

* add unverifyProjectsTestCases

* add test:projectVerificationTab

* temporary comment

* fix typo

* send email when project verification status changed

* Feat/Generating public user data

* added tests for querying user basic data

* add includeUnlisted to FilterProjectQueryInputParams

* return proper projects

* add recipient address to streams when nonexistent (#1890)

* started endaoment update feature

* Superfluid Base Support (#1893)

* finish project endpoint for superfluid to read

* add filters for network and tokens for recurringdonations

* fix verification logic and emails for base network streams

* Update src/resolvers/recurringDonationResolver.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* comment network test and add cbBTC to seeds

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* remove project validation from anchor contract

* Add networkId logic to superfluid subgraphs (#1896)

* add networkId logic to superfluid subgraphs

* remove networkId from api call to superfluid

* fix eslint

* fix linkedin scope

* fix user info link to user info

* cron job for sitemap generating

* adding additional projects to Endaoment list

* started cronjob

* finished cron job

* Feature cluster matching (#1862)

* add cluster matching entity

* add cluster matching adapters

* finish cocm adapter

* improve error handling for cluster matching

* comment broken contract tests by missing eth_getCode Method

* add feedback to handle qf cases

* add cluster matching job to bootstrap file

* fix coderabbit feedback PR

* termine worker if an exception is raised

* fix updateUser condition to handle email undefined case

* fixed one variable; added cronjob env suggested by Carlos

* removed redundant code

* check config value

* fix calling env variable

* fix/removing endaomentId from update

* add qfStrategy to qfRounds (#1903)

* update bootstrap.js adding check endaoment

* adding sitemap cronjob to bootstrap

* additional logger data

* fine tuninnig log

* improve logger

* fixing endaoment id

* Set default zero for power balance snapshot on no return from balance aggregator (#1732)

Ref #1655

* Fix/Sitemap env variables

* fix missing prefix for url

* fix matching cap calculation

* fix data insertion for cluster matching

* add user passport score null case to clustermatching queries

* fix error handling in cocm adapter

* add cluster matching sync timestamp and logs (#1913)

* add cluster matching sync timestamp and logs

* add nullability to clustermathicng syncAT

* fix db call in worker for cluster matching

* add uniquness constraint to estimatedclustedMatching

* handle undefined case for instant power boosting services

* better error handling in worker job

* fixing prettier problem

* Disable cluster matching

---------

Co-authored-by: Cherik <[email protected]>
Co-authored-by: kkatusic <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Mitch <[email protected]>
Co-authored-by: Lovel George <[email protected]>
Co-authored-by: Amin Latifi <[email protected]>
@github-project-automation github-project-automation bot moved this from Code Review/PR to Done in All-Devs Jan 27, 2025
@divine-comedian divine-comedian moved this from Done to Merged to Production in All-Devs Jan 30, 2025
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: Merged to Production
Development

No branches or pull requests

6 participants