Skip to content

Conversation

@MegaRedHand
Copy link
Collaborator

Motivation

We are checking that ecpairing G2 inputs are in the subgroup before calling compute_batch, which already checks this.

Description

This PR removes the duplicate subgroup check.

Closes #4939

@Copilot Copilot AI review requested due to automatic review settings October 20, 2025 18:19
@MegaRedHand MegaRedHand requested a review from a team as a code owner October 20, 2025 18:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes a redundant subgroup membership check for G2 points in the ecpairing precompile. The check was unnecessary because compute_batch already validates subgroup membership for G2 points.

Key Changes:

  • Removed duplicate is_in_subgroup() validation for G2 points in the pairing check function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

github-actions bot commented Oct 20, 2025

Lines of code report

Total lines added: 0
Total lines removed: 7
Total lines changed: 7

Detailed view
+------------------------------------------+-------+------+
| File                                     | Lines | Diff |
+------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/errors.rs      | 229   | -2   |
+------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/precompiles.rs | 1563  | -5   |
+------------------------------------------+-------+------+

@github-actions
Copy link

github-actions bot commented Oct 20, 2025

Benchmark Results Comparison

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 4.834 ± 0.016 4.814 4.861 1.04 ± 0.01
main_levm_BubbleSort 4.658 ± 0.024 4.628 4.697 1.00
pr_revm_BubbleSort 4.770 ± 0.019 4.737 4.798 1.02 ± 0.01
pr_levm_BubbleSort 4.690 ± 0.036 4.645 4.756 1.01 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [s] Min [s] Max [s] Relative
main_revm_ERC20Approval 1.550 ± 0.009 1.543 1.570 1.00
main_levm_ERC20Approval 1.656 ± 0.007 1.647 1.667 1.07 ± 0.01
pr_revm_ERC20Approval 1.579 ± 0.009 1.563 1.591 1.02 ± 0.01
pr_levm_ERC20Approval 1.651 ± 0.011 1.642 1.678 1.07 ± 0.01

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 186.7 ± 2.4 185.1 192.9 1.00
main_levm_ERC20Mint 203.0 ± 2.6 200.9 208.6 1.09 ± 0.02
pr_revm_ERC20Mint 186.7 ± 1.8 185.0 191.4 1.00 ± 0.02
pr_levm_ERC20Mint 201.3 ± 1.6 199.4 205.0 1.08 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 355.5 ± 3.5 353.3 364.8 1.00
main_levm_ERC20Transfer 388.1 ± 2.4 384.6 392.6 1.09 ± 0.01
pr_revm_ERC20Transfer 359.4 ± 3.1 353.0 363.9 1.01 ± 0.01
pr_levm_ERC20Transfer 384.3 ± 1.9 382.1 388.2 1.08 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 247.5 ± 25.7 232.3 320.3 1.05 ± 0.11
main_levm_Factorial 279.4 ± 8.4 274.9 302.3 1.19 ± 0.04
pr_revm_Factorial 235.1 ± 1.1 233.6 237.2 1.00
pr_levm_Factorial 279.6 ± 1.6 278.1 283.5 1.19 ± 0.01

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.686 ± 0.045 1.586 1.730 1.04 ± 0.07
main_levm_FactorialRecursive 8.526 ± 0.093 8.297 8.614 5.26 ± 0.34
pr_revm_FactorialRecursive 1.622 ± 0.103 1.337 1.693 1.00
pr_levm_FactorialRecursive 8.558 ± 0.054 8.480 8.687 5.28 ± 0.34

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 222.5 ± 2.8 219.5 230.1 1.05 ± 0.02
main_levm_Fibonacci 251.2 ± 6.8 248.0 270.5 1.19 ± 0.03
pr_revm_Fibonacci 211.2 ± 1.9 210.0 216.4 1.00
pr_levm_Fibonacci 250.9 ± 2.6 248.6 255.9 1.19 ± 0.02

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 880.2 ± 5.1 868.5 885.9 1.02 ± 0.01
main_levm_FibonacciRecursive 914.3 ± 10.6 889.3 925.7 1.06 ± 0.02
pr_revm_FibonacciRecursive 860.3 ± 7.9 849.9 874.7 1.00
pr_levm_FibonacciRecursive 929.9 ± 14.0 919.9 966.4 1.08 ± 0.02

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 12.4 ± 0.1 12.3 12.5 1.00
main_levm_ManyHashes 13.5 ± 0.1 13.5 13.7 1.10 ± 0.01
pr_revm_ManyHashes 12.4 ± 0.0 12.3 12.5 1.00 ± 0.01
pr_levm_ManyHashes 13.7 ± 0.3 13.5 14.6 1.11 ± 0.03

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 266.4 ± 6.1 262.1 279.0 1.02 ± 0.03
main_levm_MstoreBench 335.0 ± 2.2 332.7 339.1 1.28 ± 0.02
pr_revm_MstoreBench 262.4 ± 2.9 260.2 268.4 1.00
pr_levm_MstoreBench 337.5 ± 7.3 331.9 350.8 1.29 ± 0.03

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 297.3 ± 1.5 295.6 300.4 1.00 ± 0.01
main_levm_Push 385.8 ± 5.7 377.3 393.9 1.30 ± 0.02
pr_revm_Push 296.7 ± 1.6 295.3 299.7 1.00
pr_levm_Push 389.1 ± 4.5 381.6 394.4 1.31 ± 0.02

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 219.1 ± 1.0 218.3 221.5 2.40 ± 0.04
main_levm_SstoreBench_no_opt 93.5 ± 7.1 89.8 113.6 1.02 ± 0.08
pr_revm_SstoreBench_no_opt 219.2 ± 0.9 217.8 220.8 2.40 ± 0.04
pr_levm_SstoreBench_no_opt 91.3 ± 1.4 89.0 93.6 1.00

@MegaRedHand MegaRedHand marked this pull request as draft October 20, 2025 19:22
@github-actions
Copy link

github-actions bot commented Oct 20, 2025

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 81.413 ± 0.184 81.234 81.750 1.00
head 81.990 ± 0.185 81.710 82.294 1.01 ± 0.00

@MegaRedHand MegaRedHand marked this pull request as ready for review October 20, 2025 20:25
@MegaRedHand MegaRedHand moved this from Todo to In review in ethrex_performance Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

levm Lambda EVM implementation performance

Projects

Status: No status
Status: In review

Development

Successfully merging this pull request may close these issues.

Remove duplicate subgroup check in ecpairing precompile

1 participant