Adán Sánchez de Pedro Crespo [ARCHIVE] on Nostr: 📅 Original date posted:2017-11-02 📝 Original message:Hi everyone, I agree that ...
đź“… Original date posted:2017-11-02
đź“ť Original message: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
Published at
2023-06-07 18:07:28Event JSON
{
"id": "d75f1ae63a42a0358afd4b149695671f11d16c85236eb088af7a3817f9390bac",
"pubkey": "42c901fccda418477337afb5eb8e517266652306539ab9ced7196d4f3477bd14",
"created_at": 1686161248,
"kind": 1,
"tags": [
[
"e",
"f66293ea7a9b32888732d42282e8e2d2c8c37fd29a8c31abaf65ab4ee416ee28",
"",
"root"
],
[
"e",
"37eab47cac52d98b80f5d3c3940775f1075de6929991281b15d19b35e6eae4d7",
"",
"reply"
],
[
"p",
"7fe0d6ae87a1c838fd07e83b4db6aa42c07246994b5589f16cd6ac97965fdff0"
]
],
"content": "📅 Original date posted:2017-11-02\n📝 Original message:Hi everyone,\n\nI agree that the paper could use some more details on the rationale\nbehind \"jets\". After a couple of reads, I think I can \"ELI5 them\":\n\nAs far as I understand, jets are a smart optimization that makes complex\nSimplicity contracts way cheaper to compute (ideally, comparable to\nScript or EVM).\n\nFor this purpose, jets leverage the most important element of the\nSimplicity Bit Machine: the frames stack.\n\nIn a Simplicity program, every expression or sub-expression can be\nthought of as a pure function that when applied on a certain initial\nread frame, results in the active write frame having a different value.\nThis happens deterministically and without any side effects.\n\nSo, if the Simplicity interpreter finds some expression whose result\nwhen applied upon a certain read frame is already known (because it has\nalready been executed or it was somehow precomputed), it doesn't need to\nexecute such expression step-by-step once again. Instead, it just need\nto write the known result to the active write frame.\n\nThe paper suggests that at all times the interpreter knows the result of\napplying many common operations on all possible combinations of inputs\nin the range of 8 to 256 bits. In other words, the interpreter won't\nneed to calculate \"123 + 321\" or compare \"456 \u003e 654 because the results\nof those expressions will be already known to it. These are stupid\nexamples, but the savings are real for hash functions internals,\nelliptic curve calculations or even validation of signatures.\n\nAs said before, this can help making Simplicity programs lighter on CPU\nusage, but it has many other benefits too:\n\n+ Jets can replicate the behavior of complex chunks of Simplicity code\nwith the guarantee that they can't introduce side effects.\n\n+ Interpreter-bundled jets are formally proven. The more a Simplicity\nprogram relies on jets, the more it benefits from their safety. When\nproving the soundness of your program, you can just ignore the jets,\nassume they are valid and focus on your own logic.\n\nThe paper also suggests that different sets of jets could make up\ndifferent single purpose dialects, just like domain-specific languages\nbring richer vocabulary and semantics to the bare syntax and grammar of\ngeneral-purpose languages.\n\nI hope Russel or Mark can correct me if I got something totally wrong. I\nmust admit I really like this proposal and hereby declare myself a huge\nfan of their work :)\n\n-- \nAdán Sánchez de Pedro Crespo\nCTO, Stampery Inc.\nSan Francisco - Madrid",
"sig": "28aa109ce1f096d028c9da1ddb87f9b2cb3976d0cee3e79f1f2ce5dbb8708798d0dd01901db6bcdce5b42a4d14ab95e48da04397c8d334881aed481522f8f069"
}