Skip to content

Commit d0652a8

Browse files
committed
WIP: add hunspell to CI
1 parent 87bd723 commit d0652a8

15 files changed

+458
-53
lines changed

.github/workflows/spelling.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Spell checking
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '**'
9+
pull_request:
10+
branches:
11+
- '**'
12+
13+
jobs:
14+
hunspell:
15+
name:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: install hunspell
20+
run: sudo apt-get install hunspell
21+
22+
- name: run hunspell
23+
run: |
24+
cat hunspell/chialisp.dic hunspell/hex.dic hunspell/clvm-ops.dic >temp.dic
25+
hunspell -d en_US -p temp.dic -l docs/*.md docs/ref/*.md

docs/basics.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_label: 1 - CLVM Basics
55
---
66

77
CLVM is the compiled, minimal version of ChiaLisp that is used by the Chia network.
8-
Chialisp compiles into CLVM so it's important to understand how it works.
8+
ChiaLisp compiles into CLVM so it's important to understand how it works.
99
The full set of operators is documented [here](https://chialisp.com/docs/ref/clvm)
1010

1111
This guide will cover the basics of the language and act as an introduction to the structure of programs.
@@ -73,7 +73,7 @@ For example, this program is just the value `100`:
7373
(q . 100)
7474
```
7575

76-
Note that in the higher level Chialisp language, values do not need to be quoted.
76+
Note that in the higher level ChiaLisp language, values do not need to be quoted.
7777

7878
## Lists and Programs
7979

@@ -252,7 +252,7 @@ $ brun '(i (q . ()) (q . 70) (q . 80))'
252252
80
253253
```
254254

255-
Note that both `B` and `C` are evaluated eagerly, just like all subexpressions.
255+
Note that both `B` and `C` are evaluated eagerly, just like all sub-expressions.
256256
To defer evaluation until after the condition, `B` and `C` must be quoted (with
257257
`q`), and then evaluated with `(a)`.
258258

docs/coin_lifecycle.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ You should now understand how to create Chialisp puzzles that lock up coins with
77

88
## The Coin Set Model
99

10-
Chia's model of how coins are stored is called the **coin set** model and is closely modelled after Bitcoin's UTXO model. The idea is simple, every full node holds onto a database of **coin records**:
10+
Chia's model of how coins are stored is called the **coin set** model and is closely modeled after Bitcoin's UTXO model. The idea is simple, every full node holds onto a database of **coin records**:
1111

1212
```
1313
class Coin:
@@ -117,4 +117,4 @@ Furthermore, generators also enable the compression of certain puzzles in a bloc
117117

118118
You should now have a pretty decent grasp of the environment that your puzzles will be running in. Writing secure Chialisp puzzles requires a somewhat unique way of looking at things that is not shared by many other programming languages or blockchains. Understanding of the network is inextricably intertwined with the creation of puzzles and while that creates a steep learning curve, it also enables incredible functionality in an incredibly compact format.
119119

120-
It is highly recommended that you fully understand this section before you decide to deploy any smart contract so that you can ensure they are secure and functional. Simply running the puzzle on your computer is no substitute for having it run on millions of nodes with indeterminable intent.
120+
It is highly recommended that you fully understand this section before you decide to deploy any smart contract so that you can ensure they are secure and functional. Simply running the puzzle on your computer is no substitute for having it run on millions of nodes with indeterminable intent.

docs/coins_spends_and_wallets.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ title: 2 - Coins, Spends and Wallets
66
This guide directly continues on from [part 1](/docs/) so if you haven't read that, please do so before reading this.
77

88
This section of the guide will cover evaluating a program inside a program, how ChiaLisp relates to transactions and coins on the Chia network, and cover some techniques to create smart transactions using ChiaLisp.
9-
If there are any terms that you aren't sure of, be sure to check the [glossary](/docs/glossary).
9+
If there are any terms that you are not sure of, be sure to check the [glossary](/docs/glossary).
1010

1111
## Coins
1212

1313
A coin's ID is constructed from 3 pieces of information.
1414

1515
1. The ID of its parent
16-
2. The hash of its puzzle (AKA the puzzlehash)
16+
2. The hash of its puzzle (AKA the puzzle hash)
1717
3. The amount that it is worth
1818

1919
To construct a coin ID simply take the hash of these 3 pieces of information concatenated in order.
@@ -79,7 +79,7 @@ Here is the complete list of conditions along with their format and behaviour.
7979

8080
* **AGG_SIG_UNSAFE - [49] - (49 pubkey message)**: This spend is only valid if the attached aggregated signature contains a signature from the given public key of the given message. This is labeled unsafe because if you sign a message once, any other coins you have that require that signature may potentially also be unlocked. It's probably better just to use AGG_SIG_ME because of the natural entropy introduced by the coin ID.
8181
* **AGG_SIG_ME - [50] - (50 pubkey message)**: This spend is only valid if the attached aggregated signature contains a signature from the specified public key of that message concatenated with the coin's ID.
82-
* **CREATE_COIN - [51] - (51 puzzlehash amount)**: If this spend is valid, then create a new coin with the given puzzlehash and amount.
82+
* **CREATE_COIN - [51] - (51 puzzlehash amount)**: If this spend is valid, then create a new coin with the given puzzle hash and amount.
8383
* **ASSERT_FEE - [52] - (52 amount)**: This spend is only valid if there is unused value in this transaction equal to *amount*, which is explicitly to be used as the fee.
8484
* **CREATE_COIN_ANNOUNCEMENT - [60] - (60 message)**: If this spend is valid, this creates an ephemeral announcement with an ID dependent on the coin that creates it. Other coins can then assert an announcement exists for inter-coin communication inside a block.
8585
* **ASSERT_COIN_ANNOUNCEMENT - [61] - (61 announcementID)**: This spend is only valid if there was an announcement in this block matching the announcementID. The announcementID is the hash of the message that was announced concatenated with the coin ID of the coin that announced it `announcementID == sha256(coinID + message)`.
@@ -141,7 +141,7 @@ $ brun '(i (= (sha256 2) (q . 0x2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e
141141
There is one final change we need to make before this is a complete smart transaction.
142142

143143
If you want to invalidate a spend then you need to raise an exception using `x`.
144-
Otherwise you just have a valid spend that isn't returning any conditions, and that would destroy our coin and not create a new one!
144+
Otherwise you just have a valid spend that is not returning any conditions, and that would destroy our coin and not create a new one!
145145
So we need to change the fail condition to be `(x "wrong password")` which means the transaction fails and the coin is not spent.
146146

147147
If we're doing this then we should also change the `(i A B C)` pattern to `(a (i A (q . B) (q . C)) 1)`.
@@ -174,18 +174,18 @@ Suppose we lock a coin up using the following puzzle:
174174
(q . ((51 0x365bdd80582fcc2e4868076ab9f24b482a1f83f6d88fd795c362c43544380e7a 100)))
175175
```
176176

177-
Regardless of what solution is passed this puzzle will *always* return instructions to create a new coin with the puzzlehash 0x365bdd80582fcc2e4868076ab9f24b482a1f83f6d88fd795c362c43544380e7a and the amount 100.
177+
Regardless of what solution is passed this puzzle will *always* return instructions to create a new coin with the puzzle hash 0x365bdd80582fcc2e4868076ab9f24b482a1f83f6d88fd795c362c43544380e7a and the amount 100.
178178

179179
```lisp
180180
$ brun '(q . ((51 0x365bdd80582fcc2e4868076ab9f24b482a1f83f6d88fd795c362c43544380e7a 100)))' '(80 90 "hello")'
181181
((51 0x365bdd80582fcc2e4868076ab9f24b482a1f83f6d88fd795c362c43544380e7a 100))
182182
183-
$ brun '(q . ((51 0x365bdd80582fcc2e4868076ab9f24b482a1f83f6d88fd795c362c43544380e7a 100)))' '("it doesn't matter what we put here")'
183+
$ brun '(q . ((51 0x365bdd80582fcc2e4868076ab9f24b482a1f83f6d88fd795c362c43544380e7a 100)))' '("it does not matter what we put here")'
184184
((51 0x365bdd80582fcc2e4868076ab9f24b482a1f83f6d88fd795c362c43544380e7a 100))
185185
```
186186

187187
In this example the result of spending the coin is entirely determined from the puzzle.
188-
Even though anybody could initiate the spend of the coin, the person that locked the coin up has all the power in the way that the coin is spent as the solution doesn't matter at all.
188+
Even though anybody could initiate the spend of the coin, the person that locked the coin up has all the power in the way that the coin is spent as the solution does not matter at all.
189189

190190
Conversely lets consider a coin locked up with the following puzzle:
191191

@@ -274,7 +274,7 @@ Change making is simple.
274274
If a wallet spends less than the total value of a coin, they can create another coin with the remaining portion of value, and lock it up with the standard puzzle for themselves again.
275275
You can split a coin up into as many new coins with fractions of the original value as you'd like.
276276

277-
You cannot create two coins of the same value, with the same puzzlehash, from the same parent as this will lead to an ID collision and the spend will be rejected.
277+
You cannot create two coins of the same value, with the same puzzle hash, from the same parent as this will lead to an ID collision and the spend will be rejected.
278278

279279
### Coin Aggregation and Spend Bundles
280280

docs/common_functions.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: common_functions
3-
title: 5 - Common Functions in Chialisp
3+
title: 5 - Common Functions in ChiaLisp
44
---
55

66
When you start to write full smart contracts, you will start to realize that you will need certain common functionality in a lot of puzzles. Let's go over how to include them and what some of them are:
@@ -36,7 +36,7 @@ Also note that the include files are a special format. Everything that is define
3636

3737
When puzzles are hashed, they are not simply serialized and passed to sha256. Instead, we take the *tree hash* of the puzzle.
3838

39-
Recall that every clvm program can be represented as a binary tree. Every object is either an atom (a leaf of the tree) or a cons box (a branch of the tree). When we hash the puzzle we start at the leaves of the tree and hash our way up, concatenating either a 1 or a 2 to denote that it's either an atom or a cons box. Once a cons box is hashed, it becomes a new leaf to be hashed into its parent cons box and the process recurses. Here's what that looks like in Chialisp:
39+
Recall that every clvm program can be represented as a binary tree. Every object is either an atom (a leaf of the tree) or a cons box (a branch of the tree). When we hash the puzzle we start at the leaves of the tree and hash our way up, concatenating either a 1 or a 2 to denote that it's either an atom or a cons box. Once a cons box is hashed, it becomes a new leaf to be hashed into its parent cons box and the process recurses. Here's what that looks like in ChiaLisp:
4040

4141
```lisp
4242
(defun sha256tree1
@@ -48,11 +48,11 @@ Recall that every clvm program can be represented as a binary tree. Every objec
4848
)
4949
```
5050

51-
It is extremely useful to calculate tree hashes within a Chialisp puzzle. You can assert puzzles of other coins, condense puzzles for easier signing, and make CREATE_COIN conditions that are dependent on some passed in data.
51+
It is extremely useful to calculate tree hashes within a ChiaLisp puzzle. You can assert puzzles of other coins, condense puzzles for easier signing, and make CREATE_COIN conditions that are dependent on some passed in data.
5252

5353
## Currying
5454

55-
Currying is an extremely important concept in Chialisp that is responsible for almost the entirety of how state is stored in coins. The idea is to pass in arguments to a puzzle *before* it is hashed. When you curry, you commit to solution values so that the individual solving the puzzle cannot change them. Let's take a look at how this is implemented in Chialisp:
55+
Currying is an extremely important concept in ChiaLisp that is responsible for almost the entirety of how state is stored in coins. The idea is to pass in arguments to a puzzle *before* it is hashed. When you curry, you commit to solution values so that the individual solving the puzzle cannot change them. Let's take a look at how this is implemented in ChiaLisp:
5656

5757
```lisp
5858
;; utility function used by curry
@@ -82,7 +82,7 @@ You can also do the reverse operation. Given a program, you can *uncurry* the l
8282
; (c curry_arg_1 (c curry_arg_2 1))
8383
```
8484

85-
Let's take our password locked coin example from earlier, this time as a Chialisp puzzle:
85+
Let's take our password locked coin example from earlier, this time as a ChiaLisp puzzle:
8686

8787
```lisp
8888
(mod (password new_puzhash amount)
@@ -143,7 +143,7 @@ Note that this required that we run the currying module using `brun` in our own
143143

144144
## Outer and Inner puzzles
145145

146-
A common design pattern, and one of the most powerful features of Chialisp, is the ability to have an outer smart contract the "wraps" an inner puzzle. This concept is extremely handy because it allows a coin to retain all of it's standard functionality and programmability within the inner puzzle, but be bound to an extra set of rules by the outer puzzle.
146+
A common design pattern, and one of the most powerful features of ChiaLisp, is the ability to have an outer smart contract the "wraps" an inner puzzle. This concept is extremely handy because it allows a coin to retain all of it's standard functionality and programmability within the inner puzzle, but be bound to an extra set of rules by the outer puzzle.
147147

148148
For this example, we're going to continue with our password locking, but this time we're going to require that every time the coin is spent, it requires a new password to be set. Let's look at all the code and then we'll break it down:
149149

@@ -203,7 +203,7 @@ You may notice that we imported a new library called `curry-and-treehash`. We'l
203203

204204
First, let's talk about the arguments. When you create this puzzle for the first time you need to curry in 3 things: `MOD_HASH` which is the tree hash of this code, `PASSWORD_HASH` which is the hash of the password that will unlock this coin, and `INNER_PUZZLE` which is a completely separate puzzle that will have its own rules about how the coin can be spent.
205205

206-
Chialisp puzzles have the tendency to be read from the bottom up, so lets start with this chunk:
206+
ChiaLisp puzzles have the tendency to be read from the bottom up, so lets start with this chunk:
207207

208208
```lisp
209209
; main
@@ -228,7 +228,7 @@ All that's happening here is that we're making sure the password is correct and,
228228
)
229229
```
230230

231-
Recursion is the foundation of Chialisp and functions like these very commonly show up when writing it. In order to iterate through the list of conditions, we first check if there are still items left (remember that an empty list `()` or **nil** evaluates to false). Then, we morph the first condition and concatenate it with the recursive output of the rest of the list. In the end, we will have the same list of items in the same order, but all of them will have passed thru `morph-condition`.
231+
Recursion is the foundation of ChiaLisp and functions like these very commonly show up when writing it. In order to iterate through the list of conditions, we first check if there are still items left (remember that an empty list `()` or **nil** evaluates to false). Then, we morph the first condition and concatenate it with the recursive output of the rest of the list. In the end, we will have the same list of items in the same order, but all of them will have passed thru `morph-condition`.
232232

233233
```lisp
234234
;; tweak `CREATE_COIN` condition by wrapping the puzzle hash, forcing it to be a password locked coin
@@ -260,6 +260,6 @@ However, all we care about is generating the correct *puzzle hash* for the next
260260

261261
And that's it! When this coin is created, it can only be spent by a password that hashes to the curried in PASSWORD_HASH. The inner puzzle can be anything that you want including other smart contracts that have their own inner puzzles. Whatever coins get created as a result of that inner puzzle will be "wrapped" by this same outer puzzle ensuring that every child of this coin is locked by a password *forever*.
262262

263-
We created a simple coin, but you can see the potential of this. You can enforce a set of rules not only on a coin that you lock up, but on *every* descendant coin. Not only that, the rules can be enforced *on top of other smart contracts*. In the Chialisp ecosystem, all smart contracts are interoperable with each other unless otherwise specified by a parent smart contract. The possibilities are endless and represent the vast programmability that Chialisp enables for coins.
263+
We created a simple coin, but you can see the potential of this. You can enforce a set of rules not only on a coin that you lock up, but on *every* descendant coin. Not only that, the rules can be enforced *on top of other smart contracts*. In the ChiaLisp ecosystem, all smart contracts are interoperable with each other unless otherwise specified by a parent smart contract. The possibilities are endless and represent the vast programmability that ChiaLisp enables for coins.
264264

265265
In the next section, we'll talk about the standard transaction format on the Chia network.

docs/deeper_into_clvm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: 3 - Deeper into CLVM
66
This guide directly continues on from [part 1](/docs/) so if you haven't read that, please do so before reading this.
77

88
This section of the guide will cover how ChiaLisp relates to transactions and coins on the Chia network.
9-
If there are any terms that you aren't sure of, be sure to check the [glossary](/docs/glossary).
9+
If there are any terms that you are not sure of, be sure to check the [glossary](/docs/glossary).
1010

1111
## Lazy Evaluation in ChiaLisp
1212

docs/faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
id: faq
2+
id: FAQ
33
title: ChiaLisp and CLVM FAQ
44
sidebar_label: ChiaLisp and CLVM FAQ
55
---

0 commit comments

Comments
 (0)