Skip to content

Commit fece68a

Browse files
youyyytrokColin Roberts
andauthored
feat: MDBook linkcheck (#192)
* Update broken link ghash.rs * Update broken link gcm.rs * fix formatting in aes/README.md * Update broken links README.md * Create checklinks.yml * Update deploy.yml * Update checklinks.yml * Update README.md * Delete lychee * Update book.toml * Create mdbook-test.yaml * fix: two tests in `poseidon/README.md` * cleanup mdbook * Update mdbook-test.yaml * Update book.toml * fix: update workflows --------- Co-authored-by: Colin Roberts <colin@primitive.xyz>
1 parent 48c1f02 commit fece68a

14 files changed

Lines changed: 111 additions & 128 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
env:
2828
MDBOOK_VERSION: 0.4.43
2929
MDBOOK_KATEX_VERSION: 0.9.2
30+
MDBOOK_LINKCHECK_VERSION: 0.7.7
3031
steps:
3132
- uses: actions/checkout@v4
3233

@@ -42,16 +43,14 @@ jobs:
4243
run: |
4344
cargo binstall --no-confirm --version ${MDBOOK_VERSION} mdbook
4445
cargo binstall --no-confirm --version ${MDBOOK_KATEX_VERSION} mdbook-katex
46+
cargo binstall --no-confirm --version ${MDBOOK_LINKCHECK_VERSION} mdbook-linkcheck
4547
4648
- name: Setup Pages
4749
id: pages
4850
uses: actions/configure-pages@v5
4951

5052
- name: Build with mdBook
51-
run: |
52-
cargo run --bin create_mdbook
53-
cp -r assets book/
54-
mdbook build
53+
run: mdbook build
5554

5655
- name: Upload artifact
5756
uses: actions/upload-pages-artifact@v3
@@ -64,7 +63,7 @@ jobs:
6463
name: github-pages
6564
url: ${{ steps.deployment.outputs.page_url }}
6665
runs-on: ubuntu-latest
67-
needs: build
66+
needs: [build]
6867
steps:
6968
- name: Deploy to GitHub Pages
7069
id: deployment
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: MDBook Build
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
env:
11+
MDBOOK_VERSION: 0.4.43
12+
MDBOOK_KATEX_VERSION: 0.9.2
13+
MDBOOK_LINKCHECK_VERSION: 0.7.7
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install cargo-binstall
18+
uses: cargo-bins/cargo-binstall@main
19+
20+
- name: Install rust
21+
run: |
22+
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
23+
rustup update
24+
25+
- name: Install mdbook and plugins
26+
run: |
27+
cargo binstall --no-confirm --version ${MDBOOK_VERSION} mdbook
28+
cargo binstall --no-confirm --version ${MDBOOK_KATEX_VERSION} mdbook-katex
29+
cargo binstall --no-confirm --version ${MDBOOK_LINKCHECK_VERSION} mdbook-linkcheck
30+
31+
- name: Build mdBook
32+
run: mdbook build

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ version ="0.1.1"
99
exclude =["CHANGELOG.md", "assets/"]
1010

1111
[dependencies]
12-
rand ="0.8"
13-
itertools ="0.14"
14-
hex ="0.4"
15-
crypto-bigint ="0.6.0-rc.6"
16-
regex ="1.11.1"
17-
num-traits ="0.2.19"
12+
rand ="0.8"
13+
itertools ="0.14"
14+
hex ="0.4"
15+
crypto-bigint="0.6.0-rc.6"
16+
regex ="1.11.1"
17+
num-traits ="0.2.19"
1818

1919
[dev-dependencies]
2020
rstest ="0.24"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Ronkathon is a collection of cryptographic primitives implemented in Rust. It is
2222
- **Fundamental Algebraic Structures**
2323
- [Group](src/algebra/group/README.md)
2424
- [Fields and Their Extensions](src/algebra/field/README.md)
25-
- [Binary Fields](src/field/binary_towers/README.md)
25+
- [Binary Fields](src/algebra/field/binary_towers/README.md)
2626
- [Curves and Their Pairings](src/curve/README.md)
2727
- [Polynomials](src/polynomial/mod.rs)
2828
- [KZG Commitments](src/kzg/README.md)
@@ -82,13 +82,13 @@ In particular, the `math/field.sage` computes roots of unity in the `PlutoField`
8282
## Building mdBook
8383

8484
To locally build/serve the [mdBook](https://github.com/rust-lang/mdBook) site, install mdBook and [mdbook-katex](https://github.com/lzanini/mdbook-katex):
85-
```
85+
```ignore
8686
cargo install mdbook
8787
cargo install mdbook-katex
8888
```
8989

9090
To build, run:
91-
```
91+
```ignore
9292
cargo run --bin create_mdbook
9393
cp -r assets book/
9494
mdbook build
@@ -98,7 +98,7 @@ If you want to serve locally, run `mdbook serve`.
9898

9999
## License
100100

101-
Licensed under the Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
101+
Licensed under the Apache License, Version 2.0 ([LICENSE-APACHE](./LICENSE) or http://www.apache.org/licenses/LICENSE-2.0)
102102

103103
## Contributing
104104

book.toml

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
11
[book]
2-
authors = ["Contributors to Ronkathon"]
3-
language = "en"
4-
multilingual = false
5-
src = "book"
6-
title = "Ronkathon: Cryptography Educational Foundations"
7-
description = "Cryptography Educational Foundations"
2+
authors =["Contributors to Ronkathon"]
3+
language ="en"
4+
multilingual=false
5+
src ="."
6+
title ="Ronkathon: Cryptography Educational Foundations"
7+
description ="Cryptography Educational Foundations"
88

99
[build]
10-
build-dir = "docs"
11-
use-default-preprocessors = true
12-
create-missing = true
10+
build-dir ="docs"
11+
use-default-preprocessors=true
12+
create-missing =true
1313

1414
[preprocessor.katex]
15-
after = ["links"]
15+
after=["links"]
16+
17+
[preprocessor.linkcheck]
18+
follow-web-links =true
19+
traverse-parent-directories=true
20+
21+
# TODO (autoparallel): there's a bunch to fix with this
22+
# [preprocessor.keeper]
23+
# command ="mdbook-keeper"
24+
# manifest_dir="."
25+
# externs =["ronkathon", "rand"]
1626

1727
[output.html]
18-
default-theme = "dark"
19-
preferred-dark-theme = "ayu"
20-
git-repository-url = "https://github.com/pluto/ronkathon"
28+
default-theme ="dark"
29+
preferred-dark-theme="ayu"
30+
git-repository-url ="https://github.com/pluto/ronkathon"
31+
32+
[output.html.playground]
33+
editable=true
34+
runnable=true
35+
36+
[rust]
37+
edition="2021"
38+
39+
[[output.html.playground.pre-installed-crates]]
40+
name ="rand"
41+
version="0.8"

src/algebra/field/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The structs that implement these traits are
4646
4747
### `PrimeField`
4848
The `PrimeField` struct is a wrapper around a `usize` by:
49-
```rust
49+
```rust,ignore
5050
pub struct PrimeField<const P: usize> {
5151
value: usize,
5252
}
@@ -62,7 +62,7 @@ All of the relevant arithmetic operations for `PrimeField<P>` are implemented in
6262

6363
### `GaloisField`
6464
The `GaloisField` struct is a wrapper around a `PrimeField<P>` by:
65-
```rust
65+
```rust,ignore
6666
use ronkathon::algebra::field::prime::PrimeField;
6767
pub struct GaloisField<const N: usize, const P: usize> {
6868
value: [PrimeField<P>; N],

src/algebra/group/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The structs that implement these traits are
1919

2020
### `MultiplicativePrimeGroup`
2121
The `MultiplicativePrimeGroup` struct is a wrapper around a `usize` that defines $(Z/nZ)^{*}$ for a prime power $n=p^k$ with binary operation as $\times$:
22-
```rust
22+
```rust,ignore
2323
pub struct MultiplicativePrimeGroup<const P: usize, const K: usize>(usize);
2424
```
2525

src/bin/create_mdbook.rs

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/compiler/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Outputs parsed output in form of `WireCoeffs` values and coefficients.
2424
- `coefficients`: coefficient corresponding to each variable.
2525

2626

27-
```rust
27+
```rust,ignore
2828
use std::collections::HashMap;
2929
/// Values of wires with coefficients of each wire name
3030
#[derive(Debug, PartialEq)]
@@ -68,7 +68,7 @@ r2[right input]-->b
6868
b-->o2[output=l+r]
6969
```
7070

71-
```rust
71+
```rust,ignore
7272
use ronkathon::algebra::field::prime::PlutoScalarField;
7373
/// Fan-in 2 Gate representing a constraint in the computation.
7474
/// Each constraint satisfies PLONK's arithmetic equation: `a(X)QL(X) + b(X)QR(X) + a(X)b(X)QM(X) +
@@ -107,7 +107,7 @@ Converts `WireValues` to required polynomials in PLONK, i.e.
107107

108108
To get selector polynomials from constraints, each constraint is parsed into fan-in 2 arithmetic gates as explained above and wire values are assigned to respective wires in lagrange form.
109109

110-
```rust
110+
```rust,ignore
111111
/// `CommonPreprocessedInput` represents circuit related input which is apriori known to `Prover`
112112
/// and `Verifier` involved in the process.
113113
use ronkathon::{
@@ -154,8 +154,8 @@ permutation helper creates $\sigma_i$ polynomials for $i = \{1,2,3\}$.
154154
- for example: x's usage gets shifted 1 to right, new one becomes: `{'x': [(3, RIGHT), (1, LEFT), (2, LEFT), (2, RIGHT)]}`.
155155
- This ensures that variables `x` is copied from $x_i$ to $x_{i+1}$
156156

157-
```rust
158-
use ronkathon::compiler::parser::WireCoeffs;
157+
```rust,ignore
158+
use ronkathon::compiler::parser::WireCoeffs;
159159
160160
/// `Program` represents constraints used while defining the arithmetic on the inputs
161161
/// and group order of primitive roots of unity in the field.

src/encryption/symmetric/aes/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ To generate more round keys out of the original key, we do a series of word rota
4545

4646
For round **i**, if i is a multiple of the length of the key (in words):
4747

48-
```rust
48+
```rust,ignore
4949
Self::rotate_word(&mut last);
5050
word = (u32::from_le_bytes(Self::sub_word(last))
5151
^ u32::from_le_bytes(ROUND_CONSTANTS[(i / key_len) - 1]))
@@ -54,13 +54,13 @@ For round **i**, if i is a multiple of the length of the key (in words):
5454

5555
if i + 4 is a multiple of 8:
5656

57-
```rust
57+
```rust,ignore
5858
word = Self::sub_word(last)
5959
```
6060

6161
The final step is always to XOR previous round's round key with the *(i - key_len)*-th round key:
6262

63-
```rust
63+
```rust,ignore
6464
let round_key = expanded_key[i - key_len]
6565
.iter()
6666
.zip(last.iter())
@@ -132,8 +132,8 @@ In production-level AES code, fast AES software uses special techniques called t
132132

133133
## References
134134

135-
- [FIPS197](fips197)
136-
- [Serious Cryptography - A Practical Introduction to Modern Cryptography](seriouscrypto)
135+
- [FIPS197][fips197]
136+
- [Serious Cryptography - A Practical Introduction to Modern Cryptography][seriouscrypto]
137137

138138
[aes]: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
139139
[des]: ../des/README.md

0 commit comments

Comments
 (0)