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

Bubblegum add event log for burn, redeem, and decompress #1115

Merged
merged 2 commits into from
Jun 14, 2023

Conversation

danenbm
Copy link
Contributor

@danenbm danenbm commented Jun 13, 2023

Notes

  • These event logs are needed so that the indexer can get the leaf schemas for the assets being affected by these Bubblegum instructions and index them properly.
  • Also add JS tests for transfer, burn, redeem and decompress.
  • Also fix yarn API gen so Solita can build Anchor 0.26.0 the way cargo install does.

Test warning

Note there is one warning when running the tests:

Transaction references a signature that is unnecessary, only the fee payer and instruction
signer accounts should sign a transaction. This behavior is deprecated and will throw an
error in the next major version release.

This is because the leaf owner is not marked as a Signer in the Anchor account validation struct. It is only checked at runtime because either the leaf owner or the leaf delegate needs to be a signer but not both. This is planned to be fixed when we switch to Kinobi/Umi to generate the JS SDK.

Read API Testing

I tested these event generations with the Read API by running the JS tests in this PR while running the read API locally.

Previously before this PR I would see decompress get indexed, but I would NOT see burn get indexed properly. I also am fairly confident redeem was not indexing properly but did not isolate it. But not indexing redeem would not result in significant corruption because no key data gets changed by redeem. However, the sequence number is supposed to be updated so results in slight incorrect asset table.

With this PR change in place, when I ran the "transfer and burn" test, I saw it indexed by the Read API, with compressed still set to true and burnt is now set to true:

-[ RECORD 1 ]-------------+-------------------------------------------------------------------
id                        | \x49d6919c1d29bab97e52b0503a6335f79a90548aad66b82204cd5f998ee6f68f
alt_id                    | 
specification_version     | v1
specification_asset_class | NFT
owner                     | \x1eee305b675dead00c05e715223312ac159f9996a36e51c3f041019c6fc95320
owner_type                | single
delegate                  | 
frozen                    | f
supply                    | 1
supply_mint               | 
compressed                | t
compressible              | f
seq                       | 3
tree_id                   | \xed0afe0803913513e628aade7ac7b402780f98b02670d04d3d5f4bec4becf326
leaf                      | \xc4f16e218a0d8a803601eef3015b6311e29abe8a0bbd0046f33ebf5142c5494c
nonce                     | 0
royalty_target_type       | creators
royalty_target            | 
royalty_amount            | 0
asset_data                | \x49d6919c1d29bab97e52b0503a6335f79a90548aad66b82204cd5f998ee6f68f
created_at                | 2023-06-13 23:36:47.733342+00
burnt                     | t
slot_updated              | 307
data_hash                 | 5LGgLYymenGxywBTUSJRKzcemigs6jXc7SwZQmJU1VmZ      
creator_hash              | CtHfCypsUk53L5Xzocmq8MXma2BNMV7pX7wrJNhuRL1t

With this PR change in place, when I ran the "redeem and decompress" test, I saw it still indexed by the Read API, with compressed set to false (this tests decompress is still working):

-[ RECORD 1 ]-------------+-------------------------------------------------------------------
id                        | \x238115e4c1968306bb191ccb927fe13fd7d162facbf66521d04c259d537a20ac
alt_id                    | 
specification_version     | v1
specification_asset_class | NFT
owner                     | \xdc53343c46e5d7a1bd08f4780285621202f66b596f984e940a5eb423ac560fed
owner_type                | single
delegate                  | 
frozen                    | f
supply                    | 1
supply_mint               | 
compressed                | f
compressible              | f
seq                       | 0
tree_id                   | 
leaf                      | 
nonce                     | 0
royalty_target_type       | creators
royalty_target            | 
royalty_amount            | 0
asset_data                | \x238115e4c1968306bb191ccb927fe13fd7d162facbf66521d04c259d537a20ac
created_at                | 2023-06-13 23:40:30.187896+00
burnt                     | f
slot_updated              | 77
data_hash                 | BkD3QnwCGu8oJ8XA6bBWxWbasg7MquQhvwZMbwwNrWZh      
creator_hash              | 9xPpgWT7ADAp65akSw4CZnyETUMLgm7Kwm51mNnFXfoR

@github-actions
Copy link
Contributor

Workflow Verify package library found differences when running yarn api:gen in the JS lib for bubblegum. Please see the job for more details: https://github.com/metaplex-foundation/metaplex-program-library/actions/runs/5260945402.

Also fix yarn API gen so Solita can build Anchor 0.26.0
the way cargo install does.
@danenbm danenbm force-pushed the danenbm/bgum-events branch from 962ab36 to a8252fd Compare June 13, 2023 22:33
@danenbm danenbm marked this pull request as ready for review June 13, 2023 22:33
@danenbm danenbm requested a review from a team as a code owner June 13, 2023 22:33
@danenbm danenbm requested review from lorisleiva, svc01-metaplex and blockiosaurus and removed request for a team and svc01-metaplex June 13, 2023 22:33
@github-actions
Copy link
Contributor

Workflow Verify package library found differences when running yarn api:gen in the JS lib for bubblegum. Please see the job for more details: https://github.com/metaplex-foundation/metaplex-program-library/actions/runs/5261006088.

Copy link
Contributor

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good on the JS side 👌

Copy link
Contributor

@blockiosaurus blockiosaurus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good an makes sense!

@danenbm danenbm merged commit 7551a28 into master Jun 14, 2023
@danenbm danenbm deleted the danenbm/bgum-events branch June 14, 2023 16:04
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