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

Could not find node error #16

Open
0xalpharush opened this issue Jan 22, 2025 · 4 comments
Open

Could not find node error #16

0xalpharush opened this issue Jan 22, 2025 · 4 comments

Comments

@0xalpharush
Copy link

$ evm-cfg evm -o cfg.dot --open
thread 'main' panicked at src/cfg_gen/cfg_graph.rs:214:9:
Could not find node for pc 62

6080604052348015600f57600080fd5b5060b580601d6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063f42e8cdd14602d575b600080fd5b603c60383660046058565b603e565b005b60005b60ff811015605457816054576001016041565b5050565b600060208284031215606957600080fd5b81358015158114607857600080fd5b939250505056fea2646970667358221220a206d90c473b6930258d5789495c41b79941b5334c47a76b6e618d3571716d5164736f6c634300081c0033

    contract X {
        function Y(bool yes) external {
            for (uint256 i = 0; i < 255; i++) {
                if (yes) {
                    break;
                }
            }
        }
    }
@plotchy
Copy link
Owner

plotchy commented Feb 10, 2025

Did some looking into this. I get some weird results when debugging the analysis, like things dont make sense. The bytecode wants to jump to PCs that aren't jumpdests.

Can i ask how you compiled this? I'd like to dig in further. When i use either of these i get expected output.

solc X.sol --bin-runtime --no-cbor-metadata
solc X.sol --bin-runtime --no-cbor-metadata --optimize --via-ir

Version: 0.8.26+commit.8a97fa7a.Darwin.appleclang

@0xalpharush
Copy link
Author

I believe I just ran forge build X.sol

@plotchy
Copy link
Owner

plotchy commented Feb 10, 2025

ok sounds good will check it out

@plotchy
Copy link
Owner

plotchy commented Feb 10, 2025

ah on second look I can recognize that this is the deploy code rather than the runtime.

The jumps on the runtime portion aren't intended to make sense in the deploy code, so they panic.

I could probably catch those and still output a graph. That would also help with factories and stuff they have contract code that is ready to deploy but not intended to run in the same context

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