Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ScopeLift foundry default settings to repo #14

Merged
merged 7 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- main

env:
FOUNDRY_PROFILE: ci
RPC_URL: ${{ secrets.RPC_URL }}

jobs:
Expand All @@ -23,6 +24,19 @@ jobs:
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build
- name: Run Forge tests
run: |
forge test -vvv
id: test
- name: Run Tests
run: npm test
coverage:
Expand All @@ -36,6 +50,15 @@ jobs:
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build
- name: Run Coverage
run: npm run coverage
- name: Coveralls GitHub Action
Expand All @@ -51,6 +74,15 @@ jobs:
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build
- name: build source
run: npm run build
- name: Run Lint
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ cache
artifacts
yarn-error.log
.DS_Store
cache_forge
out
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ artifacts
cache
coverage*
contracts*
typechain-types
typechain-types
out
lib
5 changes: 5 additions & 0 deletions contracts/CompoundGovernor.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.18;

// TODO: Implement new governance contract for Compound. This is just a placeholder to satisfy "forge fmt".
contract CompoundGovernor {}
11 changes: 11 additions & 0 deletions contracts/test/CompoundGovernor.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.18;

import {Test, console2} from "forge-std/Test.sol";

// TODO: implement actual CompoundGovernor tests. This is just a placeholder to satisfy "forge test".
contract CompoundGovernorTest is Test {
function test() public pure {
assertEq(true, true);
}
}
50 changes: 50 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[profile.default]
src = 'contracts'
out = 'out'
libs = ['node_modules', 'lib']
test = 'test'
cache_path = 'cache_forge'
evm_version = "shanghai"
optimizer = true
optimizer_runs = 10_000_000
solc_version = "0.8.18"
verbosity = 3

[profile.ci]
fuzz = { runs = 5000 }
invariant = { runs = 1000 }

[profile.lite]
fuzz = { runs = 50 }
invariant = { runs = 10 }
# Speed up compilation and tests during development.
optimizer = false

[invariant]
call_override = false
depth = 100
dictionary_weight = 80
fail_on_revert = false
include_push_bytes = true
include_storage = true
optimizer = false
runs = 25

[fmt]
bracket_spacing = false
int_types = "long"
line_length = 120
multiline_func_header = "attributes_first"
number_underscore = "thousands"
quote_style = "double"
single_line_statement_blocks = "multi"
tab_width = 4
wrap_comments = true
ignore = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious, why mark these as ignore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A number of the original contracts got modified by "forge fmt" and adding them to the ignore list allows them to not show up as large diffs on the PR.

"contracts/Comp.sol",
"contracts/GovernorBravo*.sol",
"contracts/SafeMath.sol",
"contracts/Timelock.sol",
"contracts/test/GovernorAlpha.sol",
"contracts/test/Multicall.sol"
]
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require("@nomicfoundation/hardhat-foundry");
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@compound-finance/hardhat-match";
Expand Down
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at 1714be
Loading
Loading