Skip to content

fix: handle product attributes properly #153

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

Merged
merged 1 commit into from
Apr 9, 2025

Conversation

ali-bahjati
Copy link
Collaborator

@ali-bahjati ali-bahjati commented Apr 9, 2025

use the new pyth sdk-solana that contains a bug fix for iterating over product attributes. the older version might go beyond the size of the attributes (and show old attribute residuals instead).

We got a report that symbol is the old symbol on agent and it looked impossible because the metadata was updated everywhere. What was happening was that on Crypto.Index.CRT/USD token, symbol is defined two times if you look at the raw account data below and the older sdk would parse all the account regardless of the size. This PR has fixed it.

0000:   d4 c3 b2 a1  02 00 00 00  02 00 00 00  09 01 00 00   ................
0010:   b2 fb 54 96  6d 4d 30 af  bb 77 cc 9d  ce 9d 43 c5   ..T.mM0..w....C.
0020:   2f 0f 57 5e  7d 41 dc ab  6f f3 db fe  15 ad 45 59   /.W^}A..o.....EY
0030:   06 73 79 6d  62 6f 6c 14  43 72 79 70  74 6f 2e 49   .symbol.Crypto.I
0040:   6e 64 65 78  2e 43 52 54  2f 55 53 44  0a 61 73 73   ndex.CRT/USD.ass
0050:   65 74 5f 74  79 70 65 0c  43 72 79 70  74 6f 20 49   et_type.Crypto I
0060:   6e 64 65 78  04 62 61 73  65 03 43 52  54 0b 64 65   ndex.base.CRT.de
0070:   73 63 72 69  70 74 69 6f  6e 26 43 41  52 52 4f 54   scription&CARROT
0080:   20 59 49 45  4c 44 20 42  45 41 52 49  4e 47 20 54    YIELD BEARING T
0090:   4f 4b 45 4e  20 2f 20 55  53 20 44 4f  4c 4c 41 52   OKEN / US DOLLAR
00a0:   0e 64 69 73  70 6c 61 79  5f 73 79 6d  62 6f 6c 07   .display_symbol.
00b0:   43 52 54 2f  55 53 44 0e  67 65 6e 65  72 69 63 5f   CRT/USD.generic_
00c0:   73 79 6d 62  6f 6c 06 43  52 54 55 53  44 0e 71 75   symbol.CRTUSD.qu
00d0:   6f 74 65 5f  63 75 72 72  65 6e 63 79  03 55 53 44   ote_currency.USD
00e0:   08 73 63 68  65 64 75 6c  65 1f 41 6d  65 72 69 63   .schedule.Americ
00f0:   61 2f 4e 65  77 5f 59 6f  72 6b 3b 4f  2c 4f 2c 4f   a/New_York;O,O,O
0100:   2c 4f 2c 4f  2c 4f 2c 4f  3b 0e 71 75  6f 74 65 5f   ,O,O,O,O;.quote_
0110:   63 75 72 72  65 6e 63 79  03 55 53 44  08 73 63 68   currency.USD.sch
0120:   65 64 75 6c  65 1f 41 6d  65 72 69 63  61 2f 4e 65   edule.America/Ne
0130:   77 5f 59 6f  72 6b 3b 4f  2c 4f 2c 4f  2c 4f 2c 4f   w_York;O,O,O,O,O
0140:   2c 4f 2c 4f  3b 06 73 79  6d 62 6f 6c  11 43 72 79   ,O,O;.symbol.Cry
0150:   70 74 6f 2e  43 52 54 2f  55 53 44 2e  52 52 00 00   pto.CRT/USD.RR..

I reproduced the issue in the old version and confirmed that this change fixes the problem.

@ndiakom
Copy link
Contributor

ndiakom commented Apr 9, 2025

OK to merge? @ali-bahjati

use the new pyth sdk-solana that contains a bug fix for iterating
over product attributes. the older version might go beyond the size
of the attributes (and show old attribute residuals instead).
@ali-bahjati ali-bahjati force-pushed the fix/update-pyth-sdk-solana branch from 7b7be7e to 420172b Compare April 9, 2025 09:33
@ali-bahjati ali-bahjati merged commit 390db4e into main Apr 9, 2025
2 checks passed
@ali-bahjati ali-bahjati deleted the fix/update-pyth-sdk-solana branch April 9, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants