nifty-oss / asset

A lightweight standard for non-fungible assets.
Apache License 2.0
38 stars 8 forks source link

Cannot lock assets with certain extensions. #53

Closed joefitter closed 7 months ago

joefitter commented 7 months ago

I am unable to lock an asset with the following extensions:

await create(umi, {
    asset,
    name: "Test asset",
    authority: umi.identity,
    owner,
    payer: umi.identity,
    extensions: [
      metadata({ description: "Gm to you" }),
      blob("image/png", [
        82, 73, 70, 70, 250, 0, 0, 0, 87, 69, 66, 80, 86, 80, 56, 76, 237, 0, 0, 0, 47, 127, 193, 95, 0, 79, 160, 36, 0, 208,
        6, 69, 10, 250, 107, 226, 224, 255, 219, 242, 40, 137, 100, 133, 146, 175, 195, 27, 202, 16, 129, 254, 250, 143, 70,
        163, 168, 109, 27, 72, 125, 21, 192, 56, 220, 252, 6, 102, 4, 87, 24, 243, 31, 111, 181, 176, 196, 221, 201, 224, 63,
        160, 164, 249, 254, 1, 154, 16, 13, 92, 69, 178, 85, 71, 177, 176, 22, 176, 128, 133, 88, 184, 22, 176, 112, 44, 196,
        194, 10, 30, 222, 252, 30, 34, 250, 63, 1, 249, 218, 80, 219, 244, 235, 132, 5, 99, 121, 225, 245, 223, 245, 223, 245,
        159, 101, 247, 14, 255, 225, 59, 220, 159, 211, 177, 253, 55, 97, 193, 56, 174, 208, 119, 99, 29, 59, 111, 211, 63,
        99, 250, 240, 223, 61, 45, 75, 121, 219, 254, 90, 234, 46, 108, 19, 250, 118, 194, 251, 0, 33, 205, 47, 244, 227, 88,
        248, 33, 9, 211, 54, 133, 126, 28, 11, 125, 63, 22, 38, 212, 54, 243, 49, 125, 52, 78, 203, 82, 62, 174, 111, 38, 44,
        24, 168, 101, 243, 113, 125, 51, 97, 193, 24, 254, 224, 139, 15, 6, 250, 116, 194, 130, 209, 93, 56, 15, 11, 253, 56,
        97, 193, 152, 86, 56, 15, 11, 253, 55, 97, 193, 152, 190, 173, 93, 216, 198, 66, 127, 13, 0,
      ]),
    ],
  }).sendAndConfirm(umi)

Called with:

ApproveCpiBuilder::new(nifty_program)
        .asset(asset_info)
        .delegate(market_info)
        .delegate_input(DelegateInput::Some {
            roles: vec![DelegateRole::Lock, DelegateRole::Transfer],
        })
        .owner(seller)
        .invoke()?;

    LockCpiBuilder::new(nifty_program)
        .asset(asset_info)
        .signer(market_info)
        .invoke_signed(&[&authority_seeds])?;

The program panics on this line when calling Lock: https://github.com/nifty-oss/asset/blob/main/programs/asset/types/src/extensions/mod.rs#L82

If I remove either of the extensions it works as expected, it only fails when they are both added to the asset

febo commented 7 months ago

Thanks for the report – preparing a PR to fix this.