espresso-sequencer
espresso-sequencer copied to clipboard
prune state history on LC contract
added functionality to prune the state history using a FIFO approach and added two additional tests
Closes #1541
This PR:
- ensures that there is only ever 10 days worth of state history stored by deleting the first entries first and storing the first index to use when traversing the state history
This PR does not:
- truncate the array length to be no greater than 10 days worth of state updates
Key places to review:
FIFO approach to pruning and the fact that the array continues to grow though one only ever interacts with the 10 days worth of state updates due to storing the stateHistory first index
How to test this PR:
forge test --match-contract LightClient_StateUpdatesTest --ffi -vvv
Things tested
- updating max state history allowed
- dealing with state updates greater than the max state history allowed