Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Next
* Add `InternetComputer.subnetSelfNodeCount`, wrapping `ic0.subnet_self_node_count`, so sizing a flexible HTTPS outcall's committee no longer requires importing `mo:⛔` (#TBD).

## 2.7.0
* Derive `toText` implicit arguments for variants: import the new `Variants` module, plus the new `Unit` module for cases without a payload, and a variant renders the way `debug_show` prints it, for example `#active` or `#banned(3, abuse)`. Add the `toText`, `equal`, and `compare` functions that derivation needs but that were missing: `Blob.toText`, `Order.compare`, `Order.toText`, and `PriorityQueue.equal`, `PriorityQueue.compare`, and `PriorityQueue.toText`, which list elements in priority order (#560).
Expand Down
9 changes: 9 additions & 0 deletions src/InternetComputer.mo
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ module {
/// `isReplicated` is true for update messages and for queries that passed through consensus.
public let isReplicated : () -> Bool = Prim.isReplicatedExecution;

/// The number of nodes on the subnet this canister runs on.
///
/// Useful for sizing a flexible HTTPS outcall, whose `total_requests` must not exceed it:
///
/// ```motoko no-repl
/// let totalRequests = Nat32.min(InternetComputer.subnetSelfNodeCount(), 5);
/// ```
public let subnetSelfNodeCount : () -> Nat32 = Prim.subnetSelfNodeCount;

/// Given computation, `comp`, counts the number of actual and (for IC system calls) notional WebAssembly
/// instructions performed during the execution of `comp()`.
///
Expand Down