espresso-sequencer icon indicating copy to clipboard operation
espresso-sequencer copied to clipboard

Improve gas consumption for the `updateHistory` function

Open philippecamacho opened this issue 1 year ago • 0 comments

As reported by @alxiong

--- using `forge test --gas-report --mt "testCorrectUpdateBench"` with gradually uncommented logic in `newFinalizedState()`----

39.6k for pre-verifier logic
556.8k for verifier
27k for `states[finalizedState] = newState;`
77.6k for `updateStateHistory()` (75k for `stateHistoryCommitments.push()`)
1.9k for `emit NewState()`

Total: ~703k

philippecamacho avatar Aug 23 '24 14:08 philippecamacho