Add more parameters to round hash
MODIFY
WalletWasabi/Crypto/StrobeProtocol/StrobeHasher.cs
WalletWasabi/Crypto/StrobeProtocol/StrobeHasher.cs
using System;
using System.Collections.Generic;
using System.Globalization;
+using System.Linq;
using System.Text;
using NBitcoin;
using WalletWasabi.WabiSabi;
+using WalletWasabi.WabiSabi.Models;
namespace WalletWasabi.Crypto.StrobeProtocol
{
@@ -29,6 +31,14 @@ namespace WalletWasabi.Crypto.StrobeProtocol
public StrobeHasher Append(string fieldName, Money money)
=> Append(fieldName, money.Satoshi);
+ public StrobeHasher Append(string fieldName, MoneyRange range)
+ => Append(fieldName + "-min", range.Min).Append(fieldName + "-max", range.Max);
+
+ public StrobeHasher Append(string fieldName, IEnumerable<ScriptType> scriptTypes)
+ => scriptTypes
+ .Select((scriptType, idx) => (scriptType, idx))
+ .Aggregate(this, (hasher, scriptTypeIdxPair) => hasher.Append(fieldName + "-" + scriptTypeIdxPair.idx, Enum.GetName(scriptTypeIdxPair.scriptType)));
+
public StrobeHasher Append(string fieldName, int num)
=> Append(fieldName, BitConverter.GetBytes(num));

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
@@ -145,12 +145,17 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
ConnectionConfirmationTimeout,
OutputRegistrationTimeout,
TransactionSigningTimeout,
- MinRegistrableAmount,
- MaxRegistrableAmount,
+ CoinjoinState.Parameters.AllowedInputAmounts,
+ CoinjoinState.Parameters.AllowedInputTypes,
+ CoinjoinState.Parameters.AllowedOutputAmounts,
+ CoinjoinState.Parameters.AllowedOutputTypes,
+ CoinjoinState.Parameters.Network,
+ CoinjoinState.Parameters.FeeRate.FeePerK,
+ CoinjoinState.Parameters.MaxTransactionSize,
+ CoinjoinState.Parameters.MinRelayTxFee.FeePerK,
MaxRegistrableVsize,
MaxVsizeAllocationPerAlice,
AmountCredentialIssuerParameters,
- VsizeCredentialIssuerParameters,
- FeeRate.FeePerK);
+ VsizeCredentialIssuerParameters);
}
}

MODIFY
WalletWasabi/WabiSabi/Crypto/RoundHasher.cs
WalletWasabi/WabiSabi/Crypto/RoundHasher.cs
using System;
+using System.Collections.Generic;
using NBitcoin;
using WalletWasabi.Crypto;
using WalletWasabi.Crypto.StrobeProtocol;
+using WalletWasabi.WabiSabi.Models;
namespace WalletWasabi.WabiSabi.Crypto
{
@@ -12,25 +14,35 @@ namespace WalletWasabi.WabiSabi.Crypto
TimeSpan connectionConfirmationTimeout,
TimeSpan outputRegistrationTimeout,
TimeSpan transactionSigningTimeout,
- long minRegistrableAmount,
- long maxRegistrableAmount,
+ MoneyRange allowedInputAmounts,
+ IEnumerable<ScriptType> allowedInputTypes,
+ MoneyRange allowedOutputAmounts,
+ IEnumerable<ScriptType> allowedOutputTypes,
+ Network network,
+ long feePerK,
+ int maxTransactionSize,
+ long minRelayTxFeePerK,
long maxRegistrableVsize,
long maxVsizeAllocationPerAlice,
CredentialIssuerParameters amountCredentialIssuerParameters,
- CredentialIssuerParameters vsizeCredentialIssuerParameters,
- long feePerK)
+ CredentialIssuerParameters vsizeCredentialIssuerParameters)
=> 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.RoundAllowedInputAmountsStrobeLabel, allowedInputAmounts)
+ .Append(ProtocolConstants.RoundAllowedInputTypesStrobeLabel, allowedInputTypes)
+ .Append(ProtocolConstants.RoundAllowedOutputAmountsStrobeLabel, allowedOutputAmounts)
+ .Append(ProtocolConstants.RoundAllowedOutputTypesStrobeLabel, allowedOutputTypes)
+ .Append(ProtocolConstants.RoundNetworkStrobeLabel, network.ToString())
+ .Append(ProtocolConstants.RoundFeeRateStrobeLabel, feePerK)
+ .Append(ProtocolConstants.RoundMaxTransactionSizeStrobeLabel, maxTransactionSize)
+ .Append(ProtocolConstants.RoundMinRelayTxFeeStrobeLabel, minRelayTxFeePerK)
.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

MODIFY
WalletWasabi/WabiSabi/Models/RoundState.cs
WalletWasabi/WabiSabi/Models/RoundState.cs
@@ -66,12 +66,17 @@ namespace WalletWasabi.WabiSabi.Models
ConnectionConfirmationTimeout,
OutputRegistrationTimeout,
TransactionSigningTimeout,
- MinRegistrableAmount,
- MaxRegistrableAmount,
+ CoinjoinState.Parameters.AllowedInputAmounts,
+ CoinjoinState.Parameters.AllowedInputTypes,
+ CoinjoinState.Parameters.AllowedOutputAmounts,
+ CoinjoinState.Parameters.AllowedOutputTypes,
+ CoinjoinState.Parameters.Network,
+ CoinjoinState.Parameters.FeeRate.FeePerK,
+ CoinjoinState.Parameters.MaxTransactionSize,
+ CoinjoinState.Parameters.MinRelayTxFee.FeePerK,
MaxRegistrableVsize,
MaxVsizeAllocationPerAlice,
AmountCredentialIssuerParameters,
- VsizeCredentialIssuerParameters,
- FeeRate.FeePerK);
+ VsizeCredentialIssuerParameters);
}
}

MODIFY
WalletWasabi/WabiSabi/ProtocolContants.cs
WalletWasabi/WabiSabi/ProtocolContants.cs
@@ -11,8 +11,14 @@ namespace WalletWasabi.WabiSabi
// Round hashing labels
public const string RoundStrobeDomain = "round-parameters";
- public const string RoundMinRegistrableAmountStrobeLabel = "minimum-registrable-amount";
- public const string RoundMaxRegistrableAmountStrobeLabel = "maximum-registrable-amount";
+ public const string RoundAllowedInputAmountsStrobeLabel = "allowed-input-amounts";
+ public const string RoundAllowedOutputAmountsStrobeLabel = "allowed-output-amounts";
+ public const string RoundAllowedInputTypesStrobeLabel = "allowed-input-types";
+ public const string RoundAllowedOutputTypesStrobeLabel = "allowed-output-types";
+ public const string RoundNetworkStrobeLabel = "network";
+ public const string RoundMaxTransactionSizeStrobeLabel = "max-transaction-size";
+ public const string RoundMinRelayTxFeeStrobeLabel = "min-relay-tx-fee";
+
public const string RoundMaxRegistrableVsizeStrobeLabel = "maximum-registrable-vsize";
public const string RoundMaxVsizePerAliceStrobeLabel = "per-alice-vsize-allocation";
public const string RoundAmountCredentialIssuerParametersStrobeLabel = "amount-credential-issuer-parameters";

Add more parameters to round hash