Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 7 additions & 21 deletions src/template/L1PortalExecuteL2Call.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ pragma solidity 0.8.15;
import {VmSafe} from "forge-std/Vm.sol";
import {stdToml} from "forge-std/StdToml.sol";

import {MultisigTaskPrinter} from "../../libraries/MultisigTaskPrinter.sol";
import {Action} from "../../libraries/MultisigTypes.sol";
import {MultisigTaskPrinter} from "../libraries/MultisigTaskPrinter.sol";
import {Action} from "../libraries/MultisigTypes.sol";
import {SimpleTaskBase} from "../tasks/types/SimpleTaskBase.sol";

/// @notice Interface for the OptimismPortal2 contract on L1.
interface IOptimismPortal2 {
function depositTransaction(
address _to,
uint256 _value,
uint64 _gasLimit,
bool _isCreation,
bytes memory _data
)
function depositTransaction(address _to, uint256 _value, uint64 _gasLimit, bool _isCreation, bytes memory _data)
external
payable;
}
Expand All @@ -33,8 +27,6 @@ contract L1PortalExecuteL2Call is SimpleTaskBase {
address public l2Target;
/// @notice The calldata to be executed on l2Target.
bytes public l2Data;
/// @notice The ETH value to forward to L2.
uint256 public valueWei;
/// @notice The L2 gas limit.
uint64 public gasLimit;
/// @notice Whether to create a contract on L2.
Expand Down Expand Up @@ -92,11 +84,6 @@ contract L1PortalExecuteL2Call is SimpleTaskBase {
gasLimit = uint64(_gasLimitTmp);

// Optional fields
valueWei = 0;
try vm.parseTomlUint(_toml, ".value") returns (uint256 _v) {
valueWei = _v;
} catch {}

isCreation = false;
try vm.parseTomlBool(_toml, ".isCreation") returns (bool _b) {
isCreation = _b;
Expand All @@ -109,19 +96,18 @@ contract L1PortalExecuteL2Call is SimpleTaskBase {
/// @notice Build the portal deposit action. WARNING: State changes here are reverted after capture.
function _build(address) internal override {
// Record the L1 portal call with value for action extraction.
IOptimismPortal2(portal).depositTransaction{value: valueWei}(l2Target, valueWei, gasLimit, isCreation, l2Data);
IOptimismPortal2(portal).depositTransaction(l2Target, 0, gasLimit, isCreation, l2Data);
}

/// @notice Validate that exactly one action to the portal with the expected calldata and value was captured.
function _validate(VmSafe.AccountAccess[] memory, Action[] memory _actions, address) internal view override {
bytes memory _expected = abi.encodeCall(
IOptimismPortal2.depositTransaction, (l2Target, valueWei, gasLimit, isCreation, l2Data)
);
bytes memory _expected =
abi.encodeCall(IOptimismPortal2.depositTransaction, (l2Target, 0, gasLimit, isCreation, l2Data));

bool _found;
uint256 _matches;
for (uint256 _i = 0; _i < _actions.length; _i++) {
if (_actions[_i].target == portal && _actions[_i].value == valueWei) {
if (_actions[_i].target == portal && _actions[_i].value == 0) {
if (keccak256(_actions[_i].arguments) == keccak256(_expected)) {
_found = true;
_matches++;
Expand Down
2 changes: 1 addition & 1 deletion test/tasks/Regression.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {BlacklistGamesV400} from "src/template/BlacklistGamesV400.sol";
import {OPCMUpgradeV220toV410} from "src/template/OPCMUpgradeV220toV410.sol";
import {OPCMUpgradeV410} from "src/template/OPCMUpgradeV410.sol";
import {OPCMUpgradeSuperchainConfigV410} from "src/template/OPCMUpgradeSuperchainConfigV410.sol";
import {L1PortalExecuteL2Call} from "src/improvements/template/L1PortalExecuteL2Call.sol";
import {L1PortalExecuteL2Call} from "src/template/L1PortalExecuteL2Call.sol";

/// @notice Ensures that simulating the task consistently produces the same call data and data to sign.
/// This guarantees determinism if a bug is introduced in the task logic, the call data or data to sign
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ portal = "0xbEb5Fc579115071764c7423A4f12eDde41f106Ed" # L1 OptimismPortal
l2Target = "0xcDF27F107725988f2261Ce2256bDfCdE8B382B10" # OptimismGovernor Proxy
l2Data = "0x3659cfe6000000000000000000000000ecbf4ed9f47302f00f0f039a691e7db83bdd2624" # upgradeTo(currentImpl) -> 0xecbf4ed9f47302f00f0f039a691e7db83bdd2624
gasLimit = 500000
value = 0
isCreation = false

[addresses]
Expand Down