From b8ba360dfa4aa36e36565bb3413fc36ca409b6b3 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:07:25 -0800 Subject: [PATCH] Add asset_creators and asset_grouping tests --- .../mint_delegate_transfer_asset_creators.txt | 16 ++++ .../mint_delegate_transfer_asset_grouping.txt | 8 ++ ...edeem_redeem_decompress_asset_creators.txt | 16 ++++ ...edeem_redeem_decompress_asset_grouping.txt | 8 ++ .../mint_redeem_decompress_asset_creators.txt | 16 ++++ .../mint_redeem_decompress_asset_grouping.txt | 8 ++ .../mint_transfer_burn_asset_creators.txt | 16 ++++ .../mint_transfer_burn_asset_grouping.txt | 8 ++ .../mint_transfer_transfer_asset_creators.txt | 16 ++++ .../mint_transfer_transfer_asset_grouping.txt | 8 ++ .../run-bubblegum-sequences.sh | 80 +++++++++++++++++-- 11 files changed, 195 insertions(+), 5 deletions(-) create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_delegate_transfer_asset_creators.txt create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_delegate_transfer_asset_grouping.txt create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_redeem_cancel_redeem_redeem_decompress_asset_creators.txt create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_redeem_cancel_redeem_redeem_decompress_asset_grouping.txt create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_redeem_decompress_asset_creators.txt create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_redeem_decompress_asset_grouping.txt create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_transfer_burn_asset_creators.txt create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_transfer_burn_asset_grouping.txt create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_transfer_transfer_asset_creators.txt create mode 100644 tools/txn_forwarder/bubblegum_tests/mint_transfer_transfer_asset_grouping.txt diff --git a/tools/txn_forwarder/bubblegum_tests/mint_delegate_transfer_asset_creators.txt b/tools/txn_forwarder/bubblegum_tests/mint_delegate_transfer_asset_creators.txt new file mode 100644 index 000000000..6e62570fa --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_delegate_transfer_asset_creators.txt @@ -0,0 +1,16 @@ +-[ RECORD 1 ]+------------------------------------------------------------------- +asset_id | \x5aed3f1d3faf9f5f4664f98055d25627d59d0351ee8f0802ebbb33ccd8220d67 +creator | \xdc53343c46e5d7a1bd08f4780285621202f66b596f984e940a5eb423ac560fed +share | 55 +verified | f +seq | 1 +slot_updated | 226274127 +position | 0 +-[ RECORD 2 ]+------------------------------------------------------------------- +asset_id | \x5aed3f1d3faf9f5f4664f98055d25627d59d0351ee8f0802ebbb33ccd8220d67 +creator | \xe3dc3480d88f714c38827aada3064e8d212a91e3fdb67f22438c1ed89318a0e5 +share | 45 +verified | f +seq | 1 +slot_updated | 226274127 +position | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/mint_delegate_transfer_asset_grouping.txt b/tools/txn_forwarder/bubblegum_tests/mint_delegate_transfer_asset_grouping.txt new file mode 100644 index 000000000..4b0e51667 --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_delegate_transfer_asset_grouping.txt @@ -0,0 +1,8 @@ +-[ RECORD 1 ]--+------------------------------------------------------------------- +asset_id | \x5aed3f1d3faf9f5f4664f98055d25627d59d0351ee8f0802ebbb33ccd8220d67 +group_key | collection +group_value | +seq | +slot_updated | 226274127 +verified | f +group_info_seq | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/mint_redeem_cancel_redeem_redeem_decompress_asset_creators.txt b/tools/txn_forwarder/bubblegum_tests/mint_redeem_cancel_redeem_redeem_decompress_asset_creators.txt new file mode 100644 index 000000000..a4e23a106 --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_redeem_cancel_redeem_redeem_decompress_asset_creators.txt @@ -0,0 +1,16 @@ +-[ RECORD 1 ]+------------------------------------------------------------------- +asset_id | \x4302561a2799244936a3b020569bf90f58cd9b406af4cd084a82a2cf6415a8f0 +creator | \xdc53343c46e5d7a1bd08f4780285621202f66b596f984e940a5eb423ac560fed +share | 55 +verified | f +seq | 1 +slot_updated | 224494461 +position | 0 +-[ RECORD 2 ]+------------------------------------------------------------------- +asset_id | \x4302561a2799244936a3b020569bf90f58cd9b406af4cd084a82a2cf6415a8f0 +creator | \xe6cd5c15dc19a877bc4bdf888a32145bd007f3a6ad52243937ffe41e3c2e7c3e +share | 45 +verified | f +seq | 1 +slot_updated | 224494461 +position | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/mint_redeem_cancel_redeem_redeem_decompress_asset_grouping.txt b/tools/txn_forwarder/bubblegum_tests/mint_redeem_cancel_redeem_redeem_decompress_asset_grouping.txt new file mode 100644 index 000000000..c59e77739 --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_redeem_cancel_redeem_redeem_decompress_asset_grouping.txt @@ -0,0 +1,8 @@ +-[ RECORD 1 ]--+------------------------------------------------------------------- +asset_id | \x4302561a2799244936a3b020569bf90f58cd9b406af4cd084a82a2cf6415a8f0 +group_key | collection +group_value | +seq | +slot_updated | 224494461 +verified | f +group_info_seq | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/mint_redeem_decompress_asset_creators.txt b/tools/txn_forwarder/bubblegum_tests/mint_redeem_decompress_asset_creators.txt new file mode 100644 index 000000000..6e2798b0f --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_redeem_decompress_asset_creators.txt @@ -0,0 +1,16 @@ +-[ RECORD 1 ]+------------------------------------------------------------------- +asset_id | \x4582ef313005487b924213937300a3c5cef8502646c8c182a2a9e1188adb196b +creator | \xdc53343c46e5d7a1bd08f4780285621202f66b596f984e940a5eb423ac560fed +share | 55 +verified | f +seq | 1 +slot_updated | 224069842 +position | 0 +-[ RECORD 2 ]+------------------------------------------------------------------- +asset_id | \x4582ef313005487b924213937300a3c5cef8502646c8c182a2a9e1188adb196b +creator | \xfcd064cd56ad840b463ca2ee1f6e13b6181cbb7464699dbfe18fe989e71def89 +share | 45 +verified | f +seq | 1 +slot_updated | 224069842 +position | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/mint_redeem_decompress_asset_grouping.txt b/tools/txn_forwarder/bubblegum_tests/mint_redeem_decompress_asset_grouping.txt new file mode 100644 index 000000000..0a8de5453 --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_redeem_decompress_asset_grouping.txt @@ -0,0 +1,8 @@ +-[ RECORD 1 ]--+------------------------------------------------------------------- +asset_id | \x4582ef313005487b924213937300a3c5cef8502646c8c182a2a9e1188adb196b +group_key | collection +group_value | +seq | +slot_updated | 224069842 +verified | f +group_info_seq | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/mint_transfer_burn_asset_creators.txt b/tools/txn_forwarder/bubblegum_tests/mint_transfer_burn_asset_creators.txt new file mode 100644 index 000000000..5a372fa30 --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_transfer_burn_asset_creators.txt @@ -0,0 +1,16 @@ +-[ RECORD 1 ]+------------------------------------------------------------------- +asset_id | \x75d2c89f62f8a50ed994309655bbd27de2c5f0b3da4cf8c329320016b47aa3d1 +creator | \xdc53343c46e5d7a1bd08f4780285621202f66b596f984e940a5eb423ac560fed +share | 55 +verified | f +seq | 1 +slot_updated | 221559431 +position | 0 +-[ RECORD 2 ]+------------------------------------------------------------------- +asset_id | \x75d2c89f62f8a50ed994309655bbd27de2c5f0b3da4cf8c329320016b47aa3d1 +creator | \xab4ea130077985e7bae2df6a4aa90c94a2918c7bec1ccf44ab994c6803f5e8d2 +share | 45 +verified | f +seq | 1 +slot_updated | 221559431 +position | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/mint_transfer_burn_asset_grouping.txt b/tools/txn_forwarder/bubblegum_tests/mint_transfer_burn_asset_grouping.txt new file mode 100644 index 000000000..528b49831 --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_transfer_burn_asset_grouping.txt @@ -0,0 +1,8 @@ +-[ RECORD 1 ]--+------------------------------------------------------------------- +asset_id | \x75d2c89f62f8a50ed994309655bbd27de2c5f0b3da4cf8c329320016b47aa3d1 +group_key | collection +group_value | +seq | +slot_updated | 221559431 +verified | f +group_info_seq | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/mint_transfer_transfer_asset_creators.txt b/tools/txn_forwarder/bubblegum_tests/mint_transfer_transfer_asset_creators.txt new file mode 100644 index 000000000..35a05174a --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_transfer_transfer_asset_creators.txt @@ -0,0 +1,16 @@ +-[ RECORD 1 ]+------------------------------------------------------------------- +asset_id | \xca35c69cd4d5bb853a93e4e76526be26cf5951982653cf653d9dddac5e5ac797 +creator | \xdc53343c46e5d7a1bd08f4780285621202f66b596f984e940a5eb423ac560fed +share | 55 +verified | f +seq | 1 +slot_updated | 224501105 +position | 0 +-[ RECORD 2 ]+------------------------------------------------------------------- +asset_id | \xca35c69cd4d5bb853a93e4e76526be26cf5951982653cf653d9dddac5e5ac797 +creator | \x900de0b94569cfed833ae4c2ca61ba796f44334823c57a58be5661585fd8f2e2 +share | 45 +verified | f +seq | 1 +slot_updated | 224501105 +position | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/mint_transfer_transfer_asset_grouping.txt b/tools/txn_forwarder/bubblegum_tests/mint_transfer_transfer_asset_grouping.txt new file mode 100644 index 000000000..e3aeb62ff --- /dev/null +++ b/tools/txn_forwarder/bubblegum_tests/mint_transfer_transfer_asset_grouping.txt @@ -0,0 +1,8 @@ +-[ RECORD 1 ]--+------------------------------------------------------------------- +asset_id | \xca35c69cd4d5bb853a93e4e76526be26cf5951982653cf653d9dddac5e5ac797 +group_key | collection +group_value | +seq | +slot_updated | 224501105 +verified | f +group_info_seq | 1 \ No newline at end of file diff --git a/tools/txn_forwarder/bubblegum_tests/run-bubblegum-sequences.sh b/tools/txn_forwarder/bubblegum_tests/run-bubblegum-sequences.sh index 2749e65a1..a15342360 100755 --- a/tools/txn_forwarder/bubblegum_tests/run-bubblegum-sequences.sh +++ b/tools/txn_forwarder/bubblegum_tests/run-bubblegum-sequences.sh @@ -42,8 +42,8 @@ for i in ${!SCENARIOS[@]}; do fi # Initially this asset should not be in `asset`` table. - SQL="select * from asset where id = '$ASSET_ID';" - DATABASE_VAL=$(PGPASSWORD=solana psql -h localhost -U solana -x --command="$SQL") + ASSET_SQL="SELECT * FROM asset WHERE id = '$ASSET_ID';" + DATABASE_VAL=$(PGPASSWORD=solana psql -h localhost -U solana -x --command="$ASSET_SQL") if [ "(0 rows)" == "$DATABASE_VAL" ]; then echo $(GRN "${SCENARIOS[$i]} initial asset table passed") else @@ -51,6 +51,49 @@ for i in ${!SCENARIOS[@]}; do STATUS=1 fi + # Read in the `asset_creators` file for this scenario. + EXPECTED_ASSET_CREATORS_FILE="$(basename "${SCENARIOS[$i]}" .scenario)_asset_creators.txt" + if [ ! -f "$EXPECTED_ASSET_CREATORS_FILE" ]; then + echo $(RED "${SCENARIOS[$i]} missing asset_creators file") + STATUS=1 + continue + fi + EXPECTED_ASSET_CREATORS=$(<"$EXPECTED_ASSET_CREATORS_FILE") + + # Initially this asset should not be in `asset_creators`` table. + ASSET_CREATORS_SQL="SELECT asset_id, creator, share, verified, seq, slot_updated, position \ + FROM asset_creators \ + WHERE asset_id = '$ASSET_ID' \ + ORDER BY position;" + DATABASE_VAL=$(PGPASSWORD=solana psql -h localhost -U solana -x --command="$ASSET_CREATORS_SQL") + if [ "(0 rows)" == "$DATABASE_VAL" ]; then + echo $(GRN "${SCENARIOS[$i]} initial asset_creators table passed") + else + echo $(RED "${SCENARIOS[$i]} initial asset_creators table failed") + STATUS=1 + fi + + # Read in the `asset_grouping` file for this scenario. + EXPECTED_ASSET_GROUPING_FILE="$(basename "${SCENARIOS[$i]}" .scenario)_asset_grouping.txt" + if [ ! -f "$EXPECTED_ASSET_GROUPING_FILE" ]; then + echo $(RED "${SCENARIOS[$i]} missing asset_grouping file") + STATUS=1 + continue + fi + EXPECTED_ASSET_GROUPING=$(<"$EXPECTED_ASSET_GROUPING_FILE") + + # Initially this asset should not be in `asset_grouping`` table. + ASSET_GROUPING_SQL="SELECT asset_id, group_key, group_value, seq, slot_updated, verified, group_info_seq \ + FROM asset_grouping \ + WHERE asset_id = '$ASSET_ID';" + DATABASE_VAL=$(PGPASSWORD=solana psql -h localhost -U solana -x --command="$ASSET_GROUPING_SQL") + if [ "(0 rows)" == "$DATABASE_VAL" ]; then + echo $(GRN "${SCENARIOS[$i]} initial asset_grouping table passed") + else + echo $(RED "${SCENARIOS[$i]} initial asset_grouping table failed") + STATUS=1 + fi + # Read in the `cl_items` file for this scenario. EXPECTED_CL_ITEMS_FILE="$(basename "${SCENARIOS[$i]}" .scenario)_cl_items.txt" if [ ! -f "$EXPECTED_CL_ITEMS_FILE" ]; then @@ -95,9 +138,8 @@ for i in ${!SCENARIOS[@]}; do sleep 3 - # Asset should now be in `asset`` table and all fields except `created_at` date match. - SQL="select * from asset where id = '$ASSET_ID';" - DATABASE_VAL=$(PGPASSWORD=solana psql -h localhost -U solana -x --command="$SQL") + # Asset should now be in `asset` table and all fields except `created_at` date match. + DATABASE_VAL=$(PGPASSWORD=solana psql -h localhost -U solana -x --command="$ASSET_SQL") DATABASE_VAL_NO_DATE=$(sed '/^created_at/d' <<< "$DATABASE_VAL") if [ "$EXPECTED_ASSET_VALUE" == "$DATABASE_VAL_NO_DATE" ]; then echo $(GRN "${SCENARIOS[$i]} asset table passed") @@ -111,6 +153,34 @@ for i in ${!SCENARIOS[@]}; do STATUS=1 fi + # Asset should now be in `asset_creators` table and all fields match. + DATABASE_VAL=$(PGPASSWORD=solana psql -h localhost -U solana -x --command="$ASSET_CREATORS_SQL") + if [ "$EXPECTED_ASSET_CREATORS" == "$DATABASE_VAL" ]; then + echo $(GRN "${SCENARIOS[$i]} asset_creators table passed") + else + echo $(RED "${SCENARIOS[$i]} asset_creators table failed") + echo "Asset ID: $ASSET_ID" + echo "Expected:" + echo "$EXPECTED_ASSET_CREATORS" + echo "Actual:" + echo "$DATABASE_VAL" + STATUS=1 + fi + + # Asset should now be in `asset_grouping` table and all fields match. + DATABASE_VAL=$(PGPASSWORD=solana psql -h localhost -U solana -x --command="$ASSET_GROUPING_SQL") + if [ "$EXPECTED_ASSET_GROUPING" == "$DATABASE_VAL" ]; then + echo $(GRN "${SCENARIOS[$i]} asset_grouping table passed") + else + echo $(RED "${SCENARIOS[$i]} asset_grouping table failed") + echo "Asset ID: $ASSET_ID" + echo "Expected:" + echo "$EXPECTED_ASSET_GROUPING" + echo "Actual:" + echo "$DATABASE_VAL" + STATUS=1 + fi + # Tree should now be in `cl_items`` table and all fields match. SQL="select tree, node_idx, leaf_idx, seq, level, hash from cl_items where tree = '$TREE_ID' order by level;" DATABASE_VAL=$(PGPASSWORD=solana psql -h localhost -U solana --command="$SQL")