#Protokit array storage
11 messages · Page 1 of 1 (latest)
@lusty timber @gentle estuary
What do you mean by that?
You can either use StateMaps, which have similar behavious as array, but offer more, most notable dynamic size (you could model a dynamically sized array over the StateMap which you can't do in vanilla o1js).
Or you can store arrays into the Statemap (but then you are constrained by it being statically sized)
Operations like insert(i, item) or delete(i) would be usefull
I need something like a fixed size array with adding items to it's center or removing
Ok, and I imagine that you want all the elements after index i to move to the right (for inserting)?
Yes, I implemented similar logic for leaderboard but it looks ugly
Especially because I need to use Provable.if instead of conditions
Hmm, how many inserts/deletes are we talking about per method?
Is modelling it as a linked list an option?
I need to insert user result to top-20 leaderboard. Maybe it's not a problem that to change 1-st place I need to move 19 players. Maybe linked list implementation over StateMap is a solution