feat(rpc): implement movePrecompileToAddress for eth_simulateV1#21414
Merged
feat(rpc): implement movePrecompileToAddress for eth_simulateV1#21414
Conversation
This adds support for the movePrecompileToAddress state override in eth_simulateV1, allowing callers to move precompiles from their original addresses to new destinations. Changes: - Add NotAPrecompile error variant with error code -32000 - Add apply_precompile_overrides function to handle precompile moves - Integrate precompile override application after EVM creation in simulate_v1 - Validate that source addresses are actual precompiles before moving - Support moving multiple precompiles to the same destination - Handle self-reference (source == dest) as no-op Amp-Thread-ID: https://ampcode.com/threads/T-019bf5d7-2b64-7619-92d4-2934b62708bd Co-authored-by: Amp <amp@ampcode.com>
04ae2cf to
ff9d896
Compare
rakita
pushed a commit
that referenced
this pull request
Jan 26, 2026
Co-authored-by: Amp <amp@ampcode.com>
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.
Summary
This PR adds support for the
movePrecompileToAddressstate override ineth_simulateV1, allowing callers to move precompiles from their original addresses to new destinations.Dependencies
MovePrecompileToAddress(the field uses PascalCase in the JSON-RPC spec but alloy expects camelCase).Changes
crates/rpc/rpc-eth-types/src/simulate.rs
NotAPrecompile(Address)error variant with error code-32000(matching other clients)apply_precompile_overrides()function that:movePrecompileToAddressentries from state overridescrates/rpc/rpc-eth-api/src/helpers/call.rs
BlockBuildertrait import to accessevm_mut()apply_precompile_overrides()after EVM/builder creation, before transaction execution (in both inspector and non-inspector code paths)Test Cases Addressed
Based on hive test analysis:
ethSimulate-move-ecrecover-and-call-old-and-newethSimulate-move-ecrecover-and-callethSimulate-move-ecrecover-twice-and-callethSimulate-move-two-accounts-to-same-38023ethSimulate-move-to-address-itself-reference-38022ethSimulate-try-to-move-non-precompileRelated
MovePrecompileToAddress)