-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"VM call panic: unexpected object with id" when re-adding the same key to an avl.Tree after previously deleting it #1543
Comments
Hey @irreverentsimplicity. Maybe it is possible the object isn't getting removed correctly. Would it be possible to provide more context and send over something like the script below? I ran this locally and wasn't able to reproduce. I'm just trying to figure out the gno code and maketx combination that I need to do to observe the issue for myself.
|
@irreverentsimplicity I've already had an issue with the same error (not necessarily the same cause ;) ) and it caused tremendous headaches when developing GnoChess. Does this help? gnoverse/gnochess#97 |
@thehowl thanks, it definitely helps, it is actually to the same scenario, although with slightly different objects. As far as I understand, you had to reinstantiate an object (the chess board) before re-adding the same key. I'm not sure this approach can be used in my case, though. The avl.Tree I'm using holds listing ids for the marketplace. Re-instantiating the whole avl.Tree basically wipes all the data (or at least that's how I understand by re-instantiation, I might be wrong). I'll dig more over the next few days, and if I can't find a way, I may resort to using a map to hold listings (although a bit more verbose and slightly slower). Somehow related to this: I remember you mentioned you're working on a new type of data structure in a dev call, one that also allowed pagination. I don't know what the status of this new data structure is (merged or not) but if you can give me some pointers to it, I might try to use that instead (pagination very useful in listing potentially huge amounts of NFTs and marketplace listings). Thanks! |
For tracking references & searchability: there is a reproducible test on #1172 . The PR contains a lot of extra commits (coming from the @irreverentsimplicity The issue is not about re-using the avl tree per se. Take a look at the txtar test, it doesn't use an AVL tree at all. I'd need to take a better look at the entire code to be certain of how to work it around. If you still don't manage to do it, ping me on Signal. Let's keep this issue open to track the problem officially, I believe I hadn't opened it originally because I didn't have time when developing GnoChess to make a proper report... :) |
@thehowl I just ran that test and it is passing for me, so maybe some of the fixes we've made to the VM have resolved the underlying issue. |
I can still reproduce this on my machine. Here is the stack trace when sending the tx from command line:
|
@irreverentsimplicity Dylan was referring to the txtar test I provided in my comment :) They are automated integration tests that let us reproduce bugs. If you want to give a shot at creating one for this issue you have, please do. See directory |
Hey, I tried this code out and it seems to work. Maybe some PR has fixed it. https://gno.land/r/leon/test/avltestv1/package.gno Calling Add, Remove, Add, Read works perfectly with reusing the same keys. |
@irreverentsimplicity we'll need to have a reproducible test for this issue. If you can still reproduce, ping me and I can help you work out a txtar. |
@thehowl I can still reproduce this. Here is the last part of the error message:
I am still not sure if this is a coding error on my part, or some unusual behavior of avl.Tree. Steps to reproduce:
In terms of code, the main function call sequence is: marketplace.ListNFT(...) Any feedback is highly appreciated. Thank you! |
I'm pretty sure this is tracked somewhere else too, so closing it for clarity. |
@irreverentsimplicity , is the other issue #2266 ? |
Description
Here's my use case. I have a listings object, which is an avl.Tree: CompositeTokenID -> Listing.
CompositeTokenID is a string, Listing is a struct:
adding a listing (partial code):
removing a listing:
When adding the same listing again, using the same code, I get the error message:
VM call panic: unexpected object with id 1b4fe769c2b0acba527e54f1eca22a38499de5b4:572
is there a caching mechanism in avl.Tree? keys cannot be re-used?
The text was updated successfully, but these errors were encountered: