Let it overflow.
MODIFY
WalletWasabi.Tests/UnitTests/Crypto/ZeroKnowledge/ZkExponentTests.cs
WalletWasabi.Tests/UnitTests/Crypto/ZeroKnowledge/ZkExponentTests.cs
@@ -127,9 +127,6 @@ namespace WalletWasabi.Tests.UnitTests.Crypto.ZeroKnowledge
Assert.Throws<ArgumentOutOfRangeException>(() => new ZkExponentProof(GroupElement.Infinity, point2, scalar));
Assert.Throws<ArgumentOutOfRangeException>(() => new ZkExponentProof(point1, GroupElement.Infinity, scalar));
- Assert.Throws<ArgumentOutOfRangeException>(() => new ZkExponentProof(point1, point2, EC.N));
- Assert.Throws<ArgumentOutOfRangeException>(() => new ZkExponentProof(point1, point2, LargestScalarOverflow));
-
Assert.Throws<InvalidOperationException>(() => new ZkExponentProof(point1, point1, scalar));
}
}

MODIFY
WalletWasabi/Crypto/GroupElement.cs
WalletWasabi/Crypto/GroupElement.cs
@@ -86,26 +86,14 @@ namespace WalletWasabi.Crypto
}
public static GroupElement operator +(GroupElement a, GroupElement b)
- {
- Guard.NotNull(nameof(a), a);
- Guard.NotNull(nameof(b), b);
-
- return new GroupElement(a.Ge.ToGroupElementJacobian().AddVariable(b.Ge, out _));
- }
+ => new GroupElement(a.Ge.ToGroupElementJacobian().AddVariable(b.Ge, out _));
public static GroupElement operator -(GroupElement a, GroupElement b)
- {
- Guard.NotNull(nameof(a), a);
- Guard.NotNull(nameof(b), b);
-
- return a + new GroupElement(b.Ge.Negate());
- }
+ => a + new GroupElement(b.Ge.Negate());
/// <param name="scalar">It's ok for the scalar to overflow.</param>
public static GroupElement operator *(Scalar scalar, GroupElement groupElement)
{
- Guard.NotNull(nameof(GroupElement), groupElement);
-
// For some strange reason scalar * GE.Infinity isn't infinity. Let's fix it as it should be, since:
// 2 * GE.Infinity = GE.Infinity + GE.Infinity = GE.Infinity.
if (groupElement.IsInfinity)

MODIFY
WalletWasabi/Crypto/ZeroKnowledge/ZkExponentProof.cs
WalletWasabi/Crypto/ZeroKnowledge/ZkExponentProof.cs
@@ -13,7 +13,7 @@ namespace WalletWasabi.Crypto.ZeroKnowledge
Guard.False($"{nameof(publicPoint)}.{nameof(publicPoint.IsInfinity)}", publicPoint.IsInfinity);
Guard.False($"{nameof(randomPoint)}.{nameof(randomPoint.IsInfinity)}", randomPoint.IsInfinity);
Guard.False($"{nameof(response)}.{nameof(response.IsZero)}", response.IsZero);
- Guard.False($"{nameof(response)}.{nameof(response.IsOverflow)}", response.IsOverflow);
+
if (publicPoint == randomPoint)
{
throw new InvalidOperationException($"{nameof(publicPoint)} and {nameof(randomPoint)} should not be equal.");

Let it overflow.