fix: replace mo:base references in optimization and randomness guides
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- rust
- 领域
- backend, documentation
调研方向
从 docs/guides/backends/randomness.md、docs/guides/canister-management/optimization.md 以及 dfinity/examples 仓库中区域示例的结构开始。创建 random_lottery 示例及其标记和 mops.toml,更新 .sources/examples 子模块,将 randomness.md 迁移为带有 CodeExample 的 randomness.mdx,并删除过时的优化说明。完成的标准是:指南不再推荐使用 legacy mo:base 引用,并且新示例涵盖指定的三个区域。
由索引模型根据 Issue 内容生成。
描述
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:
- Add region markers + `mops.toml` in a PR to `dfinity/examples`
- Bump `.sources/examples` submodule
- Rewrite `randomness.md` → `randomness.mdx` using `` — the `mo:base` note disappears naturally
- 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.
- 主要语言
- JavaScript
- 星标
- 4
- 派生
- 5
- 平均合并
- 1 天 6 小时
- 30 天内合并 PR
- 30
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dfinity/developer-docs 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 55/100
dfinity/developer-docs#281 ·
-
难度 4/5 3-5 天 新手友好度 35/100
dfinity/developer-docs#279 ·
-
docs: cycle cost docs follow-up — ICP formula, worked example, instruction profiling, cost traps 未关闭
难度 4/5 3-5 天 新手友好度 68/100
dfinity/developer-docs#274 ·
-
documentation enhancement
难度 4/5 3-5 天 新手友好度 52/100
dfinity/developer-docs#232 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 65/100
dfinity/developer-docs#228 ·
查看 dfinity/developer-docs 的全部 Issue
相似的 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 90/100
apache/cloudstack#14222 ·
-
Browser Waiting for: Product Owner
难度 2/5 1-3 小时 新手友好度 85/100
getsentry/sentry-javascript#24577 · 1 条评论 ·
-
curation good first issue
难度 2/5 1-3 小时 新手友好度 88/100
amponce/archive-movie-browser#186 ·
-
light
难度 2/5 1-3 小时 新手友好度 85/100
aemdemos/patients-stryker#253 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
clerk/javascript#9852 ·