Commit aa1dc04e authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

fpac: reserve spacer slot in OptimismPortal2 (#10279)

* fpac: reserve spacer slot in OptimismPortal2

Allows for merging of `OptimismPortal` that supports
custom gas token and also `OptimismPortal2` that has
a modified storage layout. The `OptimismPortal` has
spacers to account for the storage layout changes in
`OptimismPortal2` and it adds its new storage slot
at the location that the spacer is added in.

This faciliates the ability to merge the portal
codebases in the future.

* tests: fixup

* semver-lock: update
parent 344d9192
...@@ -352,6 +352,9 @@ library ChainAssertions { ...@@ -352,6 +352,9 @@ library ChainAssertions {
require(address(portal.superchainConfig()) == address(0)); require(address(portal.superchainConfig()) == address(0));
require(portal.l2Sender() == Constants.DEFAULT_L2_SENDER); require(portal.l2Sender() == Constants.DEFAULT_L2_SENDER);
} }
// This slot is the custom gas token _balance and this check ensures
// that it stays unset for forwards compatibility with custom gas token.
require(vm.load(address(portal), bytes32(uint256(61))) == bytes32(0));
} }
/// @notice Asserts that the ProtocolVersions is setup correctly /// @notice Asserts that the ProtocolVersions is setup correctly
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
}, },
"src/L1/OptimismPortal2.sol": { "src/L1/OptimismPortal2.sol": {
"initCodeHash": "0x34432a932e5deaebb856320d6e5d243a3db5d9a8e5e572915346875923ba70be", "initCodeHash": "0x34432a932e5deaebb856320d6e5d243a3db5d9a8e5e572915346875923ba70be",
"sourceCodeHash": "0x16ac8757439b3045a08476d7486a420ff6ed53db519b0191442a6dff8cd1ed79" "sourceCodeHash": "0xe90774d3f89f937c56439fb7d567106bef0be0fc298fe07bbbc74f2b08445aa5"
}, },
"src/L1/ProtocolVersions.sol": { "src/L1/ProtocolVersions.sol": {
"initCodeHash": "0x72cd467e8bcf019c02675d72ab762e088bcc9cc0f1a4e9f587fa4589f7fdd1b8", "initCodeHash": "0x72cd467e8bcf019c02675d72ab762e088bcc9cc0f1a4e9f587fa4589f7fdd1b8",
......
...@@ -117,5 +117,12 @@ ...@@ -117,5 +117,12 @@
"offset": 0, "offset": 0,
"slot": "60", "slot": "60",
"type": "mapping(bytes32 => address[])" "type": "mapping(bytes32 => address[])"
},
{
"bytes": "32",
"label": "spacer_61_0_32",
"offset": 0,
"slot": "61",
"type": "bytes32"
} }
] ]
\ No newline at end of file
...@@ -94,6 +94,10 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver { ...@@ -94,6 +94,10 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
/// @notice Mapping of withdrawal hashes to addresses that have submitted a proof for the withdrawal. /// @notice Mapping of withdrawal hashes to addresses that have submitted a proof for the withdrawal.
mapping(bytes32 => address[]) public proofSubmitters; mapping(bytes32 => address[]) public proofSubmitters;
/// @custom:spacer _balance (custom gas token)
/// @notice Spacer for forwards compatibility.
bytes32 private spacer_61_0_32;
/// @notice Emitted when a transaction is deposited from L1 to L2. /// @notice Emitted when a transaction is deposited from L1 to L2.
/// The parameters of this event are read by the rollup node and used to derive deposit /// The parameters of this event are read by the rollup node and used to derive deposit
/// transactions on L2. /// transactions on L2.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment