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

Non-hub-transfers are not included in activity log and export statement #691

Open
louilinn opened this issue Jun 15, 2023 · 2 comments
Open
Assignees
Labels
confusion 😕 Something is confusing the users

Comments

@louilinn
Copy link
Collaborator

louilinn commented Jun 15, 2023

Only hub-transfers are returned in getLatest (core method) calling the graph only for hub transfers and transfers that are ubi payout (transfers from 0-address)

Non-hubtransfers can be made in other applications such as the gnosis app.
It may be confusing for users that they don't show up in the activity log. However the balance display is not affected and is correct.

When it comes to the statement export for shared wallets however, a missing transfer (non-hub-transfer) results in an incorrect balance. Balances in the exported csv file are calculated bu subtracting previous transactions. Since transactions that took place through the gnosis app are not included, it messes up the balances in the file.

This only affects wallets that have received or sent circles through non-hub transfers using e.g. gnosis app.

It affects calculations of historical balances before such transaction but not after.

@louilinn
Copy link
Collaborator Author

Examples:

SharedWallet1 has never sent or received non-hubtransfers. They are unaffected by this bug.

SharedWallet2 has received a non-hubtransfer of circles in August 5th 2022. Export after August 2022 are unaffected by this bug. Export with balance calculations at dates that date are incorrect.

  • An export of 1-31st of July 2022 has wrong start and end balance but a correct transaction list.
  • An export of 1-31st of August 2022 has the wrong start balance but correct end balance. Also the transaction it self will not be included in the file.
  • An export of 1-30th of September will be correct
  • Balances calculated before August 5th will be too low not recognizing the received circles

SharedWallet3 has sent a non-hubtransfer of circles in August 5th 2022. Export after August 2022 are unaffected by this bug. Export with balance calculations at dates that date are incorrect.

  • An export of 1-31st of July 2022 has wrong start and end balance but a correct transaction list.
  • An export of 1-31st of August 2022 has the wrong start balance but correct end balance. Also the transaction it self will not be included in the file.
  • An export of 1-30th of September will be correct
  • Balances calculated before August 5th will be too high not recognizing the sent circles

@louilinn louilinn changed the title Hub transfers are not included in activity log and export statement Non-hub-transfers are not included in activity log and export statement Jun 15, 2023
@louilinn louilinn added the bug 💥 Something isn't working label Jun 16, 2023
@louilinn
Copy link
Collaborator Author

Fixing this does not seem to require changes in the subgraph
We have to change filtering in getLatest https://github.com/CirclesUBI/circles-core/blob/0ab32433af581197f922b62b2d39b8e310f3ddce/src/activity.js#LL188C10-L192C12

Example of raw response for notification from subgraph before filtering in circles-core getLatest relating to a received transitive transaction:

{
  "data": {
    "notifications": [
      {
        "id": "transfer-to-28482230-54",
        "safeAddress": "0x3cb406def33aed0abd6d02a75fedca8e2e8d1a2e",
        "type": "TRANSFER",
        "time": "1686915850",
        "transactionHash": "0x2d506679270bb915d1d7a8e70b23fa30b0f05187b39d41e142a4f475b4ff7374",
        "transfer": {
          "from": "0x9ba1bcd88e99d6e1e03252a70a63fea83bf1208c",
          "to": "0x3cb406def33aed0abd6d02a75fedca8e2e8d1a2e",
          "amount": "519322203691818300000",
          "id": "28482230-54"
        },
        "hubTransfer": null
      },
      {
        "id": "hub-transfer-to-28482230-55",
        "safeAddress": "0x3cb406def33aed0abd6d02a75fedca8e2e8d1a2e",
        "type": "HUB_TRANSFER",
        "time": "1686915850",
        "transactionHash": "0x2d506679270bb915d1d7a8e70b23fa30b0f05187b39d41e142a4f475b4ff7374",
        "transfer": null,
        "hubTransfer": {
          "from": "0x0b900cbbc0e6bc4edc12f56360c8bc141ed1cc1b",
          "to": "0x3cb406def33aed0abd6d02a75fedca8e2e8d1a2e",
          "amount": "519322203691818300000",
          "id": "28482230-55"
        }
      },

Note that the transactionHashes are the same

Changes needed

Currently the only non-hubtransfers notifications from the subgraph that are saved are UBI-payouts (from 0 address).
Now instead we want to keep all UBI payout notification but also any transfer which fulfill:
a) has a unique transactionHash (that doesn't match any hubTransfer)
AND
b) is circles tokens

Further considerations:

Currently the subgraph only indexes circles token transfers so b) is covered

When checking a) we need to make sure that we have fetched enough notifications to be able to determine if the transfer is covered by another hubTransfer notification or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confusion 😕 Something is confusing the users
Projects
None yet
Development

No branches or pull requests

3 participants