#Protokit array storage

11 messages · Page 1 of 1 (latest)

maiden scaffold
#

Is there a solution to store arrays in protokit? Now we use StateMap with keys-indexes but I think inserting and deleting can be optimised

green lake
#

@lusty timber @gentle estuary

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)

maiden scaffold
#

I need something like a fixed size array with adding items to it's center or removing

gentle estuary
#

Ok, and I imagine that you want all the elements after index i to move to the right (for inserting)?

maiden scaffold
#

Especially because I need to use Provable.if instead of conditions

gentle estuary
#

Hmm, how many inserts/deletes are we talking about per method?

#

Is modelling it as a linked list an option?

maiden scaffold