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

Add EOF container validation script #3553

Merged
merged 7 commits into from
Aug 7, 2024
Merged

Add EOF container validation script #3553

merged 7 commits into from
Aug 7, 2024

Conversation

jochem-brouwer
Copy link
Member

@jochem-brouwer jochem-brouwer commented Aug 3, 2024

This PR adds a CLI to enable EOF container checks via the command line, see ipsilon/eof#146

Additionally, this exports EOFContainer and validateEOF from EVM to expose this externally.

Please do not merge until we get a 👍 that this works with the fuzzer.

Usage:

Ensure all libraries are build, cd into the monorepo and then npm i.

Now cd ./packages/evm and then tsx ./scripts/eofContainerValidator.ts. The file will read hex strings from the stdin and will either output OK if the container is valid, or err: <REASON> if there is a validation error.

@shemnon
Copy link

shemnon commented Aug 3, 2024

It seems like it should work but when I try and run a process from within Java I never get any output from the subprocess. Is there a way to force flushes? My fuzzer hangs reading from the stream.

Here's the equivelant Java code starting the process.

Process p =
    new ProcessBuilder()
        .redirectErrorStream(true)
        .command(
            "/opt/homebrew/bin/tsx",
            "/Users/shemnon/git/ethereumjs/ethereumjs-monorepo/packages/evm/scripts/eofContainerValidator.ts")
        .start();

@jochem-brouwer
Copy link
Member Author

Could you retry with my latest commit? Otherwise I might have to figure out how to setup the Java process so I can test it myself 😅

@shemnon
Copy link

shemnon commented Aug 3, 2024

No dice. I think readline package may be the issue. Java processes are just pipes, there is no higher level TTY interactions.

Something like this needs to work:

echo ef00010100040200010001040000000080000000 > simple.eof
tsx scripts/eofContainerValidator.ts < simple.eof 

and output OK

@jochem-brouwer
Copy link
Member Author

This latest push could fix it?

@shemnon
Copy link

shemnon commented Aug 3, 2024

That works. I'll post some findings over at ipsilon/eof#146 (comment) in a bit.

@jochem-brouwer
Copy link
Member Author

Cool, thanks a lot!

@jochem-brouwer jochem-brouwer marked this pull request as ready for review August 3, 2024 19:48
Copy link
Contributor

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

Neat! We should consider rewording our Trying to read out of bounds error to be more descriptive in a future EOF related PR.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Cool, nice! 🎉❤️ Love this! 😃

From my side we could merge too (won’t do myself).

@acolytec3 acolytec3 merged commit d2cef57 into master Aug 7, 2024
34 checks passed
@acolytec3 acolytec3 deleted the eof-fuzz branch August 7, 2024 10:10
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