For an L2 transaction the normal process is:
- The wallet figures the cost of the transaction
- The user submits the transaction
- The sequencer processes the transaction
- Process the transaction
- Deduct the gas cost, based on the L1 and L2 gas prices at that time
- The transaction is written to L1
Changes after the transaction is processed on the sequencer do not affect the cost the user pays. After step 3 the transaction is Optimism's responsibility. If the L1 gas price spikes, Optimism pays the new cost. Also, which the cost of L1 gas could increase between steps 1 and 3, it is only updated every five minutes and it does not change by more than 25%. So at most the user will pay 25% more than expected.