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

PoS: efficient L1 events fetching #2491

Open
sveitser opened this issue Jan 21, 2025 · 0 comments
Open

PoS: efficient L1 events fetching #2491

sveitser opened this issue Jan 21, 2025 · 0 comments
Assignees

Comments

@sveitser
Copy link
Collaborator

At the moment we always fetch all the L1 events from the stake table contract when we build the stake table for an epoch. The requests are limited to 5000 events on infura so this is fine for the permissioned stake table where we expect maybe at most 100 events. One event corresponds to an update to the stake table here.

For the permissionless / token based stake table we will have a lot more events of interest because each registration, delegation, exit etc. will create an EVM event. Therefore we need to be smarter about how we fetch events.

I think we should do something similar like what we do for blocks where we fetch each block only once (or subscribe to the blockstream via websockets) and store an LRU cache in memory. However for the stake table we probably want to persist something (not just store it in memory) so that we don't have to fetch everything again on startup. So concretely we should create a separate thread (or use the same thread that monitors blocks, if that's convenient) that receives the stake table contract events and makes those available for stake table computation.

Another concern here is catchup. During stake table catchup the node needs to build the stake table for each epoch. This should not cause repeated calls to the L1 provider. On a high level we simply need to obtain all the stake table events until the current L1 finalized block then we can use this to build the stake table for each epoch once hotshot informs us of the epoch root header via the add_epoch_root call.

tbro added a commit that referenced this issue Jan 23, 2025
Closes ##2491

Begin to add chunked fetching of stake table events.
tbro added a commit that referenced this issue Jan 27, 2025
Closes ##2491

Begin to add chunked fetching of stake table events.
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

3 participants