Add `RoundHasher`
in order to be able to compute the hash on the client side in the exact
same way the coordinator does.
MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
@@ -141,18 +141,17 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
=> Assert<SigningState>().AddWitness(index, witness);
private uint256 CalculateHash()
- => StrobeHasher.Create(ProtocolConstants.RoundStrobeDomain)
- .Append(ProtocolConstants.RoundInputRegistrationTimeoutStrobeLabel, InputRegistrationTimeout)
- .Append(ProtocolConstants.RoundConnectionConfirmationTimeoutStrobeLabel, ConnectionConfirmationTimeout)
- .Append(ProtocolConstants.RoundOutputRegistrationTimeoutStrobeLabel, OutputRegistrationTimeout)
- .Append(ProtocolConstants.RoundTransactionSigningTimeoutStrobeLabel, TransactionSigningTimeout)
- .Append(ProtocolConstants.RoundMinRegistrableAmountStrobeLabel, MinRegistrableAmount)
- .Append(ProtocolConstants.RoundMaxRegistrableAmountStrobeLabel, MaxRegistrableAmount)
- .Append(ProtocolConstants.RoundMaxRegistrableVsizeStrobeLabel, MaxRegistrableVsize)
- .Append(ProtocolConstants.RoundMaxVsizePerAliceStrobeLabel, MaxVsizeAllocationPerAlice)
- .Append(ProtocolConstants.RoundAmountCredentialIssuerParametersStrobeLabel, AmountCredentialIssuerParameters)
- .Append(ProtocolConstants.RoundVsizeCredentialIssuerParametersStrobeLabel, VsizeCredentialIssuerParameters)
- .Append(ProtocolConstants.RoundFeeRateStrobeLabel, FeeRate.FeePerK)
- .GetHash();
+ => RoundHasher.CalculateHash(
+ InputRegistrationTimeout,
+ ConnectionConfirmationTimeout,
+ OutputRegistrationTimeout,
+ TransactionSigningTimeout,
+ MinRegistrableAmount,
+ MaxRegistrableAmount,
+ MaxRegistrableVsize,
+ MaxVsizeAllocationPerAlice,
+ AmountCredentialIssuerParameters,
+ VsizeCredentialIssuerParameters,
+ FeeRate.FeePerK);
}
}

ADD
WalletWasabi/WabiSabi/Crypto/RoundHasher.cs
+using System;
+using NBitcoin;
+using WalletWasabi.Crypto;
+using WalletWasabi.Crypto.StrobeProtocol;
+
+namespace WalletWasabi.WabiSabi.Crypto
+{
+ public static class RoundHasher
+ {
+ public static uint256 CalculateHash(
+ TimeSpan inputRegistrationTimeout,
+ TimeSpan connectionConfirmationTimeout,
+ TimeSpan outputRegistrationTimeout,
+ TimeSpan transactionSigningTimeout,
+ long minRegistrableAmount,
+ long maxRegistrableAmount,
+ long maxRegistrableVsize,
+ long maxVsizeAllocationPerAlice,
+ CredentialIssuerParameters amountCredentialIssuerParameters,
+ CredentialIssuerParameters vsizeCredentialIssuerParameters,
+ long feePerK)
+ => StrobeHasher.Create(ProtocolConstants.RoundStrobeDomain)
+ .Append(ProtocolConstants.RoundInputRegistrationTimeoutStrobeLabel, inputRegistrationTimeout)
+ .Append(ProtocolConstants.RoundConnectionConfirmationTimeoutStrobeLabel, connectionConfirmationTimeout)
+ .Append(ProtocolConstants.RoundOutputRegistrationTimeoutStrobeLabel, outputRegistrationTimeout)
+ .Append(ProtocolConstants.RoundTransactionSigningTimeoutStrobeLabel, transactionSigningTimeout)
+ .Append(ProtocolConstants.RoundMinRegistrableAmountStrobeLabel, minRegistrableAmount)
+ .Append(ProtocolConstants.RoundMaxRegistrableAmountStrobeLabel, maxRegistrableAmount)
+ .Append(ProtocolConstants.RoundMaxRegistrableVsizeStrobeLabel, maxRegistrableVsize)
+ .Append(ProtocolConstants.RoundMaxVsizePerAliceStrobeLabel, maxVsizeAllocationPerAlice)
+ .Append(ProtocolConstants.RoundAmountCredentialIssuerParametersStrobeLabel, amountCredentialIssuerParameters)
+ .Append(ProtocolConstants.RoundVsizeCredentialIssuerParametersStrobeLabel, vsizeCredentialIssuerParameters)
+ .Append(ProtocolConstants.RoundFeeRateStrobeLabel, feePerK)
+ .GetHash();
+ }
+}
\ No newline at end of file

Add `RoundHasher`

in order to be able to compute the hash on the client side in the exact
same way the coordinator does.