Skip to content

docs: Motoko pay-as-you-go pricing and flexible outcalls - #448

Open
eichhorl wants to merge 4 commits into
mainfrom
docs/motoko-pay-as-you-go-outcalls
Open

eichhorl wants to merge 4 commits into
mainfrom
docs/motoko-pay-as-you-go-outcalls

Conversation

@eichhorl

Copy link
Copy Markdown
Contributor

Summary

Verification

  • npm run build passes (Node 24, submodules at their pins), and every snippet= region resolves.
  • node scripts/validate.js passes on both changed pages.

The `ic` package gained a builder in 6.0.0 that prices every outcall with
version 2 and takes the expectations that narrow its reservation, and a
builder for `flexible_http_request`. Every statement that Motoko is
version 1 only, or that the expectation setters and flexible outcalls are
Rust only, is no longer true.

The flexible example gains a Motoko tab, and the cycle costs section now
describes one rule for both languages rather than a split. The warning
against setting `pricing_version = 2` by hand goes with it: both builders
overwrite the field, so it can no longer disagree with the amount attached.
The guide said the two byte expectations are the ones to leave alone,
without the exception that matters most: a delivered byte costs about 15
times a downloaded one, so when a transform bounds its own output,
declaring that bound is often the largest single saving, and it is the
case lowering `max_response_bytes` cannot reach.

It also said an under-sized attachment can fail partway without saying
what that looks like. None of the four rejects mentions cycles, and the
likeliest one is the same message a non-deterministic transform produces,
so a reader who hits it has been sent to rewrite the transform instead of
the reservation.

Also drops a "in Rust" that the Motoko builder made wrong.
Pins .sources/examples to dfinity/examples@33af78a, the merge of
dfinity/examples#1490. The HTTPS outcalls guide quotes the Motoko
send_http_flexible regions from it, and the Motoko GET and POST
regions now show the ic 6.0.0 builder.
@eichhorl
eichhorl requested a review from a team as a code owner November 10, 2026 09:54
Copilot AI balanced review requested due to automatic review settings November 10, 2026 09:54
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

🤖 Here's your preview: https://dpfyp-oaaaa-aaaam-ahcqa-cai.icp0.io

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The guide still misstates shared-budget behavior and cycle-error semantics and omits the required minimum compiler version.

4 open issues
What changed in this PR

Updates the HTTPS outcall documentation to cover Motoko support for version 2 pricing and flexible outcalls alongside Rust.

Changes:

  • Adds Motoko tabs for flexible requests and response reconciliation.
  • Updates both pages to describe version 2 pricing through the language wrappers.
  • Expands guidance on transformed-response savings and insufficient cycle reservations.

Verified: Checked the reservation and error explanations against the local management-canister reference. Builds and snippet resolution were not rerun.

File Description
docs/​guides/​backends/​https-outcalls.mdx Adds Motoko examples and expands pricing and troubleshooting guidance.
docs/​concepts/​https-outcalls.md Updates wrapper support for version 2 pricing and flexible outcalls.

Review effort: Balanced

Comment thread docs/guides/backends/https-outcalls.mdx Resolved
Comment thread docs/guides/backends/https-outcalls.mdx Resolved
Comment thread docs/guides/backends/https-outcalls.mdx Resolved
Comment thread docs/guides/backends/https-outcalls.mdx Resolved
…rement

Out of cycles fires once the committee's unspent allowance cannot pay for
delivering any response, whether or not the nodes agreed. It is also the
one reject that does name cycles. A transform that exceeds its declared
output only fails the call when the rest of the budget cannot cover the
delivery, and ic 6.0.0 needs moc 2.1.0.
@eichhorl

Copy link
Copy Markdown
Contributor Author

🤖 Feedback addressed. All four Copilot comments were right:

  • Compiler requirement (https-outcalls.mdx:21): the prerequisite now says ic 6.0.0 requires moc 2.1.0, as its mops.toml does. The 1.9.0 toolchain in docs/getting-started/project-structure.mdx is a different page, so it is left for a separate change.
  • Transformed-size expectation (:247): exceeding it is now a risk, not a certainty. Delivery is paid from whatever the nodes leave unspent, so a larger output fails the call only when the rest of the budget cannot cover it. That matches the replica, where delivery is "only covered if the contributing replicas left enough of their allowances unspent".
  • "None of the rejects mentions cycles" (:249): replaced. Only Out of cycles names the cause; the other three look like unrelated failures.
  • Out of cycles implying agreement (:252): removed. In the replica, find_non_flexible_out_of_cycles takes one share per committee member across every response group, and fires once their unspent allowance cannot pay for delivering any response. The bullet now says that, and nothing about agreement.

npm run build and node scripts/validate.js pass.

Copilot AI balanced review requested due to automatic review settings November 10, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unavailable examples and upstream package sources prevent verification of the new Motoko snippets, version requirements, pricing behavior, and rejection diagnostics, requiring maintainer review.

No open issues 🎉

4 resolved since last review

Review effort: Balanced

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.

2 participants