Skip to content
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

[Dojo] issue with delete_entity command #525

Closed
bal7hazar opened this issue Jun 19, 2023 · 9 comments
Closed

[Dojo] issue with delete_entity command #525

bal7hazar opened this issue Jun 19, 2023 · 9 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@bal7hazar
Copy link
Contributor

I am facing an issue while using commands::delete_entity that leads to not delete my entity and allow the following test to pass:

let mut tile_sk: Query = (ctx.caller_account, col, row).into();
commands::<Tile>::delete_entity(tile_sk);
let tile = commands::<Tile>::entity(tile_sk);

By using the following work around, I succeeded to have my entity to be deleted

let mut tile_sk: Query = (ctx.caller_account, col, row).into();
ctx.world.delete_entity(ctx, 'Tile'.into(), tile_sk);
let tile = commands::<Tile>::entity(tile_sk);  <-- raised an error
@ponderingdemocritus ponderingdemocritus added the bug Something isn't working label Jul 28, 2023
@ponderingdemocritus
Copy link
Contributor

@bal7hazar can you confirm this is still an issue

@tarrencev
Copy link
Contributor

@neotheprogramist can you confirm this is resolved with the new indexer logic

@tarrencev tarrencev moved this from 📋 Backlog to 🏗 In progress in Dojo Oct 12, 2023
@tarrencev tarrencev moved this from 🏗 In progress to 🆕 Prioritized in Dojo Oct 12, 2023
@neotheprogramist
Copy link
Collaborator

I don't think we addressed this issue while working on the indexer logic.
@bal7hazar Could you provide broader context or some tests so I could check that on the newest dojo version, please?

@bal7hazar
Copy link
Contributor Author

I did not use it for a while, not sure if it is still an issue, better to close and reopen if needed probably.

@shramee
Copy link
Contributor

shramee commented Nov 15, 2023

This test fails with incorrect post delete energy,

    #[test]
    #[available_gas(30000000)]
    fn test_delete_entity() {
        let (caller, world, actions_) = init();

        let energy_init = Energy { amt: 10, id: 1 };

        set!(world, (energy_init));

        let energy = get!(world, (1), (Energy));
        assert(energy.amt == 10, 'incorrect energy');

        world.delete_entity('RPSType', array![1].span());

        let post_delete_energy = get!(world, (1), (Energy));
        assert(post_delete_energy.amt == 0, 'incorrect post delete energy');
    }
➜  contracts git:(main) ✗ sozo test
running 1 tests
test emojiman::actions::tests::test_delete_entity ... fail (gas usage est.: 6075238)
failures:
   emojiman::actions::tests::test_delete_entity - panicked with [11103201786955740868605512006434910093315610855676006929386402113401 ('incorrect post delete energy'), ].

error: test result: FAILED. 0 passed; 1 failed; 0 ignored

@shramee
Copy link
Contributor

shramee commented Nov 15, 2023

I'm happy to grab this, we need to delete entities...

@ponderingdemocritus
Copy link
Contributor

how did you go with this @shramee ?

@ponderingdemocritus ponderingdemocritus added this to the 0.4.0 milestone Nov 30, 2023
@shramee
Copy link
Contributor

shramee commented Nov 30, 2023

This is fixed and merged

@shramee
Copy link
Contributor

shramee commented Nov 30, 2023

#1191

@github-project-automation github-project-automation bot moved this from 🆕 Prioritized to ✅ Done in Dojo Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

No branches or pull requests

5 participants