Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable out-of-order transaction processing for asset table #77
* 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.
- Loading branch information