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

fix(evm): P256Verify address #9618

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/evm/core/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub const PRECOMPILES: &[Address] = &[
/// [EIP-7212](https://eips.ethereum.org/EIPS/eip-7212) secp256r1 precompile address on Odyssey.
///
/// <https://github.com/ithacaxyz/odyssey/blob/482f4547631ae5c64ebea6a4b4ef93184a4abfee/crates/node/src/evm.rs#L35-L35>
pub const ODYSSEY_P256_ADDRESS: Address = address!("0000000000000000000000000000000000000014");
pub const ODYSSEY_P256_ADDRESS: Address = address!("0000000000000000000000000000000000000100");
Copy link
Member

Choose a reason for hiding this comment

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

we deployed on 0x14 and will keep that address for odyssey, the 0x100 is the proposed RIP address, I think we should just add the precompile to both addresses instead, IIRC revm has a constant for 0x100


/// Wrapper around revm P256 precompile, matching EIP-7212 spec.
///
Expand Down
7 changes: 5 additions & 2 deletions crates/evm/core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
use alloy_consensus::BlockHeader;
use alloy_json_abi::{Function, JsonAbi};
use alloy_network::AnyTxEnvelope;
use alloy_primitives::{Address, Selector, TxKind, B256, U256};
use alloy_primitives::{address, Address, Selector, TxKind, B256, U256};
use alloy_provider::{network::BlockResponse, Network};
use alloy_rpc_types::{Transaction, TransactionRequest};
use foundry_common::is_impersonated_tx;
Expand Down Expand Up @@ -301,7 +301,10 @@ pub fn odyssey_handler_register<EXT, DB: revm::Database>(handler: &mut EvmHandle
handler.pre_execution.load_precompiles = Arc::new(move || {
let mut loaded_precompiles = prev();

loaded_precompiles.extend([ODYSSEY_P256]);
// For backwards compatibility, inject precompile at address 0x14.
let backwards_compat_p256 =
(address!("0000000000000000000000000000000000000014"), ODYSSEY_P256.1);
loaded_precompiles.extend([ODYSSEY_P256, backwards_compat_p256.into()]);

loaded_precompiles
});
Expand Down
Loading