Use Vsize instead of WU for Alice quotas
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputFailureTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputFailureTests.cs
@@ -365,7 +365,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
[Fact]
public async Task TooMuchWeightAsync()
{
- WabiSabiConfig cfg = new() { RegistrableWeightCredentials = 1 };
+ WabiSabiConfig cfg = new() { PerAliceVsizeAllocation = 1 };
var round = WabiSabiFactory.CreateRound(cfg);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
using Key key = new();

MODIFY
WalletWasabi/WabiSabi/Backend/PostRequests/InputRegistrationHandler.cs
WalletWasabi/WabiSabi/Backend/PostRequests/InputRegistrationHandler.cs
@@ -113,7 +113,7 @@ namespace WalletWasabi.WabiSabi.Backend.PostRequests
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.TooMuchFunds);
}
- if (alice.TotalInputVsize > round.RegistrableWeightCredentials)
+ if (alice.TotalInputVsize > round.PerAliceVsizeAllocation)
{
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.TooMuchWeight);
}
@@ -123,7 +123,7 @@ namespace WalletWasabi.WabiSabi.Backend.PostRequests
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.WrongPhase);
}
- if (round.RemainingInputVsizeAllocation < (round.RegistrableWeightCredentials+3)/4) // TODO standardize on vsize
+ if (round.RemainingInputVsizeAllocation < round.PerAliceVsizeAllocation)
{
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.TooMuchTotalWeight);
}

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
@@ -29,7 +29,7 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
Coinjoin = Transaction.Create(Network);
- Hash = new(HashHelpers.GenerateSha256Hash($"{Id}{MaxInputCountByAlice}{MinRegistrableAmount}{MaxRegistrableAmount}{RegistrableWeightCredentials}{AmountCredentialIssuerParameters}{WeightCredentialIssuerParameters}{FeeRate.SatoshiPerByte}"));
+ Hash = new(HashHelpers.GenerateSha256Hash($"{Id}{MaxInputCountByAlice}{MinRegistrableAmount}{MaxRegistrableAmount}{PerAliceVsizeAllocation}{AmountCredentialIssuerParameters}{WeightCredentialIssuerParameters}{FeeRate.SatoshiPerByte}"));
}
public uint256 Hash { get; }
@@ -37,7 +37,8 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
public uint MaxInputCountByAlice => RoundParameters.MaxInputCountByAlice;
public Money MinRegistrableAmount => RoundParameters.MinRegistrableAmount;
public Money MaxRegistrableAmount => RoundParameters.MaxRegistrableAmount;
- public uint RegistrableWeightCredentials => RoundParameters.RegistrableWeightCredentials;
+ public uint PerAliceVsizeAllocation => RoundParameters.PerAliceVsizeAllocation;
+ public uint RegistrableWeightCredentials => 4 * PerAliceVsizeAllocation; // TODO remove weight
public FeeRate FeeRate => RoundParameters.FeeRate;
public WasabiRandom Random => RoundParameters.Random;
public CredentialIssuer AmountCredentialIssuer { get; }
@@ -66,7 +67,7 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
public DateTimeOffset TransactionSigningStart { get; private set; }
public DateTimeOffset TransactionBroadcastingStart { get; private set; }
public int InitialInputVsizeAllocation { get; set; } = 99954; // TODO compute as CoinjoinState.Parameters.MaxWeight - CoinjoinState.Parameters.SharedOverhead, mutable for testing until then
- public int RemainingInputVsizeAllocation => InitialInputVsizeAllocation - Alices.Count() * (int)((RegistrableWeightCredentials+3)/4); // TODO remove weight
+ public int RemainingInputVsizeAllocation => InitialInputVsizeAllocation - Alices.Count * (int)PerAliceVsizeAllocation;
public void SetPhase(Phase phase)
{

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/RoundParameters.cs
WalletWasabi/WabiSabi/Backend/Rounds/RoundParameters.cs
@@ -24,7 +24,7 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
MaxInputCountByAlice = wabiSabiConfig.MaxInputCountByAlice;
MinRegistrableAmount = wabiSabiConfig.MinRegistrableAmount;
MaxRegistrableAmount = wabiSabiConfig.MaxRegistrableAmount;
- RegistrableWeightCredentials = wabiSabiConfig.RegistrableWeightCredentials;
+ PerAliceVsizeAllocation = wabiSabiConfig.PerAliceVsizeAllocation;
// Note that input registration timeouts can be modified runtime.
ConnectionConfirmationTimeout = wabiSabiConfig.ConnectionConfirmationTimeout;
@@ -47,7 +47,7 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
public uint MaxInputCountByAlice { get; }
public Money MinRegistrableAmount { get; }
public Money MaxRegistrableAmount { get; }
- public uint RegistrableWeightCredentials { get; }
+ public uint PerAliceVsizeAllocation { get; }
public Round? BlameOf { get; }
public bool IsBlameRound { get; }
public ISet<OutPoint> BlameWhitelist { get; }

MODIFY
WalletWasabi/WabiSabi/Backend/WabiSabiConfig.cs
WalletWasabi/WabiSabi/Backend/WabiSabiConfig.cs
@@ -53,14 +53,14 @@ namespace WalletWasabi.WabiSabi.Backend
public Money MaxRegistrableAmount { get; set; } = Money.Coins(43_000m);
/// <summary>
- /// How much weight units the server gives to alices per registrations.
- /// If it's 1000, then about 400 alices can participate.
+ /// How many virtual bytes the server gives to alices per registrations.
+ /// If it's 250, then about 400 alices can participate.
/// The width of the rangeproofs are calculated from this, so don't choose stupid numbers.
/// Consider that it applies to registrations, not for inputs. This usually consists one input, but can be more.
/// </summary>
- [DefaultValue(1000)]
- [JsonProperty(PropertyName = "RegistrableWeightCredentials", DefaultValueHandling = DefaultValueHandling.Populate)]
- public uint RegistrableWeightCredentials { get; set; } = 1_000;
+ [DefaultValue(250)]
+ [JsonProperty(PropertyName = "PerAliceVsizeAllocation", DefaultValueHandling = DefaultValueHandling.Populate)]
+ public uint PerAliceVsizeAllocation { get; set; } = 250;
[DefaultValue(true)]
[JsonProperty(PropertyName = "AllowNotedInputRegistration", DefaultValueHandling = DefaultValueHandling.Populate)]

Use Vsize instead of WU for Alice quotas