Skip to content
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Instead of lazy computation of blocklist, do greedy computation of allowlist and store the result, fetch it with the DB. [#4961](https://github.com/lambdaclass/ethrex/pull/4961)

### 2025-10-20

- Remove duplicate subgroup check in ecpairing precompile [#4960](https://github.com/lambdaclass/ethrex/pull/4960)

### 2025-10-17

- Replaces incremental iteration with a one-time precompute method that scans the entire bytecode, building a `BitVec<u8, Msb0>` where bits mark valid `JUMPDEST` positions, skipping `PUSH1..PUSH32` data bytes.
Expand All @@ -17,7 +21,6 @@

### 2025-10-13


- Remove explicit cache-related options from RocksDB configuration and reverted optimistic transactions to reduce RAM usage [#4853](https://github.com/lambdaclass/ethrex/pull/4853)
- Remove unnecesary mul in ecpairing [#4843](https://github.com/lambdaclass/ethrex/pull/4843)

Expand Down
2 changes: 0 additions & 2 deletions crates/vm/levm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ pub enum PrecompileError {
PointNotInTheCurve,
#[error("The point is not in the subgroup")]
PointNotInSubgroup,
#[error("BN254 ate pairing error")]
BN254AtePairingError,
#[error("The G1 point is not in the curve")]
BLS12381G1PointNotInCurve,
#[error("The G2 point is not in the curve")]
Expand Down
11 changes: 3 additions & 8 deletions crates/vm/levm/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,8 @@ pub fn pairing_check(batch: &[(G1, G2)]) -> Result<bool, VMError> {
#[cfg(not(feature = "sp1"))]
#[inline]
pub fn pairing_check(batch: &[(G1, G2)]) -> Result<bool, VMError> {
use lambdaworks_math::errors::PairingError;

type Fq = BN254FieldElement;
type Fq2 = BN254TwistCurveFieldElement;
type LambdaworksG1 = BN254Curve;
Expand Down Expand Up @@ -936,18 +938,11 @@ pub fn pairing_check(batch: &[(G1, G2)]) -> Result<bool, VMError> {
LambdaworksG2::create_point_from_affine(g2_x, g2_y)
.map_err(|_| PrecompileError::InvalidPoint)?
};
if !g2.is_in_subgroup() {
return Err(PrecompileError::PointNotInSubgroup.into());
}

if g1.is_neutral_element() || g2.is_neutral_element() {
continue;
}
valid_batch.push((g1, g2));
}
let valid_batch_refs: Vec<_> = valid_batch.iter().map(|(p1, p2)| (p1, p2)).collect();
let result = BN254AtePairing::compute_batch(&valid_batch_refs)
.map_err(|_| PrecompileError::BN254AtePairingError)?;
.map_err(|PairingError::PointNotInSubgroup| PrecompileError::PointNotInSubgroup)?;

Ok(result == QuadraticExtensionFieldElement::one())
}
Expand Down
Loading