Skip to content

Commit dfffa0f

Browse files
authored
fix: add storage padding in L1GasPriceOracle (#164)
1 parent 6c25be6 commit dfffa0f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/L2/predeploys/L1GasPriceOracle.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ contract L1GasPriceOracle is OwnableBase, IL1GasPriceOracle {
117117
/// @notice Indicates whether the network has gone through the Feynman upgrade.
118118
bool public isFeynman;
119119

120+
/// @dev Gap added to ensure that `isGalileo` is in the next storage slot.
121+
uint248 private __gap;
122+
120123
/// @notice Indicates whether the network has gone through the Galileo upgrade.
121124
bool public isGalileo;
122125

src/test/L1GasPriceOracle.t.sol

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,19 @@ contract L1GasPriceOracleTest is DSTestPlus {
312312

313313
assertEq(oracle.getL1Fee(_data), (_baseTerm + _penaltyTerm) / PRECISION);
314314
}
315+
316+
function testSetStorageDuringUpgrade() external {
317+
assertFalse(oracle.isFeynman());
318+
assertFalse(oracle.isGalileo());
319+
320+
// Feynman upgrade
321+
hevm.store(address(oracle), bytes32(uint256(11)), bytes32(uint256(1)));
322+
assertTrue(oracle.isFeynman());
323+
assertFalse(oracle.isGalileo());
324+
325+
// GalileoV2 upgrade
326+
hevm.store(address(oracle), bytes32(uint256(12)), bytes32(uint256(1)));
327+
assertTrue(oracle.isFeynman());
328+
assertTrue(oracle.isGalileo());
329+
}
315330
}

0 commit comments

Comments
 (0)