ArenaClient creates WabiSabiClients
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
@@ -40,15 +40,9 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
});
await using var coordinator = new ArenaRequestHandler(config, new Prison(), arena, mockRpc.Object);
- var rnd = new InsecureRandom();
- var amountCredentials = new CredentialPool();
- var weightCredentials = new CredentialPool();
- var protocolCredentialNumber = 2;
- var protocolMaxWeightPerAlice = 1_000L;
- var amountClient = new WabiSabiClient(round.AmountCredentialIssuerParameters, protocolCredentialNumber, rnd, 4_300_000_000_000ul, amountCredentials);
- var weightClient = new WabiSabiClient(round.WeightCredentialIssuerParameters, protocolCredentialNumber, rnd, (ulong)protocolMaxWeightPerAlice, weightCredentials);
-
- var apiClient = new ArenaClient(amountClient, weightClient, coordinator);
+ var apiClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.WeightCredentialIssuerParameters, coordinator, new InsecureRandom());
+ var amountCredentials = apiClient.AmountCredentialClient.Credentials;
+ var weightCredentials = apiClient.WeightCredentialClient.Credentials;
var aliceId = await apiClient.RegisterInputAsync(Money.Coins(1m), outpoint, key, round.Id, round.Hash);
@@ -62,14 +56,14 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
};
var inputWeight = 4 * Constants.P2wpkhInputVirtualSize;
- var inputRemainingWeights = new[] { protocolMaxWeightPerAlice - inputWeight };
+ var inputRemainingWeights = new[] { (long)ArenaClient.ProtocolMaxWeightPerAlice - inputWeight };
// Phase: Input Registration
await apiClient.ConfirmConnectionAsync(
round.Id,
aliceId,
inputRemainingWeights,
- amountCredentials.ZeroValue.Take(protocolCredentialNumber),
+ amountCredentials.ZeroValue.Take(ArenaClient.ProtocolCredentialNumber),
reissuanceAmounts);
Assert.Empty(amountCredentials.Valuable);
@@ -80,7 +74,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
round.Id,
aliceId,
inputRemainingWeights,
- amountCredentials.ZeroValue.Take(protocolCredentialNumber),
+ amountCredentials.ZeroValue.Take(ArenaClient.ProtocolCredentialNumber),
reissuanceAmounts);
Assert.Single(amountCredentials.Valuable, x => x.Amount.ToMoney() == reissuanceAmounts.First());

MODIFY
WalletWasabi/WabiSabi/Client/ArenaClient.cs
WalletWasabi/WabiSabi/Client/ArenaClient.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WalletWasabi.Crypto;
+using WalletWasabi.Crypto.Randomness;
using WalletWasabi.Crypto.ZeroKnowledge;
using WalletWasabi.Helpers;
using WalletWasabi.WabiSabi.Backend.PostRequests;
@@ -14,6 +15,24 @@ namespace WalletWasabi.WabiSabi.Client
{
public class ArenaClient
{
+ public static readonly int ProtocolCredentialNumber = 2;
+ public static readonly ulong ProtocolMaxAmountPerAlice = 4_300_000_000_000ul;
+ public static readonly ulong ProtocolMaxWeightPerAlice = 1_000ul;
+
+ public ArenaClient(
+ CredentialIssuerParameters amountCredentialIssuerParameters,
+ CredentialIssuerParameters weightCredentialIssuerParameters,
+ IArenaRequestHandler requestHandler,
+ WasabiRandom random)
+ {
+ var amountCredentials = new CredentialPool();
+ var weightCredentials = new CredentialPool();
+
+ AmountCredentialClient = new WabiSabiClient(amountCredentialIssuerParameters, ProtocolCredentialNumber, random, ProtocolMaxAmountPerAlice, amountCredentials);
+ WeightCredentialClient = new WabiSabiClient(weightCredentialIssuerParameters, ProtocolCredentialNumber, random, ProtocolMaxWeightPerAlice, weightCredentials);
+ RequestHandler = requestHandler;
+ }
+
public ArenaClient(WabiSabiClient amountCredentialClient, WabiSabiClient weightCredentialClient, IArenaRequestHandler requestHandler)
{
AmountCredentialClient = amountCredentialClient;

ArenaClient creates WabiSabiClients