profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/nothingmuch/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Yuval Kogman nothingmuch self unemployed

miyagawa/Corona 39

Coro based high-performance, asynchronous PSGI web server

ez-org/eznode 35

✨ A simple pruning-friendly setup for a personal bitcoin full node

ingydotnet/yaml-libyaml-pm 29

Perl Binding to libyaml

jrockway/github-import 23

bulk-import existing repositories to github

bingos/poe 19

(perl) portable multitasking and networking framework for Perl (mirror of the svn repository)

gugod/markapl 13

(Perl) Markup as Perl

jrockway/MooseX-Data 6

abstract data types for Moose classes

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentzkSNACKs/WalletWasabi

`WabiSabi`: Add `CoinJoinTransactionArchiver`.

+using NBitcoin;+using System;+using System.IO;+using System.Text.Json;+using System.Text.Json.Serialization;+using System.Threading;+using System.Threading.Tasks;++namespace WalletWasabi.WabiSabi.Backend.Rounds.Utils+{+	public class CoinJoinTransactionArchiver+	{+		private static readonly JsonSerializerOptions Options = new()+		{+			WriteIndented = true, // Pretty print.+		};++		public CoinJoinTransactionArchiver(string directoryPath)+		{+			DirectoryPath = directoryPath;+			IoHelpers.EnsureDirectoryExists(directoryPath);+		}++		/// <summary>Path where to store transactions.</summary>+		public string DirectoryPath { get; }++		/// <summary>+		/// Save CoinJoin transaction in a JSON file for later inspection.+		/// </summary>+		/// <param name="transaction">Transaction to store.</param>+		/// <param name="currentDate">Date when the transaction was created or <c>null</c> to use current UTC time.</param>+		/// <returns>Full path to the stored file.</returns>+		public async Task<string> StoreJsonAsync(Transaction transaction, DateTimeOffset? currentDate = null)+		{+			currentDate ??= DateTimeOffset.UtcNow;++			long unixTimeStampMs = currentDate.Value.ToUnixTimeMilliseconds();+			string txBytes = transaction.ToHex();++			// Serialize entry.+			TransactionInfo entry = new(unixTimeStampMs, transaction.GetHash().ToString(), txBytes);+			string json = JsonSerializer.Serialize(entry, Options);++			// Add UNIX timestamp to the file name to let the files be sorted by date by default.+			string fileName = $"CoinJoinTransaction.{unixTimeStampMs}.{transaction.GetHash()}.json";

I think I would prefer ISO 8601 dates, since they are human readable. i also don't know when the next time unix time will add new 1 instead of a 0, which may change the sorting order without leading 0s also being added, could be decades or weeks for all i know...

kiminuo

comment created time in a day

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

 public static class ProtocolConstants  		// 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";

as above

		public const string RoundMaxRegistrableAmountStrobeLabel = "maximum-registrable-amount";
		public const string RoundMaxRegistrableVsizeStrobeLabel = "maximum-registrable-vsize";
lontivero

comment created time in 4 days

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

 public SigningState AddWitness(int index, WitScript witness) 			=> Assert<SigningState>().AddWitness(index, witness);  		private uint256 CalculateHash()-			=> StrobeHasher.Create(ProtocolConstants.RoundStrobeDomain)-				.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,+					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,

Sorry, I misled you, although MinRegistrableAmount is redundant with Allowed{In,Out}putAmounts.Min, MaxRegistrableAmount still needs to be committed, because the server still serializes it and the client uses it to compute the range proof width independently of Allowed{In,Out}put.Max, which only constrain the blockchain level values. Without this clients may be tricked into submitting range proofs of different widths, allowing them to be differentiated by a malicious coordinator.

					MaxRegistrableAmount,
					MaxRegistrableVsize,
lontivero

comment created time in 4 days

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

 namespace WalletWasabi.WabiSabi.Models { 	public record RoundState(-		uint256 Id, 		uint256? BlameOf, 		CredentialIssuerParameters AmountCredentialIssuerParameters, 		CredentialIssuerParameters VsizeCredentialIssuerParameters, 		FeeRate FeeRate, 		Phase Phase, 		bool WasTransactionBroadcast,+		TimeSpan InputRegistrationTimeout, 		TimeSpan ConnectionConfirmationTimeout,+		TimeSpan OutputRegistrationTimeout,+		TimeSpan TransactionSigningTimeout,+		long MinRegistrableAmount,

MinRegistrableAmount is only used to populate the default value for Allowed{In,Out}putAmount.Min, so it is not needed on the client.

lontivero

comment created time in 4 days

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

 public static StrobeHasher Create(string domain) 		public StrobeHasher Append(string fieldName, IBitcoinSerializable serializable) 			=> Append(fieldName, serializable.ToBytes()); +		public StrobeHasher Append(string fieldName, TimeSpan time)+			=> Append(fieldName, time.Ticks);+ 		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)
		public StrobeHasher Append(string fieldName, ImmutableSortedSet<ScriptType> scriptTypes)

What do you think about being more specific about the concrete type here, since it implies a canonical ordering, not just a given ordering? This is strictly a readability improvement, IEnumerable is just as correct, but I think it will always be an immutable sorted set and this will save someone a brain cycle or two of worrying about where the order is specified the next time they read it.

lontivero

comment created time in 4 days

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

 namespace WalletWasabi.WabiSabi.Models { 	public record RoundState(-		uint256 Id, 		uint256? BlameOf, 		CredentialIssuerParameters AmountCredentialIssuerParameters, 		CredentialIssuerParameters VsizeCredentialIssuerParameters, 		FeeRate FeeRate, 		Phase Phase, 		bool WasTransactionBroadcast,+		TimeSpan InputRegistrationTimeout, 		TimeSpan ConnectionConfirmationTimeout,+		TimeSpan OutputRegistrationTimeout,+		TimeSpan TransactionSigningTimeout,+		long MinRegistrableAmount,

MinRegistrableAmount is only used to populate the default value for Allowed{In,Out}putAmount.Min, so it is not needed on the client.

lontivero

comment created time in 4 days

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

 namespace WalletWasabi.WabiSabi.Models { 	public record RoundState(-		uint256 Id, 		uint256? BlameOf, 		CredentialIssuerParameters AmountCredentialIssuerParameters, 		CredentialIssuerParameters VsizeCredentialIssuerParameters, 		FeeRate FeeRate, 		Phase Phase, 		bool WasTransactionBroadcast,+		TimeSpan InputRegistrationTimeout, 		TimeSpan ConnectionConfirmationTimeout,+		TimeSpan OutputRegistrationTimeout,+		TimeSpan TransactionSigningTimeout,+		long MinRegistrableAmount, 		long MaxRegistrableAmount, 		long MaxRegistrableVsize, 		long MaxVsizeAllocationPerAlice, 		MultipartyTransactionState CoinjoinState) 	{+		private uint256 _id;++		public uint256 Id => _id ??= CalculateHash();+ 		public static RoundState FromRound(Round round) => 			new(-				round.Id, 				round.BlameOf?.Id, 				round.AmountCredentialIssuerParameters, 				round.VsizeCredentialIssuerParameters, 				round.FeeRate, 				round.Phase, 				round.WasTransactionBroadcast,+				round.InputRegistrationTimeout, 				round.ConnectionConfirmationTimeout,+				round.OutputRegistrationTimeout,+				round.TransactionSigningTimeout,+				round.MinRegistrableAmount,

as above

lontivero

comment created time in 4 days

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

 CoinjoinState switch  		public WabiSabiClient CreateVsizeCredentialClient(WasabiRandom random) => 			new(VsizeCredentialIssuerParameters, random, MaxRegistrableVsize);++		private uint256 CalculateHash() =>+			RoundHasher.CalculateHash(+				InputRegistrationTimeout,+				ConnectionConfirmationTimeout,+				OutputRegistrationTimeout,+				TransactionSigningTimeout,+				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,

as above

				MaxRegistrableAmount,
				MaxRegistrableVsize,
lontivero

comment created time in 4 days

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

+using System;+using System.Collections.Generic;+using NBitcoin;+using WalletWasabi.Crypto;+using WalletWasabi.Crypto.StrobeProtocol;+using WalletWasabi.WabiSabi.Models;++namespace WalletWasabi.WabiSabi.Crypto+{+	public static class RoundHasher+	{+		public static uint256 CalculateHash(+				TimeSpan inputRegistrationTimeout,+				TimeSpan connectionConfirmationTimeout,+				TimeSpan outputRegistrationTimeout,+				TimeSpan transactionSigningTimeout,+				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)+				=> StrobeHasher.Create(ProtocolConstants.RoundStrobeDomain)+					.Append(ProtocolConstants.RoundInputRegistrationTimeoutStrobeLabel, inputRegistrationTimeout)+					.Append(ProtocolConstants.RoundConnectionConfirmationTimeoutStrobeLabel, connectionConfirmationTimeout)+					.Append(ProtocolConstants.RoundOutputRegistrationTimeoutStrobeLabel, outputRegistrationTimeout)+					.Append(ProtocolConstants.RoundTransactionSigningTimeoutStrobeLabel, transactionSigningTimeout)+					.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)

as above

					.Append(ProtocolConstants.RoundMaxRegistrableAmountStrobeLabel, maxRegistrableAmount)
					.Append(ProtocolConstants.RoundMaxRegistrableVsizeStrobeLabel, maxRegistrableVsize)
lontivero

comment created time in 4 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

+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)

Reposting my clarifications from slack for completeness:

Remove MinRegistrableAmount, MaxRegistrableAmount, replace with MultipartyTransactionParameters properties AllowedInputAmounts and AllowedOutputAmounts which are pairs of values.

Also add the following from MultipartyTransactionParameters:

  • AllowedInputTypes
  • AllowedOutputTypes
  • Network
  • MaxTransactionSize
  • MinRelayTxFee (basically a constant, so maybe not necessary, but if core ever changes standardness policy this value matters)
lontivero

comment created time in 5 days

PullRequestReviewEvent

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

+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)

more generally everything in MPTX params should be covered if it's not, since that's a subset of the round params that concerns with the tx construction rules, those are still round params.

lontivero

comment created time in 6 days

PullRequestReviewEvent

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

+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)

should use MPTX parameters, which are money ranges

lontivero

comment created time in 6 days

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

 namespace WalletWasabi.WabiSabi.Models { 	public record RoundState(-		uint256 Id, 		uint256? BlameOf, 		CredentialIssuerParameters AmountCredentialIssuerParameters, 		CredentialIssuerParameters VsizeCredentialIssuerParameters, 		FeeRate FeeRate, 		Phase Phase, 		bool WasTransactionBroadcast,+		TimeSpan InputRegistrationTimeout, 		TimeSpan ConnectionConfirmationTimeout,+		TimeSpan OutputRegistrationTimeout,+		TimeSpan TransactionSigningTimeout,+		long MinRegistrableAmount, 		long MaxRegistrableAmount, 		long MaxRegistrableVsize, 		long MaxVsizeAllocationPerAlice, 		MultipartyTransactionState CoinjoinState) 	{+		private uint256 _id;++		public uint256 Id => _id ??= CalculateHash();

_id is not nullable, so won't this leave it with the default value of 0?

lontivero

comment created time in 6 days

Pull request review commentzkSNACKs/WalletWasabi

[WabiSabi] Compute round hash

 public Round(RoundParameters roundParameters) 			VsizeCredentialIssuer = new(new(RoundParameters.Random), RoundParameters.Random, MaxRegistrableVsize); 			AmountCredentialIssuerParameters = AmountCredentialIssuer.CredentialIssuerSecretKey.ComputeCredentialIssuerParameters(); 			VsizeCredentialIssuerParameters = VsizeCredentialIssuer.CredentialIssuerSecretKey.ComputeCredentialIssuerParameters();--			Id = CalculateHash(); 		} +		public uint256 Id => _id ??= CalculateHash(); 		public MultipartyTransactionState CoinjoinState { get; set; }-		public uint256 Id { get; }

I don't understand what this change to how Id is computed is doing, is it a leftover from a refactoring? Seems to me like it stay using the assignment in the constructor instead?

lontivero

comment created time in 6 days

PullRequestReviewEvent
PullRequestReviewEvent

issue openedzkSNACKs/WalletWasabi

WabiSabi team preview milestone tracking issue

  • [ ] Coordinator Fees
  • [ ] Coin join tiers - Speedy / Private / Economical
  • [ ] Final amount decomposition alg
  • [ ] Implement Privacy optimalization correctly #6226
  • [ ] https://github.com/zkSNACKs/WalletWasabi/pull/5827#issuecomment-846812310
  • [ ] Make GetStatus streameable
  • [ ] Coin selection algorithm for sending
  • [ ] Server-side serialize/save all coinjoins to disk
  • [ ] #5944
  • [ ] RESTFUL API

created time in 6 days

PullRequestReviewEvent

pull request commentzkSNACKs/WalletWasabi

[WabiSabi] Put participant coins in quarantine after coinjoin

In general, I think it's useful to keep a data file with the history of what CJM/CJC did: what coins were registered to which previous rounds, and what parameters did they have. This would allow us to also make sure that we avoid correlating or anti-correlating coin selections for privacy, etc. However, we must be careful to not accumulate storage without limit.

lontivero

comment created time in 7 days