Skip to content

wip: fmt solar #10907

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

Draft
wants to merge 36 commits into
base: dani/fmt-solar
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
88d32ec
wip: try-catch
0xrusowsky Jun 18, 2025
aa1a0a5
wip: try-catch
0xrusowsky Jun 18, 2025
e945d91
feat: print compact tuple
0xrusowsky Jun 18, 2025
0189490
wip: inline comments
0xrusowsky Jun 18, 2025
3bde150
wip: try-cactch
0xrusowsky Jun 19, 2025
bc59dc5
bump solar to have try-catch spans (#10832)
0xrusowsky Jun 22, 2025
6f86df2
wip comment fmt
0xrusowsky Jun 23, 2025
43e1fc2
wip: array expr
0xrusowsky Jun 23, 2025
9694fa1
finish arrays
0xrusowsky Jun 23, 2025
2322863
block comments
0xrusowsky Jun 23, 2025
e174b3c
doc block comments
0xrusowsky Jun 23, 2025
20d91e2
ternary operators
0xrusowsky Jun 24, 2025
361db14
wip: fn header
0xrusowsky Jun 27, 2025
e2a4055
wip: fn header
0xrusowsky Jun 27, 2025
38f6f7c
fix: doc block comments + block braces
0xrusowsky Jul 1, 2025
6d178bb
refactor state to organize helpers
0xrusowsky Jul 2, 2025
66f9c6c
fix commasep with initial trailing cmnt
0xrusowsky Jul 2, 2025
7ba3c5f
fix: improve contract fmt
0xrusowsky Jul 3, 2025
729e250
fix: block comments + contract definition
0xrusowsky Jul 3, 2025
3c518a1
fix: wrap trailing comments
0xrusowsky Jul 3, 2025
d4c9403
fix fn alingment
0xrusowsky Jul 3, 2025
b06a67b
fix: rmv unecessary check
0xrusowsky Jul 3, 2025
c156ebf
working fn headers!!!
0xrusowsky Jul 4, 2025
a6afa14
block with comments at the beginning
0xrusowsky Jul 4, 2025
16aa884
bump solar
0xrusowsky Jul 6, 2025
a7382ef
inline if statements based on user config
0xrusowsky Jul 11, 2025
3162a89
operator expr
0xrusowsky Jul 13, 2025
5c2e8d6
finish binary operators + housekeeping
0xrusowsky Jul 14, 2025
3105192
housekeeping
0xrusowsky Jul 14, 2025
09dc9ff
feat: binary expressions
0xrusowsky Jul 15, 2025
57aff04
fix: string literals
0xrusowsky Jul 15, 2025
3b0a10f
refactor comments + finish mappings
0xrusowsky Jul 16, 2025
81d1867
named functions
0xrusowsky Jul 16, 2025
c617d1b
item spacing
0xrusowsky Jul 17, 2025
fc5ae7f
more flexible comments + return stmts
0xrusowsky Jul 17, 2025
0af1bd6
var definition and flexible comments (#11093)
0xrusowsky Jul 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
chisel-serial = { max-threads = 1 }

[profile.default]
retries = { backoff = "exponential", count = 2, delay = "3s", jitter = true }
retries = { backoff = "exponential", count = 2, delay = "5s", jitter = true }
slow-timeout = { period = "1m", terminate-after = 3 }

[[profile.default.overrides]]
Expand Down
84 changes: 84 additions & 0 deletions .devcontainer/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
FROM ubuntu:22.04

ARG USERNAME=foundry
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG PYTHON_VERSION=3.11
ARG NODE_MAJOR=20
ARG VYPER_VERSION=0.4.0

ENV DEBIAN_FRONTEND=noninteractive
ENV CARGO_TERM_COLOR=always \
RUST_BACKTRACE=full

WORKDIR /workspace

RUN apt-get update && apt-get install -y --no-install-recommends \
# Build tools
build-essential \
clang \
lld \
pkg-config \
# Network/SSL
curl \
ca-certificates \
gnupg \
libssl-dev \
# Version control & utils
git \
sudo \
unzip \
# Python
python${PYTHON_VERSION} \
python3-pip \
python${PYTHON_VERSION}-venv \
# Add Node.js repo
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& 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 \
# Update again after adding repo and install Node.js
&& apt-get update && apt-get install -y --no-install-recommends \
nodejs \
# Clean up apt cache
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Ensure python points to the installed python version
RUN ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python3

# Create non-root user with sudo privileges
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \
# Setup sudo without password prompt
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
# Add user to the sudo group (standard practice)
&& usermod -aG sudo $USERNAME

# Switch to the non-root user
USER $USERNAME
WORKDIR /home/$USERNAME

# --- User-specific installations ---

# Install Bun
ENV BUN_INSTALL="/home/$USERNAME/.bun"
ENV PATH="$BUN_INSTALL/bin:$PATH"
RUN curl -fsSL https://bun.sh/install | bash

# Install Rust & cargo-nextest
ENV CARGO_HOME="/home/$USERNAME/.cargo"
ENV RUSTUP_HOME="/home/$USERNAME/.rustup"
ENV PATH="$CARGO_HOME/bin:$PATH"
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& cargo install cargo-nextest --locked

# Install Vyper using pip
# Ensure pip user install directory is in PATH
ENV PYTHONUSERBASE="/home/$USERNAME/.local"
ENV PATH="$PYTHONUSERBASE/bin:$PATH"
RUN pip3 install --user vyper==${VYPER_VERSION}

# Switch back to the main workspace directory
WORKDIR /workspace

49 changes: 49 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Foundry Development",
"build": {
"context": "..",
"dockerfile": "Dockerfile.dev"
},

"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": true,
"configureZshAsDefaultShell": true,
"installOhMyZsh": true,
"upgradePackages": true
}
},

