feat: Sanitize block gaps in eth_simulateV1
This PR:
- fills up block gaps with empty
Callsexecution ineth_simulateV1 - ensures the block number doesn't decrease during simulation
@iTranscend do you have capacity to get this over the finish line?
Hey @jenpaff. Yeah, I can get this finished in the next day or two. I'll just need to write a simpler version of my proposed solution.
The current solution is the most efficient way of solving this that I could think of by taking advantage of Iterators laziness, but I understand that it may be a bit hard to read.
Hey @mattsse, I've done away with the iterator approach and used a while loop to fill up the gaps
Hey @mattsse, got a chance to take a look at this?
Hey @mattsse
I took the stack based approached as suggested, but reversed block_state_calls so that I could emulate popping from the front.
This mimics the behavior of a VecDeque without incurring the cost of an extra allocation.
The reversal is O(n/2) as compared to the VecDeque approach which would have been O(n) plus an extra allocation.
This also guarantees that the Vec only ever shrinks by reusing an existing slot.