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

未关闭
#122 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
冷清
技术栈
rust

调研方向

从 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 内容生成。

描述

documentation

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.

主要语言
JavaScript
星标
4
派生
5
平均合并
1 天 6 小时
30 天内合并 PR
30

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dfinity/developer-docs 的其他 Issue

查看 dfinity/developer-docs 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。