-
Notifications
You must be signed in to change notification settings - Fork 141
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
EVM Precompiles: Reserve a range for EIP-based precompiles #1164
Comments
Maybe 256? Might be easier to reason about an entire byte. In Solidity, this would be |
It would be kinda cute to have these use an F though -- |
My understanding is that precompiles are defined to be 0-256, so that might cause some issues. On the other hand... it would guarantee that we won't have any issues. |
Oh, interesting. I'm unaware of any special rules that apply to those addresses... will ask around. |
Ah, I thought there was... but I may have been mistaken. See https://eips.ethereum.org/EIPS/eip-1352. |
After asking a few ETH Layer 2's, the consensus is that there's nothing special you need to do, just give enough space for future ETH precompiles. Optimism in particular has chosen to place precompiles at addresses starting with 0x42. I think there are two options here:
Personally, I like #2 better, since contracts will already want to bake in special cases for non-evm native actors calling in (0xFF addrs). And I think that treating the FIL precompiles more like native EVM precompiles makes more sense - so they should just sit at low addresses like I think this approach is sane as long as we're providing the guarantee that these precompiles won't ever call into EVM contracts. |
Meant to say only ever call in "as themselves." From our convo today, the current impl has the call precompile spoof the caller address, so this shouldn't apply. |
Concrete proposal: Use |
I.e. |
I'm a bit more of a fan of 0xFE prefix since it's a bit more human readable (although this is some nice bikesheding) I agree with reserving 2 bytes for the address and some prefix for our native precompiles. |
So, @wadealexc commented that some other "layer 2s". Just prefix the entire address, the same thing we do for ID addresses. In terms of the actual bytes..., yeah, 0xFE is probably the way to go. That way we have a clear 0xFF and a clear 0xFE (and can add more later). |
@mriise can you handle this? |
fix was merged. |
For reference: Precompile address now must start with either Prefix examples:
Note: Eth null address is a reserved address that is nonassignable by the EAM. This also holds true for the zero index of precompile prefixes, it is a reserved address that is nonassignable by the EAM but also isn't a precompile address. |
Reported by @wadealexc.
We should reserve a precompile range for "blessed' precompiles. Personally, I'd start defining our own precompiles at, e.g., 128, leaving < 128 for ones with EIPs.
The text was updated successfully, but these errors were encountered: