Skip to content

Commit f2b2f3b

Browse files
authored
Merge branch 'master' into yash/fix-forge-update
2 parents 98223b0 + db0ce45 commit f2b2f3b

File tree

335 files changed

+12476
-6360
lines changed

Some content is hidden

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

335 files changed

+12476
-6360
lines changed

.config/nextest.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
[test-groups]
2+
chisel-serial = { max-threads = 1 }
3+
14
[profile.default]
2-
retries = { backoff = "exponential", count = 2, delay = "3s", jitter = true }
5+
retries = { backoff = "exponential", count = 2, delay = "5s", jitter = true }
36
slow-timeout = { period = "1m", terminate-after = 3 }
47

58
[[profile.default.overrides]]
@@ -9,3 +12,7 @@ slow-timeout = { period = "5m", terminate-after = 4 }
912
[[profile.default.overrides]]
1013
filter = "package(foundry-cheatcodes-spec)"
1114
retries = 0
15+
16+
[[profile.default.overrides]]
17+
filter = "package(chisel)"
18+
test-group = "chisel-serial"

.devcontainer/Dockerfile.dev

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
FROM ubuntu:22.04
2+
3+
ARG USERNAME=foundry
4+
ARG USER_UID=1000
5+
ARG USER_GID=$USER_UID
6+
ARG PYTHON_VERSION=3.11
7+
ARG NODE_MAJOR=20
8+
ARG VYPER_VERSION=0.4.0
9+
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
ENV CARGO_TERM_COLOR=always \
12+
RUST_BACKTRACE=full
13+
14+
WORKDIR /workspace
15+
16+
RUN apt-get update && apt-get install -y --no-install-recommends \
17+
# Build tools
18+
build-essential \
19+
clang \
20+
lld \
21+
pkg-config \
22+
# Network/SSL
23+
curl \
24+
ca-certificates \
25+
gnupg \
26+
libssl-dev \
27+
# Version control & utils
28+
git \
29+
sudo \
30+
unzip \
31+
# Python
32+
python${PYTHON_VERSION} \
33+
python3-pip \
34+
python${PYTHON_VERSION}-venv \
35+
# Add Node.js repo
36+
&& mkdir -p /etc/apt/keyrings \
37+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
38+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
39+
# Update again after adding repo and install Node.js
40+
&& apt-get update && apt-get install -y --no-install-recommends \
41+
nodejs \
42+
# Clean up apt cache
43+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
44+
45+
# Ensure python points to the installed python version
46+
RUN ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
47+
ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python3
48+
49+
# Create non-root user with sudo privileges
50+
RUN groupadd --gid $USER_GID $USERNAME \
51+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \
52+
# Setup sudo without password prompt
53+
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
54+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
55+
# Add user to the sudo group (standard practice)
56+
&& usermod -aG sudo $USERNAME
57+
58+
# Switch to the non-root user
59+
USER $USERNAME
60+
WORKDIR /home/$USERNAME
61+
62+
# --- User-specific installations ---
63+
64+
# Install Bun
65+
ENV BUN_INSTALL="/home/$USERNAME/.bun"
66+
ENV PATH="$BUN_INSTALL/bin:$PATH"
67+
RUN curl -fsSL https://bun.sh/install | bash
68+
69+
# Install Rust & cargo-nextest
70+
ENV CARGO_HOME="/home/$USERNAME/.cargo"
71+
ENV RUSTUP_HOME="/home/$USERNAME/.rustup"
72+
ENV PATH="$CARGO_HOME/bin:$PATH"
73+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
74+
&& cargo install cargo-nextest --locked
75+
76+
# Install Vyper using pip
77+
# Ensure pip user install directory is in PATH
78+
ENV PYTHONUSERBASE="/home/$USERNAME/.local"
79+
ENV PATH="$PYTHONUSERBASE/bin:$PATH"
80+
RUN pip3 install --user vyper==${VYPER_VERSION}
81+
82+
# Switch back to the main workspace directory
83+
WORKDIR /workspace
84+

.devcontainer/devcontainer.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// For format details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "Foundry Development",
4+
"build": {
5+
"context": "..",
6+
"dockerfile": "Dockerfile.dev"
7+
},
8+
9+
"features": {
10+
"ghcr.io/devcontainers/features/common-utils:2": {
11+
"installZsh": true,
12+
"configureZshAsDefaultShell": true,
13+
"installOhMyZsh": true,
14+
"upgradePackages": true
15+
}
16+
},
17+
18+
"forwardPorts": [],
19+
20+
"postCreateCommand": "rustup default stable && rustup update",
21+
22+
"customizations": {
23+
"vscode": {
24+
"extensions": [
25+
"rust-lang.rust-analyzer",
26+
"serayuzgur.crates",
27+
"tamasfe.even-better-toml",
28+
"ms-python.python",
29+
"dbaeumer.vscode-eslint",
30+
"oven.bun-vscode"
31+
],
32+
"settings": {
33+
"rust-analyzer.checkOnSave": true,
34+
"rust-analyzer.cargo.features": "all"
35+
}
36+
}
37+
},
38+
39+
"remoteUser": "foundry",
40+
41+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
42+
43+
"workspaceFolder": "/workspace",
44+
45+
"mounts": [
46+
"source=${localEnv:HOME}/.cargo/registry,target=/home/foundry/.cargo/registry,type=bind,consistency=cached",
47+
"source=${localEnv:HOME}/.cargo/git,target=/home/foundry/.cargo/git,type=bind,consistency=cached"
48+
]
49+
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ testdata/cheats/Vm.sol linguist-generated
33

