Skip to content

feat: CON-1700 Support flexible outcalls and pay-as-you-go pricing in pocket-ic - #11245

Open
eichhorl wants to merge 7 commits into
masterfrom
eichhorl/flexible-outcalls-pocket-ic
Open

feat: CON-1700 Support flexible outcalls and pay-as-you-go pricing in pocket-ic#11245
eichhorl wants to merge 7 commits into
masterfrom
eichhorl/flexible-outcalls-pocket-ic

Conversation

@eichhorl

@eichhorl eichhorl commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Replica Changes

The option to choose pay-as-you-go pricing for non- and fully-replicated outcalls is now gated behind the same feature flag that is already gating flexible outcalls (which use pay-as-you-go pricing by default).

Pocket-ic Changes

Added

  • Add a function and the type to mock the responses of the committee nodes of a pending flexible canister HTTP outcall.
  • Add the replication field on CanisterHttpRequest describing how a pending canister HTTP outcall is replicated across the nodes of its subnet: FullyReplicated, NonReplicated, or Flexible with the outcall's total_requests, min_responses, and max_responses.
  • Add the pricing_version field on CanisterHttpRequest, reporting whether a pending canister HTTP outcall is priced with the Legacy or the PayAsYouGo pricing model.
  • Enabling beta features (IcpConfig::beta_features passed to PocketIcBuilder::with_icp_config) now also enables the pay-as-you-go pricing model, which covers both the flexible_http_request management canister endpoint (whose outcalls are always priced that way) and the pricing_version field of http_request (through which a fully replicated or non-replicated outcall can select it).

Changed

  • Mocked canister HTTP responses report the cycles their node actually spent on the outcall, instead of reporting no spend at all.
  • Mocking a canister HTTP response whose reject message exceeds 1 KiB now fails. Such a response is not one any node could have reported.
  • A node that cannot pay for gossiping its mocked reject reports an out-of-cycles reject instead of the mocked one, matching what a node of a real subnet does under pay-as-you-go pricing.

@github-actions github-actions Bot added the feat label Aug 20, 2026

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.

Pull request overview

Adds flexible HTTP outcall mocking and pay-as-you-go pricing support across the replica, PocketIC server, client API, and tests.

Changes:

  • Gates pay-as-you-go pricing with the flexible-outcalls feature flag.
  • Adds flexible response mocking plus replication and pricing metadata.
  • Accounts for mocked response costs and validates reject-message limits.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rs/types/types/src/canister_http.rs Gates selectable pricing versions.
rs/types/management_canister_types/src/lib.rs Re-exports pricing constants.
rs/types/management_canister_types/src/http.rs Defines gated pricing versions.
rs/tests/networking/canister_http_correctness_test.rs Updates context construction.
rs/state_machine_tests/src/lib.rs Supports per-node response receipts.
rs/pocket_ic_server/src/state_api/state.rs Adds mock-validation errors.
rs/pocket_ic_server/src/state_api/routes.rs Adds the flexible-mocking route.
rs/pocket_ic_server/src/pocket_ic.rs Implements metadata, pricing, and flexible mocking.
rs/pocket_ic_server/src/beta_features.rs Enables flexible HTTP requests.
rs/pocket_ic_server/CHANGELOG.md Documents server changes.
rs/pocket_ic_server/Cargo.toml Adds the pricing dependency.
rs/pocket_ic_server/BUILD.bazel Adds the Bazel pricing dependency.
rs/https_outcalls/client/src/client.rs Enables pay-as-you-go request processing.
rs/execution_environment/src/execution_environment/tests.rs Tests pricing feature gating.
rs/execution_environment/src/execution_environment.rs Passes pricing-gate state into requests.
packages/pocket-ic/tests/tests.rs Adds comprehensive integration coverage.
packages/pocket-ic/test_canister/src/canister.rs Adds raw and flexible outcall methods.
packages/pocket-ic/test_canister/canister.did Exposes the new test methods.
packages/pocket-ic/src/nonblocking.rs Adds the asynchronous flexible-mocking API.
packages/pocket-ic/src/lib.rs Adds the synchronous flexible-mocking API.
packages/pocket-ic/src/common/rest.rs Defines new REST request and metadata types.
packages/pocket-ic/HOWTO.md Documents flexible outcalls and pricing.
packages/pocket-ic/CHANGELOG.md Records client-facing changes.
packages/pocket-ic/Cargo.toml Adds the test serialization dependency.
packages/pocket-ic/BUILD.bazel Adds corresponding test dependencies.
Cargo.lock Locks the added dependencies.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/pocket-ic/HOWTO.md Outdated
Comment thread rs/pocket_ic_server/src/pocket_ic.rs Outdated
eichhorl and others added 2 commits August 21, 2026 11:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@eichhorl
eichhorl marked this pull request as ready for review August 21, 2026 09:31
@eichhorl
eichhorl requested a review from a team as a code owner August 21, 2026 09:31
@eichhorl eichhorl changed the title feat: Support flexible outcalls and pay-as-you-go pricing in pocket-ic feat: CON-1700 Support flexible outcalls and pay-as-you-go pricing in pocket-ic Aug 21, 2026
@zeropath-ai

zeropath-ai Bot commented Aug 21, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 20cfcdf.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► packages/pocket-ic/src/common/rest.rs
    Add CanisterHttpReplication and CanisterHttpPricingVersion enums and integrate into RawCanisterHttpRequest/CanisterHttpRequest structures
► packages/pocket-ic/src/common/rest.rs
    Add MockFlexibleCanisterHttpResponse struct and conversions to/from RawMockFlexibleCanisterHttpResponse
Enhancement ► packages/pocket-ic/src/lib.rs
    Update imports and references to include MockFlexibleCanisterHttpResponse and new flexible outcall support notes
Enhancement ► packages/pocket-ic/src/nonblocking.rs
    Add support and documentation for mock_flexible_canister_http_response in async context
Enhancement ► packages/pocket-ic/BUILD.bazel
    Add dependency on serde_bytes in pocket-ic tests/build rules and include serde_bytes in test/dependency list
Enhancement ► packages/pocket-ic/CHANGELOG.md
    Document Added changes for flexible canister HTTP outcalls and related pricing/replication fields
Enhancement ► packages/pocket-ic/Cargo.toml
    Declare serde_bytes as workspace dependency for wiring new types
Enhancement ► packages/pocket-ic/HOWTO.md
    Add documentation for Flexible canister HTTP outcalls and pay-as-you-go pricing model
Enhancement ► packages/pocket-ic/test_canister/canister.did
    Extend interface to include canister_http_raw and flexible_canister_http raw entry points
Enhancement ► packages/pocket-ic/test_canister/src/canister.rs
    Update canister HTTP error mapping to be generic over Into for flexibility
Enhancement ► packages/pocket-ic/tests/tests.rs
    Add private ic_management_canister_types_private imports and extensive tests for flexible canister HTTP outcalls (including raw and transformed variants)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants