-
Notifications
You must be signed in to change notification settings - Fork 82
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
[FA migration] Make storage id consistent for transaction tables #688
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #688 +/- ##
=======================================
- Coverage 49.6% 49.5% -0.2%
=======================================
Files 252 252
Lines 28526 28535 +9
=======================================
- Hits 14166 14137 -29
- Misses 14360 14398 +38 ☔ View full report in Codecov by Sentry. |
I think integration test might fail, |
|
||
// Storage id should be derived (for the FA migration) | ||
let metadata_addr = get_paired_metadata_address(&coin_type); | ||
let storage_id = get_primary_fungible_store_address(&owner_address, &metadata_addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the coin hasn't migrated yet? does it matter what this value is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea cuz eventually you will migrate and we'll have a hard time debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense. and storage_id can be arbitrary for coin balances since it's only used for the PK of the table.
// Storage id should be derived (for the FA migration) | ||
let metadata_addr = get_paired_metadata_address(&coin_type); | ||
let storage_id = get_primary_fungible_store_address(&owner_address, &metadata_addr) | ||
.expect("calculate primary fungible store failed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this replaces all coin balances with a new primary key. how do we delete the old rows so the balances don't show up twice in the table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only affects parquet so we'll need to first wipe everythign.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuunlimm correct me if i'm wrong but i think this is also used in the postgres processors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's the legacy table, right? then it was deprecated so the code can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i see, the RawCurrentFungibleAssetBalance is already using get_primary_fungible_store_address
@yuunlimm we also should enable the cfab tests (non-legacy) so this PR has enough testing |
|
848e722
to
c07eeaf
Compare
c07eeaf
to
5dd1d06
Compare
Even those are the same assets storage id is different.
![image](https://private-user-images.githubusercontent.com/11738325/405430697-3db1063d-01da-43c7-85e6-0c712ccc2d77.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4MzI0NjcsIm5iZiI6MTczODgzMjE2NywicGF0aCI6Ii8xMTczODMyNS80MDU0MzA2OTctM2RiMTA2M2QtMDFkYS00M2M3LTg1ZTYtMGM3MTJjY2MyZDc3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDA4NTYwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ2ZjU2ZTJhYjFjM2E0M2VhMjU0YjYxNjFhMDJmZjhlNjU4Zjc2YTAyMTZlY2Q1ZTYzY2ZhNjMwYTEyNWNjMTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.q4us4MOunsMwyUiIMZZ_NDsp1coquGrJ3aV33BLxKlk)
Backfill
Testnet: 0
Mainnet: 0
This affects fungible_asset_activities and fungible_asset_balances (for analytics)
Test
Storage id is now the same!
![image](https://private-user-images.githubusercontent.com/11738325/405430636-fbe9db93-88f8-4d66-9653-1e7152540e03.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4MzI0NjcsIm5iZiI6MTczODgzMjE2NywicGF0aCI6Ii8xMTczODMyNS80MDU0MzA2MzYtZmJlOWRiOTMtODhmOC00ZDY2LTk2NTMtMWU3MTUyNTQwZTAzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDA4NTYwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM3NmEwZTlmZmRjYTkxMWU1Yzc3NTIwZTZjZmU5NGY1YTQwMTM5YzYzYjYxMDJhOTFmNTU3Zjk2ZGRjNTYwYTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Ny-6RkAzPndcWUEwtA-zCFvrdJnnh2eQboVNOk8DPzs)