Skip to content
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

Switch to solc 0.8.24, upgrade dependencies and enable via-ir #342

Merged
merged 4 commits into from
Mar 4, 2024

Conversation

CodeSandwich
Copy link
Collaborator

Some changes were needed to make the code via-IR-compatible.

The behavior of the inline initialization (e.g. uint256 internal immutable foo = 123;) is different, it's no longer done before all the constructors are run, but only right before the constructor of the contract containing this variable, so it can't be used as a parameter of the parent contract, it's silently set to 0.

Via-IR has some problems with very large functions, it probably tries to inline them and then optimize, which it fails to do. This is why some tests needed to be prevented from inlining by making the complicated function calls external.

Via-IR assumes that block.timestamp never changes, so it sometimes replaces accessing variables known to be holding the timestamp with block.timestamp retrieval, which derailed some tests.

CodeSandwich added a commit that referenced this pull request Feb 28, 2024
CodeSandwich added a commit that referenced this pull request Feb 28, 2024
CodeSandwich added a commit that referenced this pull request Feb 28, 2024
CodeSandwich added a commit that referenced this pull request Feb 28, 2024
@xmxanuel
Copy link
Collaborator

Via-IR assumes that block.timestamp never changes, so it sometimes replaces accessing variables known to be holding the timestamp with block.timestamp retrieval, which derailed some tests.

Interesting.

I started to read about it here:
foundry-rs/foundry#1373

Copy link
Collaborator

@xmxanuel xmxanuel left a comment

Choose a reason for hiding this comment

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

looks good.

One minor thing. I would add to the PR name that it includes a solidity version upgrade.

@CodeSandwich CodeSandwich changed the title Enable via-ir Switch to solc 0.8.24, upgrade dependencies and enable via-ir Feb 29, 2024
@CodeSandwich CodeSandwich merged commit 3d8a4b6 into main Mar 4, 2024
1 check passed
@CodeSandwich CodeSandwich deleted the igor/via_ir branch March 4, 2024 13:13
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