44
# See <https://git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header>
55
*.rs diff=rust
6+
crates/lint/testdata/* text eol=lf

.github/workflows/nextest.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ jobs:
7272
with:
7373
python-version: 3.11
7474
- name: Install Vyper
75+
# Also update vyper version in .devcontainer/Dockerfile.dev
7576
run: pip --version && pip install vyper==0.4.0
7677

7778
- name: Forge RPC cache
78-
uses: actions/cache@v3
79+
uses: actions/cache@v4
7980
with:
8081
path: |
8182
~/.foundry/cache

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
CARGO_TERM_COLOR: always
1616
IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
1717
PROFILE: maxperf
18-
STABLE_VERSION: "v1.0.0"
18+
STABLE_VERSION: "v1.1.0"
1919

2020
jobs:
2121
prepare:
@@ -159,7 +159,7 @@ jobs:
159159
run: |
160160
set -eo pipefail
161161
flags=(--target $TARGET --profile $PROFILE --bins
162-
--no-default-features --features aws-kms,cli,asm-keccak)
162+
--no-default-features --features aws-kms,gcp-kms,cli,asm-keccak)
163163
164164
# `jemalloc` is not fully supported on MSVC or aarch64 Linux.
165165
if [[ "$TARGET" != *msvc* && "$TARGET" != "aarch64-unknown-linux-gnu" ]]; then
@@ -293,7 +293,7 @@ jobs:
293293
issue:
294294
name: Open an issue
295295
runs-on: ubuntu-latest
296-
needs: [ prepare, release-docker, release, cleanup ]
296+
needs: [prepare, release-docker, release, cleanup]
297297
if: failure()
298298
steps:
299299
- uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ elsewhere.
4040

4141
If you have reviewed existing documentation and still have questions, or you are having problems, you can get help in the following ways:
4242

43-
- **Asking in the support Telegram:** The [Foundry Support Telegram][support-tg] is a fast and easy way to ask questions.
44-
- **Opening a discussion:** This repository comes with a discussions board where you can also ask for help. Click the "Discussions" tab at the top.
43+
- **Asking in the support Telegram:** The [Foundry Support Telegram][support-tg] is a fast and easy way to ask questions.
44+
- **Opening a discussion:** This repository comes with a discussions board where you can also ask for help. Click the "Discussions" tab at the top.
4545

4646
As Foundry is still in heavy development, the documentation can be a bit scattered.
4747
The [Foundry Book][foundry-book] is our current best-effort attempt at keeping up-to-date information.
@@ -54,10 +54,10 @@ If you believe that you have uncovered a bug, please fill out the form to the be
5454

5555
The most important pieces of information we need in a bug report are:
5656

57-
- The Foundry version you are on (and that it is up to date)
58-
- The platform you are on (Windows, macOS, an M1 Mac or Linux)
59-
- Code snippets if this is happening in relation to testing or building code
60-
- Concrete steps to reproduce the bug
57+
- The Foundry version you are on (and that it is up to date)
58+
- The platform you are on (Windows, macOS or Linux)
59+
- Code snippets if this is happening in relation to testing or building code
60+
- Concrete steps to reproduce the bug
6161

6262
In order to rule out the possibility of the bug being in your project, the code snippets should be as minimal
6363
as possible. It is better if you can reproduce the bug with a small snippet as opposed to an entire project!
@@ -86,7 +86,14 @@ Please also make sure that the following commands pass if you have changed the c
8686
cargo check --all
8787
cargo test --all --all-features
8888
cargo +nightly fmt -- --check
89-
cargo +nightly clippy --all --all-targets --all-features -- -D warnings
89+
cargo +nightly clippy --all --all-targets --all-features -- -D warning
90+
```
91+
92+
or alternatively:
93+
94+
```sh
95+
make build
96+
make pr
9097
```
9198

9299
If you are working in VSCode, we recommend you install the [rust-analyzer](https://rust-analyzer.github.io/) extension, and use the following VSCode user settings:
@@ -103,7 +110,7 @@ If you are working on a larger feature, we encourage you to open up a draft pull
103110

104111
If you would like to test the binaries built from your change, see [foundryup](https://github.com/foundry-rs/foundry/tree/master/foundryup).
105112

106-
If you would like to use a debugger with breakpoints to debug a patch you might be working on, keep in mind we currently strip debug info for faster builds, which is *not* the default. Therefore, to use a debugger, you need to enable it on the workspace [`Cargo.toml`'s `dev` profile](https://github.com/foundry-rs/foundry/tree/master/Cargo.toml#L15-L18).
113+
If you would like to use a debugger with breakpoints to debug a patch you might be working on, keep in mind we currently strip debug info for faster builds, which is _not_ the default. Therefore, to use a debugger, you need to enable it on the workspace [`Cargo.toml`'s `dev` profile](https://github.com/foundry-rs/foundry/tree/master/Cargo.toml#L15-L18).
107114

108115
#### Adding tests
109116

@@ -113,9 +120,9 @@ in the future.
113120

114121
Types of tests include:
115122

116-
- **Unit tests**: Functions which have very specific tasks should be unit tested.
117-
- **Integration tests**: For general purpose, far reaching functionality, integration tests should be added.
118-
The best way to add a new integration test is to look at existing ones and follow the style.
123+
- **Unit tests**: Functions which have very specific tasks should be unit tested.
124+
- **Integration tests**: For general purpose, far reaching functionality, integration tests should be added.
125+
The best way to add a new integration test is to look at existing ones and follow the style.
119126

120127
Tests that use forking must contain "fork" in their name.
121128

0 commit comments

Comments
 (0)