Commit 51a661b9 authored by Maurelian's avatar Maurelian Committed by GitHub

Use tryFfi in Setup.sol (#9983)

* use tryFfi

* ctb: Update FfiFailed revert message in Setup.sol

* Update Setup.sol

* Update Setup.sol

* ctb: Update snapshot

---------
Co-authored-by: default avatarzhiqiangxu <652732310@qq.com>
parent ebf299bb
...@@ -8,4 +8,4 @@ GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (g ...@@ -8,4 +8,4 @@ GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (g
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92930) GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92930)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68360) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68360)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 69013) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 69013)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155551) GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155559)
\ No newline at end of file \ No newline at end of file
...@@ -42,6 +42,8 @@ import { DataAvailabilityChallenge } from "src/L1/DataAvailabilityChallenge.sol" ...@@ -42,6 +42,8 @@ import { DataAvailabilityChallenge } from "src/L1/DataAvailabilityChallenge.sol"
/// up behind proxies. In the future we will migrate to importing the genesis JSON /// up behind proxies. In the future we will migrate to importing the genesis JSON
/// file that is created to set up the L2 contracts instead of setting them up manually. /// file that is created to set up the L2 contracts instead of setting them up manually.
contract Setup { contract Setup {
error FfiFailed(string);
/// @notice The address of the foundry Vm contract. /// @notice The address of the foundry Vm contract.
Vm private constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); Vm private constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
...@@ -159,7 +161,24 @@ contract Setup { ...@@ -159,7 +161,24 @@ contract Setup {
args[0] = Executables.bash; args[0] = Executables.bash;
args[1] = "-c"; args[1] = "-c";
args[2] = string.concat(vm.projectRoot(), "/scripts/generate-l2-genesis.sh"); args[2] = string.concat(vm.projectRoot(), "/scripts/generate-l2-genesis.sh");
vm.ffi(args); Vm.FfiResult memory result = vm.tryFfi(args);
if (result.exitCode != 0) {
revert FfiFailed(
string.concat(
"FFI call to generate genesis.json failed with exit code: ",
string(abi.encodePacked(result.exitCode)),
".\nCommand: ",
Executables.bash,
" -c ",
vm.projectRoot(),
"/scripts/generate-l2-genesis.sh",
".\nOutput: ",
string(result.stdout),
"\nError: ",
string(result.stderr)
)
);
}
} }
// Prevent race condition where the genesis.json file is not yet created // Prevent race condition where the genesis.json file is not yet created
......
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