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

Response from assets endpoint doesn't include assets whose holders are UNAUTHORZIED or AUTHORIZED_TO_MAINTAIN_LIABILITIES #3240

Closed
howardtw opened this issue Nov 20, 2020 · 3 comments
Labels
bug horizon horizon-api Issues or features related to the Horizon API
Milestone

Comments

@howardtw
Copy link
Contributor

howardtw commented Nov 20, 2020

What version are you using?

This is the current Horizon behavior as of the issue opened date with the latest commit sha being it

What did you do?

Someone issued 100 OOO tokens from GAWAYMF36WZTCPOTNDM5M7DBQTFAJZCQYAPPV2THVEDXIBS2MB3RWZIA to GDDCNH4CJ5UP56VLV6AANKAII6V3CU3FRURCWWO2CAYMIT5Q5YFCXLWI, but that person cannot see the asset through the assets endpoint with either the asset issuer or the asset code.

What did you expect to see?

I expected to see the assets is included in the response of the assets endpoint regardless asset holders' authorization state.

"records": [
      {
        "asset_type": "credit_alphanum4",
        "asset_code": "OOO",
        "asset_issuer": "GAWAYMF36WZTCPOTNDM5M7DBQTFAJZCQYAPPV2THVEDXIBS2MB3RWZIA",
        "amount": "100",
        "num_accounts": 1,
        "flags": {
          "auth_required": true,
          "auth_revocable": true,
          "auth_immutable": false
        }
      }
    ]

What did you see instead?

Nothing is returned in the response.

 "_embedded": {
    "records": []
  }
@howardtw howardtw changed the title An asset is not recorded in the Horizon DB if all of the holders are set to UNAUTHORZIED or AUTHORIZED_TO_MAINTAIN_LIABILITIES Response from assets endpoint doesn't include assets whose holders are UNAUTHORZIED or AUTHORIZED_TO_MAINTAIN_LIABILITIES Nov 20, 2020
@howardtw
Copy link
Contributor Author

@tamirms after some further experiments, I think they are recorded in the Horizon DB, but the endpoint just simply doesn't count the assets in the accounts where the authorization flag is set to either UNAUTHORZIED or AUTHORIZED_TO_MAINTAIN_LIABILITIES.

Example:
I issued 150 XXX from GBHNRQGRM2QJU5PGEILXDXOOWNQ7NCUOQJOIBXQR5TQ4UUPRNCHUN6B7 to GCPEONTZCDJ4WN2HMMN7QSHNACKTIMUVILCX4BTSFZ2RBBLC3HKUJ2AH and 50 XXX from GBHNRQGRM2QJU5PGEILXDXOOWNQ7NCUOQJOIBXQR5TQ4UUPRNCHUN6B7 to GBT2R5M7YOW2AQUAUJFMPWITVCFJJ2EYHFPBYTTVDVDJWJVQR3U42VYV.

I can see the assets endpoint returns 150 with num_accounts being 1 when the authorization flag is set to authorized in GBHNRQGRM2QJU5PGEILXDXOOWNQ7NCUOQJOIBXQR5TQ4UUPRNCHUN6B7. And when I used allow_trust to authorize GBT2R5M7YOW2AQUAUJFMPWITVCFJJ2EYHFPBYTTVDVDJWJVQR3U42VYV, the result became 200 with num_accounts being 2.

@howardtw howardtw added the horizon-api Issues or features related to the Horizon API label Nov 20, 2020
@howardtw
Copy link
Contributor Author

A quote from @tamirms

If there is 1 AUTHORIZED trustline, then the asset will be in the horizon database. Let's say in the next ledger, the trustline is revoked, at that point because there are no trustlines for that asset the asset is removed from the horizon db.

For anyone who will be looking into it.

@bartekn bartekn added this to the Horizon 2.1.0 milestone Mar 3, 2021
@2opremio 2opremio assigned 2opremio and unassigned 2opremio Mar 11, 2021
@bartekn
Copy link
Contributor

bartekn commented Mar 22, 2021

Fixed in #3454. Will be part of Horizon 2.1.0 release.

@bartekn bartekn closed this as completed Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug horizon horizon-api Issues or features related to the Horizon API
Projects
None yet
Development

No branches or pull requests

3 participants