Skip to content

Commit 6d90737

Browse files
committed
Updates for generating jets.md from SimplicityHL codegen
1 parent 08a735b commit 6d90737

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

jets.md.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/env python3
22

3+
# This consumes elements.json as generated by
4+
# https://github.com/BlockstreamResearch/SimplicityHL/tree/master/codegen
5+
# and generates doc/documentation/jets.md.
6+
37
import datetime
48
import json
59
import re
@@ -16,7 +20,7 @@
1620
1721
* For example, in SimplicityHL, you check whether two integers are equal with a call to a jet such as `jet::eq_32`.
1822
19-
Some jets allow a Simplicity program to refuse a proposed transaction by performing a mandatory assertion (these jets' return type is `unit` below). The "panic" or failure effect produced by these jets is the *only* way to decline a transaction, so every program will need to call one or more of these jets directly or indirectly.
23+
Some jets allow a Simplicity program to refuse a proposed transaction by performing a mandatory assertion (these jets' return type is `()` below). The "panic" or failure effect produced by these jets is the *only* way to decline a transaction, so every program will need to call one or more of these jets directly or indirectly.
2024
2125
* For example, `jet::bip_0340_verify` checks a digital signature and refuses the transaction if the signature cannot be verified.
2226
@@ -42,7 +46,7 @@ def new_section(section_name, introduction = ""):
4246
| ----------------------------------- | ----------- |"""
4347
return template.format(section_name, introduction)
4448

45-
elements = json.load(open(sys.argv[1]))["elements"]
49+
elements = json.load(open(sys.argv[1]))
4650

4751
def format_jet(name, i, o, desc):
4852
return " | `{}({}) -> {}` | {} |".format(name, i, o, desc)
@@ -84,6 +88,6 @@ def format_jet(name, i, o, desc):
8488
8589
Calling jets, where available, makes your Simplicity program smaller and faster.
8690
87-
A few jets <a href="https://delvingbitcoin.org/t/delving-simplicity-part-two-side-effects/2091">provide behaviors that could not be achieved directly with low-level Simplicity combinators alone</a>, such as transaction introspection. Jets that can fail (those whose return type is `unit`) are the expected and only way for a Simplicity program to disapprove a proposed transaction."""
91+
A few jets <a href="https://delvingbitcoin.org/t/delving-simplicity-part-two-side-effects/2091">provide behaviors that could not be achieved directly with low-level Simplicity combinators alone</a>, such as transaction introspection. Jets that can fail (those whose return type is `()`) are the expected and only way for a Simplicity program to disapprove a proposed transaction."""
8892

8993
print(footer)

0 commit comments

Comments
 (0)