diff --git a/crates/precompile/src/lib.rs b/crates/precompile/src/lib.rs index 4dc6cae518..7903d38b27 100644 --- a/crates/precompile/src/lib.rs +++ b/crates/precompile/src/lib.rs @@ -63,6 +63,7 @@ impl Precompiles { PrecompileSpecId::ISTANBUL => Self::istanbul(), PrecompileSpecId::BERLIN => Self::berlin(), PrecompileSpecId::CANCUN => Self::cancun(), + PrecompileSpecId::PRAGUE => Self::prague(), PrecompileSpecId::LATEST => Self::latest(), } } @@ -154,9 +155,21 @@ impl Precompiles { }) } + /// Returns precompiles for Prague spec. + pub fn prague() -> &'static Self { + static INSTANCE: OnceBox = OnceBox::new(); + INSTANCE.get_or_init(|| { + let precompiles = Self::cancun().clone(); + // EIP-2537: Precompile for BLS12-381 curve operations + // TODO(alexey): add BLS12-381 precompiles + // precompiles.extend(bls12_381::precompiles()); + Box::new(precompiles) + }) + } + /// Returns the precompiles for the latest spec. pub fn latest() -> &'static Self { - Self::cancun() + Self::prague() } /// Returns an iterator over the precompiles addresses. @@ -229,6 +242,7 @@ pub enum PrecompileSpecId { ISTANBUL, BERLIN, CANCUN, + PRAGUE, LATEST, } @@ -243,7 +257,8 @@ impl PrecompileSpecId { BYZANTIUM | CONSTANTINOPLE | PETERSBURG => Self::BYZANTIUM, ISTANBUL | MUIR_GLACIER => Self::ISTANBUL, BERLIN | LONDON | ARROW_GLACIER | GRAY_GLACIER | MERGE | SHANGHAI => Self::BERLIN, - CANCUN | PRAGUE => Self::CANCUN, + CANCUN => Self::CANCUN, + PRAGUE => Self::PRAGUE, LATEST => Self::LATEST, #[cfg(feature = "optimism")] BEDROCK | REGOLITH | CANYON => Self::BERLIN,