Repository navigation
feat!: price HTTPS outcalls with pay-as-you-go pricing (6.0.0) - #21
Merged
Merged
Conversation
Call.httpRequest becomes a builder that sets pricing_version = ?2 and attaches the cost from Prim.costHttpRequestV2, which moc 2.1.0 exposes. Call.flexibleHttpRequest is its counterpart for flexible_http_request. The design follows #16. It drops Prim.subnetSelfNodeCount, because moc imports it into every canister that imports Call, and replicas without it refuse to install those canisters. HTTPS outcall tests move to PocketIC 16.1.0. The dfx 0.30.1 replica implements an earlier draft of ic0.cost_http_request_v2 that rejects the specified parameters. Co-authored-by: Leo Eichhorn <leo.eichhorn@dfinity.org> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`mops publish` runs every test file on one replica, and no replica passes both, so the publish workflow now runs the same split as CI and publishes with `--no-test`. Request bytes are UTF-8 lengths, as the system charges. `Text.size()` counted characters and under-reserved for non-ASCII URLs and headers. New tests pin each builder cost to `ic0.cost_http_request_v2` on the parameters the spec defines, which catches swapped fields. The CHANGELOG now states the replica requirement every `Call` importer inherits, and no longer overstates the flexible per-node cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The `test-pocket-ic` job now uses mops 2.24.0 with `--replica pocket-ic`, the same combination the publish workflow runs, so a PR exercises it. A golden test pins the transform path: context bytes, the encoded function reference, and the 5 billion instruction maximum. Docs no longer say HTTPS outcalls attach the minimum, describe the per-node budget split, and say an outcall that exceeds its expectations is rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Call.httpRequestnow attaches a pricing version 2 ("pay-as-you-go") reservation instead of the version 1 cost. Version 1 charges formax_response_bytes, which is 2 MB when unset. Version 2 charges for the bytes and round-trip time a call actually uses and refunds the rest. Costs come fromPrim.costHttpRequestV2, whichmoc2.1.0 exposes.Supersedes #16, rebuilt on the 5.0.0 types from #17. The builder design is from #16.
Before / After
The signature change is deliberate. Every call site fails to compile until it migrates, rather than switching pricing silently.
Call.Cost.httpRequest(args, expected)now prices version 2. The version 1Call.Cost.httpRequest(args)is gone, butPrim.costHttpRequeststill exposes it.[requirements] mocgoes to 2.1.0. Merging publishesic6.0.0, so this is a draft.Differences from #16
Prim.subnetSelfNodeCount.mocimports every system API it references into each canister that importsmo:ic/Call, even a canister that only callscreateCanister. Replicas withoutic0.subnet_self_node_count, such as the ones indfx0.30.1 and 0.31.0, refuse to install those canisters. feat: pay-as-you-go pricing and flexible outcalls (5.0.0) #16 used the node count only to cap the default reservation whenreplicationis unset. Without it, such a flexible outcall reserves for full-size responses, and the surplus is refunded. Settingreplicationrestores the cap.#flexible_instead of#_351978059_.mocdrops the trailing underscore when it maps to Candid, the same escapedidcuses for#public_.replicationis passed through as given. When it's unset, the system applies its own defaults, the same asic-cdk-management-canister.Cost.httpRequestV2is namedCost.httpRequest. It takes a second argument, so old call sites fail to compile.Why CI changed
The
dfx0.30.1 replica that CI uses implements an earlier draft ofic0.cost_http_request_v2, with five parameters and nooutcall_type. It rejects the specified encoding:PocketIC 16.1.0 implements the spec. However, under
mops testPocketIC has no signing keys and makes no outcalls. The suite is now split:testjob: runstest/Call.test.moondfx0.30.1 forcreate_canister, ECDSA, and Schnorr. The suite is unchanged except that the HTTP tests moved out.test-pocket-icjob: runstest/HttpRequest.test.moon PocketIC 16.1.0. It pins each builder's cost toic0.cost_http_request_v2on the parameters the spec defines, and checks that each setter moves the price the right way.Both jobs use
mops2.24.0.mops publishwould run every test file on a single replica, and neither replica passes both. Somops-publish.ymlnow runs the same two commands, thenmops publish --no-test. As a side effect, mops.one won't show test results for 6.0.0.No CI replica can both price version 2 and make an outcall, so nothing here sends a request end to end.
send()isgetCost()plus the management canister call.🤖 Generated with Claude Code