-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: don't request Solc JSON AST unless absolutely necessary #7197
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this affect the regular forge build artifacts?
we added metadata because this is apparently used by some tools
that's not part of metadata, so I think we can do that, but not entirely sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be fine with that.
we should check with slither first if they're relying on this in the artifacts file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some external tools rely on this, so i'd add a flag to forge build
to get this back
cc @0xalpharush for thoughts on how this affects slither |
Can we get a comparison for release mode compilation time improvements due to this on a large repo? e.g. Optimism contracts |
@gakonst It's 2-3% faster on clean builds, up to 2-3x for sablier/v2-core (absolute time save of about 2.5s for both). Note that time saved is proportional to amount of total artifacts. |
I ran |
Forge has recently (foundry-rs/foundry#7197) dropped the ast from the build json by default, so we need to request it explicitly with `--ast`, `ast = <bool>` config or just `--build-info` to avoid checking if forge supports the `--ast` command
…y-rs#7197) * feat: don't request Solc JSON AST unless absolutely necessary * fix: don't require AST just for the path of a file * feat: add `--abi` and `abi = <bool>` config values * fmt * fix config * fix: keep AST in build_info
#151) …ch is absent by default in the current foundry version foundry-rs/foundry#7197 Co-authored-by: Dmitry Gusakov <dmitry.gusakov@lido.fi>
The Solc JSON AST output is very expensive to both serialize on the compiler's side, and deserialize on our side due to its very nested nature and generally big size.
This is especially noticeable on hot starts thanks to less time spent deserializing all the already-compiled artifacts. This is applicable to all commands that require a built project.
Adds the
ast = <bool>
config and--ast
flag to build args to optionally include the AST in the artifacts.We currently use the AST in:
coverage
flatten
NatSpec
)coverage
andflatten
have been updated to override theast
config.test
has not been updated for inline test config since it currently does not work, and all tests pass without it. It will have to be rewritten usingsolang_parser
or something else.Results
Note that I'm using the debug profile to build
forge
, but this won't matter much as most of the time is spent insolc
anyway.Default
forge init
project:Solmate:
sablier/v2-core:
ethereum-optimism/optimism packages/contracts-bedrock