Rename PostRequestHandler to ArenaRequestHandler
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/AliceTimeoutTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/AliceTimeoutTests.cs
@@ -35,7 +35,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
};
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, rpc);
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, rpc);
var minAliceDeadline = DateTimeOffset.UtcNow + cfg.ConnectionConfirmationTimeout * 0.9;
await handler.RegisterInputAsync(req);
@@ -60,7 +60,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
Assert.Single(round.Alices);
DateTimeOffset preDeadline = DateTimeOffset.UtcNow - TimeSpan.FromMilliseconds(1);
@@ -84,7 +84,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
Assert.Single(round.Alices);
DateTimeOffset preDeadline = DateTimeOffset.UtcNow - TimeSpan.FromMilliseconds(1);
@@ -110,7 +110,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
Assert.Equal(3, round.Alices.Count);
DateTimeOffset preDeadline = DateTimeOffset.UtcNow - TimeSpan.FromMilliseconds(1);
@@ -133,7 +133,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
Assert.Single(round.Alices);
DateTimeOffset preDeadline = DateTimeOffset.UtcNow - TimeSpan.FromMilliseconds(1);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/ConfirmConnectionTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/ConfirmConnectionTests.cs
@@ -30,7 +30,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
var minAliceDeadline = DateTimeOffset.UtcNow + cfg.ConnectionConfirmationTimeout * 0.9;
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var resp = await handler.ConfirmConnectionAsync(req);
Assert.NotNull(resp);
Assert.NotNull(resp.ZeroAmountCredentials);
@@ -57,7 +57,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var resp = await handler.ConfirmConnectionAsync(req);
Assert.NotNull(resp);
Assert.NotNull(resp.ZeroAmountCredentials);
@@ -74,7 +74,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
public async Task RoundNotFoundAsync()
{
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
- await using PostRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
var req = WabiSabiFactory.CreateConnectionConfirmationRequest();
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.ConfirmConnectionAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.RoundNotFound, ex.ErrorCode);
@@ -99,7 +99,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
if (phase != Phase.InputRegistration && phase != Phase.ConnectionConfirmation)
{
round.SetPhase(phase);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.ConfirmConnectionAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode);
}
@@ -118,7 +118,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var req = WabiSabiFactory.CreateConnectionConfirmationRequest(round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.ConfirmConnectionAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.AliceNotFound, ex.ErrorCode);
@@ -143,7 +143,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
req.RealAmountCredentialRequests,
req.ZeroWeightCredentialRequests,
WabiSabiFactory.CreateRealCredentialRequests(round, null, 234).weightReq);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.ConfirmConnectionAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.IncorrectRequestedWeightCredentials, ex.ErrorCode);
Assert.False(alice.ConfirmedConnetion);
@@ -169,7 +169,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
WabiSabiFactory.CreateRealCredentialRequests(round, Money.Coins(3), null).amountReq,
req.ZeroWeightCredentialRequests,
req.RealWeightCredentialRequests);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.ConfirmConnectionAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.IncorrectRequestedAmountCredentials, ex.ErrorCode);
Assert.False(alice.ConfirmedConnetion);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputFailureTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputFailureTests.cs
@@ -19,7 +19,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
{
public class RegisterInputFailureTests
{
- private static async Task RegisterAndAssertWrongPhaseAsync(InputsRegistrationRequest req, PostRequestHandler handler)
+ private static async Task RegisterAndAssertWrongPhaseAsync(InputsRegistrationRequest req, ArenaRequestHandler handler)
{
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode);
@@ -31,7 +31,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
using Key key = new();
- await using PostRequestHandler handler = new(new(), new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(new(), new(), arena, WabiSabiFactory.CreateMockRpc(key));
var req = WabiSabiFactory.CreateInputsRegistrationRequest();
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.RoundNotFound, ex.ErrorCode);
@@ -48,7 +48,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var round = arena.Rounds.First().Value;
using Key key = new();
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
foreach (Phase phase in Enum.GetValues(typeof(Phase)))
{
@@ -71,7 +71,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Key key = new();
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
round.Alices.Add(WabiSabiFactory.CreateAlice());
@@ -91,7 +91,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Key key = new();
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
arena.Rounds.Add(round.Id, round);
@@ -109,7 +109,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg);
using Key key = new();
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
var round = arena.Rounds.First().Value;
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
@@ -129,7 +129,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
var inputSigPair = WabiSabiFactory.CreateInputRoundSignaturePair();
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc());
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc());
var req = WabiSabiFactory.CreateInputsRegistrationRequest(new[] { inputSigPair, inputSigPair }, round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.NonUniqueInputs, ex.ErrorCode);
@@ -145,7 +145,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
using Key key = new();
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var req = WabiSabiFactory.CreateInputsRegistrationRequest(WabiSabiFactory.CreateInputRoundSignaturePairs(4), round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.TooManyInputs, ex.ErrorCode);
@@ -162,7 +162,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
WabiSabiConfig cfg = new();
var round = WabiSabiFactory.CreateRound(cfg);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using PostRequestHandler handler = new(cfg, prison, arena, WabiSabiFactory.CreateMockRpc());
+ await using ArenaRequestHandler handler = new(cfg, prison, arena, WabiSabiFactory.CreateMockRpc());
var req = WabiSabiFactory.CreateInputsRegistrationRequest(pair, round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.InputBanned, ex.ErrorCode);
@@ -180,7 +180,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var round = WabiSabiFactory.CreateRound(cfg);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using PostRequestHandler handler = new(cfg, prison, arena, WabiSabiFactory.CreateMockRpc());
+ await using ArenaRequestHandler handler = new(cfg, prison, arena, WabiSabiFactory.CreateMockRpc());
var req = WabiSabiFactory.CreateInputsRegistrationRequest(pair, round);
var ex = await Assert.ThrowsAnyAsync<Exception>(async () => await handler.RegisterInputAsync(req));
if (ex is WabiSabiProtocolException wspex)
@@ -201,7 +201,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var round = WabiSabiFactory.CreateRound(cfg);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using PostRequestHandler handler = new(cfg, prison, arena, WabiSabiFactory.CreateMockRpc());
+ await using ArenaRequestHandler handler = new(cfg, prison, arena, WabiSabiFactory.CreateMockRpc());
var req = WabiSabiFactory.CreateInputsRegistrationRequest(pair, round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.InputBanned, ex.ErrorCode);
@@ -218,7 +218,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
MockRpcClient rpc = new();
rpc.OnGetTxOutAsync = (_, _, _) => null;
- await using PostRequestHandler handler = new(cfg, new(), arena, rpc);
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, rpc);
var req = WabiSabiFactory.CreateInputsRegistrationRequest(round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.InputSpent, ex.ErrorCode);
@@ -235,7 +235,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
MockRpcClient rpc = new();
rpc.OnGetTxOutAsync = (_, _, _) => new() { Confirmations = 0 };
- await using PostRequestHandler handler = new(cfg, new(), arena, rpc);
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, rpc);
var req = WabiSabiFactory.CreateInputsRegistrationRequest(round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.InputUnconfirmed, ex.ErrorCode);
@@ -256,7 +256,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
{
rpc.OnGetTxOutAsync = (_, _, _) => new() { Confirmations = i, IsCoinBase = true };
- await using PostRequestHandler handler = new(cfg, new(), arena, rpc);
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, rpc);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.InputImmature, ex.ErrorCode);
}
@@ -279,7 +279,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
TxOut = new(Money.Coins(1), key.PubKey.GetScriptAddress(Network.Main))
};
- await using PostRequestHandler handler = new(cfg, new(), arena, rpc);
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, rpc);
var req = WabiSabiFactory.CreateInputsRegistrationRequest(round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.ScriptNotAllowed, ex.ErrorCode);
@@ -295,7 +295,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
using Key key = new();
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var req = WabiSabiFactory.CreateInputsRegistrationRequest(round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.WrongRoundSignature, ex.ErrorCode);
@@ -311,7 +311,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
using Key key = new();
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.NotEnoughFunds, ex.ErrorCode);
@@ -327,7 +327,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
using Key key = new();
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.TooMuchFunds, ex.ErrorCode);
@@ -343,7 +343,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
using Key key = new();
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.TooMuchWeight, ex.ErrorCode);
@@ -366,7 +366,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.Alices.Add(anotherAlice);
round.SetPhase(Phase.ConnectionConfirmation);
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
await RegisterAndAssertWrongPhaseAsync(req, handler);
await arena.StopAsync(CancellationToken.None);
@@ -388,7 +388,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
anotherRound.Alices.Add(preAlice);
anotherRound.SetPhase(Phase.ConnectionConfirmation);
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.AliceAlreadyRegistered, ex.ErrorCode);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputSuccessTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputSuccessTests.cs
@@ -36,7 +36,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
using Key key = new();
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var req = WabiSabiFactory.CreateInputsRegistrationRequest(key, round);
var minAliceDeadline = DateTimeOffset.UtcNow + cfg.ConnectionConfirmationTimeout * 0.9;
@@ -60,7 +60,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var preAlice = WabiSabiFactory.CreateAlice(req.InputRoundSignaturePairs);
round.Alices.Add(preAlice);
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var minAliceDeadline = DateTimeOffset.UtcNow + cfg.ConnectionConfirmationTimeout * 0.9;
var resp = await handler.RegisterInputAsync(req);
AssertSingleAliceSuccessfullyRegistered(round, minAliceDeadline, resp);
@@ -83,7 +83,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
var preAlice = WabiSabiFactory.CreateAlice(req.InputRoundSignaturePairs);
anotherRound.Alices.Add(preAlice);
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var minAliceDeadline = DateTimeOffset.UtcNow + cfg.ConnectionConfirmationTimeout * 0.9;
var resp = await handler.RegisterInputAsync(req);
AssertSingleAliceSuccessfullyRegistered(round, minAliceDeadline, resp);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputToBlameRoundTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputToBlameRoundTests.cs
@@ -29,7 +29,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round, blameRound);
using Key key = new();
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc(key));
var req = WabiSabiFactory.CreateInputsRegistrationRequest(blameRound);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.InputNotWhitelisted, ex.ErrorCode);
@@ -47,7 +47,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
Round blameRound = WabiSabiFactory.CreateBlameRound(round, cfg);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round, blameRound);
- await using PostRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc());
+ await using ArenaRequestHandler handler = new(cfg, new(), arena, WabiSabiFactory.CreateMockRpc());
var req = WabiSabiFactory.CreateInputsRegistrationRequest(pair, blameRound);
var ex = await Assert.ThrowsAnyAsync<Exception>(async () => await handler.RegisterInputAsync(req));
@@ -71,7 +71,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
Round blameRound = WabiSabiFactory.CreateBlameRound(round, cfg);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round, blameRound);
- await using PostRequestHandler handler = new(cfg, prison, arena, WabiSabiFactory.CreateMockRpc());
+ await using ArenaRequestHandler handler = new(cfg, prison, arena, WabiSabiFactory.CreateMockRpc());
var req = WabiSabiFactory.CreateInputsRegistrationRequest(pair, blameRound);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.InputBanned, ex.ErrorCode);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterOutputTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterOutputTests.cs
@@ -26,7 +26,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.SetPhase(Phase.OutputRegistration);
round.Alices.Add(WabiSabiFactory.CreateAlice());
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round);
var resp = await handler.RegisterOutputAsync(req);
@@ -43,7 +43,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
public async Task RoundNotFoundAsync()
{
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
- await using PostRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
var req = WabiSabiFactory.CreateOutputRegistrationRequest();
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterOutputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.RoundNotFound, ex.ErrorCode);
@@ -61,7 +61,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
using Key key = new();
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round, key.PubKey.GetAddress(ScriptPubKeyType.Legacy, Network.Main).ScriptPubKey);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RegisterOutputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.ScriptNotAllowed, ex.ErrorCode);
@@ -76,7 +76,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.SetPhase(Phase.OutputRegistration);
round.Alices.Add(WabiSabiFactory.CreateAlice(value: Money.Coins(1)));
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round);
@@ -94,7 +94,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.SetPhase(Phase.OutputRegistration);
round.Alices.Add(WabiSabiFactory.CreateAlice(value: Money.Coins(2)));
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round);
@@ -112,7 +112,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.SetPhase(Phase.OutputRegistration);
round.Alices.Add(WabiSabiFactory.CreateAlice());
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var req = WabiSabiFactory.CreateOutputRegistrationRequest(round, weight: 30);
@@ -127,7 +127,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
{
WabiSabiConfig cfg = new();
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21)).ConfigureAwait(false);
var round = arena.Rounds.First().Value;
round.Alices.Add(WabiSabiFactory.CreateAlice());

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RemoveInputTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RemoveInputTests.cs
@@ -26,7 +26,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
round.Alices.Add(alice);
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, round);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
// There's no such alice yet, so success.
var req = new InputsRemovalRequest(round.Id, Guid.NewGuid());
@@ -44,7 +44,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
{
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
- await using PostRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
var req = new InputsRemovalRequest(Guid.NewGuid(), Guid.NewGuid());
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RemoveInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.RoundNotFound, ex.ErrorCode);
@@ -66,7 +66,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
if (phase != Phase.InputRegistration)
{
round.SetPhase(phase);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.RemoveInputAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode);
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/SignTransactionTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/SignTransactionTests.cs
@@ -35,7 +35,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
signedCoinJoin.Sign(key.GetBitcoinSecret(Network.Main), alice.Coins.First());
var req = new TransactionSignaturesRequest(round.Id, new[] { new InputWitnessPair(0, signedCoinJoin.Inputs[0].WitScript) });
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
await handler.SignTransactionAsync(req);
Assert.True(round.Coinjoin.Inputs.First().HasWitScript());
await arena.StopAsync(CancellationToken.None);
@@ -45,7 +45,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
public async Task RoundNotFoundAsync()
{
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
- await using PostRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
var req = new TransactionSignaturesRequest(Guid.NewGuid(), null!);
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.SignTransactionAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.RoundNotFound, ex.ErrorCode);
@@ -66,7 +66,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
if (phase != Phase.TransactionSigning)
{
round.SetPhase(phase);
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.SignTransactionAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode);
}
@@ -96,7 +96,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PostRequests
signedCoinJoin.Sign(key2.GetBitcoinSecret(Network.Main), alice2.Coins.First());
var req = new TransactionSignaturesRequest(round.Id, new[] { new InputWitnessPair(0, signedCoinJoin.Inputs[0].WitScript) });
- await using PostRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
+ await using ArenaRequestHandler handler = new(cfg, new Prison(), arena, new MockRpcClient());
var ex = await Assert.ThrowsAsync<WabiSabiProtocolException>(async () => await handler.SignTransactionAsync(req));
Assert.Equal(WabiSabiProtocolErrorCode.WrongCoinjoinSignature, ex.ErrorCode);
await arena.StopAsync(CancellationToken.None);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/RequestHandlerDisposeTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/RequestHandlerDisposeTests.cs
@@ -20,7 +20,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
public async Task DisposeGuardAsync()
{
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync();
- PostRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
+ ArenaRequestHandler handler = new(new WabiSabiConfig(), new Prison(), arena, new MockRpcClient());
await handler.DisposeAsync();
await Assert.ThrowsAsync<ObjectDisposedException>(async () => await handler.RegisterInputAsync(null!));

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
@@ -37,7 +37,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
Confirmations = 200,
TxOut = new TxOut(Money.Coins(1m), key.PubKey.WitHash.GetAddress(Network.Main)),
});
- await using var coordinator = new PostRequestHandler(config, new Prison(), arena, mockRpc.Object);
+ await using var coordinator = new ArenaRequestHandler(config, new Prison(), arena, mockRpc.Object);
var rnd = new InsecureRandom();
var protocolCredentialNumber = 2;

