diff --git a/crates/common/types/genesis.rs b/crates/common/types/genesis.rs index 393c2302865..eb0c33abc1d 100644 --- a/crates/common/types/genesis.rs +++ b/crates/common/types/genesis.rs @@ -421,7 +421,17 @@ impl ChainConfig { } pub fn get_fork(&self, block_timestamp: u64) -> Fork { - if self.is_osaka_activated(block_timestamp) { + if self.is_bpo5_activated(block_timestamp) { + Fork::BPO5 + } else if self.is_bpo4_activated(block_timestamp) { + Fork::BPO4 + } else if self.is_bpo3_activated(block_timestamp) { + Fork::BPO3 + } else if self.is_bpo2_activated(block_timestamp) { + Fork::BPO2 + } else if self.is_bpo1_activated(block_timestamp) { + Fork::BPO1 + } else if self.is_osaka_activated(block_timestamp) { Fork::Osaka } else if self.is_prague_activated(block_timestamp) { Fork::Prague diff --git a/crates/networking/rpc/rpc.rs b/crates/networking/rpc/rpc.rs index 12872add687..8787a0a1bd3 100644 --- a/crates/networking/rpc/rpc.rs +++ b/crates/networking/rpc/rpc.rs @@ -948,7 +948,7 @@ mod tests { "ID": "0x0000000000000000000000000000000000000004", "KZG_POINT_EVALUATION": "0x000000000000000000000000000000000000000a", "MODEXP": "0x0000000000000000000000000000000000000005", - "P256_VERIFICATION":"0x0000000000000000000000000000000000000100", + "P256VERIFY":"0x0000000000000000000000000000000000000100", "RIPEMD160": "0x0000000000000000000000000000000000000003", "SHA256": "0x0000000000000000000000000000000000000002" }, diff --git a/crates/vm/levm/src/precompiles.rs b/crates/vm/levm/src/precompiles.rs index bc90e11c15b..85f9cb7a1b2 100644 --- a/crates/vm/levm/src/precompiles.rs +++ b/crates/vm/levm/src/precompiles.rs @@ -255,12 +255,12 @@ pub const BLS12_MAP_FP2_TO_G2: Precompile = Precompile { active_since_fork: Prague, }; -pub const P256_VERIFICATION: Precompile = Precompile { +pub const P256VERIFY: Precompile = Precompile { address: H160([ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, ]), - name: "P256_VERIFICATION", + name: "P256VERIFY", active_since_fork: Osaka, }; @@ -283,7 +283,7 @@ pub const PRECOMPILES: [Precompile; 19] = [ BLS12_MAP_FP2_TO_G2, BLS12_MAP_FP_TO_G1, BLS12_PAIRING_CHECK, - P256_VERIFICATION, + P256VERIFY, ]; pub fn precompiles_for_fork(fork: Fork) -> impl Iterator { @@ -293,7 +293,7 @@ pub fn precompiles_for_fork(fork: Fork) -> impl Iterator { } pub fn is_precompile(address: &Address, fork: Fork, vm_type: VMType) -> bool { - (matches!(vm_type, VMType::L2(_)) && *address == P256_VERIFICATION.address) + (matches!(vm_type, VMType::L2(_)) && *address == P256VERIFY.address) || precompiles_for_fork(fork).any(|precompile| precompile.address == *address) } @@ -329,10 +329,9 @@ pub fn execute_precompile( Some(bls12_map_fp_to_g1 as PrecompileFn); precompiles[BLS12_MAP_FP2_TO_G2.address.0[19] as usize] = Some(bls12_map_fp2_tp_g2 as PrecompileFn); - precompiles[u16::from_be_bytes([ - P256_VERIFICATION.address.0[18], - P256_VERIFICATION.address.0[19], - ]) as usize] = Some(p_256_verify as PrecompileFn); + precompiles + [u16::from_be_bytes([P256VERIFY.address.0[18], P256VERIFY.address.0[19]]) as usize] = + Some(p_256_verify as PrecompileFn); precompiles };