Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base gas costs for function calls are too high #7741

Open
jakmeier opened this issue Sep 30, 2022 · 3 comments
Open

Base gas costs for function calls are too high #7741

jakmeier opened this issue Sep 30, 2022 · 3 comments
Labels
A-contract-runtime Area: contract compilation and execution, virtual machines, etc A-transaction-runtime Area: transaction runtime (transaction and receipts processing, state transition, etc) T-contract-runtime Team: issues relevant to the contract runtime team

Comments

@jakmeier
Copy link
Contributor

Between unpacking a function call action from a receipt and when we start executing the WASM code, there is a bunch of constant fixed overhead. The way we are charging this today is through several parameters.

The sum of all parameters seems to be approximately right but some of the individual values are completely off. Most importantly, we do not scale properly with the number of bytes in the code and instead rely on high base fees.

Reshuffling the costs to scale properly with the code size could help users with small contracts a lot. We are talking about roughly halving the base cost per function call based on today's available data.

Detailed numbers are available in this comment #7227 (comment) and the comment right below it has some more detailed explanation. Further, there is table of which parameters we can play with in this comment #6992 (comment).

A slide deck with even more details on how exactly we charge gas and which places need fixing is available here:
https://docs.google.com/presentation/d/10nqplCDpmLdzeZbVx9POwBqEYH6aSFcZOgZPA2vMK_g/edit#slide=id.g13c377cb935_0_432

@jakmeier jakmeier added A-transaction-runtime Area: transaction runtime (transaction and receipts processing, state transition, etc) A-contract-runtime Area: contract compilation and execution, virtual machines, etc T-contract-runtime Team: issues relevant to the contract runtime team labels Sep 30, 2022
@jakmeier
Copy link
Contributor Author

Actually reshuffling at the moment is blocked by at least #5962.

Additionally, we probably also need some more optimizations and then we need reevaluate the costs.
Relevant improvements that are already somwhere in the pipleine:

@nagisa nagisa changed the title Reshuffle base gas costs for function calls Base gas costs for function calls are too high Mar 27, 2023
@nagisa
Copy link
Collaborator

nagisa commented Sep 1, 2023

FWIW some work to improve how memory maps for contract loading has landed a while ago in #9244 but we done the follow up work to recalculate the costs so that these improvements make their way to the users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contract-runtime Area: contract compilation and execution, virtual machines, etc A-transaction-runtime Area: transaction runtime (transaction and receipts processing, state transition, etc) T-contract-runtime Team: issues relevant to the contract runtime team
Projects
None yet
Development

No branches or pull requests

2 participants