Commit Graph

23 Commits

Author SHA1 Message Date
DaniPopes
14f8704c13 chore(meta): update .gitignore (#12975) 2026-01-02 09:36:47 +00:00
DaniPopes
8625e9fcf3 chore(meta): update .gitignore (#11941) 2025-10-03 05:41:54 +02:00
0xrusowsky
9d38af931b feat(fmt): rewrite formatter using Solar and a structured algorithm (#10907)
* init

* wip

* wip

* add dbg from prettyplease

* wip

* fixes, pragma&imports

* feat: using, types, literals

* feat: contract

* rm duplicate testdata

* wip: finish items; exprs, stmts

* wips

* feat: line_length, tab_width

* feat: contract_new_lines

* wip: single_line_statement_blocks

* tweaks

* chore: bump solar to latest main

* fix: test dir

* bump

* fix docs

* fix: adjust '()' for modifier calls

* test: typed yul does not exist anymore

https://github.com/ethereum/solidity/pull/15329

* test: function parameters cannot be empty

* fix: adjust '()' for modifier calls for real

* fix: forge fmt hates '*' imports

* test: fix some invalid syntax

* test: disable-stop does not exist

* test: fix all parse errors

* fix: literal touchups

* bump

* test: add snapshotting

* test: update NumberLiteralUnderscore

* fixes

* struct space

* test: fix StructDefinition; empty structs are not allowed anyway

* test: update EventDefinition; matches Solidity style guide

* test: update EnumDefinition; same as StructDefinition

* test: update StructDefinition 2

* fix: comments in structs/enums

* test: update ErrorDefinition; matches Solidity style guide

* feat: print docs with other comments; update EnumVariants

* chore: update EnumDefinition, StructDefinition

* chore: readd post_break

* chore: rename is_hardbreak_tok

* feat: cleanups, more impls

* test: fix some compile errors

* feat: add FormatterResult with more variants

* stuff

* refactor: move print_item arms into their own functions

* chore: consolidate item hardbreaks

* fix: inline config parsing for block comments

* wip: rm FunctionLike, wip functions

* fix: clamp margin to max as well

* megawip

* feat: most of yul

* wip: try-catch

* wip: try-catch

* feat: print compact tuple

* wip: inline comments

* wip: try-cactch

* bump solar to have try-catch spans (#10832)

* wip comment fmt

* wip: array expr

* finish arrays

* block comments

* doc block comments

* ternary operators

* wip: fn header

* wip: fn header

* fix: doc block comments + block braces

* refactor state to organize helpers

* fix commasep with initial trailing cmnt

* fix: improve contract fmt

* fix: block comments + contract definition

* fix: wrap trailing comments

* fix fn alingment

* fix: rmv unecessary check

* working fn headers!!!

* block with comments at the beginning

* bump solar

* inline if statements based on user config

* operator expr

* finish binary operators + housekeeping

* housekeeping

* feat: binary expressions

* fix: string literals

* refactor comments + finish mappings

* named functions

* item spacing

* more flexible comments + return stmts

* var definition and flexible comments (#11093)

* comment wrapping

* sorted imports

* middle cmnts for arrays and literals with subdenominations

* revert: solar won't have spanned dataloc + subdenom

* refactor inline config + almost finished impl

* finish inline disable

* finish inline disable

* wip inline disable for repros

* passing repros

* almost working yul

* chore: remove unrelated changes / merge artifacts

* chore: remove unrelated changes / merge artifacts 2

* chore: remove unrelated changes / merge artifacts 3

* update fmt files to reflect current status

* enable both passes

* undo repros changes

* config: style = tabs

* test: inline config

* style: drop "lint" references in favor of "ids"

* function header config

* finish fn header config!

* re-enable 2nd pass

* finish fn header style

* feat: yul

* test: update tracking cmnts

* fix: yul repros

* chore: small comment

* chore: random + typos

* chore: rm dead code

* chore: rm unused vars

* chore: clippy --fix

* chore: some manual clippying

* chore: final clippy --fix

* refactor: tidy up

* yul: inline blocks

* yul: inline fn params

* ensure all tests are successful

* chore(fmt): merge new compiler setup (#11487)

* patch/impl/test pending repros

* style: typos

* docs: update readme

* docs: readme feedback

* style: clippy

* fix: merge conflicts

* fix: disable legacy fmt tests

* fix: config test

* fix(win): normalize breaks

* style: clippy

* fix(win): normalize escaped quotes

* fix(win): normalize multiline strings

* fix(win): only normalize line breaks for expected data

* chore: solar-powered fmt rollout (#11570)

* fix: comment spans for asm + try blocks

* fix: don't fmt yul addresses

* fix: empty buffer due to really long comment

* add repro

* Revert "fix: empty buffer due to really long comment"

This reverts commit f6768b43d2.

* fix: advance cursor correctly in print_comment

* fix: bin op indentation in complex exprs

* docs

Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>

* chore: clean up

* refactor: inline config

* chore: share inline config

* feat: remove HIR inline config visitor

* test: bless

* style: clippy

* feat(fmt): call chain awareness (#11611)

* wip: better call chains + return stmts + more tests

* fix: more yul cmnts

* fix: modifier cmnts + more yul cmnts

* fix: returns with bin ops

* fix breaks, still pending indentation

* wip: call cahins and nested... getting closer

* call stack to fmt complex calls

* fix: more yul cmnts

* Fix config test, typos

* wip

* fix: new call alignement cases

* Fix tests

* fix: return + bin ops + calls

* style: clippy

* feat: wrap long comments and merge with next line

* fix: stale test

* style: rmv comments

* fmt nits (#11750)

* nits

* Try no format

* chore: simplify call logic

* fix: reenable 2nd pass

* chore: cleanup

* docs: solar cmnt

* format testdata with new style

* fix: extra space in function type

* Readd relevant todo

* style: use span builder methods

* Review changes

* fix: remove outdated cmnt

* fix: test spacing

* Revert "fix: test spacing"

This reverts commit 541f4c8f20.

---------

Co-authored-by: 0xrusowsky <0xrusowsky@proton.me>

---------

Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Co-authored-by: grandizzy <38490174+grandizzy@users.noreply.github.com>
Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
2025-09-24 17:07:34 +03:00
DaniPopes
a1da952eba chore(lint): re-use project output (#11563)
* chore(lint): re-use project output

* patch

* upd

* fix: lower

* update, bless, fix tests to compile with solc

* pragma

* blessings

* j1

* bump

* bless

* bless

* hide
2025-09-12 02:55:08 +02:00
o-az
592d09d5c5 feat(npm): publish forge to npm for each arch (#11047)
* feat(npm): publish forge to npmjs.com

* chore: make names similar to github release

* chore: fmt

* cleanup

* up deps

* chore(npm): fix windows and update deps

* chore(npm): rm unused file

* chore(npm): more specific home pages

* chore: pull out npm publish

* chore: complete vardaccio script

* chore: rename publish to npm

* chore: disable workflow_run temporarily

* chore: comment out workflow_run deps
2025-08-30 22:00:31 +03:00
o-az
ca9f420144 feat(fmt): dprint for toml, json, md, dockerfile, ts, & yml (#10824)
* feat(fmt): dprint for toml, json, md, dockerfile, ts, & yml

* chore: fmt
2025-06-21 18:26:48 +02:00
Yash Atreya
df0ec82f48 chore: gitignore CLAUDE instructions and settings (#10750)
* chore: gitignore CLAUDE instructions and settings

* fix
2025-06-10 15:34:25 +00:00
DaniPopes
ba505dfabc chore: use "full" for debug (#9670) 2025-01-13 09:35:24 +00:00
zerosnacks
08a6409ab7 feat: gas snapshots over arbitrary sections (#8952)
* update internal naming

* further internals

* deprecate cheats

* update Solidity tests and add dedicated test for testing deprecated cheatcodes

* clarify gas snapshots

* fix build

* final fixes

* fix build

* fix repro 6355 rename

* add gas snapshot setup from #8755

* fix build + clippy warnings

* fix cheatcodes

* account for fixed CREATE / CALL gas cost

* remove import

* add stipend

* recalculate after a - b setup

* clear call_stipend, update tests

* avoid double counting external calls

* update cheatcodes, remove debug prints

* enable assertions

* clean up tests

* clean up test names

* remove snapshot directory on `forge clean`

* do not remove all snapshots by default due to multiple test suites being able to be ran concurrently or sequentially + optimize gas snapshots check - skip if none were captured

* handle edge case where we ask to compare but file does not exist, remove snapshot directory at a top level before test suites are ran

* fix path issue when attempting removal

* Update crates/cheatcodes/src/evm.rs

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>

* Update crates/cheatcodes/src/inspector.rs

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>

* refactor, apply recommended changes for last_snapshot_group, last_snapshot_name

* remove gas snapshots from fuzz tests for now: this is largely due to it conflicting with the FORGE_SNAPSHOT_CHECK where it is highly likely that with different fuzzed input the gas measurement differs as well. In the future it would be an idea to capture the average gas

* fix clippy

* avoid setting to 0 unnecessarily

* use if let Some

* improve comments, clarify use of last_gas_used != 0

* fix merge conflict issue

* fix arg ordering to address group naming regression

* fix import

* move snapshot name derivation to helper

* only skip initial call w/ overhead, no special handling for call frames

* add flare test

* style nits + use helper method

---------

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
2024-10-02 14:29:15 +02:00
DaniPopes
3202223836 chore: add more size optimizations (#8847) 2024-09-12 07:34:28 +02:00
DaniPopes
7545c7a285 chore(deps): bump all dependencies, revm 7 (#7365)
* chore(deps): bump revm to 7.1

* chore: general cargo update

```text
    Updating crates.io index
    Updating git repository `https://github.com/alloy-rs/alloy`
    Updating git repository `https://github.com/paradigmxyz/evm-inspectors`
    Updating ahash v0.8.10 -> v0.8.11
    Updating bumpalo v3.15.3 -> v3.15.4
    Updating cc v1.0.88 -> v1.0.90
      Adding cfg_aliases v0.1.1 (latest: v0.2.0)
    Updating chrono v0.4.34 -> v0.4.35
    Updating clap v4.5.1 -> v4.5.2
    Updating clap_builder v4.5.1 -> v4.5.2
    Updating const-hex v1.11.1 -> v1.11.2
    Updating ctrlc v3.4.2 -> v3.4.4
    Updating enr v0.10.0 -> v0.10.1
    Updating env_logger v0.11.2 -> v0.11.3
    Updating foundry-compilers v0.3.9 -> v0.3.10
    Updating http v0.2.11 -> v0.2.12 (latest: v1.1.0)
      Adding jobserver v0.1.28
    Updating js-sys v0.3.68 -> v0.3.69
    Updating nix v0.27.1 -> v0.28.0
    Updating pin-project v1.1.4 -> v1.1.5
    Updating pin-project-internal v1.1.4 -> v1.1.5
      Adding proc-macro-crate v3.1.0
    Updating regex-automata v0.4.5 -> v0.4.6
    Updating reqwest v0.11.24 -> v0.11.25
    Updating serde_path_to_error v0.1.15 -> v0.1.16
    Updating strum v0.26.1 -> v0.26.2
    Updating strum_macros v0.26.1 -> v0.26.2
    Updating system-configuration v0.5.1 -> v0.6.0
    Updating system-configuration-sys v0.5.0 -> v0.6.0
    Updating wasm-bindgen v0.2.91 -> v0.2.92
    Updating wasm-bindgen-backend v0.2.91 -> v0.2.92
    Updating wasm-bindgen-futures v0.4.41 -> v0.4.42
    Updating wasm-bindgen-macro v0.2.91 -> v0.2.92
    Updating wasm-bindgen-macro-support v0.2.91 -> v0.2.92
    Updating wasm-bindgen-shared v0.2.91 -> v0.2.92
    Updating web-sys v0.3.68 -> v0.3.69
    Updating yansi v1.0.0-rc.1 -> v1.0.0
```

* chore: chrono deprecation

* chore: no default features
2024-03-11 19:11:02 +01:00
Wodann
c06b53287d feat: add serde feature flag to anvil-core (#3603)
* feat: add serde feature flag to anvil-core

* chore: rustfmt

* meta: move serde to default

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-11-04 19:27:23 +01:00
DaniPopes
860d083183 fmt: all (#3398)
* fmt: all

* fmt: rest

* fmt: missing
2022-09-28 18:28:26 +02:00
Shawn Harmsen
c344386ffa replace dapphub/ds-test with forge-std (#1409)
* update forge init default library

* update forge init default library

* update tests

* update more tests in lib.rs

* revert lib.rs

* update tests for forge-std

* can_init_vscode test first

* loaded config has resolved, absolute paths

* remappings work from file

* env vars work from-env

* revert from-env, from-file, absolute paths

* can_override_config tests
2022-04-26 07:42:53 -07:00
Alexey Shekhirin
d1a9a3dc9f test(fmt): introduce our own test cases (#1341)
* test(fmt): introduce our own test cases

* use new testing approach in StatementBlock and StructDefinition
2022-04-18 11:36:30 +02:00
Alexey Shekhirin
ff4ec0fee1 feat: solidity formatter MVP (#201)
* feat: add fmt pallet

* feat: add formatter skeleton

* feat(fmt): Visitable for source & contract parts

* dyn -> impl, contract & enum impls, tests

* add empty_brackets helper

* use indent_write, implement more visitors

* cleanup test_formatter helper

* better brackets helpers

* add multiline support and respect to line_length

* fix clippy

* remove itertools dep

* add llvm to ci tests

* add llvm to env var

* add llvm install and env var set to lint step

* respect basic style guide

* fix Cargo.lock

* use solang without LLVM

* update solang, remove LLVM from CI

* bump solang

* final solang bump

* add README.md, improve comments

* fix README.md

* test against prettier-plugin-solidity snapshots

* add submodules recursively in CI

* Revert "chore: remove integration tests (#196)"

This reverts commit bab7e2d672.

* add fmt testdata to Makefile

* run make fmt-testdata in CI

* cli & better formatting

* fix constructor function corner case

* use separate solang-parser crate

* add --check option

* bump solang, fix missing parts regarding source visiting

* bump solang, refactor blank lines formatting

* fix semver parsing (remove it lol)

* improve cli args

* parallel formatting w/ rayon, improve errors

* fix Makefile fmt-testdata dir structure

* fixes after matt's review

* good looking diffs on --check

* fix lint

* more default Visitor implementations

* bump solang, improve doc comments

* fix clippy

Signed-off-by: Alexey Shekhirin <a.shekhirin@gmail.com>

* bump solang

Signed-off-by: Alexey Shekhirin <a.shekhirin@gmail.com>

* comment out fmt from cli

* support error definitions & fix clippy

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-02-15 01:13:35 +02:00
Bjerg
cd92f69d0f Remove unused files (#602) 2022-01-27 12:36:17 +01:00
Rajiv Patel-O'Connor
a9d4bd2815 feat: add nonce to cast (#266)
* fix: do not track .DS_STORE

* feat: add nonce to cast

* chore: lint

* docs: add code doctest

* chore: Makefile commands for local development
2021-12-20 01:47:23 +02:00
Alexey Shekhirin
fdb5ad6f02 chore(ci): integration tests (#243)
* Revert "chore: remove integration tests (#196)"

This reverts commit bab7e2d672.

* add Makefile, prepare CI matrix dynamically

* fix set-matrix command

* add install libusb step in CI for integration tests

* clone testdata recursively

* update README.md and improve Makefile

* add missing depth and recursive git flags

* better Makefile formatting

* use u128 in fuzz/mean_gas

* use release build

* run e2e on master push only
2021-12-17 13:56:33 +02:00
Georgios Konstantopoulos
80bf88ed54 chore: add Cargo.lock 2021-09-13 23:19:57 +03:00
Georgios Konstantopoulos
3bfe28a9e4 feat: lib-path imports as a vec + document remappings/lib-paths 2021-09-13 03:17:41 +03:00
Georgios Konstantopoulos
df1b15fde3 refactor: move build opts to own struct 2021-09-13 02:05:06 +03:00
Georgios Konstantopoulos
f1d339a0f1 init cli 2021-09-10 01:49:03 +03:00