metaplex-foundation / metaplex-program-library

Smart contracts maintained by the Metaplex team
Other
588 stars 513 forks source link

[Bug]: Burning the Metadata of an Edition of a Listed Master Edition breaks the Fixed Price Sale program completely. #1100

Closed c4b4d4 closed 1 year ago

c4b4d4 commented 1 year ago

Which package is this bug report for?

fixed-price-sale

Which Type of Package is this bug report for?

Rust Contract

Issue description

  1. List a Master Edition NFT for X amount of supply
  2. Buy an Edition from this Master Edition listing
  3. Burn the Metadata of the Printed Edition
  4. Try to buy another Edition, will fail because it'll try to buy an Edition #number that it was already printed (because metadata burn)

This is where the error is thrown: https://github.com/metaplex-foundation/metaplex-program-library/blob/78095a3328bd48d4bbb3eb295e1954b6435da5b0/token-metadata/program/src/utils/master_edition.rs#L137

And here it is where it is called:

https://github.com/metaplex-foundation/metaplex-program-library/blob/78095a3328bd48d4bbb3eb295e1954b6435da5b0/fixed-price-sale/program/src/processor/buy.rs#L49

Is failing to get the correct #number of the Edition, it tries to mint again the same #number of a previously printed Edition. Somehow is not detecting the "Burnt Metadata".

Relevant log output

[
    "Program 11111111111111111111111111111111 invoke [1]",
    "Program 11111111111111111111111111111111 success",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
    "Program log: Instruction: InitializeMint",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2967 of 1000000 compute units",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
    "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",
    "Program log: Create",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
    "Program log: Instruction: GetAccountDataSize",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1622 of 991670 compute units",
    "Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
    "Program 11111111111111111111111111111111 invoke [2]",
    "Program 11111111111111111111111111111111 success",
    "Program log: Initialize the associated token account",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
    "Program log: Instruction: InitializeImmutableOwner",
    "Program log: Please upgrade to SPL Token 2022 for immutable owner support",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 985180 compute units",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
    "Program log: Instruction: InitializeAccount3",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4241 of 981300 compute units",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
    "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 20257 of 997033 compute units",
    "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
    "Program log: Instruction: MintTo",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4536 of 976776 compute units",
    "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
    "Program SaLeTjyUa5wXHnGuewUSyJ5JWZaHwz3TxqUntCE9czo invoke [1]",
    "Program log: Instruction: Buy",
    "Program 11111111111111111111111111111111 invoke [2]",
    "Program 11111111111111111111111111111111 success",
    "Program 11111111111111111111111111111111 invoke [2]",
    "Program 11111111111111111111111111111111 success",
    "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [2]",
    "Program log: IX: Mint New Edition from Master Edition Via Token",
    "Program log: Already initialized",
    "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 24764 of 929181 compute units",
    "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: custom program error: 0x3",
    "Program SaLeTjyUa5wXHnGuewUSyJ5JWZaHwz3TxqUntCE9czo consumed 67823 of 972240 compute units",
    "Program SaLeTjyUa5wXHnGuewUSyJ5JWZaHwz3TxqUntCE9czo failed: custom program error: 0x3"
]

Priority this issue should have

High (immediate attention needed)

samuelvanderwaal commented 1 year ago

This should be fixed in the latest release of the Fixed Price Sale program. Feel free to re-open this issue if the problem persists.