Skip to content

Issue when using Assembly Scripts splice()  #603

Closed
@davekay100

Description

@davekay100

Do you want to request a feature or report a bug?
bug

What is the current behavior?
I use assembly scripts .indexOf() to find the item I want to delete out of an array. Then I splice that element out of the array. It works most of the time, but it fails sometimes, see this if statement specifically for a case that fails in the aragon subgraph.

The token manager permission is failing to splice out certain elements. It might even be duplicating an element while removing another (but I'm not totally sure), as seen in the highlighted part in this query:
screen shot 2018-11-26 at 9 26 08 pm

Now if we look at the Aragon Dapp, these are the only available permissions:
screen shot 2018-11-26 at 9 27 41 pm

Our store has two extra 0x012 and an extra 0x18f. Also the CanBurn role has an extra 0xfffffff.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

To reproduce it, run the aragon subgraph from the repo https://github.com/graphprotocol/aragon-subgraph. Then compare it to the dapp here https://rinkeby.aragon.org/#/dude.aragonid.eth/permissions?params=app.0x9294b6165da858e3c9576a9b49050e02eb0ec365

What is the expected behavior?

The .splice() from assembly script should be consistent and work in all cases. It could be that I have implemented it wrong or my algorithm is messed up, and I am hoping if that is the case someone can point it out!

But the thing is, assembly script only tests splice() once, and with an extremely simple example, so I think it is possible my implementation is hitting an edge case.

It is either I have screwed it up or assembly script has a bug. Either way we need to fix it. Also, if anyone has some other ideas on how to delete an item out an array, let me know! (in case splice is buggy)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions