@@ -95,20 +95,26 @@ describe('e2e_fees fee settings', () => {
9595 reference : reference . toInspect ( ) ,
9696 } ) ;
9797
98- // Bump next L1 block base fee to ~3x current with a 0.1 gwei floor. The 0.1 gwei floor
98+ const minRiseTarget = ( reference . feePerL2Gas * 13n ) / 10n ;
99+
100+ // Bump next L1 block base fee above both the current L1 fee and the L1 fee implied by
101+ // the requested L2 fee rise, with a 0.1 gwei absolute floor. The absolute floor
99102 // matters when anvil's natural EIP-1559 decay has driven `currentL1BaseFee` close to zero —
100103 // multiplying tiny numbers stays tiny, so a target below the previous oracle snapshot can
101- // *decrease* L2 fees. The oracle rotation deadband (`LIFETIME - LAG = 3` L2 slots between
102- // successful rotations, see FeeLib.sol:170) silently no-ops `updateL1GasFeeOracle` until
103- // the window opens; we retry every second so the *first* call after the deadband opens
104- // captures our bumped block.
104+ // *decrease* L2 fees. The reference-derived floor matters after an earlier spike has
105+ // already raised the L2 fee baseline: repeating the same absolute L1 base fee can leave
106+ // the derived L2 fee below the required 1.3x rise. The oracle rotation deadband
107+ // (`LIFETIME - LAG = 3` L2 slots between successful rotations, see FeeLib.sol:170)
108+ // silently no-ops `updateL1GasFeeOracle` until the window opens; we retry every second so
109+ // the *first* call after the deadband opens captures our bumped block.
105110 const latestL1Block = await cheatCodes . eth . publicClient . getBlock ( ) ;
106111 const currentL1BaseFee = latestL1Block . baseFeePerGas ?? 1_000_000_000n ;
107- const targetL1BaseFee = currentL1BaseFee * 3n > 100_000_000n ? currentL1BaseFee * 3n : 100_000_000n ;
112+ const referenceDerivedL1BaseFee = minRiseTarget / 8_000n ;
113+ const targetL1BaseFee = [ currentL1BaseFee * 2n , 100_000_000n , referenceDerivedL1BaseFee ] . reduce ( ( a , b ) =>
114+ a > b ? a : b ,
115+ ) ;
108116 t . logger . info ( `Targeting L1 base fee ${ targetL1BaseFee } (current ${ currentL1BaseFee } )` ) ;
109117
110- const minRiseTarget = ( reference . feePerL2Gas * 13n ) / 10n ;
111-
112118 return await retryUntil (
113119 async ( ) => {
114120 await cheatCodes . eth . setNextBlockBaseFeePerGas ( targetL1BaseFee ) ;
@@ -215,12 +221,8 @@ describe('e2e_fees fee settings', () => {
215221 const lowerMinFees = await getCurrentMinFeesAfterCheckpoint ( testContractDeployBlock ) ;
216222 // `higherMinFees` is the synthetic "stale" snapshot the wallet supposedly took before the
217223 // real L2 fee bumped — it only needs to stay above the realized `bumpedMinFees` so that
218- // `txWithNoPadding` is still mineable after the bump. A 3x L1 spike (the magnitude
219- // `inflateL2FeesViaL1BaseFee` produces) drives the L2 fee to roughly 2.0–2.5x of the
220- // pre-bump baseline once EIP-1559 decay on the oracle-rotation block is accounted for,
221- // so `2x` headroom is too tight (assertions racing against the bump landing barely above
222- // 2x) — use `4x` for unambiguous headroom while keeping the snapshot still under the
223- // 6x default-padding cap.
224+ // `txWithNoPadding` is still mineable after the bump. Use `4x` for unambiguous headroom
225+ // while keeping the snapshot below the 6x default-padding cap.
224226 const higherMinFees = lowerMinFees . mul ( 4 ) ;
225227
226228 const { txWithNoPadding, txWithDefaultPadding } = await prepareTxsWithMockedMinFees ( higherMinFees , lowerMinFees ) ;
0 commit comments