[Cbor] Proposal for Deterministic CBOR (dCBOR) discussion at May 17th meeting

Christopher Allen <christophera@lifewithalacrity.com> Mon, 08 May 2023 17:40 UTC

Return-Path: <christophera@lifewithalacrity.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7A309C13737E for <cbor@ietfa.amsl.com>; Mon, 8 May 2023 10:40:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.896
X-Spam-Level:
X-Spam-Status: No, score=-6.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=lifewithalacrity-com.20221208.gappssmtp.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hGaVaILUEpKZ for <cbor@ietfa.amsl.com>; Mon, 8 May 2023 10:40:49 -0700 (PDT)
Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 57AE2C14CF0D for <cbor@ietf.org>; Mon, 8 May 2023 10:40:49 -0700 (PDT)
Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-956ff2399c9so912014166b.3 for <cbor@ietf.org>; Mon, 08 May 2023 10:40:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lifewithalacrity-com.20221208.gappssmtp.com; s=20221208; t=1683567647; x=1686159647; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=g4EgUShPlzUxyS8TsgjWMCdySCQJ9x69EbdfU4nEOcI=; b=gngikwZfjUDHlpwe6RusIRLobWzdJJUAydE/aWuS9sIcIKrkQREFhEnZlV1WnVze+p 1cnLhb+dcTAN+oBfJC3iJWvweSVzLiGfMg1X4AGJ5xgmcmxoyyPG3KtmlHLpTJMFOIQs 6Q4ZH86sEVzRBkI43pAa3LhxrTXDwDnxB2t2p2jF8fBoOwoFNGavk0M50IMI5OlTsy+o 1cZqKVse2NcDaZYEh2nEZ3hsinpxan1ttnjtV2yDHnmhsMuVRA244HX7zEXdh8H3sIFm iY+5lD0NXmqEuU4Kha/JKJ93gMAfy+5Z/ZXVhN3rVv/Cjuns7m7AVorr8IkBR/xxjxfY n7aQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683567647; x=1686159647; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=g4EgUShPlzUxyS8TsgjWMCdySCQJ9x69EbdfU4nEOcI=; b=Ro4VkzG+6Ba/EJnxw4qWUPaLEaP7rH6PoH+ySEhgAkNmgZI2e5xo+R1sQJkAEEaCJB yTEVRagYlzNKLW2NsCY3EcirWYZNaej8deHyzyCSCO1v+zMSgB6GcgazVMIBCQIXqLpe FbYSmWbLQ/pVz6+xTz+DOEDgsG5rH5fZFVV9AptB5ssS0JU+Ao8lpSVIlOCd6L+EEkrP nvqOvdxXfN7/hGzKmkHDgKNc+/bmuB0oQEegi36W6yt+XYNDnSS7KS8TBn4apys16sOP X0psnlCyLDtKObpJPry+gP/HbVrLs1lNE4TCN7eKuMtsPvGQu27ghYEOY9laD24LWHxI Oy3w==
X-Gm-Message-State: AC+VfDxj1JHK7c+OdGCi/EZtNmX1ul/ynR/chPjR+jPIcTdQaNINbPeO cZz5Mx8MEMKFhYcUkYwE5zf7zbu1mF8t1Au2NhuoYqGLtPR0ki0q/nMtSg==
X-Google-Smtp-Source: ACHHUZ6BG22o9oYZeVnoup2n0zKC1NVrOuBS4W4hZ/489w4PM0UDqYDTLXzfv1AygQyirxiFEKZJNwRlkn00crUi0H0=
X-Received: by 2002:a17:907:26c2:b0:8b1:3467:d71b with SMTP id bp2-20020a17090726c200b008b13467d71bmr9612940ejc.48.1683567646938; Mon, 08 May 2023 10:40:46 -0700 (PDT)
MIME-Version: 1.0
From: Christopher Allen <christophera@lifewithalacrity.com>
Date: Mon, 08 May 2023 10:40:36 -0700
Message-ID: <CAAse2dGXh-NUvt1FpFXQk3G54vsPaEvZfrHk-YhXzYoMKO5FLA@mail.gmail.com>
To: cbor@ietf.org
Cc: Wolf McNally <wolf@wolfmcnally.com>, Shannon.Appelcline@gmail.com
Content-Type: multipart/alternative; boundary="0000000000008d2b4805fb322367"
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/G1oXN5DlSpAt7TI5re-fb1lL69I>
Subject: [Cbor] Proposal for Deterministic CBOR (dCBOR) discussion at May 17th meeting
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 08 May 2023 17:40:53 -0000

