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

Fresh runtime api instance per call estimation #565

Merged

Conversation

tgmichel
Copy link
Contributor

@tgmichel tgmichel commented Feb 4, 2022

A new ApiRef instance needs to be used per execution to avoid the overlayed state to affect the estimation result of subsequent calls.

Note that this would have a performance penalty if we introduce gas estimation for past blocks - and thus, past runtime versions - in the future. Substrate has a runtime_cache_size (introduced in paritytech/substrate#10177) which defaults to 2 slots LRU-style, meaning if users were to access multiple runtime versions (more than 2) in a short period of time, the RPC response time would degrade a lot, as the VersionedRuntime needs to be compiled to occupy a slot.

To solve that, and if we introduce historical gas estimation, we'd need to increase value.

@sorpaas
Copy link
Member

sorpaas commented Feb 15, 2022

LGTM, but need to resolve conflicts.

@tgmichel
Copy link
Contributor Author

done

@sorpaas sorpaas merged commit bc07f7b into polkadot-evm:master Feb 24, 2022
boundless-forest pushed a commit to darwinia-network/frontier that referenced this pull request Mar 2, 2022
* Fresh runtime api instance per call estimation

* rustfmt skip

* fmt
jordy25519 pushed a commit to cennznet/frontier that referenced this pull request Apr 6, 2022
* Fresh runtime api instance per call estimation

* rustfmt skip

* fmt
boundless-forest pushed a commit to darwinia-network/frontier that referenced this pull request May 11, 2022
* Fresh runtime api instance per call estimation

* rustfmt skip

* fmt
@tgmichel tgmichel deleted the tgm-fix-runtimeapi-reuse branch June 24, 2022 07:39
abhijeetbhagat pushed a commit to web3labs/frontier that referenced this pull request Jan 11, 2023
* Fresh runtime api instance per call estimation

* rustfmt skip

* fmt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants