holaplex / indexer

Index Solana data using a Geyser plugin (downstream service cluster)
https://holaplex.com
GNU Affero General Public License v3.0
162 stars 38 forks source link

fix handling of candy machine config lines #672

Closed wbarksdale closed 2 years ago

wbarksdale commented 2 years ago

Candy machine config line parsing previously assumed that config line's were stored in their own PDA, however these config lines are actually stored as part of the candy machine account itself, but are not deserialized by mpl's candy machine data structure.

This implements a function to parse those config lines. The config lines are indexed based on a compound key (candy_machine_address, idx) where idx is the the index of the config line within the candy machine account data.

I also took a stab at adding a test for this, its not a super useful test, but wanted to give it a shot. In order to make the test work, I needed to add a feature test-internal to expose the internals of the indexer to the test, this resulted in some changes to pre-push.sh and Cargo.toml. I'm happy to delete this test if its not wanted, but thought i'd take a stab at it.

wbarksdale commented 2 years ago

@ray-kast I think I got everything, I left the data the test relies on in crates/indexer/tests/data because this seems to be the current_dir() for when the test is run. I also cleaned up the sql a bit, but for some reason it seemed to want the column rename to be in its own alter table, i'm not sure why, but let me know if you have any insight or want further changes there.