Skip to content

Add via SSA CFG in CLI and Standard Json Interface#16503

Merged
clonker merged 4 commits intodevelopfrom
via_ssa_cfg_cli
Mar 11, 2026
Merged

Add via SSA CFG in CLI and Standard Json Interface#16503
clonker merged 4 commits intodevelopfrom
via_ssa_cfg_cli

Conversation

@clonker
Copy link
Member

@clonker clonker commented Mar 5, 2026

Expose the SSA CFG pipeline through the CLI (--via-ssa-cfg) and Standard JSON (settings.viaSSACFG) as an experimental feature. Both flags imply viaIR and require experimental mode.

@clonker clonker marked this pull request as ready for review March 5, 2026 22:25
Copy link
Contributor

@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.

Looks reasonable to me, left some questions.
I'll leave approval to someone who has worked with CLI/JSON arguments before.

cameel
cameel previously requested changes Mar 6, 2026
Copy link
Collaborator

@cameel cameel left a comment

Choose a reason for hiding this comment

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

Not going to do a proper review now, but since the PR was up already I decided to take a peek and I see that you're not storing the state of the flag in metadata. This is very important for source verification. All settings necessary to reproduce the bytecode must be stored in metadata.

This aspect also needs test coverage.

@clonker clonker requested review from cameel and nikola-matic March 9, 2026 09:09
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are a few more test cases here where the new option is relevant: invalid_options_input_modes_combinations, assembly_mode_options, cli_mode_options.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have added tests to these test cases. It is a bit unfortunate for experimental features in the invalid_options_input_modes_combinations because I can't, e.g., test that --via-ssa-cfg --standard-json is an invalid combination inside of the test definition, it will error out differently:

solc --via-ssa-cfg --standard-json input.json 
> Error: The following options are only available in experimental mode: --via-ssa-cfg. To enable experimental mode, use the --experimental flag.

solc --experimental --via-ssa-cfg --standard-json input.json
> Error: Standard JSON input mode is incompatible with the --experimental flag. Instead, please use the 'settings.experimental' setting in your Standard JSON input file to enable experimental mode.

The only thing I could effectively test it against (without changing the test itself) was --link).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be fine to change the test and accept this alternative error message too.

BTW, I see that the evmasm import mode is not in that table and it really should be. Especially for --via-ssa-cfg, which does not make sense in this mode.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep you are right of course. I have added --import-asm-json to the list. Let's do the asm json for the rest in a follow up.

@clonker clonker force-pushed the via_ssa_cfg_cli branch 2 times, most recently from 260ecd6 to e08dba6 Compare March 9, 2026 15:35
@argotorg argotorg deleted a comment from stackenbotten3000 Mar 9, 2026
@clonker clonker force-pushed the via_ssa_cfg_cli branch 2 times, most recently from b1caac3 to 79612c5 Compare March 10, 2026 09:38
@clonker clonker requested a review from cameel March 10, 2026 09:49
Copy link
Collaborator

@cameel cameel left a comment

Choose a reason for hiding this comment

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

The only thing that's missing in the implementation are validations that SSA CFG codegen is not requested in evmasm import mode. Since that mode is experimental, I'd be fine with addressing that in a separate PR, especially given that this validation is missing for many other options too.

Other than that, mostly wording and test tweaks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

viaSSACFG: true should be disallowed in EVMAssembly mode (which goes through importEVMAssembly() and just ignores the setting).

I see that we're not disallowing viaIR there either. That perhaps should be fixed in a separate PR covering all the stray options we're allowing there but shouldn't.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be fine to change the test and accept this alternative error message too.

BTW, I see that the evmasm import mode is not in that table and it really should be. Especially for --via-ssa-cfg, which does not make sense in this mode.

@cameel cameel dismissed their stale review March 10, 2026 11:06

There are still minor things to improve, but overall the PR is no longer missing anything vital.

@clonker clonker force-pushed the via_ssa_cfg_cli branch 2 times, most recently from 3444570 to a73b2a9 Compare March 10, 2026 13:07
@clonker clonker requested a review from cameel March 10, 2026 17:00
cameel
cameel previously approved these changes Mar 10, 2026
Copy link
Collaborator

@cameel cameel left a comment

Choose a reason for hiding this comment

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

It's 99.9% good, so approving already, but please remember to remove the Standard JSON changelog entry (#16503 (comment)) before you merge.

@clonker clonker merged commit 9f4d0b8 into develop Mar 11, 2026
83 checks passed
@clonker clonker deleted the via_ssa_cfg_cli branch March 11, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants