Skip to content

Commit 0d409eb

Browse files
committed
chore: merge slashing
2 parents e284ffa + d2bfd57 commit 0d409eb

File tree

101 files changed

+6584
-4445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+6584
-4445
lines changed

.github/workflows/forge-coverage.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
workflow_dispatch: {}
6+
7+
jobs:
8+
run-coverage:
9+
name: CI
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Load issue number
19+
uses: actions/github-script@v6
20+
id: get_issue_number
21+
with:
22+
script: |
23+
const pullRequests = await github.rest.repos.listPullRequestsAssociatedWithCommit({
24+
commit_sha: context.sha,
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
});
28+
29+
if (pullRequests.data.length > 0) {
30+
return pullRequests.data[0].number;
31+
} else {
32+
throw new Error('No associated pull request found.');
33+
}
34+
result-encoding: string
35+
36+
- name: Install dependencies
37+
run: |
38+
sudo apt-get install lcov
39+
id: lcov
40+
41+
- name: Install Foundry
42+
uses: foundry-rs/foundry-toolchain@v1
43+
with:
44+
version: nightly
45+
46+
- name: Run coverage
47+
run: FOUNDRY_PROFILE=ci forge coverage --report lcov
48+
env:
49+
RPC_MAINNET: ${{ secrets.RPC_MAINNET }}
50+
RPC_HOLESKY: ${{ secrets.RPC_HOLESKY }}
51+
52+
- name: Prune coverage report
53+
run: lcov --remove ./lcov.info -o ./lcov.info.pruned 'test/*' 'script/*' '*Storage.sol' --ignore-errors inconsistent
54+
55+
- name: Generate reports
56+
run: genhtml -o report ./lcov.info.pruned
57+
58+
- name: Upload coverage results
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: code-coverage-report
62+
path: report/*
63+
64+
- name: View and log coverage
65+
id: print_coverage
66+
run: |
67+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
68+
echo "comment_contents<<$EOF" >> $GITHUB_OUTPUT
69+
echo "$(lcov --list ./lcov.info.pruned --ignore-errors inconsistent)" >> $GITHUB_OUTPUT
70+
echo "$EOF" >> $GITHUB_OUTPUT
71+
- name: Log Coverage Report
72+
run: echo "${{ steps.print_coverage.outputs.comment_contents }}"

.github/workflows/forge-fmt.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Forge Fmt
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
- mainnet
9+
- testnet-goerli
10+
- dev
11+
pull_request:
12+
13+
jobs:
14+
check:
15+
name: CI
16+
strategy:
17+
fail-fast: true
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
- name: Install Foundry
24+
uses: foundry-rs/foundry-toolchain@v1
25+
with:
26+
version: nightly
27+
- name: Run forge fmt
28+
run: |
29+
forge fmt --check
30+
id: fmt

foundry.toml

Lines changed: 108 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,111 @@
11
[profile.default]
2-
src = "src"
3-
out = "out"
4-
libs = ["lib"]
5-
fs_permissions = [{ access = "read-write", path = "./" }]
6-
gas_limit = 5000000000
7-
8-
ffi = true
9-
no-match-contract = "FFI"
10-
11-
# Enables or disables the optimizer
12-
optimizer = true
13-
# Sets the number of optimizer runs
14-
optimizer_runs = 200
15-
# Whether or not to use the Yul intermediate representation compilation pipeline
16-
via_ir = false
17-
# Override the Solidity version (this overrides `auto_detect_solc`)
18-
solc_version = '0.8.27'
2+
# Project Configuration
3+
4+
# Path to contract sources relative to the root of the project.
5+
src = "src"
6+
# Path to the test contract sources relative to the root of the project.
7+
test = "test"
8+
# Path to the script contract sources relative to the root of the project.
9+
script = "script"
10+
# Path to store contract artifacts relative to the root of the project.
11+
out = "out"
12+
# Array of paths that contain libraries, relative to the root of the project.
13+
libs = ["lib"]
14+
15+
# Solidity Compiler Configuration
16+
17+
# Defines paths for Solidity imports.
18+
remappings = [
19+
"@openzeppelin/=lib/openzeppelin-contracts-v4.9.0/",
20+
"@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable-v4.9.0/",
21+
"ds-test/=lib/ds-test/src/",
22+
"forge-std/=lib/forge-std/src/"
23+
]
24+
# Specifies the exact version of Solidity to use, overriding auto-detection.
25+
solc_version = '0.8.27'
26+
# If enabled, treats Solidity compiler warnings as errors, preventing artifact generation if warnings are present.
27+
deny_warnings = false
28+
# If set to true, changes compilation pipeline to go through the new IR optimizer.
29+
via_ir = false
30+
# Whether or not to enable the Solidity optimizer.
31+
optimizer = true
32+
# The number of runs specifies roughly how often each opcode of the deployed code will be executed
33+
# across the life-time of the contract. This means it is a trade-off parameter between code size (deploy cost)
34+
# and code execution cost (cost after deployment).
35+
optimizer_runs = 200
36+
37+
# Test Configuration
38+
39+
# Verbosity level during test execution. Higher levels provide more detailed information:
40+
# - 2 (-vv): Logs emitted during tests are displayed.
41+
# - 3 (-vvv): Stack traces for failing tests are displayed.
42+
# - 4 (-vvvv): Stack traces for all tests and setup traces for failing tests are displayed.
43+
# - 5 (-vvvvv): Stack and setup traces are always displayed.
44+
verbosity = 0
45+
# Enables the Foreign Function Interface (FFI) cheatcode.
46+
# WARNING: This allows arbitrary programs to run on your computer, which poses security risks.
47+
ffi = true
48+
# Contracts to include in gas reports. By default, all contracts are included.
49+
gas_reports = ["./src/**/*"]
50+
# Show test execution progress if set to true.
51+
show_progress = true
52+
# Sparse mode only compiles files that match certain criteria.
53+
sparse_mode = true
54+
55+
gas_limit = 5000000000
56+
no-match-contract = "FFI"
57+
fs_permissions = [{ access = "read-write", path = "./" }]
58+
59+
[profile.default.fmt]
60+
# Single-line vs multi-line statement blocks
61+
single_line_statement_blocks = "preserve" # Options: "single", "multi", "preserve"
62+
# Formatting style for long function headers
63+
multiline_func_header = "params_first" # Options: "attributes_first", "params_first", "all"
64+
# Sort import statements alphabetically
65+
sort_imports = false
66+
# Maximum line length where formatter will wrap the line
67+
line_length = 100 # Default: 120
68+
# Number of spaces per indentation level
69+
tab_width = 4 # Default: 4
70+
# Whether to print spaces between brackets
71+
bracket_spacing = false
72+
# Style of uint/int256 types
73+
int_types = "long" # Options: "long", "short", "preserve"
74+
# Quotation mark style
75+
quote_style = "double" # Options: "double", "single", "preserve"
76+
# Style of underscores in number literals
77+
number_underscore = "thousands" # Options: "preserve", "thousands", "remove"
78+
# Whether or not to wrap comments at line_length
79+
wrap_comments = false
80+
# List of files to ignore during formatting (can use glob patterns)
81+
# ignore = [
82+
# "./script/**/*",
83+
# "./test/**/*"
84+
# ]
85+
86+
# TODO: Decide if we want to enable this.
87+
# [profile.test.fmt]
88+
# int_types = "short"
89+
# line_length = 140
90+
# ignore = [
91+
# "./src/**/*"
92+
# ]
93+
94+
[profile.ci.fuzz]
95+
optimizer = false
96+
runs = 32
97+
98+
[profile.intense.fuzz]
99+
optimizer = false
100+
runs = 15000
101+
102+
[profile.forktest.fuzz]
103+
runs = 16
104+
105+
[rpc_endpoints]
106+
mainnet = "${RPC_MAINNET}"
107+
holesky = "${RPC_HOLESKY}"
19108

