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

base/counter_offer_id not ingested when buy offer not exist (synthetic) #3966

Closed
bartekn opened this issue Sep 28, 2021 · 3 comments · Fixed by #3970
Closed

base/counter_offer_id not ingested when buy offer not exist (synthetic) #3966

bartekn opened this issue Sep 28, 2021 · 3 comments · Fixed by #3970
Assignees
Labels
amm support cap 38 (automated market makers) in horizon bug

Comments

@bartekn
Copy link
Contributor

bartekn commented Sep 28, 2021

What version are you using?

release-horizon-v2.9.0 branch

What did you do?

Run verify-range tests for range: [13494463, 13494591].

What did you expect to see?

No diff when comparing to 2.8.3 (DB dump contains offer_id column removed in 2.9.0 - I manually removed it, will add a PR tomorrow).

What did you see instead?

Diff:

1,2c1,2
< 57958466240647169,0,2017-09-14 22:50:10,12536407,10000000,121914,4669644484668035073,GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W,GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN,native,,,credit_alphanum4,JPY,GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM
< 57958470535614465,0,2017-09-14 22:50:18,74221311,5000000,121685,4669644488963002369,GDDNNC4SIEDN64YKJWN5VJH3OFMV4R3RWXRPT25BDR3T2HQWZMOWD6QJ,GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W,credit_alphanum4,XRP,GA7FCCMTTSUIC37PODEL6EOOSPDRILP6OQI5FWCWDDVDBLJV72W6RINZ,native,,
---
> 57958466240647169,0,2017-09-14 22:50:10,12536407,10000000,121914,,GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W,GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN,native,,,credit_alphanum4,JPY,GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM
> 57958470535614465,0,2017-09-14 22:50:18,74221311,5000000,121685,,GDDNNC4SIEDN64YKJWN5VJH3OFMV4R3RWXRPT25BDR3T2HQWZMOWD6QJ,GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W,credit_alphanum4,XRP,GA7FCCMTTSUIC37PODEL6EOOSPDRILP6OQI5FWCWDDVDBLJV72W6RINZ,native,,

The missing field is base_offer_id or counter_offer_id. I think the bug (if it is a bug or me missing something) was introduced in #3857 which removed synthetic offer ID. The new code is missing the else branch:

if buyOfferExists {
row.CounterOfferID = null.IntFrom(int64(buyOffer.OfferId))
}

present in the old code:
if entry.BuyOfferExists {
buyOfferID = EncodeOfferId(uint64(entry.BuyOfferID), CoreOfferIDType)
} else {
buyOfferID = EncodeOfferId(uint64(entry.HistoryOperationID), TOIDType)
}

@tamirms can you check it out? Was it removed accidentally? I can't see any AMM issue mentioning removal of synthetic offer IDs.

@bartekn bartekn added bug amm support cap 38 (automated market makers) in horizon labels Sep 28, 2021
@tamirms
Copy link
Contributor

tamirms commented Sep 29, 2021

@bartekn I allowed base_offer_id and counter_offer_id to be NULL when there is no offer involved in the trade (e.g. liquidity pool trades). What is the purpose of having synthetic offer ids?

@bartekn
Copy link
Contributor Author

bartekn commented Sep 29, 2021

Shouldn't we have this still for non-LP trades? AFAIR, synthetic offer IDs are there for offers which are immediately traded so aren't assigned a specific ID.

@bartekn
Copy link
Contributor Author

bartekn commented Sep 29, 2021

Synthetic offer IDs were added in #667 and motivation was:

This should allow easier audit trails for offers and trades. When offer ids are not created in the protocol level (fully consumed offers and path payments) a synthetic offer id will be created (...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
amm support cap 38 (automated market makers) in horizon bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants