Skip to content

Commit

Permalink
chore: require solhint as part of continuous integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jac18281828 committed Aug 2, 2024
1 parent bb5ae18 commit 0e59845
Show file tree
Hide file tree
Showing 15 changed files with 1,435 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends libssl-dev
&& apt-get -y install --no-install-recommends libssl-dev ripgrep
12 changes: 7 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"build": {
"dockerfile": "Dockerfile",
},

// Configure tool-specific properties.
"customizations": {
// Configure access control to other repositories
Expand All @@ -25,13 +24,16 @@
]
}
},

"containerEnv": {
"PRIVATE_KEY": "${localEnv:PRIVATE_KEY}",
"PUBLIC_KEY": "${localEnv:PUBLIC_KEY}",
"RPC_MAINNET": "${localEnv:RPC_MAINNET}",
"RPC_HOLESKY": "${localEnv:RPC_HOLESKY}"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "chmod +x ./.devcontainer/install.sh && bash ./.devcontainer/install.sh",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
}
34 changes: 32 additions & 2 deletions .devcontainer/install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
#!/usr/bin/env bash

set -e

NVM_DIR=${HOME}/.nvm
NODE_VERSION=v22.3.0

# Install node
function npm_install {
mkdir -p ${NVM_DIR}/etc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
bash -c ". ${NVM_DIR}/nvm.sh && nvm install ${NODE_VERSION} && nvm alias default ${NODE_VERSION} && nvm use default"

NVM_NODE_PATH=${NVM_DIR}/versions/node/${NODE_VERSION}
NODE_PATH=${NVM_NODE_PATH}/lib/node_modules
PATH=${NVM_NODE_PATH}/bin:$PATH

npm install npm -g
npm install yarn -g
}

# Install foundry
curl -L https://foundry.paradigm.xyz | bash
~/.foundry/bin/foundryup
function foundry_install {
curl -L https://foundry.paradigm.xyz | bash
~/.foundry/bin/foundryup
}

npm_install
foundry_install

export NVM_NODE_PATH=${NVM_DIR}/versions/node/${NODE_VERSION}
export NODE_PATH=${NVM_NODE_PATH}/lib/node_modules
export PATH=${PATH}:${NVM_NODE_PATH}/bin:
19 changes: 9 additions & 10 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
name: format

name: lint and check format
on:
workflow_dispatch:
pull_request:
push:
branches:
- "dev"

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
name: Foundry Fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge linter
- name: Run forge fmt
run: |
forge fmt src/contracts --check
id: lint
forge fmt --check src/contracts
id: fmt
- name: install npm dependencies
run: npm install --include=dev
- name: run solhint
run: npm run hint
81 changes: 81 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "install",
"type": "shell",
"command": "npm install --include=dev",
"options": {
"cwd": "${workspaceFolder}",
},
"group": {
"kind": "build"
}
},
{
"label": "fmt",
"type": "shell",
"command": "forge fmt --check src/contracts",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "install",
"group": {
"kind": "build"
}
},
{
"label": "hint",
"type": "shell",
"command": "npm run hint",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "fmt",
"group": {
"kind": "build"
}
},
{
"label": "build",
"type": "shell",
"command": "forge build --sizes",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "hint",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "clean",
"type": "shell",
"command": "forge clean && forge cache clean",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "build",
"group": {
"kind": "build",
"isDefault": false
}
},
{
"label": "test",
"type": "shell",
"command": "forge test -vvv",
"options": {
"cwd": "${workspaceFolder}"
},
"dependsOn": "hint",
"group": {
"kind": "test",
"isDefault": true
}
},
]
}
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ FROM ubuntu:24.04
COPY bin /build-bin

RUN apt-get update \
&& apt-get install -y make curl git software-properties-common jq sudo

