Skip to content

Conversation

@xqft
Copy link
Contributor

@xqft xqft commented Dec 19, 2025

0.15.0 introduces a new modexp syscall and fixes for the existing patches, apart from other optimizations (see https://github.com/0xPolygonHermez/zisk/releases/tag/v0.15.0)

we found a regression some time ago in main, probably related to a ZisK patch, in which some blocks failed to execute with a gas mismatch error. We tested those blocks again and the regression was gone. So the new patches' versions contain fixes too.

@github-actions github-actions bot added the L2 Rollup client label Dec 19, 2025
@github-actions
Copy link

github-actions bot commented Dec 19, 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 2.830 ± 0.029 2.800 2.886 1.00 ± 0.01
main_levm_BubbleSort 2.936 ± 0.024 2.920 3.000 1.04 ± 0.01
pr_revm_BubbleSort 2.822 ± 0.029 2.799 2.900 1.00
pr_levm_BubbleSort 2.929 ± 0.018 2.916 2.979 1.04 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Approval 910.8 ± 8.8 903.3 928.1 1.00
main_levm_ERC20Approval 1044.0 ± 2.4 1040.5 1048.4 1.15 ± 0.01
pr_revm_ERC20Approval 911.7 ± 8.9 902.6 926.2 1.00 ± 0.01
pr_levm_ERC20Approval 1046.4 ± 5.5 1041.6 1056.2 1.15 ± 0.01

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 120.4 ± 1.0 119.5 123.0 1.00
main_levm_ERC20Mint 157.3 ± 1.2 156.4 160.3 1.31 ± 0.01
pr_revm_ERC20Mint 120.5 ± 1.2 119.4 123.1 1.00 ± 0.01
pr_levm_ERC20Mint 156.8 ± 0.5 156.1 157.7 1.30 ± 0.01

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 215.3 ± 2.5 213.1 219.8 1.00 ± 0.02
main_levm_ERC20Transfer 266.9 ± 3.1 264.4 272.8 1.24 ± 0.02
pr_revm_ERC20Transfer 214.8 ± 2.8 213.1 222.4 1.00
pr_levm_ERC20Transfer 266.2 ± 2.4 264.3 271.2 1.24 ± 0.02

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 184.4 ± 1.3 182.4 187.1 1.00 ± 0.01
main_levm_Factorial 242.1 ± 8.6 235.4 260.6 1.31 ± 0.05
pr_revm_Factorial 184.2 ± 1.2 182.7 186.4 1.00
pr_levm_Factorial 237.7 ± 2.5 235.3 243.7 1.29 ± 0.02

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.330 ± 0.024 1.283 1.368 1.00 ± 0.02
main_levm_FactorialRecursive 6.251 ± 0.059 6.141 6.355 4.72 ± 0.07
pr_revm_FactorialRecursive 1.325 ± 0.016 1.307 1.353 1.00
pr_levm_FactorialRecursive 6.208 ± 0.041 6.148 6.267 4.68 ± 0.06

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 152.4 ± 1.3 151.5 155.9 1.00 ± 0.01
main_levm_Fibonacci 223.0 ± 5.5 218.6 236.0 1.47 ± 0.04
pr_revm_Fibonacci 152.0 ± 0.6 150.9 152.9 1.00
pr_levm_Fibonacci 227.1 ± 14.8 219.0 268.3 1.49 ± 0.10

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 728.4 ± 9.0 715.8 749.3 1.16 ± 0.03
main_levm_FibonacciRecursive 629.6 ± 11.7 597.6 638.0 1.00
pr_revm_FibonacciRecursive 722.6 ± 3.6 716.3 727.4 1.15 ± 0.02
pr_levm_FibonacciRecursive 637.5 ± 12.8 627.8 672.2 1.01 ± 0.03

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 7.7 ± 0.0 7.6 7.7 1.00
main_levm_ManyHashes 8.7 ± 0.2 8.4 9.1 1.13 ± 0.03
pr_revm_ManyHashes 7.7 ± 0.0 7.7 7.8 1.01 ± 0.01
pr_levm_ManyHashes 8.6 ± 0.2 8.4 8.9 1.12 ± 0.02

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 258.8 ± 5.2 255.6 273.3 1.09 ± 0.02
main_levm_MstoreBench 237.6 ± 1.3 235.9 240.1 1.00
pr_revm_MstoreBench 260.1 ± 10.5 256.2 290.0 1.09 ± 0.04
pr_levm_MstoreBench 237.9 ± 3.0 236.1 246.0 1.00 ± 0.01

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 244.2 ± 5.2 241.4 258.7 1.01 ± 0.02
main_levm_Push 320.0 ± 12.4 313.2 355.2 1.32 ± 0.05
pr_revm_Push 242.8 ± 1.1 241.9 245.0 1.00
pr_levm_Push 319.7 ± 12.8 313.9 356.1 1.32 ± 0.05

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 144.9 ± 4.3 142.4 155.3 1.89 ± 0.06
main_levm_SstoreBench_no_opt 79.6 ± 6.3 76.0 95.4 1.04 ± 0.08
pr_revm_SstoreBench_no_opt 143.6 ± 0.9 142.3 145.3 1.87 ± 0.02
pr_levm_SstoreBench_no_opt 76.6 ± 0.5 75.7 77.3 1.00

@github-actions
Copy link

github-actions bot commented Dec 22, 2025

Lines of code report

Total lines added: 13
Total lines removed: 2
Total lines changed: 15

Detailed view
+---------------------------------------------+-------+------+
| File                                        | Lines | Diff |
+---------------------------------------------+-------+------+
| ethrex/crates/l2/prover/src/backend/zisk.rs | 136   | -2   |
+---------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/precompiles.rs    | 1688  | +13  |
+---------------------------------------------+-------+------+

@xqft xqft changed the title chore(l2): bump ZisK to 0.15.0 chore(l2): bump ZisK to 0.15.0 & add modexp syscall Dec 22, 2025
@xqft xqft marked this pull request as ready for review December 22, 2025 15:46
@xqft xqft requested review from a team, ManuelBilbao and avilagaston9 as code owners December 22, 2025 15:46
Comment on lines -678 to 694
let base_mod = base % &modulus; // malachite requires base to be reduced to modulus first
base_mod.mod_pow(&exponent, &modulus)
#[cfg(not(feature = "zisk"))]
{
let base_mod = base % &modulus; // malachite requires base to be reduced to modulus first
base_mod.mod_pow(&exponent, &modulus)
}

#[cfg(feature = "zisk")]
{
use ziskos::zisklib::modexp_u64;
let (mut base, mut exponent, mut modulus) = (base, exponent, modulus);
let base_limbs = base.to_limbs_asc();
let exponent_limbs = exponent.to_limbs_asc();
let modulus_limbs = modulus.to_limbs_asc();
let result_limbs = modexp_u64(&base_limbs, &exponent_limbs, &modulus_limbs);
Natural::from_owned_limbs_asc(result_limbs)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Two things:

  1. Try not to put these implementations ad-hoc, as it quickly grows with different provers;
  2. I think we were using target_vendor rather than feature flags for this.

Copy link
Contributor Author

@xqft xqft Dec 23, 2025

Choose a reason for hiding this comment

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

Yes, at some point we would need to create a module, maybe in ethrex-crypto, to refactor the syscalls and patched crates.

Initially I tried using

#[cfg(all(target_os = "zkvm", target_vendor = "zisk"))]

which I copied from a ZisK patched crate here, but when compiling the guest program it seems to not enable the ZisK path of the code because I had a snippet that didn't compile but the guest compiled anyways. We also lose linting (CI workflows use feature flags).

Considering that currently we are not using target_vendor anywhere in the codebase for zkVMs precompiles, we could leave for a future PR the task of:

  1. Changing all precompile conditional compilation cases from feature flags to target_vendor
  2. Have some kind of feedback to make sure we are compiling the right path for each case
  3. Change the CI workflows to have linting in those cases

Because I think these are out of scope of this PR

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with this but I'd rather prefer to address it all in one single PR later.

@ilitteri ilitteri requested a review from Oppen December 23, 2025 18:05
@ilitteri ilitteri added this pull request to the merge queue Dec 23, 2025
Merged via the queue into main with commit 94386ea Dec 23, 2025
60 of 61 checks passed
@ilitteri ilitteri deleted the bump_zisk branch December 23, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L2 Rollup client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants