Skip to content

Don't compile contract bindindgs we don't use#4324

Open
MartinquaXD wants to merge 6 commits intomainfrom
minimize-generated-contract-bindings
Open

Don't compile contract bindindgs we don't use#4324
MartinquaXD wants to merge 6 commits intomainfrom
minimize-generated-contract-bindings

Conversation

@MartinquaXD
Copy link
Copy Markdown
Contributor

@MartinquaXD MartinquaXD commented Apr 10, 2026

Description

Currently many contracts we use have many functions we don't use. Those result in a lot of code that gets compiled unnecessarily which is slow.

Changes

I moved the unused functions in the artifact ABI files into under a new key (_disabled) which does not get parsed by alloy for code generation. I decided to do that instead of deleting the functions entirely in case we need to use some of them in the future.

This resulted in ~180K lines of net reduction. On my machine this reduced compile times of a clean rebuild from 69s to 63.7s. The effects on CI are 10s faster compilation of tests and likely significantly more savings when building the full image.

How to test

all tests should still pass

@MartinquaXD MartinquaXD requested a review from a team as a code owner April 10, 2026 08:08
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

The number of changes in this pull request is too large for Gemini Code Assist to generate a review.

@MartinquaXD MartinquaXD marked this pull request as draft April 10, 2026 08:09
@MartinquaXD MartinquaXD marked this pull request as ready for review April 10, 2026 08:27
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

The number of changes in this pull request is too large for Gemini Code Assist to generate a review.

@jmg-duarte
Copy link
Copy Markdown
Contributor

The core idea makes sense to me, but is there a way we can automate this process? Otherwise, if someone runs generate it will overwrite this

@MartinquaXD
Copy link
Copy Markdown
Contributor Author

if someone runs generate it will overwrite this

generate does not touch the underlying ABI files.
When I run just generate-contracts, just fmt-toml, and just fmt I'm left with 0 changes.

@jmg-duarte
Copy link
Copy Markdown
Contributor

jmg-duarte commented Apr 10, 2026

generate does not touch the underlying ABI files.

True I was thinking of the forge thingy, nvm then

Copy link
Copy Markdown
Contributor

@jmg-duarte jmg-duarte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to shave 2s on my end, but 10s in CI is very nice

Copy link
Copy Markdown
Contributor

@squadgazzz squadgazzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants