near / near-sdk-contract-tools

Helpful functions and macros for developing smart contracts on NEAR Protocol.
https://crates.io/crates/near-sdk-contract-tools
Apache License 2.0
41 stars 12 forks source link

NFT contract derived from NonFungibleToken macro will panic if receiver account lenght is shorter than sender account. #155

Open VladasZ opened 2 months ago

VladasZ commented 2 months ago

It looks like in case when receiver account is shorter than sender account apply_storage_accounting_hook is trying to refund excess storage to it and fails.

Steps to reproduce:

Edit NFT macro tests like this: https://github.com/VladasZ/near-sdk-contract-tools/commit/8054ed3d1f835d110192f8a1b21311e88a731695

It will panic:

called `Result::unwrap()` on an `Err` value: HostError(GuestPanic { panic_msg: "Storage accounting error: Account bob cannot unlock more tokens than it has deposited" })