Skip to content

Implement CLZ opcode#940

Merged
blishko merged 14 commits intomainfrom
clz-opcode
Feb 4, 2026
Merged

Implement CLZ opcode#940
blishko merged 14 commits intomainfrom
clz-opcode

Conversation

@elopez
Copy link
Copy Markdown
Collaborator

@elopez elopez commented Dec 3, 2025

Description

This also bumps the Solidity version used in tests to be able to compile an example with CLZ

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

@elopez
Copy link
Copy Markdown
Collaborator Author

elopez commented Dec 3, 2025

It is worth noting that this does not implement CLZ on the SMT, help is welcome on that regard 😄

@elopez elopez mentioned this pull request Dec 3, 2025
13 tasks
This also bumps the Solidity version used in tests to be able to
compile an example with CLZ
@msooseth
Copy link
Copy Markdown
Collaborator

OK, this should now work, but the ethereum-tests have moved, and have changed format, so that needs to be updated, as per @elopez

@msooseth msooseth marked this pull request as ready for review February 4, 2026 10:29
@msooseth
Copy link
Copy Markdown
Collaborator

msooseth commented Feb 4, 2026

@elopez wanna review this? I resolved the cash with main by taking the main on the flake.lock, I hope that's good? The change is: 84c1e37 Plus I added a CLZ smt implementation of course

Indentation fix

Better indentation
Copy link
Copy Markdown
Collaborator

@blishko blishko left a comment

Choose a reason for hiding this comment

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

Nice!
I think it looks good!
I think it would be nice to fix the one misaligned line in the SMT encoding, and add a negative test.
We can also add a concrete test!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe we should add a negative test as well?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

OK, added more tests, including negative tests. I actually much prefer these to the ones that were added as part of forge, because forge tests are slower and harder to edit. But I'll leave those in, too, they do check forge which is nice.

@elopez
Copy link
Copy Markdown
Collaborator Author

elopez commented Feb 4, 2026

@elopez wanna review this? I resolved the cash with main by taking the main on the flake.lock, I hope that's good? The change is: 84c1e37 Plus I added a CLZ smt implementation of course

IIRC the flake.lock change was upgrading the solcs.nix, but I think that might have been upgraded independently since opening this PR. As long as we have a recent enough solc that can do clz we should be ok :)

@elopez
Copy link
Copy Markdown
Collaborator Author

elopez commented Feb 4, 2026

@msooseth can you remove tests that should pass now from the problematicTests list? It should be at least these, but possibly some other ones as well 😄 https://github.com/argotorg/hevm/blob/17e0724/test/EVM/Test/BlockchainTests.hs#L217-L221

@msooseth
Copy link
Copy Markdown
Collaborator

msooseth commented Feb 4, 2026

Damn. Windows is failing, maybe because of the nix "cleanup" I did:

2026-02-04T14:12:08.1858158Z     Fusaka:                                                       compilation failed: exit code: ExitFailure 1
2026-02-04T14:12:08.1859277Z 
2026-02-04T14:12:08.1859664Z stdout:
2026-02-04T14:12:08.1859843Z 
2026-02-04T14:12:08.1859850Z 
2026-02-04T14:12:08.1859968Z stderr:
2026-02-04T14:12:08.1860896Z Error: Encountered invalid solc version in src\unit-tests.t.sol: No solc version exists that matches the version requirement: ^0.8.31
2026-02-04T14:12:08.1861958Z 
2026-02-04T14:12:08.1945072Z FAIL
2026-02-04T14:12:08.1952906Z       Exception: Internal Error: Error compiling test file "test/contracts/pass/fusaka.sol" in directory "D:\\a\\_temp\\msys64\\tmp\\dapp-test-dc2ed3372c7debb4" -- CallStack (from HasCallStack):

@msooseth
Copy link
Copy Markdown
Collaborator

msooseth commented Feb 4, 2026

OK, moved Windows to latest solidity.

Copy link
Copy Markdown
Collaborator

@blishko blishko left a comment

Choose a reason for hiding this comment

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

LGTM!

@blishko blishko merged commit da1a71c into main Feb 4, 2026
6 of 8 checks passed
@blishko blishko deleted the clz-opcode branch February 4, 2026 15:42
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