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

Enable out-of-order transaction processing for asset table #83

Closed
wants to merge 4 commits into from

Conversation

linuskendall
Copy link

See: metaplex-foundation#77

Notes

  • Update owner and delegate in asset table when collection or creator verification occurs.
  • Modify program transformers to enable out-of-order transaction processing by adding the following changes:
    • Upsert leaf info based on seq OR was_decompressed flag.
    • Upsert owner and delegate based on owner_delegate_seq.
    • Upsert "compression status" fields (compressed, compressible, supply, and supply_mint) based on was_decompressed flag.

Database changes

  • Add owner_delegate_seq and was_decompressed columns to asset table, and PROGRAMMABLE_NFT to specification_asset_class type.
    • Regenerate Sea ORM objects.
    • Needed to temporarily comment out a performance improvement migration that removed foreign keys so that SeaORM CLI would regenerate, since it builds relations based on those constraints.
    • Needed to add a migration to add PROGRAMMABLE_NFT to specification_asset_class since it is needed by the API code but missing from the SQL code.

Other misc. changes

  • Fix docker preparation script to build solana-program-library.
  • Also remove unused 'filling' variable.
  • Rustfmt/clippy fixes as I change files.

Testing

  • Tests done so far:
    1. Made sure it builds and runs in Docker.
    2. Used transaction forwarder to send out of order transactions and then observe correct asset table in database.
      1. Ran a CreateTree/Mint, Transfer, and Burn and observed asset table. Ran it in reverse (Burn, Transfer, and then CreateTree/Mint) and observed database update properly in reverse order. Compared final state and they match. While running in reverse order I observed that could not get info for the asset via getAsset until Mint was indexed.
      2. Ran a CreateTree/Mint, Redeem, and Decompress and observed asset table. Ran it in reverse (Decompress, Redeem, and then CreateTree/Mint) and observed database update properly in reverse order. Compared final state and they match.
      3. Ran a CreateTree/Mint, Redeem, CancelRedeem, second Redeem, and Decompress and observed asset table. Ran it in reverse (Decompress, second Redeem, CancelRedeem, first Redeem, and then CreateTree/Mint) and observed database update properly in reverse order. Compared final state and they match.
      4. Ran a CreateTree/Mint, Transfer, and second Transfer, and observed asset table. Ran it in reverse (second Transfer, first Transfer, and then CreateTree/Mint) and observed database update properly in reverse order. Compared final state and they match.

@linuskendall linuskendall force-pushed the triton_partial_updates branch from 5438762 to fcd9054 Compare June 22, 2023 09:29
@fanatid
Copy link
Collaborator

fanatid commented Jun 22, 2023

utACK

@linuskendall linuskendall force-pushed the triton_partial_updates branch from 9726a3e to 6844d20 Compare July 4, 2023 18:56
* Update owner and delegate in asset table when collection or creator verification occurs.
* Modify program transformers to enable out-of-order transaction processing by adding the following changes:
  * Upsert `leaf` info based on `seq` OR `was_decompressed` flag.
  * Upsert `owner` and `delegate` based on `owner_delegate_seq`.
  * Upsert "compression status" fields (`compressed`, `compressible`, `supply`, and `supply_mint`) based on `was_decompressed` flag.

* Add `owner_delegate_seq` and `was_decompressed` columns to asset table, and `PROGRAMMABLE_NFT` to `specification_asset_class` type.
  * Regenerate Sea ORM objects.
  * Needed to temporarily comment out a performance improvement migration that removed foreign keys so that SeaORM CLI would regenerate, since it builds relations based on those constraints.
  * Needed to add a migration to add `PROGRAMMABLE_NFT` to `specification_asset_class` since it is needed by the API code but missing from the SQL code.

* Fix docker preparation script to build solana-program-library.
* Also remove unused 'filling' variable.
* Rustfmt/clippy fixes as I change files.

  1. Made sure it builds and runs in Docker.
  2. Used transaction forwarder to send out of order transactions and then observe asset table in database.
     1.  Ran a `CreateTree`/`Mint`, `Transfer`, and `Burn` and observed asset table.  Ran it in reverse (`Burn`, `Transfer`, and then `CreateTree`/`Mint`) and observed database update properly in reverse order.  Compared final state and they match.  While running in reverse order I observed that could not get info for the asset via `getAsset` until `Mint` was indexed.
     2.  Ran a `CreateTree`/`Mint`, `Redeem`, `CancelRedeem`, second `Redeem`, and `Decompress` and observed asset table.  Ran it in reverse (`Decompress`, second `Redeem`, `CancelRedeem`, first `Redeem`, and then `CreateTree`/`Mint`) and observed database update properly in reverse order.  Compared final state and they match.
     3.  Ran a `CreateTree`/`Mint`, `Transfer`, and second `Transfer`, and observed asset table.  Ran it in reverse (second `Transfer`, first `Transfer`, and then `CreateTree`/`Mint`) and observed database update properly in reverse order.  Compared final state and they match.
  3.  Ran these same transactions in correct forward order on main branch and observed for each asset, final state of asset matched final state of asset when using my PR branch.  Observed that running transactions in backwards order on main branch results in various incorrect data in asset table.
  4.  Ran these same transactions in correct forward order on main branch and observed state of cl_items table was the same as when using my PR branch.  Observed that running transactions in backwards order on main branch results in various incorrect data in cl_items table.
@linuskendall linuskendall force-pushed the triton_partial_updates branch from 6844d20 to 85ddf35 Compare July 4, 2023 19:13
linuskendall pushed a commit that referenced this pull request Jul 26, 2023
* feat(das): add task queue depth metric

* count pending tasks only

Co-authored-by: Nikhil Acharya <[email protected]>

---------

Co-authored-by: Nikhil Acharya <[email protected]>
linuskendall pushed a commit that referenced this pull request Jul 26, 2023
@linuskendall linuskendall marked this pull request as draft July 27, 2023 16:31
@kespinola kespinola closed this Mar 19, 2024
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