Hey valuable Substrate community,
I am running into the problem that I need to iterate over an unbounded StorageMap
. So I need an IterationLimit
and use an extrinsic which gets called multiple times.
The problem is that I can't drain the StorageMap
, because the storage is still required. So I need to iterate and continue iterating in the subsequent calls.
But it is possible that the StorageMap
changes (keys inserted) between the calls that exceed the iteration limit.
Test that fails with the last assert: https://github.com/zeitgeistpm/zeitgeist/blob/f81d03da05f1c3ab75b27af6964594df2dfee6d8/zrml/court/src/tests.rs#L429-L473
With the above test I found out, that new key inserts are not ensured to be inserted after previous key inserts. So I can't use iter_from
or iter_keys_from
.
So my aim is to iterate over all elements and if all elements inside the StorageMap
fulfill a specific condition, then it should return Ok, otherwise it throws and error.