From: "Adán Sánchez de Pedro Crespo" <adan@stampery.co>
To: bitcoin-dev@lists.linuxfoundation.org
Subject: Re: [bitcoin-dev] Simplicity proposal - Jets?
Date: Fri, 3 Nov 2017 01:45:40 +0100 [thread overview]
Message-ID: <76afed77-dd30-7a6d-8ee7-90b1396460d1@stampery.com> (raw)
In-Reply-To: <052D6E20-7194-4645-B628-1B7B7FECF330@gmail.com>
Hi everyone,
I agree that the paper could use some more details on the rationale
behind "jets". After a couple of reads, I think I can "ELI5 them":
As far as I understand, jets are a smart optimization that makes complex
Simplicity contracts way cheaper to compute (ideally, comparable to
Script or EVM).
For this purpose, jets leverage the most important element of the
Simplicity Bit Machine: the frames stack.
In a Simplicity program, every expression or sub-expression can be
thought of as a pure function that when applied on a certain initial
read frame, results in the active write frame having a different value.
This happens deterministically and without any side effects.
So, if the Simplicity interpreter finds some expression whose result
when applied upon a certain read frame is already known (because it has
already been executed or it was somehow precomputed), it doesn't need to
execute such expression step-by-step once again. Instead, it just need
to write the known result to the active write frame.
The paper suggests that at all times the interpreter knows the result of
applying many common operations on all possible combinations of inputs
in the range of 8 to 256 bits. In other words, the interpreter won't
need to calculate "123 + 321" or compare "456 > 654 because the results
of those expressions will be already known to it. These are stupid
examples, but the savings are real for hash functions internals,
elliptic curve calculations or even validation of signatures.
As said before, this can help making Simplicity programs lighter on CPU
usage, but it has many other benefits too:
+ Jets can replicate the behavior of complex chunks of Simplicity code
with the guarantee that they can't introduce side effects.
+ Interpreter-bundled jets are formally proven. The more a Simplicity
program relies on jets, the more it benefits from their safety. When
proving the soundness of your program, you can just ignore the jets,
assume they are valid and focus on your own logic.
The paper also suggests that different sets of jets could make up
different single purpose dialects, just like domain-specific languages
bring richer vocabulary and semantics to the bare syntax and grammar of
general-purpose languages.
I hope Russel or Mark can correct me if I got something totally wrong. I
must admit I really like this proposal and hereby declare myself a huge
fan of their work :)
--
Adán Sánchez de Pedro Crespo
CTO, Stampery Inc.
San Francisco - Madrid
next prev parent reply other threads:[~2017-11-03 0:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.5469.1509483670.27509.bitcoin-dev@lists.linuxfoundation.org>
2017-11-01 10:34 ` [bitcoin-dev] Simplicity proposal - Jets? JOSE FEMENIAS CAÑUELO
2017-11-03 0:45 ` Adán Sánchez de Pedro Crespo [this message]
2017-11-03 1:10 ` Russell O'Connor
2017-11-03 8:46 ` Adán Sánchez de Pedro Crespo
2017-11-03 12:59 ` Hampus Sjöberg
2017-11-03 16:19 ` Mark Friedenbach
2017-11-03 16:42 ` Adán Sánchez de Pedro Crespo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=76afed77-dd30-7a6d-8ee7-90b1396460d1@stampery.com \
--to=adan@stampery.co \
--cc=adan@stampery.com \
--cc=bitcoin-dev@lists.linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox