Do not use `ArenaRequestHandler` in tests.
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/AliceTimeoutTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/AliceTimeoutTests.cs
@@ -70,7 +70,6 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using ArenaRequestHandler handler = new(arena);
Assert.Single(round.Alices);
DateTimeOffset preDeadline = DateTimeOffset.UtcNow - TimeSpan.FromMilliseconds(1);
@@ -94,7 +93,6 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using ArenaRequestHandler handler = new(arena);
Assert.Single(round.Alices);
DateTimeOffset preDeadline = DateTimeOffset.UtcNow - TimeSpan.FromMilliseconds(1);
@@ -120,7 +118,6 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using ArenaRequestHandler handler = new(arena);
Assert.Equal(3, round.Alices.Count);
DateTimeOffset preDeadline = DateTimeOffset.UtcNow - TimeSpan.FromMilliseconds(1);
@@ -143,12 +140,11 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using ArenaRequestHandler handler = new(arena);
Assert.Single(round.Alices);
DateTimeOffset preDeadline = DateTimeOffset.UtcNow - TimeSpan.FromMilliseconds(1);
alice.Deadline = preDeadline;
- await handler.ConfirmConnectionAsync(req, CancellationToken.None);
+ await arena.ConfirmConnectionAsync(req, CancellationToken.None);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
Assert.Single(round.Alices);
Assert.NotEqual(preDeadline, alice.Deadline);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/ConfirmConnectionTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/ConfirmConnectionTests.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using WalletWasabi.Tests.Helpers;
using WalletWasabi.WabiSabi.Backend;
using WalletWasabi.WabiSabi.Backend.Models;
-using WalletWasabi.WabiSabi.Backend.PostRequests;
using WalletWasabi.WabiSabi.Backend.Rounds;
using WalletWasabi.WabiSabi.Crypto;
using WalletWasabi.WabiSabi.Crypto.CredentialRequesting;
@@ -29,8 +28,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
var minAliceDeadline = DateTimeOffset.UtcNow + cfg.ConnectionConfirmationTimeout * 0.9;
- await using ArenaRequestHandler handler = new(arena);
- var resp = await handler.ConfirmConnectionAsync(req, CancellationToken.None);
+
+ var resp = await arena.ConfirmConnectionAsync(req, CancellationToken.None);
Assert.NotNull(resp);
Assert.NotNull(resp.ZeroAmountCredentials);
Assert.NotNull(resp.ZeroVsizeCredentials);
@@ -56,8 +55,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using ArenaRequestHandler handler = new(arena);
- var resp = await handler.ConfirmConnectionAsync(req, CancellationToken.None);
+
+ var resp = await arena.ConfirmConnectionAsync(req, CancellationToken.None);
Assert.NotNull(resp);
Assert.NotNull(resp.ZeroAmountCredentials);
Assert.NotNull(resp.ZeroVsizeCredentials);
@@ -75,11 +74,10 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var cfg = new WabiSabiConfig();
var nonExistingRound = WabiSabiFactory.CreateRound(cfg);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
- await using ArenaRequestHandler handler = new(arena);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(nonExistingRound);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(
- async () => await handler.ConfirmConnectionAsync(req, CancellationToken.None));
+ async () => await arena.ConfirmConnectionAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.RoundNotFound, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
@@ -97,14 +95,13 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21)).ConfigureAwait(false);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using ArenaRequestHandler handler = new(arena);
foreach (Phase phase in Enum.GetValues(typeof(Phase)))
{
if (phase != Phase.InputRegistration && phase != Phase.ConnectionConfirmation)
{
round.SetPhase(phase);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(
- async () => await handler.ConfirmConnectionAsync(req, CancellationToken.None));
+ async () => await arena.ConfirmConnectionAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode);
}
@@ -123,8 +120,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using ArenaRequestHandler handler = new(arena);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.ConfirmConnectionAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.ConfirmConnectionAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.AliceNotFound, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
@@ -144,8 +140,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var incorrectVsizeCredentials = WabiSabiFactory.CreateRealCredentialRequests(round, null, 234).vsizeRequest;
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round) with { RealVsizeCredentialRequests = incorrectVsizeCredentials };
- await using ArenaRequestHandler handler = new(arena);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.ConfirmConnectionAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.ConfirmConnectionAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.IncorrectRequestedVsizeCredentials, ex.ErrorCode);
Assert.False(alice.ConfirmedConnection);
@@ -165,8 +160,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var incorrectAmountCredentials = WabiSabiFactory.CreateRealCredentialRequests(round, Money.Coins(3), null).amountRequest;
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round) with { RealAmountCredentialRequests = incorrectAmountCredentials };
- await using ArenaRequestHandler handler = new(arena);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.ConfirmConnectionAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.ConfirmConnectionAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.IncorrectRequestedAmountCredentials, ex.ErrorCode);
Assert.False(alice.ConfirmedConnection);
@@ -207,8 +201,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
// invalidate serial numbers
issuer.HandleRequest(credentialsRequest);
- await using ArenaRequestHandler handler = new(arena);
- var ex = await Assert.ThrowsAsync<WabiSabiCryptoException>(async () => await handler.ConfirmConnectionAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiCryptoException>(async () => await arena.ConfirmConnectionAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiCryptoErrorCode.SerialNumberAlreadyUsed, ex.ErrorCode);
Assert.False(alice.ConfirmedConnection);
await arena.StopAsync(CancellationToken.None);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputFailureTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputFailureTests.cs
@@ -9,7 +9,6 @@ using WalletWasabi.Tests.Helpers;
using WalletWasabi.WabiSabi.Backend;
using WalletWasabi.WabiSabi.Backend.Banning;
using WalletWasabi.WabiSabi.Backend.Models;
-using WalletWasabi.WabiSabi.Backend.PostRequests;
using WalletWasabi.WabiSabi.Backend.Rounds;
using WalletWasabi.WabiSabi.Models;
using Xunit;
@@ -18,7 +17,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
{
public class RegisterInputFailureTests
{
- private static async Task RegisterAndAssertWrongPhaseAsync(InputRegistrationRequest req, ArenaRequestHandler handler)
+ private static async Task RegisterAndAssertWrongPhaseAsync(InputRegistrationRequest req, Arena handler)
{
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode);
@@ -48,14 +47,13 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var round = arena.Rounds.First();
using Key key = new();
var req = WabiSabiFactory.CreateInputRegistrationRequest(round, key: key);
- await using ArenaRequestHandler handler = new(arena);
foreach (Phase phase in Enum.GetValues(typeof(Phase)))
{
if (phase != Phase.InputRegistration)
{
round.SetPhase(phase);
- await RegisterAndAssertWrongPhaseAsync(req, handler);
+ await RegisterAndAssertWrongPhaseAsync(req, arena);
}
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputToBlameRoundTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputToBlameRoundTests.cs
@@ -25,9 +25,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Key key = new();
var mockRpc = WabiSabiFactory.CreatePreconfiguredRpcClient();
- await using ArenaRequestHandler handler = new(arena);
var req = WabiSabiFactory.CreateInputRegistrationRequest(round: blameRound);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RegisterInputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.InputNotWhitelisted, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
@@ -43,10 +42,9 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
Round blameRound = WabiSabiFactory.CreateBlameRound(round, cfg);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round, blameRound);
- await using ArenaRequestHandler handler = new(arena);
var req = WabiSabiFactory.CreateInputRegistrationRequest(prevout: alice.Coin.Outpoint, round: blameRound);
- var ex = await Assert.ThrowsAnyAsync<Exception>(async () => await handler.RegisterInputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAnyAsync<Exception>(async () => await arena.RegisterInputAsync(req, CancellationToken.None));
if (ex is WabiSabiProtocolException wspex)
{
Assert.NotEqual(WabiSabiProtocolErrorCode.InputNotWhitelisted, wspex.ErrorCode);
@@ -73,10 +71,9 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await ArenaBuilder.From(cfg, mockRpc, prison).CreateAndStartAsync(round, blameRound);
prison.Punish(bannedCoin, Punishment.Banned, uint256.Zero);
- await using ArenaRequestHandler handler = new(arena);
var req = WabiSabiFactory.CreateInputRegistrationRequest(key: key, round: blameRound, prevout: bannedCoin);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RegisterInputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.InputBanned, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterOutputTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterOutputTests.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using WalletWasabi.Tests.Helpers;
using WalletWasabi.WabiSabi.Backend;
using WalletWasabi.WabiSabi.Backend.Models;
-using WalletWasabi.WabiSabi.Backend.PostRequests;
using WalletWasabi.WabiSabi.Backend.Rounds;
using WalletWasabi.WabiSabi.Models.MultipartyTransaction;
using Xunit;
@@ -23,10 +22,9 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.SetPhase(Phase.OutputRegistration);
round.Alices.Add(WabiSabiFactory.CreateAlice(round));
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using ArenaRequestHandler handler = new(arena);
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round);
- await handler.RegisterOutputAsync(req, CancellationToken.None);
+ await arena.RegisterOutputAsync(req, CancellationToken.None);
Assert.NotEmpty(round.Bobs);
await arena.StopAsync(CancellationToken.None);
@@ -38,9 +36,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var cfg = new WabiSabiConfig();
var nonExistingRound = WabiSabiFactory.CreateRound(cfg);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
- await using ArenaRequestHandler handler = new(arena);
var req = WabiSabiFactory.CreateOutputRegistrationRequest(nonExistingRound);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterOutputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RegisterOutputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.RoundNotFound, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
@@ -60,8 +57,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.Alices.Add(WabiSabiFactory.CreateAlice(Money.Coins(1), round));
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round, key.PubKey.GetAddress(ScriptPubKeyType.Legacy, Network.Main).ScriptPubKey);
- await using ArenaRequestHandler handler = new(arena);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterOutputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RegisterOutputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.ScriptNotAllowed, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
@@ -80,8 +76,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var sha256Bounty = Script.FromHex("aa20000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f87");
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round, sha256Bounty);
- await using ArenaRequestHandler handler = new(arena);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterOutputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RegisterOutputAsync(req, CancellationToken.None));
// The following assertion requires standardness to be checked before allowed script types
Assert.Equal(WabiSabiProtocolErrorCode.NonStandardOutput, ex.ErrorCode);
@@ -97,11 +92,10 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.SetPhase(Phase.OutputRegistration);
round.Alices.Add(WabiSabiFactory.CreateAlice(Money.Coins(1), round));
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using ArenaRequestHandler handler = new(arena);
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterOutputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RegisterOutputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.NotEnoughFunds, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
@@ -115,11 +109,10 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.SetPhase(Phase.OutputRegistration);
round.Alices.Add(WabiSabiFactory.CreateAlice(Money.Coins(2), round));
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using ArenaRequestHandler handler = new(arena);
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterOutputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RegisterOutputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.TooMuchFunds, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
@@ -133,11 +126,10 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.SetPhase(Phase.OutputRegistration);
round.Alices.Add(WabiSabiFactory.CreateAlice(round));
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using ArenaRequestHandler handler = new(arena);
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round, vsize: 30);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterOutputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RegisterOutputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.IncorrectRequestedVsizeCredentials, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
@@ -148,7 +140,6 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
{
WabiSabiConfig cfg = new();
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg);
- await using ArenaRequestHandler handler = new(arena);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
var round = arena.Rounds.First();
round.MaxVsizeAllocationPerAlice = 11 + 31 + MultipartyTransactionParameters.SharedOverhead;
@@ -161,7 +152,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
{
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round);
round.SetPhase(phase);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterOutputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RegisterOutputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode);
}
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RemoveInputTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RemoveInputTests.cs
@@ -27,15 +27,13 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using ArenaRequestHandler handler = new(arena);
-
// There's no such alice yet, so success.
var req = new InputsRemovalRequest(round.Id, Guid.NewGuid());
- await handler.RemoveInputAsync(req, CancellationToken.None);
+ await arena.RemoveInputAsync(req, CancellationToken.None);
// There was the alice we want to remove so success.
req = new InputsRemovalRequest(round.Id, alice.Id);
- await handler.RemoveInputAsync(req, CancellationToken.None);
+ await arena.RemoveInputAsync(req, CancellationToken.None);
// Ensure that removing an alice freed up the input vsize
// allocation from the round
@@ -49,9 +47,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
{
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
- await using ArenaRequestHandler handler = new(arena);
var req = new InputsRemovalRequest(uint256.Zero, Guid.NewGuid());
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RemoveInputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RemoveInputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.RoundNotFound, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
@@ -71,8 +68,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
if (phase != Phase.InputRegistration)
{
round.SetPhase(phase);
- await using ArenaRequestHandler handler = new(arena);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RemoveInputAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.RemoveInputAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode);
}
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/SignTransactionTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/SignTransactionTests.cs
@@ -32,8 +32,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
aliceSignedCoinJoin.Sign(key.GetBitcoinSecret(Network.Main), alice.Coin);
var req = new TransactionSignaturesRequest(round.Id, new[] { new InputWitnessPair(0, aliceSignedCoinJoin.Inputs[0].WitScript) });
- await using ArenaRequestHandler handler = new(arena);
- await handler.SignTransactionAsync(req, CancellationToken.None);
+ await arena.SignTransactionAsync(req, CancellationToken.None);
Assert.True(round.Assert<SigningState>().IsFullySigned);
await arena.StopAsync(CancellationToken.None);
}
@@ -42,9 +41,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
public async Task RoundNotFoundAsync()
{
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
- await using ArenaRequestHandler handler = new(arena);
var req = new TransactionSignaturesRequest(uint256.Zero, null!);
- var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.SignTransactionAsync(req, CancellationToken.None));
+ var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await arena.SignTransactionAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.RoundNotFound, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);
}
@@ -63,9 +61,9 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
if (phase != Phase.TransactionSigning)
{
round.SetPhase(phase);
- await using ArenaRequestHandler handler = new(arena);
+
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () =>
- await handler.SignTransactionAsync(req, CancellationToken.None));
+ await arena.SignTransactionAsync(req, CancellationToken.None));
Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode);
}
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
@@ -60,8 +60,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(config, mockRpc, round);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1));
- await using var coordinator = new ArenaRequestHandler(arena);
- var wabiSabiApi = new WabiSabiController(coordinator);
+ var wabiSabiApi = new WabiSabiController(arena);
var insecureRandom = new InsecureRandom();
var roundState = RoundState.FromRound(round);
var aliceArenaClient = new ArenaClient(
@@ -176,8 +175,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
using Arena arena = await ArenaBuilder.From(config).CreateAndStartAsync(round);
- await using var coordinator = new ArenaRequestHandler(arena);
- var wabiSabiApi = new WabiSabiController(coordinator);
+ var wabiSabiApi = new WabiSabiController(arena);
var apiClient = new ArenaClient(null!, null!, wabiSabiApi);
round.SetPhase(Phase.InputRegistration);
@@ -203,8 +201,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(config, round);
var mockRpc = new Mock<IRPCClient>();
- await using var coordinator = new ArenaRequestHandler(arena);
- var wabiSabiApi = new WabiSabiController(coordinator);
+ var wabiSabiApi = new WabiSabiController(arena);
var rnd = new InsecureRandom();
var amountClient = new WabiSabiClient(round.AmountCredentialIssuerParameters, rnd, 4300000000000L);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/BobClientTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/BobClientTests.cs
@@ -32,9 +32,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(config, mockRpc, round);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1));
- await using var coordinator = new ArenaRequestHandler(arena);
var insecureRandom = new InsecureRandom();
- var wabiSabiApi = new WabiSabiController(coordinator);
+ var wabiSabiApi = new WabiSabiController(arena);
var roundState = RoundState.FromRound(round);
var aliceArenaClient = new ArenaClient(
roundState.CreateAmountCredentialClient(insecureRandom),

Do not use `ArenaRequestHandler` in tests.