metaplex-foundation / digital-asset-rpc-infrastructure

Reference implementation for Metaplex Digital Asset Standard API
https://github.com/metaplex-foundation/digital-asset-standard-api
GNU Affero General Public License v3.0
66 stars 38 forks source link

Mixed up metadata for compressed NFTs #45

Closed linuskendall closed 1 year ago

linuskendall commented 1 year ago

It looks like there's a bug where the metadata that gets indexed gets mixed up. Creating this issue as a placeholder for further dicsussion on this topic.

Example case: https://explorer.solana.com/address/9NcgMu8spvV2abTfUH9njsdHnG9e7dDPkMjzhWEXZTRJ?cluster=devnet

This has two NFTs associated. One where URI is set to https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/sticker-1-devnet-metadata.json and one where URI is set to https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/sticker-2-devnet-metadata.json.

However, in our indexed response on devnet we see the following:

curl --request POST   --url ...   --header 'Content-Type: application/json'   --data '{
        "jsonrpc": "2.0",
"method":"getAssetsByOwner",
        "id": "get-assets-op-1",
        "params": {
          "ownerAddress": "9NcgMu8spvV2abTfUH9njsdHnG9e7dDPkMjzhWEXZTRJ",
          "page": 1
        }
}'
{
   "jsonrpc" : "2.0",
   "id" : "get-assets-op-1",
   "result" : {
      "limit" : 1000,
      "items" : [
         {
            "authorities" : [
               {
                  "address" : "BXNgnWuSf4qV34WuTZMYmHcd2P4fHrQNpUUDdRAJow7j",
                  "scopes" : [
                     "full"
                  ]
               }
            ],
            "content" : {
               "files" : [],
               "metadata" : {
                  "name" : "Critters #1 DEVNET",
                  "description" : "Critter sticker 1",
                  "symbol" : "CTP"
               },
               "$schema" : "https://schema.metaplex.com/nft1.0.json",
               "links" : {
                  "external_url" : null
               },
               "json_uri" : "https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/sticker-1-devnet-metadata.json"
            },
            "interface" : "V1_NFT",
            "creators" : [
               {
                  "share" : 100,
                  "address" : "51HrvWtWjvrkw8F7y1Z3SMCLE9SAU9kfE8HNjn8XMBbu",
                  "verified" : true
               },
               {
                  "verified" : false,
                  "share" : 35,
                  "address" : "D2q37yaP8f87FyW3f6XJqiEVGaAh7zv62FVm6jCDpfAs"
               }
            ],
            "compression" : {
               "data_hash" : "Fa5V8vYjKuqpDfcSg1mWBky75oY8imBq6pRGa2vA18bL",
               "seq" : 386,
               "asset_hash" : "59eS8WBqXj2Ehrq8EP3SpAs2teQs6Scojo63zB8AHD3k",
               "eligible" : false,
               "leaf_id" : 374,
               "tree" : "APBGd5QtSg8PWxGK6pqzRpffBXknpHhMET1bzafLkysx",
               "creator_hash" : "73uaC8PrLQxamuZR2tvKxEdCsxeCNqPTS887kaeDEu9P",
               "compressed" : true
            },
            "mutable" : true,
            "supply" : {
               "print_current_supply" : 0,
               "edition_nonce" : 0,
               "print_max_supply" : 0
            },
            "grouping" : [
               {
                  "group_value" : "EpbHnATobvsAeS864EpX1TKzUyxEADvUAF17LFHJYYwK",
                  "group_key" : "collection"
               }
            ],
            "ownership" : {
               "frozen" : false,
               "delegate" : null,
               "delegated" : false,
               "owner" : "9NcgMu8spvV2abTfUH9njsdHnG9e7dDPkMjzhWEXZTRJ",
               "ownership_model" : "single"
            },
            "royalty" : {
               "basis_points" : 300,
               "royalty_model" : "creators",
               "target" : null,
               "locked" : false,
               "percent" : 0.03,
               "primary_sale_happened" : false
            },
            "id" : "8kM6QnXADYR8uEstjm8ghYMLd5ogh1PRuHjULt6Xj9Ci"
         },
         {
            "mutable" : true,
            "supply" : {
               "print_max_supply" : 0,
               "edition_nonce" : 0,
               "print_current_supply" : 0
            },
            "grouping" : [
               {
                  "group_value" : "EpbHnATobvsAeS864EpX1TKzUyxEADvUAF17LFHJYYwK",
                  "group_key" : "collection"
               }
            ],
            "id" : "ESKQ8bwp7iASVb7pUTLSQgzhuuRQChPRKeFDm6tsnJpj",
            "royalty" : {
               "primary_sale_happened" : false,
               "percent" : 0.03,
               "locked" : false,
               "target" : null,
               "royalty_model" : "creators",
               "basis_points" : 300
            },
            "ownership" : {
               "owner" : "9NcgMu8spvV2abTfUH9njsdHnG9e7dDPkMjzhWEXZTRJ",
               "ownership_model" : "single",
               "delegated" : false,
               "frozen" : false,
               "delegate" : null
            },
            "authorities" : [
               {
                  "scopes" : [
                     "full"
                  ],
                  "address" : "BXNgnWuSf4qV34WuTZMYmHcd2P4fHrQNpUUDdRAJow7j"
               }
            ],
            "interface" : "V1_NFT",
            "creators" : [
               {
                  "address" : "51HrvWtWjvrkw8F7y1Z3SMCLE9SAU9kfE8HNjn8XMBbu",
                  "share" : 18,
                  "verified" : true
               },
               {
                  "verified" : false,
                  "address" : "FnUaaRXXAdV1Y4RHD2k9BUwRXBtHuyTWrMK6HHtqKaEq",
                  "share" : 82
               }
            ],
            "compression" : {
               "leaf_id" : 375,
               "tree" : "APBGd5QtSg8PWxGK6pqzRpffBXknpHhMET1bzafLkysx",
               "creator_hash" : "3PkYeFyfrnU67Mk7CYi236p3bAdxD9rbfpkkBEqYtbQR",
               "compressed" : true,
               "data_hash" : "FqbcEYuWU5UMnyMZL191z8sQWWNJrj8wNop76JKYxcwr",
               "seq" : 387,
               "asset_hash" : "9K6tjL75wm7iSnfuhfsr7RBaVb7JDVbfYkULSwxsTCwf",
               "eligible" : false
            },
            "content" : {
               "$schema" : "https://schema.metaplex.com/nft1.0.json",
               "files" : [],
               "metadata" : {
                  "name" : "Critters #3 DEVNET",
                  "description" : "Critter sticker 3",
                  "symbol" : "CTP"
               },
               "json_uri" : "https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/sticker-3-devnet-metadata.json",
               "links" : {
                  "external_url" : null
               }
            }
         }
      ],
      "page" : 1,
      "total" : 2
   }
}
linuskendall commented 1 year ago

