Commit fc458665 authored by Diego's avatar Diego Committed by GitHub

contracts-bedrock: add useInterop flag (#10433)

* bedrock-devnet: add useInterop flag

* op-chain-ops: add useInterop flag

* op-node: add useInterop flag to config

* contracts-bedrock: add useInterop flag to DeployConfig

* contracts-bedrock: add useInterop flag to Predeploy's getName

* contracts-bedrock: add useInterop flag to L2Genesis

* contracts-bedrock: add useInterop flag to Predeploy's test

* contracts-bedrock: add useInterop flag to CommonTest

* contracts-bedrock: add useInterop flag to Setup

* Revert "op-chain-ops: add useInterop flag"

This reverts commit 83c63cc63bcccf15c8f2e7d7c4f74d0316abcdae.

* Revert "op-node: add useInterop flag to config"

This reverts commit c3617f9fd8ae4777cf4f13dd399167f0718cd9d1.

* Revert "bedrock-devnet: add useInterop flag"

This reverts commit 858257c8666af70586e6f40a510b2a0ff3056bcb.

* contracts-bedrock: use L1Block in Predeploys for L1BlockInterop

* contracts-bedrock: update gas-snapshot

* op-chain-ops: add UseInterop flag to genesis DeployConfig

* contracts-bedrock: remove useInterop argument in Predeploys

* op-chain-ops: make UseInterop flag optional
Co-Authored-By: default avatarprotolambda <proto@protolambda.com>

---------
Co-authored-by: default avatarprotolambda <proto@protolambda.com>
parent 66ec96b0
......@@ -268,6 +268,9 @@ type DeployConfig struct {
// When Cancun activates. Relative to L1 genesis.
L1CancunTimeOffset *hexutil.Uint64 `json:"l1CancunTimeOffset,omitempty"`
// UseInterop is a flag that indicates if the system is using interop
UseInterop bool `json:"useInterop,omitempty"`
}
// Copy will deeply copy the DeployConfig. This does a JSON roundtrip to copy
......
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369398)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967433)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 562077)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4074053)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467008)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512757)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72627)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369443)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967411)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 562055)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4074098)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467053)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512735)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72672)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68453)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68945)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155567)
\ No newline at end of file
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68923)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155612)
\ No newline at end of file
......@@ -77,6 +77,8 @@ contract DeployConfig is Script {
bool public useCustomGasToken;
address public customGasTokenAddress;
bool public useInterop;
function read(string memory _path) public {
console.log("DeployConfig: reading file %s", _path);
try vm.readFile(_path) returns (string memory data) {
......@@ -151,6 +153,8 @@ contract DeployConfig is Script {
useCustomGasToken = _readOr(_json, "$.useCustomGasToken", false);
customGasTokenAddress = _readOr(_json, "$.customGasTokenAddress", address(0));
useInterop = _readOr(_json, "$.useInterop", false);
}
function l1StartingBlockTag() public returns (bytes32) {
......@@ -191,6 +195,11 @@ contract DeployConfig is Script {
useFaultProofs = _useFaultProofs;
}
/// @notice Allow the `useInterop` config to be overridden in testing environments
function setUseInterop(bool _useInterop) public {
useInterop = _useInterop;
}
/// @notice Allow the `fundDevAccounts` config to be overridden.
function setFundDevAccounts(bool _fundDevAccounts) public {
fundDevAccounts = _fundDevAccounts;
......
......@@ -21,6 +21,7 @@ contract CommonTest is Test, Setup, Events {
bool usePlasmaOverride;
bool useFaultProofs;
address customGasToken;
bool useInteropOverride;
function setUp() public virtual override {
alice = makeAddr("alice");
......@@ -40,6 +41,9 @@ contract CommonTest is Test, Setup, Events {
if (customGasToken != address(0)) {
deploy.cfg().setUseCustomGasToken(customGasToken);
}
if (useInteropOverride) {
deploy.cfg().setUseInterop(true);
}
vm.etch(address(ffi), vm.getDeployedCode("FFIInterface.sol:FFIInterface"));
vm.label(address(ffi), "FFIInterface");
......@@ -135,4 +139,14 @@ contract CommonTest is Test, Setup, Events {
customGasToken = _token;
}
function enableInterop() public {
// Check if the system has already been deployed, based off of the heuristic that alice and bob have not been
// set by the `setUp` function yet.
if (!(alice == address(0) && bob == address(0))) {
revert("CommonTest: Cannot enable interop after deployment. Consider overriding `setUp`.");
}
useInteropOverride = true;
}
}
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