Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 11 additions & 1 deletion crates/common/types/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/networking/rpc/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ mod tests {
"ID": "0x0000000000000000000000000000000000000004",
"KZG_POINT_EVALUATION": "0x000000000000000000000000000000000000000a",
"MODEXP": "0x0000000000000000000000000000000000000005",
"P256_VERIFICATION":"0x0000000000000000000000000000000000000100",
"P256VERIFY":"0x0000000000000000000000000000000000000100",
"RIPEMD160": "0x0000000000000000000000000000000000000003",
"SHA256": "0x0000000000000000000000000000000000000002"
},
Expand Down
15 changes: 7 additions & 8 deletions crates/vm/levm/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand All @@ -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<Item = Precompile> {
Expand All @@ -293,7 +293,7 @@ pub fn precompiles_for_fork(fork: Fork) -> impl Iterator<Item = Precompile> {
}

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)
}

Expand Down Expand Up @@ -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
};

Expand Down