Re:

> CBOR one-hour Wednesday meeting on 17 May, at 14:00 UTC (16:00 CET).
>
> Information for this meeting is here:
> https://datatracker.ietf.org/meeting/interim-2023-cbor-08/session/cbor
>
 Dear CBOR Working Group Members,

We would like to propose an agenda for the upcoming CBOR meeting on the
17th to discuss certain issues related to dCBOR. We aim to be as
collaborative as possible and would like to discuss the pros and cons of
each issue in order to foster a productive discussion. It should be noted
that nothing in our proposal affects the CBOR RFC or the ways that CBOR is
commonly used in any way.

— Christopher Allen & Wolf McNally


# Proposed Agenda: Deterministic CBOR (dCBOR) Proposal

The recent update to the dCBOR Internet-Draft is the subject of this agenda:

https://www.ietf.org/archive/id/draft-mcnally-deterministic-cbor-01.html

Some of this draft is a restatement of what’s in the RFC as
recommendations, but making its deterministic factors requirements. Other
issues raised by the draft have been a subject of discussion. Our aim is to
reach a consensus on these issues.

## Numerical Reduction

Proposal: All numbers MUST be reduced to the smallest possible
representation. Failure to do so is a well-formness error.

Pros:

* Deterministic
* Generally smaller representation
* Not hard to implement (we already have reference implementations in Swift
and Rust)
* Support for larger numbers (e.g., BIGNUM) is allowed but not required
* Directly compatible with languages like Javascript and Ruby that have a
generic number type
* Generally removes cognitive load from the programmer
* Useful for Gordian Envelope and other protocols requiring determinism
* Can be ignored by other protocols that do not care about determinism

Cons:

* The current recommendations for "deterministic" encoding in the RFC do
not have the above requirements, and therefore CBOR encoded with only the
recommendations in the RFC will not necessarily conform to the requirements
for dCBOR.
* This includes the reference implementation at https://cbor.me and the
Java package at org.webpki.cbor.
   * Though all dCBOR must be CBOR; we do not believe the converse is true,
which may reduce this issue.
* Some integer values (such as 1099511627775 [0xffffffffff]) can actually
be larger than BIGNUM equivalents!

Alternative: The alternative would be to mandate that floats remain
unchanged, which trends away from the suggestions in §4.2 of RFC 8949 for
moving data to the shortest encoding possible and has the possibility of
damaging determinism, but which matches some current implementations:
   * Floats MUST be maintained as Floats, but otherwise all numbers MUST be
reduced to the smallest possible representation. Failure to do so is a
well-formness error.

## Adding dCBOR Support to Flagship Implementations and Tools

Proposal: Add a "deterministic" flag to existing implementations and tools
such as https://cbor.me and QCBOR.

Pros:

* Would encourage dCBOR adoption
* Would enable such tools to be be used by developers of protocols
requiring determinism, including Gordian Envelope
* Would not invalidate other CBOR implementations
* Would be opt-in, and so transparent to existing users and protocols that
do not care about determinism

Cons:

* Requires work to implement, test, document, and maintain

## Bringing the dCBOR specification under purview of the CBOR Working Group
and putting it on a track to RFC status.

Pros:

* Would be in line with the recommendation of IETF Dispatch.
* Would benefit the entire CBOR community.

Cons:

* Would require active participation from the CBOR WG.