Skip to content

Commit

Permalink
Format solidity and check formatting in CI (#7)
Browse files Browse the repository at this point in the history
* Format solidity and check formatting in CI

* parametrize ci_builder_image
  • Loading branch information
maurelian authored May 15, 2024
1 parent 178e09a commit 2695071
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
17 changes: 16 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -18,10 +23,19 @@ jobs:
- checkout
- run: go test ./...

format:
docker:
- image: <<pipeline.parameters.ci_builder_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: <<pipeline.parameters.ci_builder_image>>
working_directory: /go/src/github.com/ethereum-optimism/presigner
steps:
- checkout
Expand Down Expand Up @@ -62,4 +76,5 @@ workflows:
jobs:
- build
- test
- format
- e2e-test
15 changes: 5 additions & 10 deletions script/CallPause.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

}
15 changes: 5 additions & 10 deletions script/CallUnpause.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

}

0 comments on commit 2695071

Please sign in to comment.