From 269507136eb6f04d4ff485949682161e4d609349 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Wed, 15 May 2024 11:37:33 -0400 Subject: [PATCH] Format solidity and check formatting in CI (#7) * Format solidity and check formatting in CI * parametrize ci_builder_image --- .circleci/config.yml | 17 ++++++++++++++++- script/CallPause.s.sol | 15 +++++---------- script/CallUnpause.s.sol | 15 +++++---------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 53b5f8d..5ac4dac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,6 +2,11 @@ version: 2.1 +parameters: + ci_builder_image: + type: string + default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.47.3 + jobs: build: docker: @@ -18,10 +23,19 @@ jobs: - checkout - run: go test ./... + format: + docker: + - image: <> + working_directory: /go/src/github.com/ethereum-optimism/presigner + steps: + - checkout + - run: + command: forge fmt --check + e2e-test: circleci_ip_ranges: true docker: - - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.35.0 + - image: <> working_directory: /go/src/github.com/ethereum-optimism/presigner steps: - checkout @@ -62,4 +76,5 @@ workflows: jobs: - build - test + - format - e2e-test diff --git a/script/CallPause.s.sol b/script/CallPause.s.sol index 0d1d526..a1f2222 100644 --- a/script/CallPause.s.sol +++ b/script/CallPause.s.sol @@ -4,36 +4,31 @@ pragma solidity ^0.8.15; import "./Pauseable.sol"; import "forge-std/console.sol"; import "@base-contracts/script/universal/MultisigBuilder.sol"; -import { IGnosisSafe } from "@eth-optimism-bedrock/scripts/interfaces/IGnosisSafe.sol"; +import {IGnosisSafe} from "@eth-optimism-bedrock/scripts/interfaces/IGnosisSafe.sol"; contract CallPause is MultisigBuilder { - - function _postCheck() internal override view { + function _postCheck() internal view override { IGnosisSafe safe = IGnosisSafe(_ownerSafe()); console.log("Nonce post check", safe.nonce()); } - function _buildCalls() internal override view returns (IMulticall3.Call3[] memory) { + function _buildCalls() internal view override returns (IMulticall3.Call3[] memory) { IMulticall3.Call3[] memory calls = new IMulticall3.Call3[](1); calls[0] = IMulticall3.Call3({ target: _superchainConfigAddr(), allowFailure: false, - callData: abi.encodeCall( - Pausable.pause, - ("presigner") - ) + callData: abi.encodeCall(Pausable.pause, ("presigner")) }); return calls; } - function _ownerSafe() internal override view returns (address) { + function _ownerSafe() internal view override returns (address) { return vm.envAddress("SAFE_ADDR"); } function _superchainConfigAddr() internal view returns (address) { return vm.envAddress("TARGET_ADDR"); } - } diff --git a/script/CallUnpause.s.sol b/script/CallUnpause.s.sol index 1d304e9..543921f 100644 --- a/script/CallUnpause.s.sol +++ b/script/CallUnpause.s.sol @@ -4,36 +4,31 @@ pragma solidity ^0.8.15; import "./Pauseable.sol"; import "forge-std/console.sol"; import "@base-contracts/script/universal/MultisigBuilder.sol"; -import { IGnosisSafe } from "@eth-optimism-bedrock/scripts/interfaces/IGnosisSafe.sol"; +import {IGnosisSafe} from "@eth-optimism-bedrock/scripts/interfaces/IGnosisSafe.sol"; contract CallUnpause is MultisigBuilder { - - function _postCheck() internal override view { + function _postCheck() internal view override { IGnosisSafe safe = IGnosisSafe(_ownerSafe()); console.log("Nonce post check", safe.nonce()); } - function _buildCalls() internal override view returns (IMulticall3.Call3[] memory) { + function _buildCalls() internal view override returns (IMulticall3.Call3[] memory) { IMulticall3.Call3[] memory calls = new IMulticall3.Call3[](1); calls[0] = IMulticall3.Call3({ target: _superchainConfigAddr(), allowFailure: false, - callData: abi.encodeCall( - Pausable.unpause, - () - ) + callData: abi.encodeCall(Pausable.unpause, ()) }); return calls; } - function _ownerSafe() internal override view returns (address) { + function _ownerSafe() internal view override returns (address) { return vm.envAddress("SAFE_ADDR"); } function _superchainConfigAddr() internal view returns (address) { return vm.envAddress("TARGET_ADDR"); } - }