Skip to content
Merged
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
9 changes: 2 additions & 7 deletions crates/vm/levm/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ pub fn ecmul(calldata: &Bytes, gas_remaining: &mut u64, _fork: Fork) -> Result<B
bn254_g1_mul(g1, scalar)
}

#[cfg(all(not(feature = "sp1"), not(feature = "risc0")))]
#[cfg(not(feature = "sp1"))]
#[inline]
pub fn bn254_g1_mul(point: G1, scalar: U256) -> Result<Bytes, VMError> {
let x = ark_bn254::Fq::from_be_bytes_mod_order(&point.0.to_big_endian());
Expand Down Expand Up @@ -813,7 +813,7 @@ pub fn bn254_g1_mul(point: G1, scalar: U256) -> Result<Bytes, VMError> {
Ok(Bytes::from(out))
}

#[cfg(any(feature = "sp1", feature = "risc0"))]
#[cfg(feature = "sp1")]
#[inline]
pub fn bn254_g1_mul(g1: G1, scalar: U256) -> Result<Bytes, VMError> {
use substrate_bn::{AffineG1, Fq, Fr, G1, Group};
Expand All @@ -832,11 +832,6 @@ pub fn bn254_g1_mul(g1: G1, scalar: U256) -> Result<Bytes, VMError> {
let scalar =
Fr::from_slice(&scalar.to_big_endian()).map_err(|_| PrecompileError::ParsingInputError)?;

#[cfg(feature = "risc0")]
// RISC0's substrate-bn patch does not implement Mul<Fr> for AffineG1, but
// it does implement Mul<Fr> for G1. So we convert AffineG1 to G1 first.
let result = G1::from(g1) * scalar;
#[cfg(feature = "sp1")]
let result = g1 * scalar;

let mut x_bytes = [0u8; 32];
Expand Down
Loading