[Cbor] CDDL Codegen in production

Sebastien Guillemot <sebastien@emurgo.io> Fri, 04 September 2020 05:46 UTC

Return-Path: <sebastien@emurgo.io>
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 720053A0AFF for <cbor@ietfa.amsl.com>; Thu, 3 Sep 2020 22:46:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.878
X-Spam-Level:
X-Spam-Status: No, score=-0.878 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, HTML_TEXT_INVISIBLE_FONT=1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01, T_REMOTE_IMAGE=0.01, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=emurgo-io.20150623.gappssmtp.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id thykG8nbmJia for <cbor@ietfa.amsl.com>; Thu, 3 Sep 2020 22:46:15 -0700 (PDT)
Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 93EF13A0B1C for <cbor@ietf.org>; Thu, 3 Sep 2020 22:46:15 -0700 (PDT)
Received: by mail-pf1-x442.google.com with SMTP id u128so4000721pfb.6 for <cbor@ietf.org>; Thu, 03 Sep 2020 22:46:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emurgo-io.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:cc; bh=wmfW6JvERu9fonQK5aoYm6S+rvDnIFu5B5+8P46erTk=; b=pAblYQivtOg3c9YzmV9Wda7V4n4w3GrDOXY4rhAwq2ig170OPLGguM08tgqvmHkGcr 992jauHkAH6MsxzO01jbVdoCPkA69UIj9q7tceP1wSP/SFrEFG67v7evCvKeGt2n2FG1 NGgico/H9aMQirqXCaWbE+7lx7eXsHOpOYS13uPQMfPOSVL/hant90ucR2h5g2VCdlBk qBRMPPA+LnLyxUtsI11k589DxdiTeBpN6TOoPhUHh1I1d2cIvA0HS3SbPMl+yZY9ulfG fzXf+zEERRI4RE9mFd3yv8T/iaxMAABrKy5skrU3l5CDhM6Jj+EZxRnXP1zH08NATaR/ GtZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=wmfW6JvERu9fonQK5aoYm6S+rvDnIFu5B5+8P46erTk=; b=NMLEG8SktTjQUZZg8xDWXbh4RSAsiIQBQewzGFSWdJMfbNbyQFRAZLilmqFLcKgcj0 IkmgSorN3fiIE24UfCmMuk705ATOY5BhdjKHXUat1eFNge/yYGOjcPJBnNbT7WnZSgfP wu8XCkkJ3hVzkL00XklRNqI79UfJydl+EP1BPiyWGQD22a8t3SJew1VQ4KKvr6RaCTXP yK9TmVwC/CzJKA5aIeK81kEZ01F/2KjtCzQBuZYUVK8v48pvT00fsQiys59LA8lrHruE Ze0qSciYnUCQVcUBE90B3wakKYj9N8JwaCB4gyN42kf48w3HEfy1ELDBgAld9/r27+m4 jV1w==
X-Gm-Message-State: AOAM530JqlRtKy6sgsxbHQa0atKPpVnDYV7fgFMPAucQqxPDk/Sg/bKz LelN/5ItM+M9DhVgS7PewHdkQGYZgRBeSotxfTOprgPCa5vZKoyN
X-Google-Smtp-Source: ABdhPJz7XLIuUGyZIRVo+wlFfhaLyxh6WQ1MGOCgarFHTOqtQ8x2nPczn1c58dit/Hboe3rC026WDdMWN2aMckJMr1I=
X-Received: by 2002:a62:bd0d:: with SMTP id a13mr7270940pff.39.1599198374557; Thu, 03 Sep 2020 22:46:14 -0700 (PDT)
MIME-Version: 1.0
From: Sebastien Guillemot <sebastien@emurgo.io>
Date: Fri, 4 Sep 2020 14:44:31 +0900
Message-ID: <CAFhANbEhUFV23t_MCEO372NcpfAeeSLZREE8f0BtY7DBhjCP_Q@mail.gmail.com>
To: cbor@ietf.org
Cc: henk.birkholz@sit.fraunhofer.de, christoph.vigano@uni-bremen.de, cabo@tzi.org, Nicolas Arqueros <nicolas@emurgo.io>, rob@emurgo.io
Content-Type: multipart/alternative; boundary="0000000000000a906905ae76632f"
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/jxJQ2EycCSk-NG4I5WX_STMSb_Y>
Subject: [Cbor] CDDL Codegen in production
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
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: Fri, 04 Sep 2020 05:46:17 -0000

Hello all,

Background: most of you are familiar with RFC 8610
<https://tools.ietf.org/html/rfc8610> (CDDL). You may also be familiar with
the CDDL Ruby gem <https://rubygems.org/gems/cddl/versions/0.6.2> which can
be used to parse & validate CDDL. There is also a Rust tool
<https://github.com/anweiss/cddl> by Andrew Weiss that provides equivalent
functionality in Rust.

Our company (EMURGO) leveraged the work by Andrew to build a full Rust
codegen tool for CDDL that we called "cddl-codgen
<https://github.com/Emurgo/cddl-codegen>" where the output Rust code is
WASM-compatible. We then used this codegen tool on a CDDL file created by
one of our partners and generated a Rust library (link if you're curious
<https://github.com/Emurgo/cardano-serialization-lib>). This library
shipped to production last month and it's now being used by multiple
companies with a 6-digit number of end users running the library on their
devices thanks to the free & open source distribution of the whole stack.

There are still rough edges to our codegen library because some features of
CDDL don't work well with codegen (hopefully CDDL can improve this going
forward!), but overall this has been significantly easier for our company
to manage than having to hand-write CBOR parsing code every time our
partner updates their CDDL. We look forward to leveraging our CDDL-codgen
tool for other projects in the future.

I wanted to say thank you to everybody involved in the CDDL specification,
and if you have any questions about our library, don't hesitate to reach
out to me at sebastien@emurgo.io


<https://twitter.com/sebastiengllmt>
<https://www.youtube.com/channel/UCgFQ0hHuPO1QDcyP6t9KZTQ>
<https://t.me/emurgo>     <https://www.linkedin.com/company/emurgo_io/>
Sebastien Guillemot
Co-VP of Eng & Cardano PM
_______________________
 sebastien@emurgo.io