Return-Path: Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id F0A21C0051 for ; Fri, 21 Aug 2020 19:50:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D2515230FB for ; Fri, 21 Aug 2020 19:50:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RYrlYi1sO8kB for ; Fri, 21 Aug 2020 19:50:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by silver.osuosl.org (Postfix) with ESMTPS id 2D2542045D for ; Fri, 21 Aug 2020 19:50:36 +0000 (UTC) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (authenticated bits=0) (User authenticated as jlrubin@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 07LJoY1Y030422 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 21 Aug 2020 15:50:35 -0400 Received: by mail-ej1-f46.google.com with SMTP id o18so3731650eje.7 for ; Fri, 21 Aug 2020 12:50:35 -0700 (PDT) X-Gm-Message-State: AOAM533C5hTDOWgUSViYvyurNJ/JdaNaaRXrSLh9AqU8tuMizF/c0vg8 KauPAFlqaZfs0E/ed0A7EM/QatrMA5IG1k+rSNM= X-Google-Smtp-Source: ABdhPJz0zS3pyZr8NsquHiJHvp0Y+a6LESZFQj7bCZ6aYXBFzX9LKJ7d+hUlqrpZ8F1/9DtXXhymKTG6qgs59PvjUfU= X-Received: by 2002:a17:906:b814:: with SMTP id dv20mr4582111ejb.4.1598039434207; Fri, 21 Aug 2020 12:50:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jeremy Date: Fri, 21 Aug 2020 12:50:21 -0700 X-Gmail-Original-Message-ID: Message-ID: To: Eric Voskuil , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="000000000000d028a405ad688c88" Subject: Re: [bitcoin-dev] Generalizing feature negotiation when new p2p connections are setup X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 19:50:39 -0000 --000000000000d028a405ad688c88 Content-Type: text/plain; charset="UTF-8" I have a proposal: Protocol >= 70016 cease to send or process VERACK, and instead use HANDSHAKEACK, which is completed after feature negotiation. This should make everyone happy/unhappy, as in a new protocol number it's fair game to change these semantics to be clear that we're acking more than version. I don't care about when or where these messages are sequenced overall, it seems to have minimal impact. If I had free choice, I slightly agree with Eric that verack should come before feature negotiation, as we want to divorce the idea that protocol number and feature support are tied. But once this is done, we can supplant Verack with HANDSHAKENACK or HANDSHAKEACK to signal success or failure to agree on a connection. A NACK reason (version too high/low or an important feature missing) could be optional. Implicit NACK would be disconnecting, but is discouraged because a peer doesn't know if it should reconnect or the failure was intentional. ------ AJ: I think I generally do prefer to have a FEATURE wrapper as you suggested, or a rule that all messages in this period are interpreted as features (and may be redundant with p2p message types -- so you can literally just use the p2p message name w/o any data). I think we would want a semantic (which could be based just on message names, but first-class support would be nice) for ACKing that a feature is enabled. This is because a transcript of: NODE0: FEATURE A FEATURE B VERACK NODE1: FEATURE A VERACK It remains unclear if Node 1 ignored B because it's an unknown feature, or because it is disabled. A transcript like: NODE0: FEATURE A FEATURE B FEATURE C ACK A VERACK NODE1: FEATURE A ACK A NACK B VERACK would make it clear that A and B are known, B is disabled, and C is unknown. C has 0 support, B Node 0 should support inbound messages but knows not to send to Node 1, and A has full bilateral support. Maybe instead it could a message FEATURE SEND A and FEATURE RECV A, so we can make the split explicit rather than inferred from ACK/NACK. ------ I'd also propose that we add a message which is SYNC, which indicates the end of a list of FEATURES and a request to send ACKS or NACKS back (which are followed by a SYNC). This allows multi-round negotiation where based on the presence of other features, I may expand the set of features I am offering. I think you could do without SYNC, but there are more edge cases and the explicitness is nice given that this already introduces future complexity. This multi-round makes it an actual negotiation rather than a pure announcement system. I don't think it would be used much in the near term, but it makes sense to define it correctly now. Build for the future and all... -- @JeremyRubin --000000000000d028a405ad688c88 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I have a= proposal:

Protocol >=3D 70016 cease to send or process VERACK, an= d instead use HANDSHAKEACK, which is completed after feature negotiation.

This should make everyone happy/unhappy, as in a new protocol number i= t's fair game to change these semantics to be clear that we're acki= ng more than version.

I don't care about when or where these mess= ages are sequenced overall, it seems to have minimal impact. If I had free = choice, I slightly agree with Eric that verack should come before feature n= egotiation, as we want to divorce the idea that protocol number and feature= support are tied.

But once this is done, we can supplant Verack with= HANDSHAKENACK or HANDSHAKEACK to signal success or failure to agree on a c= onnection. A NACK reason (version too high/low or an important feature miss= ing) could be optional. Implicit NACK would be disconnecting, but is discou= raged because a peer doesn't know if it should reconnect or the failure= was intentional.

------

AJ: I think I generally do pre= fer to have a FEATURE wrapper as you suggested, or a rule that all messages= in this period are interpreted as features (and may be redundant with p2p = message types -- so you can literally just use the p2p message name w/o any= data).

I think we would want a semantic (which could be based just o= n message names, but first-class support would be nice) for ACKing that a f= eature is enabled. This is because a transcript of:

NODE0:
FEATURE A
FEATURE B
VERACK

NODE1:
FEATURE A
VERACK

It remains unclear if Node 1 ignored B becaus= e it's an unknown feature, or because it is disabled. A transcript like= :

NODE0:
FEATURE A
FEATURE= B
FEATURE C
ACK A
VERACK

NODE1:
F= EATURE A
ACK A
NACK B
V= ERACK

would make it clear that A and B are known, B is disabled= , and C is unknown. C has 0 support, B Node 0 should support inbound messag= es but knows not to send to Node 1, and A has full bilateral support. Maybe= instead it could a message FEATURE SEND A and FEATURE RECV A, so we can ma= ke the split explicit rather than inferred from ACK/NACK.

<= br>
------

I'd als= o propose that we add a message which is SYNC, which indicates the end of a= list of FEATURES and a request to send ACKS or NACKS back (which are follo= wed by a SYNC). This allows multi-round negotiation where based on the pres= ence of other features, I may expand the set of features I am offering. I t= hink you could do without SYNC, but there are more edge cases and the expli= citness is nice given that this already introduces future complexity.
=

This multi-round makes it an actual negotiation rather than a pure a= nnouncement system. I don't think it would be used much in the near ter= m, but it makes sense to define it correctly now. Build for the future and = all...


--000000000000d028a405ad688c88--