diff --git a/src/Nethermind/Directory.Packages.props b/src/Nethermind/Directory.Packages.props
index f3cb0784482..1e9b9594a48 100644
--- a/src/Nethermind/Directory.Packages.props
+++ b/src/Nethermind/Directory.Packages.props
@@ -45,7 +45,7 @@
-
+
diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/PairingCheckPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/PairingCheckPrecompile.cs
index 6be90e9054a..08661cdb03f 100644
--- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/PairingCheckPrecompile.cs
+++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/PairingCheckPrecompile.cs
@@ -19,6 +19,7 @@ namespace Nethermind.Evm.Precompiles.Bls;
public class PairingCheckPrecompile : IPrecompile
{
private const int PairSize = 384;
+ private const int PrecomputeLinesSize = 6 * 6 * 68;
public static readonly PairingCheckPrecompile Instance = new();
private PairingCheckPrecompile() { }
@@ -42,9 +43,12 @@ private PairingCheckPrecompile() { }
G1 x = new(stackalloc long[G1.Sz]);
G2 y = new(stackalloc long[G2.Sz]);
- using ArrayPoolList buf = new(GT.Sz * 2, GT.Sz * 2);
+ int sz = GT.Sz * 2 + PrecomputeLinesSize;
+ using ArrayPoolList buf = new(sz, sz);
+
var acc = GT.One(buf.AsSpan());
- GT p = new(buf.AsSpan()[GT.Sz..]);
+ GT p = new(buf.AsSpan()[GT.Sz..(GT.Sz * 2)]);
+ Span lines = buf.AsSpan()[(GT.Sz * 2)..];
for (int i = 0; i < inputData.Length / PairSize; i++)
{
@@ -64,7 +68,8 @@ private PairingCheckPrecompile() { }
continue;
}
- p.MillerLoop(y, x);
+ y.ToAffine().PrecomputeLines(lines);
+ p.MillerLoopLines(lines, x.ToAffine());
acc.Mul(p);
}