diff --git a/.github/workflows/test-fuzz.yml b/.github/workflows/test-fuzz.yml index 7fabee4..a0fd3eb 100644 --- a/.github/workflows/test-fuzz.yml +++ b/.github/workflows/test-fuzz.yml @@ -20,12 +20,6 @@ # - name: Install Foundry # uses: foundry-rs/foundry-toolchain@v1 # -# - name: Run Forge build -# run: | -# forge --version -# make sizes -# id: build -# # - name: Run Forge fuzz tests # run: make fuzz profile=ci # env: diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 2e9d35b..9ec9187 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -20,12 +20,6 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 - - name: Run Forge build - run: | - forge --version - make sizes - id: build - - name: Run Forge integration tests env: MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} diff --git a/.github/workflows/test-invariant.yml b/.github/workflows/test-invariant.yml index 90c92b5..377dc00 100644 --- a/.github/workflows/test-invariant.yml +++ b/.github/workflows/test-invariant.yml @@ -20,12 +20,6 @@ # - name: Install Foundry # uses: foundry-rs/foundry-toolchain@v1 # -# - name: Run Forge build -# run: | -# forge --version -# make sizes -# id: build -# # - name: Run Forge invariant tests # run: make invariant profile=ci # env: diff --git a/.github/workflows/test-sizes.yml b/.github/workflows/test-sizes.yml new file mode 100644 index 0000000..ae2d19f --- /dev/null +++ b/.github/workflows/test-sizes.yml @@ -0,0 +1,27 @@ +name: Forge Sizes Check + +on: + push: + branches: + - main + pull_request: + +permissions: write-all + +jobs: + check: + name: Sizes Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Run Forge build + run: | + forge --version + make sizes + id: build diff --git a/README.md b/README.md index d3e0b72..6acc681 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,13 @@ cp .env.example .env Run the following command to compile the contracts: ```bash -forge compile +npm run build +``` + +or + +```bash +make build ``` ### Coverage @@ -46,6 +52,12 @@ Forge is used for coverage, run it with: npm run coverage ``` +or + +```bash +make coverage +``` + You can then consult the report by opening `coverage/index.html`: ```bash @@ -57,19 +69,13 @@ open coverage/index.html To run all tests: ```bash -forge test -``` - -Run test that matches a test contract: - -```bash -forge test --mc +make tests ``` Test a specific test case: ```bash -forge test --mt +./test.sh -v -t ``` To run slither: diff --git a/build.sh b/build.sh index dee82ed..8eefe17 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,7 @@ export FOUNDRY_PROFILE=$profile echo Using profile: $FOUNDRY_PROFILE if [ "$sizes" = false ]; then - forge build --skip '*/test/**/*.t.sol' --skip '*/script/**' --skip '*/lib/forge-std/**' --extra-output-files abi + forge build --skip '*/test/**' --skip '*/script/**' --skip '*/lib/**' --extra-output-files abi else - forge build --skip '*/test/**/*.t.sol' --skip '*/script/**' --skip '*/lib/forge-std/**' --extra-output-files abi --sizes + forge build --skip '*/test/**' --skip '*/script/**' --skip '*/lib/**' --extra-output-files abi --sizes fi diff --git a/foundry.toml b/foundry.toml index e10f97f..016467e 100644 --- a/foundry.toml +++ b/foundry.toml @@ -2,8 +2,9 @@ gas_reports = ["*"] gas_reports_ignore = [] ignored_error_codes = [] -optimizer = false solc_version = "0.8.23" +optimizer = true +optimizer_runs = 999999 verbosity = 3 block_number = 20_270_778 block_timestamp = 1_720_550_400 @@ -12,8 +13,6 @@ rpc_storage_caching = { chains = ["mainnet"], endpoints = "all" } evm_version = "shanghai" [profile.production] -optimizer = true -optimizer_runs = 999999 build_info = true sizes = true @@ -25,10 +24,6 @@ runs = 512 # The number of calls to make in the invariant tests depth = 25 # The number of times to run the invariant tests fail_on_revert = true # Fail the test if the contract reverts -[profile.ci] -optimizer = true -optimizer_runs = 999999 - [profile.ci.fuzz] runs = 10_000