dfinity / dfinity/developer-docs

fix: replace mo:base references in optimization and randomness guides

Open
#122 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
JavaScript
Stars
4
Forks
5
Avg merge
1d 6h
Merged PRs (30d)
30

Description

Two docs pages reference `mo:base` in notes about upstream examples. Rather than patching the notes, the right fix is a purpose-built example and a full guide rewrite.

Current state

  • `docs/guides/backends/randomness.md` — notes that `motoko/random_maze` in `dfinity/examples` uses `mo:base/Random.Finite`
  • `docs/guides/canister-management/optimization.md` — notes that `motoko/low_wasm_memory` uses legacy `mo:base`

Plan

randomness.md (primary scope)

Per issue #44, create a new `random_lottery` example (Motoko + Rust, Ninja-enabled) with three focused regions:

Region What it shows
`raw_rand_call` Calling the management canister's `raw_rand`
`random_in_range` Deriving a bounded `Nat` from the 32-byte result
`fair_selection` Picking a winner from a list

Then:

  1. Add region markers + `mops.toml` in a PR to `dfinity/examples`
  2. Bump `.sources/examples` submodule
  3. Rewrite `randomness.md` → `randomness.mdx` using `` — the `mo:base` note disappears naturally
  4. Keep `random_maze` as a "see also" link (no note about `mo:base`)

The example is backend-only; ICP Ninja provides the UI for calling canister methods.

optimization.md (separate, smaller fix)

Remove the note about `motoko/low_wasm_memory` using legacy `mo:base` — the inline snippet in the page is already the correct `mo:core` reference. This is a one-line text change, independent of the `random_lottery` work.

Out of scope

Updating `random_maze` itself — the maze algorithm is too complex to serve as a teaching example for randomness patterns.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/guides/backends/randomness.md, docs/guides/canister-management/optimization.md, and the dfinity/examples repository structure for regional examples. Create the random_lottery example and its markers and mops.toml, update the .sources/examples submodule, migrate randomness.md to randomness.mdx with CodeExample, and remove the obsolete optimization note. Done means the guides no longer recommend legacy mo:base references and the new example covers the three specified regions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.