A code override can return the expected result and still charge the wrong gas. In a proposed fix for Reth’s precompile overrides, an empty-code replacement worked, but a nested call to it cost an extra 2,500 gas.
The original report concerned replacement code being ignored. The gas error came from my first version of the fix, which changed native dispatch and accidentally changed address warming with it.
Getting the replacement code to run
State overrides let an RPC request simulate a call against temporary account state. They do not change the chain's state or the network's precompile rules.
The report in Reth #27806 concerned a code override at 0x04 , the identity precompile. Identity normally returns its input unchanged.…