20109
[etherscan]
21-
mainnet = { key = "${ETHERSCAN_API_KEY}" }
22-
holesky = { key = "${ETHERSCAN_API_KEY}" }
23-
24-
[fmt]
25-
bracket_spacing = false
26-
int_types = "long"
27-
line_length = 100
28-
multiline_func_header = "params_first"
29-
number_underscore = "thousands"
30-
quote_style = "double"
31-
tab_width = 4
32-
33-
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
110+
mainnet = { key = "${ETHERSCAN_API_KEY}" }
111+
holesky = { key = "${ETHERSCAN_API_KEY}" }

script/utils/OperatorSetUpgradeLib.sol

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
pragma solidity ^0.8.0;
33
// Deploy L2AVS proxy
44

5-
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
5+
import {TransparentUpgradeableProxy} from
6+
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
67
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
78

89
import {Vm} from "forge-std/Vm.sol";
@@ -27,8 +28,7 @@ library OperatorSetUpgradeLib {
2728
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
2829
*/
2930
bytes32 internal constant ADMIN_SLOT =
30-
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
31-
31+
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
3232

3333
function upgrade(address proxy, address implementation, bytes memory data) internal {
3434
ProxyAdmin admin = ProxyAdmin(getAdmin(proxy));
@@ -40,13 +40,17 @@ library OperatorSetUpgradeLib {
4040
admin.upgrade(TransparentUpgradeableProxy(payable(proxy)), implementation);
4141
}
4242

43-
function getAdmin(address proxy) internal view returns (address) {
43+
function getAdmin(
44+
address proxy
45+
) internal view returns (address) {
4446
bytes32 value = vm.load(proxy, ADMIN_SLOT);
4547
return address(uint160(uint256(value)));
4648
}
4749

48-
function getImplementation(address proxy) internal view returns (address) {
50+
function getImplementation(
51+
address proxy
52+
) internal view returns (address) {
4953
bytes32 value = vm.load(proxy, IMPLEMENTATION_SLOT);
5054
return address(uint160(uint256(value)));
5155
}
52-
}
56+
}

0 commit comments

Comments
 (0)