-
Notifications
You must be signed in to change notification settings - Fork 1k
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
bound the maximum number of validators considered for withdrawals per sweep #3095
Conversation
156468c
to
57fdbfa
Compare
I like this change and I think 2) is actually necessary cause it may be that all validators are withrawn in the sweep interval and then we would be stuck if we don't advance. I suggest changing the check to when there were less than the maximum, instead of none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, 2**17 sounds like a reasonable choice for capella
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs consensus tests
I'm also loosely against the proposal. I don't think there has been a strong case made for the additional complexity and the selected current value
re discussion on latest cl call: my preference order is
Based on convos, I think (1) is uncertain so I'm now in camp (2) |
57fdbfa
to
920b3d0
Compare
I think the suggestion @potuz made about advancing the sweep if less than the max were found is important, or everyone after the last index gets another crack at it... More importantly, everyone in the range after the last validator are clearly not selectable as at the previous slot... So if max is 4, and we start from 0, and get 0,1,2 in the list, then scan the rest of the range and don't find another one, we know that we should start after that sweep range, because 3..2^15 (or whatever the number becomes) won't have had a partial/full withdrawal that could be processed when we scanned the last slot... so really we'd just be scanning the first 3 as real potential additions... which is close enough to stalling the scan... Overall the change makes sense, especially once we fix this potential stall issue. |
Run some benchmarks for Lodestar's implementation. Each case has 4 parameters
This does not reflect mainnet since clusters of keys will act together controlled by the same operator. But it forces different counts of total sampled validators Worst case is not great but the node could survive with it. Note that this tests are for an old state with 250k vals. Mainnet should ~ double the worst case results. Would be interesting to analyze mainnet and understand how interlaced or not are indexes of independent actors.
|
I had a quick look at mainnet... So in around 1.5 days we'd be doing all the withdrawals.... Given the number of 0x01 withdrawal addresses already set, we probably don't need to be too concerned with limiting the scan distance, as that first leap of 120374 is not that huge... I guess that means every 1.5 days we'll be doing that large scan, until some of those update their withdrawal addresses, which probably won't take very long. My point, I guess, is that maybe this scan limit isn't really needed? |
a0796b9
to
a05cb87
Compare
a05cb87
to
1eaa441
Compare
Yes, it's great to know that block processing time worst case is bounded. This is a guarantee I really want to have unless the bounded sweep has drawbacks. |
4431dae
to
24a8e22
Compare
If we do this, our upper limit should be more like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to do a bit of a test pass still but wanted to get the initial comments out.
thanks!
tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py
Show resolved
Hide resolved
elif len(expected_withdrawals) < spec.MAX_WITHDRAWALS_PER_PAYLOAD: | ||
assert len(spec.get_expected_withdrawals(state)) == 0 | ||
bound = min(spec.MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP, spec.MAX_WITHDRAWALS_PER_PAYLOAD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like a weird code path. I think we should just consider configs (we make very few) in which the withdrawals per payload is less than the sweep bound as invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is less about the size of the sweep and more just about the scenario where you do the full sweep (of whatever size) and only have a small number of withdrawals
I think all three arms are realistic cases -- do you see it differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but isn't the bound always going to be MAX_WITHDRAWALS_PER_PAYLOAD
here? I mean there is no sense in defining a config with MAX_VALIDATOR_PER_WITHDRAWAL_SWEEP
being smaller since then we would never attain the MAX_WITHDRAWAL_PER_PAYLOAD
and therefore is equivalent to simply lower it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right that for the current parameterization across mainnet
and minimal
the bound will always be MAX_WITHDRAWALS_PER_PAYLOAD
although that is not necessarily the case
we can separately make the commitment that we will never do this but its the type of thing that is hard to track and then enforce...
separately there is the point about this arm of this conditional block and I am imagining a scenario where there are a handful of validators, less than MAX_WITHDRAWALS_PER_PAYLOAD
, which are withdrawable e.g. going into an inactivity leak
tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py
Outdated
Show resolved
Hide resolved
tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py
Outdated
Show resolved
Hide resolved
b631e70
to
240ba48
Compare
tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py
Show resolved
Hide resolved
ae79349
to
4cae27a
Compare
4cae27a
to
37e504e
Compare
tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py
Show resolved
Hide resolved
tests/core/pyspec/eth2spec/test/capella/block_processing/test_process_withdrawals.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, let's get this merged and released. I suggest a 2^14
for mainnet value as a compromise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Teku has already implemented the new logic in a branch and is ready to go! 🚀
This PR implements ethereum/consensus-specs#3095
* Implement bound on expected withdrawals This PR implements ethereum/consensus-specs#3095 * Terence's suggestion Co-authored-by: terencechain <terence@prysmaticlabs.com> * Update spectests * fix minimal preset * Clear committee cache during header tests to ensure active validators ain't leaking * Rm debug log * Rm bad init * Update consensus spec sha * Fix bad tests and remove redundant casting * Fix build * MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP typo Co-authored-by: terencechain <terence@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
fixes #3079
this PR does a few things:
MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP
the rationale for (2) is without it the processing will just stay at the same place in the validator set until there is some withdrawal to advance the state of the sweep
(2) adds some complexity to the implementation and I am not convinced it pulls its weight -- if you don't see the value please chime in below and I'll remove from this PR
if/when there is general consensus on this change then I'll add some testing