Ah, it appears they are the same based on my tests, the documentation probably reduces down into the formula in the OP.
Okay so then I have another question. When I set cycles to 0 on one of my HTTP outcalls, I get an error asking for 1_603_166_400 cycles: http_request request sent with 0 cycles, but 1_603_166_400 cycles are required
I have not set max_response_bytes. My calculation for this request, using both of the methods I was describing above, gets me to 20_850_393_200. Why is my calculation so far off from what is actually required?
I guess you’re computing for the mainnet with 13 nodes, but dfx runs with single node subnet. So the costs that dfx shows are 1/13th of the average mainnet subnet.
I personally find this discrepancy very confusing. I think dfx should show the costs for a 13-node subnet even if it internally runs a single node. But there are people who think that the current behavior is correct.
I wonder if it would be good for a canister to be able to query at runtime the number of nodes on its subnet, I already have this calculation dynamic but this is yet another environment variable or init param that a developer would have to add to the canister.
Getting rid of the need to send cycles for http outcalls would be even better.
I wonder if it would be good for a canister to be able to query at runtime the number of nodes on its subnet,
I think that would be useful. Since this information is already indirectly observable by the canister via cycles, I don’t see any problems with exposing the static subnet size to the canister at runtime.
Getting rid of the need to send cycles for http outcalls would be even better.
Do you mean they should be for free or that the system should automatically deduct cycles? Note that on the protocol level an http outcall is implemented as a regular call.
Not that they should be free, but that the system should automatically deduct cycles.
I also wish we could get rid of the need to specify max_response_bytes, and remove the need for the transform function in many cases. I have some ideas on removing the need for the transform function in many cases.
Having these extra non-standard parameters for HTTP outcalls makes it difficult to use off-the-shelf libraries from npm for example that use HTTP calls.