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

Eon key publishing gas limit estimation error #480

Open jannikluhn opened 6 days ago

jannikluhn commented 6 days ago

Here's a used eon key publishing contract: https://gnosis-chiado.blockscout.com/address/0x92b3cAFc417483deBcC1ECDC1d00C476D1638D77

In the first block, three keypers try to vote on a new key, but only one succeeds. In the second, the two remaining keypers try again. This time again only one succeeds. The threshold here is two.

The issue seems to be that the first t - 1 transactions take a small amount of gas (just recording a vote). Transaction t will be more expensive since it will store the key in the broadcasting contract. When keypers estimate the gas for their transaction, usually 0 votes have been submitted so far, so all keypers think they need little gas. This turns out to be wrong for the last ones. In the next block, gas estimation succeeds again.

A possible solution might be to hardcode the gas limit. However, I'm not sure if the required gas amount depends on the number of keypers. It might be safer to multiply the estimated gas amount by a certain factor.

However, all of this is not critical. Eventually, the broadcast succeeds, we just have a few failed transactions.

konradkonrad commented 6 days ago

For a gas optimized version, we could also have a responsibility coordination algorithm:

1) order the keypers by proximity of their address to the eon key (probably needs some projection from key space to address space) 2) closest keyper will publish immediately at block X (when the key is available) 3) second closest will publish with n blocks delay at X + n 4) rest will publish later at X + 2 * n if not yet published

Granted, this is way more complicated and probably overkill, since the current scheme, albeit wasteful, just works.