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

Add a simple eth_call cache #877

Closed
Nana-EC opened this issue Feb 7, 2023 · 1 comment · Fixed by #880
Closed

Add a simple eth_call cache #877

Nana-EC opened this issue Feb 7, 2023 · 1 comment · Fixed by #880
Assignees
Labels
enhancement New feature or request P1
Milestone

Comments

@Nana-EC
Copy link
Collaborator

Nana-EC commented Feb 7, 2023

Problem

In some cases DApps may poll the relay eth_call endpoint quite often even when there are no contract changes.
In the current iteration prior to HIP 584 completion is may be beneficial to consider a cache to speed up responses

Solution

Add an appropriate cache

  • Check the Mirror Node api/v1/contracts/{contractIdOrAddress} for the timestamp of the last change

  • Cache the timestamp

  • On future calls query the endpoint. If the timestamp returned is greater than the cached value then it's worth making a full state call

  • Also add a new metric for gas used by an endpoint. Start with a proxy of 0.8 * gasLimit provided

Alternatives

No response

@Nana-EC Nana-EC added the enhancement New feature or request label Feb 7, 2023
@Nana-EC Nana-EC self-assigned this Feb 7, 2023
@Nana-EC Nana-EC added the P1 label Feb 7, 2023
@Nana-EC Nana-EC added this to the 0.18.0 milestone Feb 7, 2023
@Nana-EC Nana-EC mentioned this issue Feb 7, 2023
2 tasks
@steven-sheehy
Copy link
Member

api/v1/contracts/{contractIdOrAddress} timestamp would only update for CUD operations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P1
Projects
Archived in project
2 participants