Skip to content

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

Open
eichhorl wants to merge 9 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 9 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 6391b16.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► packages/pocket-ic/BUILD.bazel
    Add dependency on rs/types/management_canister_types
Enhancement ► packages/pocket-ic/CHANGELOG.md
    Document added features for mockable/managed HTTP interfaces and pricing/versioning
Enhancement ► packages/pocket-ic/Cargo.toml
    Add serde_bytes as workspace dependency
Enhancement ► packages/pocket-ic/HOWTO.md
    Add section on Flexible canister HTTP outcalls and pay-as-you-go pricing details
Enhancement ► packages/pocket-ic/src/common/rest.rs
    Introduce CanisterHttpReplication and CanisterHttpPricingVersion enums
    Extend RawCanisterHttpRequest with replication and pricing_version
    Extend CanisterHttpRequest with replication and pricing_version
    Add RawMockFlexibleCanisterHttpResponse and MockFlexibleCanisterHttpResponse types
    Add conversions between Raw and Strongly-Typed representations
Enhancement ► packages/pocket-ic/src/lib.rs
    Expose MockFlexibleCanisterHttpResponse in API surface
    Update PocketIc docs to mention mock_flexible_canister_http_response
Enhancement ► packages/pocket-ic/src/nonblocking.rs
    Add mock_flexible_canister_http_response method (async) and documentation notes
Enhancement ► packages/pocket-ic/test_canister/canister.did
    Add canister_http_raw and flexible_canister_http entry points (Raw/Raw result types)
Enhancement ► packages/pocket-ic/test_canister/src/canister.rs
    Update canister to map errors with Into and add canister_http_raw and flexible_canister_http helpers
Enhancement ► packages/pocket-ic/tests/tests.rs
    Extend tests to include flexible canister HTTP outcalls with new types, pricing versions, and transforms
    Add numerous test scenarios for flexible outcalls, timeouts, partial responses, and per-replica pricing behavior
Enhancement ► (General) Various tests and test helpers to cover flexible canister HTTP outcalls, pricing versions, and transforms

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