Asset data is mangled in the DB so it's either a plugin or ingester issue:

 \x731c80b888af577cd3799fbb3fa8fa64050f74b37d1b6a9007bebe9e6e75af97 |        | v1                    | NFT                       | \x7c6708cb57dcda1fd565c2cf35b101de7ebe9f01c8b7b373d5ce02086d39df69 | single     |          | f      |      1 |             | t          | f            | 386 | \x8b67925c607bbeeff547369e6380d37bb5866ecffb005a328cbe914a587a74d3 | \x3da5b858d73bf0ef3e4ea1655b156547ed603f432ec14eed5241dcbe6f926ebf |   374 | creators            |                |            300 | \x731c80b888af577cd3799fbb3fa8fa64050f74b37d1b6a9007bebe9e6e75af97 | 2023-03-21 13:15:29.870937+00 | f     |    203518444 | Fa5V8vYjKuqpDfcSg1mWBky75oY8imBq6pRGa2vA18bL       | 73uaC8PrLQxamuZR2tvKxEdCsxeCNqPTS887kaeDEu9P       | \x731c80b888af577cd3799fbb3fa8fa64050f74b37d1b6a9007bebe9e6e75af97 | mutable               | {"name": "Critters #1 DEVNET", "symbol": "CTP", "edition_nonce": 0, "token_standard": "NonFungible", "primary_sale_happened": false} | https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/sticker-1-devnet-metadata.json | mutable             | {"name": "Critter 1", "image": "https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/critters-1-static.png", "symbol": "CTP", "description": "Critter sticker 1", "external_url": "https://dialect.to", "animation_url": "https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/critters-1.gif"} |    203518448
 \xc7a440fdc3e3a6070ba63699520448db147438beadc9f809e48458692e5fe87c |        | v1                    | NFT                       | \x7c6708cb57dcda1fd565c2cf35b101de7ebe9f01c8b7b373d5ce02086d39df69 | single     |          | f      |      1 |             | t          | f            | 387 | \x8b67925c607bbeeff547369e6380d37bb5866ecffb005a328cbe914a587a74d3 | \x7b809ca95cf0d6957f7a9c223dd9a8a82fc83df75354199e50ecf7c352cbe47e |   375 | creators            |                |            300 | \xc7a440fdc3e3a6070ba63699520448db147438beadc9f809e48458692e5fe87c | 2023-03-21 13:15:29.920226+00 | f     |    203518444 | FqbcEYuWU5UMnyMZL191z8sQWWNJrj8wNop76JKYxcwr       | 3PkYeFyfrnU67Mk7CYi236p3bAdxD9rbfpkkBEqYtbQR       | \xc7a440fdc3e3a6070ba63699520448db147438beadc9f809e48458692e5fe87c | mutable               | {"name": "Critters #3 DEVNET", "symbol": "CTP", "edition_nonce": 0, "token_standard": "NonFungible", "primary_sale_happened": false} | https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/sticker-3-devnet-metadata.json | mutable             | {"name": "Critter 3", "image": "https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/critters-3-static.png", "symbol": "CTP", "description": "Critter sticker 3", "external_url": "https://dialect.to", "animation_url": "https://dialect-file-storage.s3.us-west-2.amazonaws.com/sticker-packs/critters-test-pack/critters-3.gif"} |    203518449
austbot commented 1 year ago

@linuskendall was this fixed with the discovery of the confirmation level configuration setting in plerkle? https://github.com/metaplex-foundation/digital-asset-validator-plugin#additional-configuration-examples

NicolasPennie commented 1 year ago

Resolved thanks to https://github.com/metaplex-foundation/digital-asset-validator-plugin/pull/52