RENAME
WalletWasabi/WabiSabi/Backend/PostRequests/PostRequestHandler.cs
WalletWasabi/WabiSabi/Backend/PostRequests/ArenaRequestHandler.cs
@@ -14,9 +14,9 @@ using WalletWasabi.WabiSabi.Models;
namespace WalletWasabi.WabiSabi.Backend.PostRequests
{
- public class PostRequestHandler : IAsyncDisposable, IRequestHandler
+ public class ArenaRequestHandler : IAsyncDisposable, IArenaRequestHandler
{
- public PostRequestHandler(WabiSabiConfig config, Prison prison, Arena arena, IRPCClient rpc)
+ public ArenaRequestHandler(WabiSabiConfig config, Prison prison, Arena arena, IRPCClient rpc)
{
Config = config;
Prison = prison;
@@ -96,7 +96,7 @@ namespace WalletWasabi.WabiSabi.Backend.PostRequests
{
if (DisposeStarted)
{
- throw new ObjectDisposedException(nameof(PostRequestHandler));
+ throw new ObjectDisposedException(nameof(ArenaRequestHandler));
}
}
}

RENAME
WalletWasabi/WabiSabi/Backend/PostRequests/IRequestHandler.cs
WalletWasabi/WabiSabi/Backend/PostRequests/IArenaRequestHandler.cs
@@ -3,7 +3,7 @@ using WalletWasabi.WabiSabi.Models;
namespace WalletWasabi.WabiSabi.Backend.PostRequests
{
- public interface IRequestHandler
+ public interface IArenaRequestHandler
{
Task<InputsRegistrationResponse> RegisterInputAsync(InputsRegistrationRequest request);
Task<ConnectionConfirmationResponse> ConfirmConnectionAsync(ConnectionConfirmationRequest request);

MODIFY
WalletWasabi/WabiSabi/Client/ArenaClient.cs
WalletWasabi/WabiSabi/Client/ArenaClient.cs
@@ -14,7 +14,7 @@ namespace WalletWasabi.WabiSabi.Client
{
public class ArenaClient
{
- public ArenaClient(WabiSabiClient amountCredentialClient, WabiSabiClient weightCredentialClient, IRequestHandler requestHandler)
+ public ArenaClient(WabiSabiClient amountCredentialClient, WabiSabiClient weightCredentialClient, IArenaRequestHandler requestHandler)
{
AmountCredentialClient = amountCredentialClient;
WeightCredentialClient = weightCredentialClient;
@@ -23,7 +23,7 @@ namespace WalletWasabi.WabiSabi.Client
public WabiSabiClient AmountCredentialClient { get; }
public WabiSabiClient WeightCredentialClient { get; }
- public IRequestHandler RequestHandler { get; }
+ public IArenaRequestHandler RequestHandler { get; }
public ValueTask<Guid> RegisterInputAsync(Money amount, OutPoint outPoint, Key key, Guid roundId, uint256 roundHash) =>
RegisterInputAsync(

MODIFY
WalletWasabi/WabiSabi/WabiSabiCoordinator.cs
WalletWasabi/WabiSabi/WabiSabiCoordinator.cs
@@ -36,7 +36,7 @@ namespace WalletWasabi.WabiSabi
public CoordinatorParameters Parameters { get; }
public IRPCClient Rpc { get; }
- public PostRequestHandler Postman { get; }
+ public ArenaRequestHandler Postman { get; }
public Arena Arena { get; }
public string WorkDir => Parameters.CoordinatorDataDir;

Rename PostRequestHandler to ArenaRequestHandler