From 5aa3e86639d0e867fdb01e13a0fefe933b125e4d Mon Sep 17 00:00:00 2001 From: igorroncevic <57319163+igorroncevic@users.noreply.github.com> Date: Wed, 6 May 2026 15:34:20 +0200 Subject: [PATCH] chore: update minimal foundry config --- README.md | 31 +++++++++++++++++-------------- foundry.toml | 7 +++++-- script/Counter.s.sol | 2 +- src/Counter.sol | 2 +- test/Counter.t.sol | 2 +- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 72ce9fd..488136d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ This project is meant to be used as a templated during the creation of new Githu It will contain some useful configuration files and scripts, that can be used also with existing projects (manually copied). - ## Usage ### Build @@ -15,6 +14,10 @@ It will contain some useful configuration files and scripts, that can be used al forge build ``` +Project contracts should keep simple caret pragmas like `^0.8` so downstream projects can import them with older compatible Solidity 0.8 compilers. + +If specific features are needed (like PUSH0 in 0.8.20 for gas optimizations or transient storage/better `via-ir` in 0.8.34), you can use it but make sure to keep the caret (`^`). + ### Test ```shell @@ -44,18 +47,18 @@ forge script script/Counter.s.sol:CounterScript --rpc-url --priva The following operations need to be performed after this repository has been created. - [ ] In GitHub repo settings: - - [ ] Add a new ruleset called "Protected branches" and include the following changes: - - Enforcement status: active - - Target branches: Include default branch - - Require linear history - - Require a pull request before merging - - Required approvals: 1 - - Allowed merge methods: Squash - - Block force pushes - - [ ] In General → Features → Pull requests: - - Select "Pull request title and description" in "Default commit message" option - - Unckeck "Allow merge commits" option - - Check "Allow auto-merge" option + - [ ] Add a new ruleset called "Protected branches" and include the following changes: + - Enforcement status: active + - Target branches: Include default branch + - Require linear history + - Require a pull request before merging + - Required approvals: 1 + - Allowed merge methods: Squash + - Block force pushes + - [ ] In General → Features → Pull requests: + - Select "Pull request title and description" in "Default commit message" option + - Unckeck "Allow merge commits" option + - Check "Allow auto-merge" option - [ ] Run `forge install` to install the dependencies. This will create a new `foundry.lock` file which you should commit to the project - [ ] Make sure you use the [latest version of Solidity](https://github.com/argotorg/solidity/releases) by updating the `solc` version in `foundry.toml` -- [ ] Once all entries in this list are checked, delete this section from the readme \ No newline at end of file +- [ ] Once all entries in this list are checked, delete this section from the readme diff --git a/foundry.toml b/foundry.toml index 751f7be..1a8cbfc 100644 --- a/foundry.toml +++ b/foundry.toml @@ -2,11 +2,14 @@ src = "src" out = "out" libs = ["lib"] -solc = "0.8.33" # See latest release at: https://github.com/argotorg/solidity/releases +solc = "0.8.34" # See latest release at: https://github.com/argotorg/solidity/releases [fmt] sort_imports = true +number_underscore = "thousands" [profile.ci] deny = "warnings" # Why not always: sometimes you just want to code and see what comes out -fuzz.seed = '0' # It makes CI reproducible, but still on a local machine it tries different parameters and so we can see edge cases if needed. +verbosity = 3 # Outputs stack traces for failed tests. +fuzz.seed = "0" +fuzz.runs = 10_000 diff --git a/script/Counter.s.sol b/script/Counter.s.sol index 3983ed4..7c3df20 100644 --- a/script/Counter.s.sol +++ b/script/Counter.s.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; +pragma solidity ^0.8; import {Counter} from "../src/Counter.sol"; import {Script} from "forge-std/Script.sol"; diff --git a/src/Counter.sol b/src/Counter.sol index aded799..28ed0cd 100644 --- a/src/Counter.sol +++ b/src/Counter.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; +pragma solidity ^0.8; contract Counter { uint256 public number; diff --git a/test/Counter.t.sol b/test/Counter.t.sol index 8e2817e..573539e 100644 --- a/test/Counter.t.sol +++ b/test/Counter.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; +pragma solidity ^0.8; import {Counter} from "../src/Counter.sol"; import {Test} from "forge-std/Test.sol";