-
Notifications
You must be signed in to change notification settings - Fork 38
feat: electra withdrawals #1431
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
Conversation
in fails
2a73484
to
1bb0e6c
Compare
…g in with at validate_attestation
…g in with at validate_attestation
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, just some comments for the future and one question
@spec get_expected_withdrawals(BeaconState.t()) :: | ||
{list(Withdrawal.t()), non_neg_integer()} | ||
def get_expected_withdrawals(%BeaconState{} = state) do |
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.
Most of this function was preserved, but probably worth to take a look at it in the future regarding to clarity (and even performance after measuring it)
{complete_withdrawals, processed_partial_withdrawals_count} | ||
end | ||
|
||
defp process_partial_withdrawal( |
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.
We can improve both of this functions (process_partial_withdrawal and do_process_partial_withdrawal), but i guess it's better to have them merged now to the electra-support branch and pass the spec-test. I'm going to add these 2 to the list of functions we need to revisit for legibility.
if withdrawal.withdrawable_epoch > epoch || | ||
processed_partial_withdrawals_count == max_pending_partials_per_withdrawals_sweep do | ||
{:halt, {processed_partial_withdrawals_count, withdrawal_index, withdrawals}} |
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 mostly a question I have, they are ordered right? specially for the withdrawal.withdrawable_epoch > epoch
because that just make sense to halt if you have them ordered by epoch, or am I missing something?
Btw I checked that this was the correct condition to break the loop in the spec but i was intrigued about the order.
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.
That's a good question, I don't explicitly order them but I've yet to see a case in which they aren't not in the spec tests and not while syncing Sepolia. I can add that or maybe leave a comment so that if we run into this issue later in testing we can fix 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.
Maybe there is no way to get them unordered but yes, I think we should left at least a comment for the future (but probably where we actually add the pending widthrawal instead of here)
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.
Left comment both there and when we are adding the partial withdrawals to the state here
@@ -1030,7 +1134,7 @@ defmodule LambdaEthereumConsensus.StateTransition.Operations do | |||
|
|||
is_correct_source_address = | |||
case validator.withdrawal_credentials do | |||
<<_::binary-size(12), rest>> -> rest == address | |||
<<_::binary-size(12), validator_address::binary>> -> validator_address == address |
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.
👍
…if they are not ordered
Motivation
Implement changes in Electra to withdrawals + fix all spec-tests related to it.
Description
get_expected_withdrawals
linkprocess_withdrawals
linkFixed Spec Tests
Spec Test Progress
11370 tests, 4 failures, 784 skipped