&& apt-get install -y \
make curl git \
software-properties-common \
jq sudo
RUN /build-bin/install-deps.sh
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /workspaces/eigenlayer-contracts
2 changes: 2 additions & 0 deletions certora/scripts/core/verifyDelegationManager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ certoraRun certora/harnesses/DelegationManagerHarness.sol \
src/contracts/pods/EigenPodManager.sol src/contracts/pods/EigenPod.sol src/contracts/strategies/StrategyBase.sol src/contracts/core/StrategyManager.sol \
src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
--verify DelegationManagerHarness:certora/specs/core/DelegationManager.spec \
--solc_via_ir \
--solc_optimize 1 \
--optimistic_loop \
--optimistic_fallback \
--optimistic_hashing \
Expand Down
2 changes: 2 additions & 0 deletions certora/scripts/core/verifyStrategyManager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ certoraRun certora/harnesses/StrategyManagerHarness.sol \
src/contracts/strategies/StrategyBase.sol src/contracts/core/DelegationManager.sol \
src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
--verify StrategyManagerHarness:certora/specs/core/StrategyManager.spec \
--solc_via_ir \
--solc_optimize 1 \
--optimistic_loop \
--optimistic_fallback \
--optimistic_hashing \
Expand Down
2 changes: 2 additions & 0 deletions certora/scripts/libraries/verifyStructuredLinkedList.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ solc-select use 0.8.12

certoraRun certora/harnesses/StructuredLinkedListHarness.sol \
--verify StructuredLinkedListHarness:certora/specs/libraries/StructuredLinkedList.spec \
--solc_via_ir \
--solc_optimize 1 \
--optimistic_loop \
--optimistic_fallback \
--parametric_contracts StructuredLinkedListHarness \
Expand Down
2 changes: 2 additions & 0 deletions certora/scripts/permissions/verifyPausable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ solc-select use 0.8.12
certoraRun certora/harnesses/PausableHarness.sol \
src/contracts/permissions/PauserRegistry.sol \
--verify PausableHarness:certora/specs/permissions/Pausable.spec \
--solc_via_ir \
--solc_optimize 1 \
--optimistic_loop \
--optimistic_fallback \
--prover_args '-recursionErrorAsAssert false -recursionEntryLimit 3' \
Expand Down
2 changes: 2 additions & 0 deletions certora/scripts/pods/verifyEigenPod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ certoraRun certora/harnesses/EigenPodHarness.sol \
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol \
lib/openzeppelin-contracts/contracts/mocks/ERC1271WalletMock.sol \
--verify EigenPodHarness:certora/specs/pods/EigenPod.spec \
--solc_via_ir \
--solc_optimize 1 \
--optimistic_loop \
--prover_args '-recursionEntryLimit 3' \
--optimistic_hashing \
Expand Down
2 changes: 2 additions & 0 deletions certora/scripts/pods/verifyEigenPodManager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ certoraRun certora/harnesses/EigenPodManagerHarness.sol \
src/contracts/core/DelegationManager.sol src/contracts/pods/EigenPod.sol src/contracts/strategies/StrategyBase.sol src/contracts/core/StrategyManager.sol \
src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
--verify EigenPodManagerHarness:certora/specs/pods/EigenPodManager.spec \
--solc_via_ir \
--solc_optimize 1 \
--optimistic_loop \
--optimistic_fallback \
--optimistic_hashing \
Expand Down
2 changes: 2 additions & 0 deletions certora/scripts/strategies/verifyStrategyBase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ certoraRun src/contracts/strategies/StrategyBase.sol \
src/contracts/permissions/PauserRegistry.sol \
src/contracts/core/Slasher.sol \
--verify StrategyBase:certora/specs/strategies/StrategyBase.spec \
--solc_via_ir \
--solc_optimize 1 \
--optimistic_loop \
--optimistic_fallback \
--prover_args '-recursionErrorAsAssert false -recursionEntryLimit 3' \
Expand Down
Loading

0 comments on commit 0e59845

Please sign in to comment.