feat(withdrawals): Allow for Disabling Withdrawals [DO NOT MERGE]#2777
feat(withdrawals): Allow for Disabling Withdrawals [DO NOT MERGE]#2777
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2777 +/- ##
==========================================
+ Coverage 60.53% 60.64% +0.10%
==========================================
Files 351 351
Lines 16235 16260 +25
Branches 22 22
==========================================
+ Hits 9828 9861 +33
+ Misses 5653 5645 -8
Partials 754 754
🚀 New features to boost your workflow:
|
| fv := s.ActiveForkVersionForTimestamp(timestamp) | ||
| switch fv { | ||
| case version.Electra1(): | ||
| return false | ||
| default: | ||
| return true |
There was a problem hiding this comment.
I get the idea but not sure this would be backward, if we activate Pectra and some withdrawals are made before this hard fork. We'd have to go by slot I think? Or timestamp
abi87
left a comment
There was a problem hiding this comment.
I would expect a proper hard fork, with a (list of) timestamps specified in specs for when withdrawals should be activate/disactivated right?
| // ElectraDisableWithdrawalsForkTime is the time at which withdrawals were first disabled (if disabled). | ||
| ElectraDisableWithdrawalsForkTime uint64 `mapstructure:"electra-disable-withdrawals-fork-time"` | ||
| // ElectraEnableWithdrawalsForkTime is the time at which withdrawals were enabled after disabling | ||
| ElectraEnableWithdrawalsForkTime uint64 `mapstructure:"electra-enable-withdrawals-fork-time"` |
There was a problem hiding this comment.
we should enforce somewhere that Disable Time <= Enable Time
There was a problem hiding this comment.
Also wonder if we should make scaffolding for multiple periods of withdrawal pause?
There was a problem hiding this comment.
Also consider renaming this to DisableWithdrawalsRequestsWindowStart and DisableWithdrawalsRequestsWindowEnd.
I do not believe this is strictly related to Electra.
Also we should stress this is a disabling window
There was a problem hiding this comment.
Also, in terms of operations we just need to specify the start window at first, right? We can leave the end to farFuture and reset that once the window is closed
There was a problem hiding this comment.
we should enforce somewhere that Disable Time <= Enable Time
This should be done as a larger ordering enforcement of forks. e.g. geth https://github.com/ethereum/go-ethereum/blob/516451dc3a514c7c122f28864ea76742a027b858/params/config.go#L702
There was a problem hiding this comment.
Also, in terms of operations we just need to specify the start window at first, right? We can leave the end to farFuture and reset that once the window is closed
correct
There was a problem hiding this comment.
Enforcement of fork timestamps for now can be done in the (s spec) validate() error function we already have. Good way to make use of that and I would also recommend taking this opportunity to add it in.
| func (s spec) WithdrawalsEnabled(timestamp math.U64) bool { | ||
| time := timestamp.Unwrap() | ||
| if time >= s.ElectraDisableWithdrawalsForkTime() && time < s.ElectraEnableWithdrawalsForkTime() { | ||
| return false | ||
| } | ||
| return true | ||
| } |
There was a problem hiding this comment.
nit: we are really defining a window where withdrawals are disabled, so we may consider a negative logic here and have a WithdrawalDisabled method
|
|
||
| // After Electra, validators can request withdrawals through execution requests which must be handled. | ||
| // If withdrawals are enabled, process the withdrawals. Otherwise, the withdrawal requests are ignored | ||
| // to prevent withdrawals from excessively queuing up. |
There was a problem hiding this comment.
is this true? It seems to me we just let withdrawals be enqueued rn.
I am not against dropping requests but I don't think we are doing this now
There was a problem hiding this comment.
good catch, i removed the logic but forgot to update comment
abi87
left a comment
There was a problem hiding this comment.
Some points:
- request to rename disabling window
- question about disabling not just servicing of withdrawals but enqueing of requests as well (it's in a comment but not in the code)
Finally I wonder if we should prepare the specs to allow for multiple stopping window, but making two lists of Disabling window start and disabling window ends
Addressed 1 and 2. With regards to 3, we can always retroactively refactor the process if we end up doing a first withdrawal fork |
calbera
left a comment
There was a problem hiding this comment.
General question. Do these 2 chain spec values imply we can "re-use" them to do a withdrawals freeze in the future? I.e. say we recognize an issue at t=100. Then we say we will disable at t=150 and enable at t=250. Now later on if t=1000, and we need to freeze again, we could just set the disable=1100 and enable to 1200.
Is this the general thinking?
No, there is no intention to re-use these specific variables. As you're aware, that would cause issues with syncing. If we reach the unfortunate position where we need multiple freezes, we can refactor the fork retroactively similar to the way we did forking by timestamp, such that it allows for multiple freezes. I'd rather not over-engineer upfront for an unlikely scenario |
This PR sets up the relevant boilerplate such that withdrawals can be disabled if needed
DO NOT MERGE till needed