You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: