HTTP outcall cycles parameter

I just had a look at the IC portal and Rust documentation, but none seems to explicitly explain how the second parameter cycle of an http_request outcall works. By this, I mean that if I specify an oversized value, are all the cycles consumed, or only those effectively required for the call?

1 Like

I think they are returned due to a test I did yesterday(same with ecdsa), but I seem to remember that maybe something was reserved if you put the expected return size very high. Perhaps it has to reserve some memory for the duration of the call? Basically putting this here because I have the same question and would love to see the code that calculates it.

1 Like

Cost is explained here: Paying for resources in cycles | Internet Computer

IIRC that’s it. The outcall has to reserve memory for the result and for some (probably consensus-related) reason can’t change it after the fact

So, to answer my original question, do you mean that providing an oversized value lead to having all the cycles being burned anyway?

Not all, but the possible maximum. There is a max value for response_bytes that would be used

1 Like

That’s great!

Where’s that documented though? Maybe I missed it but, is that clearly explained in any HTTP outcall portal documentation or rust doc?

This page says the max is 2_000_000 bytes

So long story short, it’s not documented.