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

Strange CFG Benchmark Results for SEVM #155

Open
cdump opened this issue Feb 24, 2025 · 3 comments
Open

Strange CFG Benchmark Results for SEVM #155

cdump opened this issue Feb 24, 2025 · 3 comments

Comments

@cdump
Copy link

cdump commented Feb 24, 2025

Hey, I just added Control Flow Graph (CFG) support to my evmole tool and included benchmarks for several open-source tools I found:
CFG Benchmark Results

While SEVM performs very well for selectors/mutability (and for decompilation, though it's not benchmarked), it performs poorly in the CFG benchmark. I suspect I might be using it incorrectly.

Could you take a look at this part of the implementation? https://github.com/cdump/evmole/blob/master/benchmark/providers/sevm/main.mjs#L44

The expected output format is a list of edges between basic blocks, where each block is identified by the bytecode offset of its first opcode. Let me know if I'm misusing SEVM or if there's an alternative way to get accurate CFG results.

@acuarica
Copy link
Owner

Hey thanks for opening this. Great work with your evmole tool!

I'm at EthDenver this week, but I'll take a look when I have some time.

it performs poorly in the CFG benchmark

It might yes, sevm is not precise in terms of CFG generation. It does loop unroll, so that may lead to different CFGs.

a list of edges between basic blocks, where each block is identified by the bytecode offset of its first opcode

sevm performs basic block cloning. That means that two different basic blocks can have the same offset as id. This is because a single JUMP(I) instruction can have multiple destinations.

@cdump
Copy link
Author

cdump commented Feb 25, 2025

Found a bug on my side
Now, the results are much better: https://github.com/cdump/evmole/tree/master?tab=readme-ov-file#control-flow-graph

But anyway, take a look when you come back - there are probably more bugs in my code using SEVM :)

@cdump
Copy link
Author

cdump commented Feb 25, 2025

two different basic blocks can have the same offset as id.

that's not a problem and expected, I'm using pc, not block id

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

No branches or pull requests

2 participants