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

Store smart pools in registry state #25

Open
gabririgo opened this issue Sep 3, 2023 · 0 comments
Open

Store smart pools in registry state #25

gabririgo opened this issue Sep 3, 2023 · 0 comments

Comments

@gabririgo
Copy link
Contributor

Summary

Store an indexed array of smart pools in the pool registry at pool creation.

Motivation

RPC providers' endpoints do not provide historical logs on some L2s, claiming it would affect node performance. Therefore, in order to display pools on the interface, we provide an endpoint pools.rigoblock.com that returns the pools. Storing the in the registry state will allow retrieving all pools with one single RPC call.

Specification

  • store pools in an indexed mapping
    • mapping(uint256 => Pool) poolsByIndex
    • uint256 poolsLength
    • store new pool at position index in poolsByIndex mapping
  • upgrade registry used by protocol and staking proxy (requires onchain governance vote.

Rationale

The new pools are scraped regularly, but by storing the pools in the registry we could skip logs query and url list update entirely, at an additional 20k gas cost at pool creation, which is acceptable as pool cost creation is less than cost of making 2 onchain swaps.
Storing an indexed mapping and the pools' number allows for avoiding storing a big array, which is going to be expensive to update. Since pools are persistent, we will not find ourselves in a situation where the pool at index is empty, but even if it were it would not cause harm to a call.

Notes

It is still undecided whether this is something worth a registry upgrade.

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

No branches or pull requests

1 participant