shutter-network / rolling-shutter

Rolling Shutter is an MEV protection system to be plugged into rollups.
https://twitter.com/project_shutter/
26 stars 7 forks source link

Keypers crash when started before first keyper set activation #453

Open jannikluhn opened 2 weeks ago

jannikluhn commented 2 weeks ago

When the keypers are started before the first keyper set gets active, they crash with an error like the following:

Error: could not retrieve keyper set index at block 10275942: VM execution error.
could not retrieve keyper set index at block 10275942: VM execution error.

This is because they try to fetch the current keyper set from the keyper set manager (see here), but the contract reverts if the given block number is older than the first activation block number (see here).

To fix this we'd ideally catch the error "NoActiveKeyperSet" and handle it appropriately. Unfortunately, the go contract bindings don't yet support custom error types (see here). One workaround could be to check if there's at least one keyper set and if its activation block number is earlier than the given value.

Note that this issue is much less critical than it might appear: We typically add a dummy keyper set with a single keyper as the first keyper set. Its activation block number doesn't really matter, so we can choose it much earlier than the one of the first real keyper set (maybe even in the past) to work around this issue.