-
Notifications
You must be signed in to change notification settings - Fork 1k
Issue when using Assembly Scripts splice()
#603
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
Comments
Here is the file with the assembly script array func https://github.com/AssemblyScript/assemblyscript/blob/18826798074c9fb02243dff76b1a938570a8eda7/std/assembly/array.ts |
Try latest master. This issue should be fixed |
@MaxGraey That's great to hear, we'll give it a spin! |
I started getting into it, but our graph typescript library is tied to an older version of AssemblyScript, from months ago. When upgrading to the new AssemblyScript, we get a some compiling errors. So we are going to have to dig into this a bit before we can test out the newest fix on master |
@MaxGraey I can confirm it works now, thanks for fixing it! For our reference, see here graphprotocol/aragon-subgraph@d41289c , the splicing functions now works as intended. Closing |
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:

Now if we look at the Aragon Dapp, these are the only available permissions:

Our store has two extra
0x012
and an extra0x18f
. Also theCanBurn
role has an extra0xfffffff
.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)The text was updated successfully, but these errors were encountered: