internet-computer-protocol / evm-rpc-canister

Interact with EVM blockchains from the Internet Computer.
https://internetcomputer.org/docs/current/developer-docs/multi-chain/ethereum/evm-rpc/overview
Apache License 2.0
63 stars 13 forks source link

fix: use exact formula for HTTP outcall cost calculation #157

Closed rvanasa closed 8 months ago

rvanasa commented 8 months ago

The original Ethereum integration and ckETH cycles calculation logic used a linear approximation of the HTTP outcall cycles cost calculation. This PR uses the exact formula, which includes a quadratic term:

((3M + 60K * nodes_in_subnet) + 400 * request_size + 800 * max_response) * nodes_in_subnet

I also added a link to the (somewhat difficult-to-find) documentation page knowing that some community members are using this code as reference for calculating HTTP outcall costs.