Paginated Getters Expansion + Testing
Closed this issue · 1 comments
The paginated getters allow for the variants of getting Cdps-by-owner even if the list becomes so
The issue is you have to do some preprocessing (know where certain breakpoints in the list are). And run multiple commands
There are now paginated variants of the three ways of getting a Cdp by owner:
cdpOfOwnerByIndex
cdpCountOf
getCdpsOf
Realistically, people would be doing off-chain processing at that point, but we want the protocol to work well fully on-chain.
The expected workflow of pagnation.
- Start from head, run up to N nodes safely
- Get the final node from that run, and run the next
- etc
How the paginated versions work:
- cut the run if we exceed
maxNodes
iterations through the loop - start at the given node rather than the first node
getCdpsOf() improvements
we should be able to do this with only one run through the list with the same code.
the issue is we have to premake the memory array to a static size, but we don't know how many Cdps there are for the user yet.
one way we could do this is have:
- an initial memory array that is remade and doubles in size everytime the size is reached
- copy the real result to a new array at the end