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

Add script to forward transactions and check database results #154

Merged

Conversation

danenbm
Copy link
Contributor

@danenbm danenbm commented Jan 3, 2024

Overview

Adds a Bubblegum Test Sequences script that can run sequences of Bubblegum transactions forwards and backwards and check the results in the Postgres database.

How to run it

While running the multi-container Docker application locally, you can run a script located in tools/txn_forwarder/bubblegum_tests that will send sequences of bubblegum transactions via the txn_forwarder, and then use psql to read and verify the indexing results in the local Postgres database.

sudo rm -rf db-data/
sudo rm -rf ledger/
docker compose up --force-recreate --build

In another terminal:

cd tools/txn_forwarder/bubblegum_tests/
./run-bubblegum-sequences.sh

You should see it log something like:

Running 10 scenarios forwards
mint_transfer_burn.scenario initial asset table state passed
mint_transfer_burn.scenario initial asset_creators table state passed
mint_transfer_burn.scenario initial asset_grouping table state passed
mint_transfer_burn.scenario initial cl_items table state passed
...
mint_to_collection_unverify_collection.scenario asset table passed
mint_to_collection_unverify_collection.scenario asset_creators table passed
mint_to_collection_unverify_collection.scenario asset_grouping table passed
mint_to_collection_unverify_collection.scenario cl_items table passed

ALL TESTS PASSED FORWARDS!

You can also run the sequences in reverse:

./run-bubblegum-sequences.sh reverse

And after it runs you should see ALL TESTS PASSED IN REVERSE!

Detailed notes

  • This script is not all-encompassing. It is only meant to automate some normal basic tests that were previously done manually. The reason this test is not added to CI is because requires a more powerful system to run the Docker application, which contains the no-vote Solana validator.
  • The test sequences are in .scenario files, but instead of sending those files to the txn_forwarder directly (which supports the file format), we parse them out and send them individually using the single parameter. This is because using the .scenario file directly results in random ordering of the transactions and we are explicity trying to test them going forwards and in reverse.
  • In general the expected database results are the same when running the transactions forwards and backwards. However, for assets that are decompressed, this is not true because we don't index some of the asset information from Bubblegum mint indexing if we already know the asset has been decompressed. We instead let Token Metadata account based indexing fill in that information. This is not reflected by this test script so the results differ when running these sequences in reverse. The differing results are reflected in test files with the _reverse suffix.

Testing

I have run this forwards and in reverse on danenbm/update-metadata-parsing and it passes.

@danenbm danenbm marked this pull request as ready for review January 5, 2024 08:02
@danenbm danenbm changed the title Add script to forward transactions an check database results Add script to forward transactions and check database results Jan 5, 2024
@danenbm danenbm merged commit e519c21 into danenbm/update-metadata-parsing Jan 18, 2024
2 checks passed
@danenbm danenbm deleted the danenbm/bubblegum-sequence-tests branch January 18, 2024 22:11
@danenbm danenbm restored the danenbm/bubblegum-sequence-tests branch January 18, 2024 22:11
@danenbm danenbm deleted the danenbm/bubblegum-sequence-tests branch January 18, 2024 22:39
@danenbm danenbm restored the danenbm/bubblegum-sequence-tests branch January 18, 2024 22:40
@danenbm danenbm deleted the danenbm/bubblegum-sequence-tests branch January 18, 2024 22:41
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.

2 participants