Skip to content

docs: fix the Poseidon book snippets and turn on mdbook-keeper - #263

Open
saviourmk wants to merge 1 commit into
pluto:mainfrom
saviourmk:docs/mdbook-keeper
Open

saviourmk wants to merge 1 commit into
pluto:mainfrom
saviourmk:docs/mdbook-keeper

Conversation

@saviourmk

Copy link
Copy Markdown

This PR closes #212

I uncommented the keeper preprocessor and ran mdbook build to see what was broken. Everything else either compiles or is marked ignore, and the only failing snippets were the two in the Poseidon README: they imported from ronkathon::field (it's ronkathon::algebra::field), called a load_constants that only exists in the test module, used rng, rate and squeeze_size without defining them, and called absorb and squeeze on a sponge that hadn't been moved into the absorbing or squeezing state.

It changes the following:

Both Poseidon snippets now compile and run. load_constants is a hidden helper in each snippet (simple round constants and a Cauchy matrix, which is MDS), so the rendered page still reads like before but the code is real. The sponge example goes through start_absorbing and start_squeezing, and the input size is a random number below 100 instead of a random u32.

book.toml turns the keeper preprocessor back on with optional = true, so a build without mdbook-keeper installed just prints a warning instead of failing. The README install steps mention it, and its doctest_cache folder is in .gitignore.

I couldn't include the CI part, because my token isn't allowed to touch workflow files from a fork. To run it in CI, the "Install mdbook" step in both mdbook-build.yaml and deploy.yml needs one more line. There are no prebuilt binaries, so it has to be built, and --locked keeps it building on the pinned nightly (I checked 0.5.0):

cargo install --locked --version 0.5.0 mdbook-keeper

One thing to know: keeper 0.5 prints failing snippets in the build log but doesn't fail the build, so this is visibility rather than a hard gate. The playground question from the comments is separate, this only checks the snippets at build time. Locally the build now has no keeper errors.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: MDBook keeper tests

1 participant