Repository navigation
Conversation
`InternetComputer` wraps the system calls a canister needs, several of them straight from `Prim`: `call_raw`, `isReplicatedExecution`, `performanceCounter`. `ic0.subnet_self_node_count` had no wrapper, so a canister that needs the subnet's node count imports `mo:⛔` itself. Flexible HTTPS outcalls need it: `flexible_http_request` takes `ReplicationCounts`, whose `total_requests` must not exceed the number of nodes, so a committee smaller than the subnet has to be sized against the count rather than hardcoded. Rust has it as ordinary public API, `ic_cdk::api::subnet_self_node_count()`. The primitive exists from moc 2.1.0, so this does not compile on the currently pinned 1.16.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One wrapper:
InternetComputeralready wrapsPrim.call_raw,Prim.isReplicatedExecutionandPrim.performanceCounter.ic0.subnet_self_node_countwas the one left out, so a canister that needs the subnet's node count has toimport Prim "mo:⛔"itself.Why now
Flexible HTTPS outcalls need it.
flexible_http_requesttakesReplicationCounts, andtotal_requestsmust not exceed the number of nodes on the subnet, so asking a committee smaller than the subnet means sizing it against the count:A smaller committee is the point of the feature: fewer requests cost less and are gentler on the endpoint's rate limits. Hardcoding a number instead breaks on a subnet smaller than that number.
Rust has this as ordinary public API,
ic_cdk::api::subnet_self_node_count(), so Motoko is the only side reaching into a module named "no entry" for it. That is now visible in published material: the Motoko flexible outcall example in dfinity/examples#1490 and thehttps-outcallsagent skill both importmo:⛔and carry a comment explaining why.Why CI will be red, and what you have to decide
Prim.subnetSelfNodeCountexists from moc 2.1.0. This repo pins[toolchain] moc = "1.16.0"and runs a second CI leg on moc 2.0.0. Verified withcheck:orphanson this branch:So this cannot merge as-is, and the change that makes it mergeable is not mine to make.
coreis foundational: anything that stops type-checking below moc 2.1.0 raises the floor for every consumer, not just callers of the new function. Projects on moc 1.x would failmops checkthe way a moc 2.x project does today againstbaseand itsExperimentalStableMemory.I am opening it as a one-line proposal so the cost is visible rather than described, and I have deliberately not bundled the pin bump, the CI leg change,
validation/api/api.lock.json, or a[requirements]raise. Happy to do any of that, split it differently, or close this if the floor should not move yet.The
Changelog.mdentry under## Nextcarries a#TBDthat wants this PR number.🤖 Generated with Claude Code