feat: Replace Python IO with Rust FFI#83
Open
samuelburnham wants to merge 2 commits intoNethermindEth:mainfrom
Open
feat: Replace Python IO with Rust FFI#83samuelburnham wants to merge 2 commits intoNethermindEth:mainfrom
samuelburnham wants to merge 2 commits intoNethermindEth:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces Python IO calls with faster/safer Rust FFI using https://docs.rs/revm-precompile/32.1.0/revm_precompile/ for the Rust backend and https://github.com/argumentcomputer/lean-ffi for a safe API over
rust-bindgenbindings to thelean.hC library.If this approach is of interest, we can replace the rest of the Python calls with FFI to https://github.com/bluealloy/revm.
I wasn't sure if Python or C was being used for blake2, Sha256, and Keccak, so I replaced both blake2 Python and C with Rust as a proof of concept for now. There is less benefit to replacing C with Rust, but the latter still produces simpler/less error-prone code. The Rust API has typed wrappers to distinguish owned from borrowed Lean references, and
Clone/Dropimplementations handle ref counting automatically instead of requiring manuallean_inc/lean_deccalls.I also added a small test filtering helper to run e.g. just
ripemdtests withwhere the test names were grepped from the Ethereum tests JSONs such as static_CallRipemd160_1.json.