"forwardPorts": [],

"postCreateCommand": "rustup default stable && rustup update",

"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"serayuzgur.crates",
"tamasfe.even-better-toml",
"ms-python.python",
"dbaeumer.vscode-eslint",
"oven.bun-vscode"
],
"settings": {
"rust-analyzer.checkOnSave": true,
"rust-analyzer.cargo.features": "all"
}
}
},

"remoteUser": "foundry",

"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",

"workspaceFolder": "/workspace",

"mounts": [
"source=${localEnv:HOME}/.cargo/registry,target=/home/foundry/.cargo/registry,type=bind,consistency=cached",
"source=${localEnv:HOME}/.cargo/git,target=/home/foundry/.cargo/git,type=bind,consistency=cached"
]
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ testdata/cheats/Vm.sol linguist-generated

# See <https://git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header>
*.rs diff=rust
crates/lint/testdata/* text eol=lf
5 changes: 4 additions & 1 deletion .github/workflows/nextest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- uses: taiki-e/install-action@nextest
- uses: taiki-e/install-action@v2
with:
tool: [email protected]

# External tests dependencies
- name: Setup Node.js
Expand All @@ -72,6 +74,7 @@ jobs:
with:
python-version: 3.11
- name: Install Vyper
# Also update vyper version in .devcontainer/Dockerfile.dev
run: pip --version && pip install vyper==0.4.0

- name: Forge RPC cache
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: nix

on:
schedule:
# Run weekly
- cron: "0 0 * * SUN"
workflow_dispatch:
# Needed so we can run it manually

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# Opens a PR with an updated flake.lock file
update:
runs-on: ubuntu-latest
steps:
- uses: DeterminateSystems/determinate-nix-action@v3
- uses: actions/checkout@v4
- uses: DeterminateSystems/update-flake-lock@main
with:
pr-title: "Update flake.lock"
pr-labels: |
L-ignore
A-dependencies

build:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: DeterminateSystems/determinate-nix-action@v3
- uses: actions/checkout@v4

- name: Update flake.lock
run: nix flake update

- name: Activate nix env
run: nix develop -c echo Ok

- name: Check that we can compile all crates
run: nix develop -c cargo check --all-targets
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
CARGO_TERM_COLOR: always
IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
PROFILE: maxperf
STABLE_VERSION: "v1.0.0"
STABLE_VERSION: "v1.1.0"

jobs:
prepare:
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:

# Creates the release for this specific version
- name: Create release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v2.2.2
with:
name: ${{ needs.prepare.outputs.release_name }}
tag_name: ${{ needs.prepare.outputs.tag_name }}
Expand All @@ -254,7 +254,7 @@ jobs:
# tagged `nightly` for compatibility with `foundryup`
- name: Update nightly release
if: ${{ env.IS_NIGHTLY == 'true' }}
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v2.2.2
with:
name: "Nightly"
tag_name: "nightly"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo hack check --each-feature --exclude-features isolate-by-default
- run: cargo hack check

deny:
uses: ithacaxyz/ci/.github/workflows/deny.yml@main
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ snapshots/
out.json
.idea
.vscode
.claude
CLAUDE.md
37 changes: 0 additions & 37 deletions CHANGELOG.md

This file was deleted.

29 changes: 18 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ elsewhere.

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

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

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

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

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

In order to rule out the possibility of the bug being in your project, the code snippets should be as minimal
as possible. It is better if you can reproduce the bug with a small snippet as opposed to an entire project!
Expand Down Expand Up @@ -86,7 +86,14 @@ Please also make sure that the following commands pass if you have changed the c
cargo check --all
cargo test --all --all-features
cargo +nightly fmt -- --check
cargo +nightly clippy --all --all-targets --all-features -- -D warnings
cargo +nightly clippy --all --all-targets --all-features -- -D warning
```

or alternatively:

```sh
make build
make pr
```

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:
Expand All @@ -103,7 +110,7 @@ If you are working on a larger feature, we encourage you to open up a draft pull

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

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).
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).

#### Adding tests

Expand All @@ -113,9 +120,9 @@ in the future.

Types of tests include:

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

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

Expand Down
Loading
Loading