Change all ulong to long
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
@@ -203,8 +203,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
var rnd = new InsecureRandom();
ZeroCredentialPool zeroAmountCredentials = new();
ZeroCredentialPool zeroVsizeCredentials = new();
- var amountClient = new WabiSabiClient(round.AmountCredentialIssuerParameters, rnd, 4300000000000ul, zeroAmountCredentials);
- var vsizeClient = new WabiSabiClient(round.VsizeCredentialIssuerParameters, rnd, 2000ul, zeroVsizeCredentials);
+ var amountClient = new WabiSabiClient(round.AmountCredentialIssuerParameters, rnd, 4300000000000l, zeroAmountCredentials);
+ var vsizeClient = new WabiSabiClient(round.VsizeCredentialIssuerParameters, rnd, 2000l, zeroVsizeCredentials);
var apiClient = new ArenaClient(amountClient, vsizeClient, wabiSabiApi);
round.SetPhase(Phase.TransactionSigning);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/CredentialDependencyTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/CredentialDependencyTests.cs
@@ -16,8 +16,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
public async void AsyncDependencyGraphTraversalAsync()
{
var g = DependencyGraph.ResolveCredentialDependencies(
- inputValues: new[] { new ulong[] { 10000, 1930 }, new ulong[] { 1000, 1930 } },
- outputValues: new[] { new ulong[] { 5000, 31 }, new ulong[] { 3500, 31 }, new ulong[] { 2500, 31 } });
+ inputValues: new[] { new long[] { 10000, 1930 }, new long[] { 1000, 1930 } },
+ outputValues: new[] { new long[] { 5000, 31 }, new long[] { 3500, 31 }, new long[] { 2500, 31 } });
await SimulateAsyncRequestsAsync(g);
}
@@ -28,7 +28,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
{
// Keep track of the partial sets credentials to present. Requests
// that are keys in this dictionary are still waiting to be sent.
- var pendingCredentialsToPresent = g.Vertices.ToDictionary(v => v, _ => DependencyGraph.CredentialTypes.ToDictionary(t => t, _ => new List<ulong>()));
+ var pendingCredentialsToPresent = g.Vertices.ToDictionary(v => v, _ => DependencyGraph.CredentialTypes.ToDictionary(t => t, _ => new List<long>()));
// A waiting request is blocked if either set of credentials that
// need to be presented is incomplete. Since input registrations and
@@ -37,7 +37,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
ImmutableArray<RequestNode> UnblockedRequests() => pendingCredentialsToPresent.Keys.Where(node => DependencyGraph.CredentialTypes.All(t => g.InDegree(node, t) == pendingCredentialsToPresent[node][t].Count)).ToImmutableArray();
// Also keep track of the in-flight requests
- var inFlightRequests = new List<(Task<ImmutableSortedDictionary<CredentialType, IEnumerable<ulong>>> Task, ImmutableSortedDictionary<CredentialType, IEnumerable<CredentialDependency>> Dependencies)>();
+ var inFlightRequests = new List<(Task<ImmutableSortedDictionary<CredentialType, IEnumerable<long>>> Task, ImmutableSortedDictionary<CredentialType, IEnumerable<CredentialDependency>> Dependencies)>();
// And all sent requests, for testing purposes.
var sent = new HashSet<RequestNode>();
@@ -45,11 +45,11 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
var rng = new Random();
// Simulate sending a request. Instead of actual Credential objects,
- // credentials are just represented as ulongs.
- async Task<ImmutableSortedDictionary<CredentialType, IEnumerable<ulong>>> SimulateRequest(
+ // credentials are just represented as longs.
+ async Task<ImmutableSortedDictionary<CredentialType, IEnumerable<long>>> SimulateRequest(
RequestNode node,
- ImmutableSortedDictionary<CredentialType, IEnumerable<ulong>> presented,
- ImmutableSortedDictionary<CredentialType, IEnumerable<ulong>> requested)
+ ImmutableSortedDictionary<CredentialType, IEnumerable<long>> presented,
+ ImmutableSortedDictionary<CredentialType, IEnumerable<long>> requested)
{
foreach (var credentialType in presented.Keys)
{
@@ -126,8 +126,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
{
// Whitebox test of simple case, ensuring that edge values are
// correct
- var inputValues = new ulong[][] { new[] { 3UL, 3UL } };
- var outputValues = new ulong[][] { new[] { 1UL, 1UL }, new[] { 1UL, 1UL }, new[] { 1UL, 1UL } };
+ var inputValues = new long[][] { new[] { 3L, 3L } };
+ var outputValues = new long[][] { new[] { 1L, 1L }, new[] { 1L, 1L }, new[] { 1L, 1L } };
var g = DependencyGraph.ResolveCredentialDependencies(inputValues, outputValues);
Assert.Equal(5, g.Vertices.Count);
@@ -138,17 +138,17 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
Assert.Equal(2, edges.Where(x => x.Value > 0).Count());
var small = edges.OrderByDescending(e => e.Value).Skip(1).First();
- Assert.Equal(1UL, small.Value);
+ Assert.Equal(1L, small.Value);
Assert.Equal(g.Vertices[3], small.To);
Assert.Empty(g.OutEdges(small.To, CredentialType.Amount));
Assert.Equal(2, g.InEdges(small.To, CredentialType.Amount).Count());
- Assert.Equal(1, g.InEdges(small.To, CredentialType.Amount).Select(e => e.From).Distinct().Count());
+ Assert.Single(g.InEdges(small.To, CredentialType.Amount).Select(e => e.From).Distinct());
Assert.Empty(g.OutEdges(small.To, CredentialType.Vsize));
Assert.Equal(2, g.InEdges(small.To, CredentialType.Vsize).Count());
Assert.Equal(g.Vertices[0], g.InEdges(small.To, CredentialType.Vsize).Select(e => e.From).Distinct().Single());
var large = edges.OrderByDescending(e => e.Value).First();
- Assert.Equal(2UL, large.Value);
+ Assert.Equal(2L, large.Value);
Assert.Equal(2, g.InEdges(large.To, CredentialType.Amount).Count());
Assert.Equal(1, g.InEdges(large.To, CredentialType.Amount).Select(e => e.From).Distinct().Count());
@@ -162,8 +162,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
[Fact]
public void ResolveCredentialDependenciesNoVsize()
{
- var inputValues = new ulong[][] { new[] { 1UL, 0UL } };
- var outputValues = new ulong[][] { new[] { 1UL, 0UL } };
+ var inputValues = new long[][] { new[] { 1L, 0L } };
+ var outputValues = new long[][] { new[] { 1L, 0L } };
var g = DependencyGraph.ResolveCredentialDependencies(inputValues, outputValues);
Assert.Equal(2, g.Vertices.Count);
@@ -171,10 +171,10 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
var edges = g.OutEdges(g.Vertices[0], CredentialType.Amount);
Assert.Equal(2, edges.Count());
- Assert.Equal(1, edges.Where(x => x.Value > 0).Count());
+ Assert.Single(edges.Where(x => x.Value > 0));
var nonZeroEdge = edges.OrderByDescending(e => e.Value).First();
- Assert.Equal(1UL, nonZeroEdge.Value);
+ Assert.Equal(1L, nonZeroEdge.Value);
Assert.Equal(g.Vertices[1], nonZeroEdge.To);
Assert.Empty(g.OutEdges(nonZeroEdge.To, CredentialType.Amount));
Assert.Equal(2, g.InEdges(nonZeroEdge.To, CredentialType.Amount).Count());
@@ -263,8 +263,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
// of inputs with various corner cases that must be handled.
// Parse values out of strings because InputData can't contain arrays
- var inputValues = inputs.Split(" ").Select(x => x.Split(",").Select(y => ulong.Parse(y)));
- var outputValues = outputs.Split(" ").Select(x => x.Split(",").Select(y => ulong.Parse(y)));
+ var inputValues = inputs.Split(" ").Select(x => x.Split(",").Select(y => long.Parse(y)));
+ var outputValues = outputs.Split(" ").Select(x => x.Split(",").Select(y => long.Parse(y)));
var g = DependencyGraph.ResolveCredentialDependencies(inputValues, outputValues);
@@ -280,7 +280,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
await SimulateAsyncRequestsAsync(g);
}
- private void AssertResolvedGraphInvariants(DependencyGraph graph, IEnumerable<IEnumerable<ulong>> inputValues, IEnumerable<IEnumerable<ulong>> outputValues)
+ private void AssertResolvedGraphInvariants(DependencyGraph graph, IEnumerable<IEnumerable<long>> inputValues, IEnumerable<IEnumerable<long>> outputValues)
{
foreach (var credentialType in DependencyGraph.CredentialTypes)
{
@@ -338,7 +338,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
// Ensure that vsize credentials do not exceed the range proof width
foreach (var edge in graph.EdgeSets[CredentialType.Vsize].Successors.Values.SelectMany(x => x))
{
- Assert.InRange<ulong>(edge.Value, 0, ProtocolConstants.MaxVsizeCredentialValue);
+ Assert.InRange<long>(edge.Value, 0, ProtocolConstants.MaxVsizeCredentialValue);
}
// TODO add InlineData param for max depth?
@@ -349,14 +349,14 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
[Fact]
public void ResolveCredentialDependenciesThrows()
{
- foreach ((var inputValues, var outputAmounts) in new (ulong[][], ulong[][])[]
+ foreach ((var inputValues, var outputAmounts) in new (long[][], long[][])[]
{
- (new[] { new[] { 1UL, 0UL } }, new[] { new[] { 2UL, 0UL } }),
- (new[] { Array.Empty<ulong>() }, new[] { new[] { 1UL, 0UL } }),
- (new[] { new[] { 1UL } }, new[] { new[] { 1UL, 0UL } }),
- (new[] { new[] { 1UL, 1UL, 1UL, } }, new[] { new[] { 1UL, 0UL } }),
- (new[] { new[] { 1UL, 0UL } }, new[] { new[] { 1UL } }),
- (new[] { new[] { 1UL, 0UL } }, new[] { new[] { 1UL, 0UL, 0UL } }),
+ (new[] { new[] { 1L, 0L } }, new[] { new[] { 2L, 0L } }),
+ (new[] { Array.Empty<long>() }, new[] { new[] { 1L, 0L } }),
+ (new[] { new[] { 1L } }, new[] { new[] { 1L, 0L } }),
+ (new[] { new[] { 1L, 1L, 1L, } }, new[] { new[] { 1L, 0L } }),
+ (new[] { new[] { 1L, 0L } }, new[] { new[] { 1L } }),
+ (new[] { new[] { 1L, 0L } }, new[] { new[] { 1L, 0L, 0L } }),
})
{
Assert.Throws<ArgumentException>(() => DependencyGraph.ResolveCredentialDependencies(inputValues, outputAmounts));
@@ -366,7 +366,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
[Fact]
public void EdgeConstraints()
{
- var g = DependencyGraph.FromValues(new[] { new ulong[] { 11, 0 }, new ulong[] { 8, 0 } }, new[] { new ulong[] { 7, 0 }, new ulong[] { 11, 0 } });
+ var g = DependencyGraph.FromValues(new[] { new long[] { 11, 0 }, new long[] { 8, 0 } }, new[] { new long[] { 7, 0 }, new long[] { 11, 0 } });
var i = g.Inputs[0];
var o = g.Outputs[0];

MODIFY
WalletWasabi/Crypto/Extensions.cs
WalletWasabi/Crypto/Extensions.cs
@@ -17,10 +17,10 @@ namespace System.Linq
groupElements.Aggregate(GroupElement.Infinity, (ge, acc) => ge + acc);
public static Money ToMoney(this Scalar scalar) =>
- Money.Satoshis(scalar.ToUlong());
+ Money.Satoshis(scalar.ToLong());
- public static ulong ToUlong(this Scalar scalar) =>
- ((ulong)scalar.d1 << 32) | scalar.d0;
+ public static long ToLong(this Scalar scalar) =>
+ ((long)scalar.d1 << 32) | scalar.d0;
public static IEnumerable<TResult> Zip<TFirst, TSecond, TThird, TResult>(this IEnumerable<TFirst> first, IEnumerable<TSecond> second, IEnumerable<TThird> third, Func<TFirst, TSecond, TThird, TResult> resultSelector)
{

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
@@ -25,7 +25,7 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
MaxVsizeAllocationPerAlice = MaxRegistrableVsize;
AmountCredentialIssuer = new(new(RoundParameters.Random), RoundParameters.Random, MaxRegistrableAmount);
- VsizeCredentialIssuer = new(new(RoundParameters.Random), RoundParameters.Random, (ulong)MaxRegistrableVsize);
+ VsizeCredentialIssuer = new(new(RoundParameters.Random), RoundParameters.Random, MaxRegistrableVsize);
AmountCredentialIssuerParameters = AmountCredentialIssuer.CredentialIssuerSecretKey.ComputeCredentialIssuerParameters();
VsizeCredentialIssuerParameters = VsizeCredentialIssuer.CredentialIssuerSecretKey.ComputeCredentialIssuerParameters();

MODIFY
WalletWasabi/WabiSabi/Client/ArenaClient.cs
WalletWasabi/WabiSabi/Client/ArenaClient.cs
@@ -74,13 +74,13 @@ namespace WalletWasabi.WabiSabi.Client
Guard.InRange(nameof(amountCredentialsToPresent), amountCredentialsToPresent, 0, AmountCredentialClient.NumberOfCredentials);
Guard.InRange(nameof(vsizeCredentialsToPresent), vsizeCredentialsToPresent, 0, VsizeCredentialClient.NumberOfCredentials);
- var presentedAmount = amountCredentialsToPresent.Sum(x => (long)x.Amount.ToUlong());
+ var presentedAmount = amountCredentialsToPresent.Sum(x => x.Amount.ToLong());
var (realAmountCredentialRequest, realAmountCredentialResponseValidation) = AmountCredentialClient.CreateRequest(
new[] { presentedAmount - amount },
amountCredentialsToPresent,
cancellationToken);
- var presentedVsize = vsizeCredentialsToPresent.Sum(x => (long)x.Amount.ToUlong());
+ var presentedVsize = vsizeCredentialsToPresent.Sum(x => x.Amount.ToLong());
var (realVsizeCredentialRequest, realVsizeCredentialResponseValidation) = VsizeCredentialClient.CreateRequest(
new[] { presentedVsize - scriptPubKey.EstimateOutputVsize() },
vsizeCredentialsToPresent,
@@ -110,13 +110,13 @@ namespace WalletWasabi.WabiSabi.Client
{
Guard.InRange(nameof(amountCredentialsToPresent), amountCredentialsToPresent, 0, AmountCredentialClient.NumberOfCredentials);
- var presentedAmount = amountCredentialsToPresent.Sum(x => (long)x.Amount.ToUlong());
+ var presentedAmount = amountCredentialsToPresent.Sum(x => x.Amount.ToLong());
if (amountsToRequest.Sum() != presentedAmount)
{
throw new InvalidOperationException($"Reissuence amounts must equal with the sum of the presented ones.");
}
- var presentedVsize = vsizeCredentialsToPresent.Sum(x => (long)x.Amount.ToUlong());
+ var presentedVsize = vsizeCredentialsToPresent.Sum(x => x.Amount.ToLong());
var (realVsizeCredentialRequest, realVsizeCredentialResponseValidation) = VsizeCredentialClient.CreateRequest(
vsizesToRequest,
vsizeCredentialsToPresent,

MODIFY
WalletWasabi/WabiSabi/Client/CredentialDependencies/CredentialDependency.cs
WalletWasabi/WabiSabi/Client/CredentialDependencies/CredentialDependency.cs
@@ -2,7 +2,7 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
{
public class CredentialDependency
{
- public CredentialDependency(RequestNode from, RequestNode to, CredentialType credentialType, ulong value)
+ public CredentialDependency(RequestNode from, RequestNode to, CredentialType credentialType, long value)
{
From = from;
To = to;
@@ -13,6 +13,6 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
public RequestNode From { get; }
public RequestNode To { get; }
public CredentialType CredentialType { get; }
- public ulong Value { get; }
+ public long Value { get; }
}
}

MODIFY
WalletWasabi/WabiSabi/Client/CredentialDependencies/CredentialEdgeSet.cs
WalletWasabi/WabiSabi/Client/CredentialDependencies/CredentialEdgeSet.cs
@@ -35,7 +35,7 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
public int AvailableZeroOutDegree(RequestNode node) => RemainingZeroOnlyOutDegree(node) + (RemainingOutDegree(node) - (Balance(node) > 0 ? 1 : 0));
- public CredentialEdgeSet AddEdge(RequestNode from, RequestNode to, ulong value)
+ public CredentialEdgeSet AddEdge(RequestNode from, RequestNode to, long value)
{
var edge = new CredentialDependency(from, to, CredentialType, value);
@@ -54,13 +54,13 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
else if (RemainingOutDegree(edge.From) == 1)
{
// This is the final out edge for the node edge.From
- if (Balance(edge.From) - (long)edge.Value > 0)
+ if (Balance(edge.From) - edge.Value > 0)
{
throw new InvalidOperationException($"Can't add final out edge without discharging positive value (edge value {edge.Value} but node balance is {Balance(edge.From)}).");
}
// If it's the final edge overall for that node, the final balance must be 0
- if (RemainingInDegree(edge.From) == 0 && Balance(edge.From) - (long)edge.Value != 0)
+ if (RemainingInDegree(edge.From) == 0 && Balance(edge.From) - edge.Value != 0)
{
throw new InvalidOperationException("Can't add final in edge without discharging negative value completely.");
}
@@ -81,13 +81,13 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
if (RemainingInDegree(edge.To) == 1)
{
// This is the final in edge for the node edge.To
- if (Balance(edge.To) + (long)edge.Value < 0)
+ if (Balance(edge.To) + edge.Value < 0)
{
throw new InvalidOperationException("Can't add final in edge without discharging negative value.");
}
// If it's the final edge overall for that node, the final balance must be 0
- if (RemainingOutDegree(edge.To) == 0 && Balance(edge.To) + (long)edge.Value != 0)
+ if (RemainingOutDegree(edge.To) == 0 && Balance(edge.To) + edge.Value != 0)
{
throw new InvalidOperationException("Can't add final in edge without discharging negative value completely.");
}
@@ -95,13 +95,12 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
if (RemainingOutDegree(edge.To) == 0)
{
- if (Balance(edge.To) + (long)edge.Value > 0)
+ if (Balance(edge.To) + edge.Value > 0)
{
throw new InvalidOperationException("Can't add edge with excess value to node with no remaining out degree.");
}
}
-
var predecessors = InEdges(edge.To);
var successors = OutEdges(edge.From);
@@ -112,8 +111,8 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
EdgeBalances = EdgeBalances.SetItems(
new KeyValuePair<RequestNode, long>[]
{
- new (edge.From, EdgeBalances[edge.From] - (long)edge.Value),
- new (edge.To, EdgeBalances[edge.To] + (long)edge.Value),
+ new (edge.From, EdgeBalances[edge.From] - edge.Value),
+ new (edge.To, EdgeBalances[edge.To] + edge.Value),
}),
};
}
@@ -193,11 +192,11 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
}
else if (value > 0)
{
- return AddEdge(node, reissuance, (ulong)value);
+ return AddEdge(node, reissuance, value);
}
else if (value < 0)
{
- return AddEdge(reissuance, node, (ulong)(-1 * value)).AddZeroEdges(reissuance, node);
+ return AddEdge(reissuance, node, (-1 * value)).AddZeroEdges(reissuance, node);
}
else if (InDegree(reissuance) == 0)
{
@@ -209,7 +208,9 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
// (it's guaranteed to be possible) to avoid crossing edges,
// even if there's no balance to discharge.
return AddZeroEdges(reissuance, node);
- } else {
+ }
+ else
+ {
return this;
}
}
@@ -238,13 +239,13 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
// Fan out, discharge the entire balance, adding zero edges if
// needed (might not be if the discharged node has already
// received an input edge in a previous pass).
- return AddEdge(node, dischargeNode, (ulong)Math.Min(Balance(node), -1 * value));
+ return AddEdge(node, dischargeNode, Math.Min(Balance(node), -1 * value));
}
else if (value > 0)
{
// Fan in, draining zero credentials is never necessary.
- var edgeAmount = (ulong)Math.Min(-1 * Balance(node), value);
- if (edgeAmount == (ulong)value || RemainingOutDegree(dischargeNode) > 1)
+ var edgeAmount = Math.Min(-1 * Balance(node), value);
+ if (edgeAmount == value || RemainingOutDegree(dischargeNode) > 1)
{
return AddEdge(dischargeNode, node, edgeAmount);
}

MODIFY
WalletWasabi/WabiSabi/Client/CredentialDependencies/DependencyGraph.cs
WalletWasabi/WabiSabi/Client/CredentialDependencies/DependencyGraph.cs
@@ -64,14 +64,14 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
var effectiveCosts = Enumerable.Zip(outputs, outputSizes, (txout, size) => txout.EffectiveCost(feerate));
return ResolveCredentialDependencies(
- Enumerable.Zip(effectiveValues.Select(a => (ulong)a.Satoshi), inputSizes.Select(i => (ulong)(vsizeAllocationPerInput - i)), ImmutableArray.Create).Cast<IEnumerable<ulong>>(),
- Enumerable.Zip(effectiveCosts.Select(a => (ulong)a.Satoshi), outputSizes.Select(i => (ulong)i), ImmutableArray.Create).Cast<IEnumerable<ulong>>()
+ Enumerable.Zip(effectiveValues.Select(a => a.Satoshi), inputSizes.Select(i => (vsizeAllocationPerInput - i)), ImmutableArray.Create).Cast<IEnumerable<long>>(),
+ Enumerable.Zip(effectiveCosts.Select(a => a.Satoshi), outputSizes.Select(i => (long)i), ImmutableArray.Create).Cast<IEnumerable<long>>()
);
}
- public static DependencyGraph ResolveCredentialDependencies(IEnumerable<IEnumerable<ulong>> inputValues, IEnumerable<IEnumerable<ulong>> outputValues)
+ public static DependencyGraph ResolveCredentialDependencies(IEnumerable<IEnumerable<long>> inputValues, IEnumerable<IEnumerable<long>> outputValues)
=> FromValues(inputValues, outputValues).ResolveCredentials();
- public static DependencyGraph FromValues(IEnumerable<IEnumerable<ulong>> inputValues, IEnumerable<IEnumerable<ulong>> outputValues)
+ public static DependencyGraph FromValues(IEnumerable<IEnumerable<long>> inputValues, IEnumerable<IEnumerable<long>> outputValues)
{
if (Enumerable.Concat(inputValues, outputValues).Any(x => x.Count() != CredentialTypes.Count()))
{
@@ -80,7 +80,7 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
foreach (var credentialType in CredentialTypes)
{
- long CredentialTypeValue(IEnumerable<ulong> x) => (long)x.ElementAt((int)credentialType);
+ long CredentialTypeValue(IEnumerable<long> x) => x.ElementAt((int)credentialType);
if (inputValues.Sum(CredentialTypeValue) < outputValues.Sum(CredentialTypeValue))
{
@@ -112,20 +112,20 @@ namespace WalletWasabi.WabiSabi.Client.CredentialDependencies
// early but using it implies connection confirmations may have
// dependencies, posing some complexity for a privacy preserving
// approach.
- private DependencyGraph AddInput(IEnumerable<ulong> values)
+ private DependencyGraph AddInput(IEnumerable<long> values)
{
- var node = new InputNode(values.Select(y => (long)y));
+ var node = new InputNode(values.Select(y => y));
return (this with { Inputs = Inputs.Add(node) }).AddNode(node);
}
- private DependencyGraph AddOutput(IEnumerable<ulong> values)
+ private DependencyGraph AddOutput(IEnumerable<long> values)
{
- var node = new OutputNode(values.Select(y => -1 * (long)y));
+ var node = new OutputNode(values.Select(y => -1 * y));
return (this with { Outputs = Outputs.Add(node) }).AddNode(node);
}
- private DependencyGraph AddInputs(IEnumerable<IEnumerable<ulong>> values) => values.Aggregate(this, (g, v) => g.AddInput(v));
+ private DependencyGraph AddInputs(IEnumerable<IEnumerable<long>> values) => values.Aggregate(this, (g, v) => g.AddInput(v));
- private DependencyGraph AddOutputs(IEnumerable<IEnumerable<ulong>> values) => values.Aggregate(this, (g, v) => g.AddOutput(v));
+ private DependencyGraph AddOutputs(IEnumerable<IEnumerable<long>> values) => values.Aggregate(this, (g, v) => g.AddOutput(v));
private (DependencyGraph, RequestNode) AddReissuance()
{

MODIFY
WalletWasabi/WabiSabi/Client/SmartRequestNode.cs
WalletWasabi/WabiSabi/Client/SmartRequestNode.cs
@@ -134,7 +134,7 @@ namespace WalletWasabi.WabiSabi.Client
return nonZeroValues;
}
- var missing = presentedCredentials.Sum(cr => (long)cr.Amount.ToUlong()) - valuesToRequest.Sum();
+ var missing = presentedCredentials.Sum(cr => cr.Amount.ToLong()) - valuesToRequest.Sum();
if (missing > 0)
{

MODIFY
WalletWasabi/WabiSabi/Crypto/CredentialIssuer.cs
WalletWasabi/WabiSabi/Crypto/CredentialIssuer.cs
@@ -51,7 +51,7 @@ namespace WalletWasabi.WabiSabi.Crypto
public CredentialIssuer(
CredentialIssuerSecretKey credentialIssuerSecretKey,
WasabiRandom randomNumberGenerator,
- ulong maxAmount)
+ long maxAmount)
{
MaxAmount = maxAmount;
RangeProofWidth = (int)Math.Ceiling(Math.Log2(MaxAmount));
@@ -60,7 +60,7 @@ namespace WalletWasabi.WabiSabi.Crypto
RandomNumberGenerator = Guard.NotNull(nameof(randomNumberGenerator), randomNumberGenerator);
}
- public ulong MaxAmount { get; }
+ public long MaxAmount { get; }
public int RangeProofWidth { get; }

MODIFY
WalletWasabi/WabiSabi/Crypto/WabiSabiClient.cs
WalletWasabi/WabiSabi/Crypto/WabiSabiClient.cs
@@ -24,7 +24,7 @@ namespace WalletWasabi.WabiSabi.Crypto
public WabiSabiClient(
CredentialIssuerParameters credentialIssuerParameters,
WasabiRandom randomNumberGenerator,
- ulong rangeProofUpperBound,
+ long rangeProofUpperBound,
ZeroCredentialPool zeroCredentialPool)
{
RangeProofWidth = (int)Math.Ceiling(Math.Log2(rangeProofUpperBound));
@@ -158,7 +158,7 @@ namespace WalletWasabi.WabiSabi.Crypto
var transcript = BuildTransnscript(isNullRequest: false);
return new(
new RealCredentialsRequest(
- amountsToRequest.Sum() - credentialsToPresent.Sum(x => (long)x.Amount.ToUlong()),
+ amountsToRequest.Sum() - credentialsToPresent.Sum(x => x.Amount.ToLong()),
presentations,
credentialsToRequest,
ProofSystem.Prove(transcript, knowledgeToProve, RandomNumberGenerator)),

MODIFY
WalletWasabi/WabiSabi/Models/RoundState.cs
WalletWasabi/WabiSabi/Models/RoundState.cs
@@ -41,9 +41,9 @@ namespace WalletWasabi.WabiSabi.Models
};
public WabiSabiClient CreateAmountCredentialClient(ZeroCredentialPool zeroAmountCredentialPool, WasabiRandom random) =>
- new(AmountCredentialIssuerParameters, random, (ulong)MaxRegistrableAmount, zeroAmountCredentialPool);
+ new(AmountCredentialIssuerParameters, random, MaxRegistrableAmount, zeroAmountCredentialPool);
public WabiSabiClient CreateVsizeCredentialClient(ZeroCredentialPool zeroVsizeCredentialPool, WasabiRandom random) =>
- new(VsizeCredentialIssuerParameters, random, (ulong)MaxRegistrableVsize, zeroVsizeCredentialPool);
+ new(VsizeCredentialIssuerParameters, random, MaxRegistrableVsize, zeroVsizeCredentialPool);
}
}

Change all ulong to long