Skip to content
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

Electra: EIP-7251 Update process_voluntary_exit #14176

Merged
merged 3 commits into from
Jul 9, 2024

Conversation

prestonvanloon
Copy link
Member

What type of PR is this?

Feature

What does this PR do? Why is it needed?

Updates process_voluntary_exit to the spec changes at v1.5.0-alpha.3

Which issues(s) does this PR fix?

Other notes for review

Introduced in ethereum/consensus-specs#3668

@prestonvanloon prestonvanloon requested a review from a team as a code owner July 2, 2024 19:31
@@ -186,6 +190,18 @@ func verifyExitConditions(validator state.ReadOnlyValidator, currentSlot primiti
params.BeaconConfig().ShardCommitteePeriod,
validator.ActivationEpoch()+params.BeaconConfig().ShardCommitteePeriod,
)
}

if st.Version() >= version.Electra {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to break this out from the core blocks into electra?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually. Breaking this out would involve breaking the other forks out and it would be a large change. Currently trying to get to devnet-1 while taking note of this. I'll take a note of this, thanks

@prestonvanloon prestonvanloon force-pushed the electra-process_voluntary_exit branch from e6d3240 to ae696b6 Compare July 2, 2024 19:56
james-prysm
james-prysm previously approved these changes Jul 2, 2024
Copy link
Contributor

@james-prysm james-prysm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@prestonvanloon prestonvanloon added the Electra electra hardfork label Jul 3, 2024
@prestonvanloon prestonvanloon force-pushed the electra-process_voluntary_exit branch from ae696b6 to f5e6376 Compare July 3, 2024 16:43
// # Verify signature
// domain = get_domain(state, DOMAIN_VOLUNTARY_EXIT, voluntary_exit.epoch)
// signing_root = compute_signing_root(voluntary_exit, domain)
// assert bls.Verify(validator.pubkey, signing_root, signed_voluntary_exit.signature)
// # Initiate exit
// initiate_validator_exit(state, voluntary_exit.validator_index)
func verifyExitConditions(validator state.ReadOnlyValidator, currentSlot primitives.Slot, exit *ethpb.VoluntaryExit) error {
func verifyExitConditions(st state.ReadOnlyBeaconState, validator state.ReadOnlyValidator, currentSlot primitives.Slot, exit *ethpb.VoluntaryExit) error {
currentEpoch := slots.ToEpoch(currentSlot)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried about the new state not being compatible with currentSlot here. Either the state should have state.Slot() == currentSlot in which case you can just not pass this old parameter, or you need to ensure compatibility. One may be acting on an exit for a slot with data from an old state.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK that is fair, I will remove the state parameter and require the fork parameter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, actually, we must have the state. So the correct solution is to remove currentSlot and reference state.Slot() as you mentioned

@prestonvanloon prestonvanloon added this pull request to the merge queue Jul 9, 2024
Merged via the queue into develop with commit 18be899 Jul 9, 2024
17 checks passed
@prestonvanloon prestonvanloon deleted the electra-process_voluntary_exit branch July 9, 2024 20:54
saolyn pushed a commit that referenced this pull request Jul 17, 2024
* Electra: EIP-7251 Update `process_voluntary_exit`

* Add unit test for VerifyExitAndSignature EIP-7251

* @potuz peer feedback
github-merge-queue bot pushed a commit that referenced this pull request Jul 19, 2024
* add http endpoint

* add tests

* Gaz

* Add pointers

* add endpoint to test

* Electra: EIP-7251 Update `process_voluntary_exit` (#14176)

* Electra: EIP-7251 Update `process_voluntary_exit`

* Add unit test for VerifyExitAndSignature EIP-7251

* @potuz peer feedback

* Avoid Cloning When Creating a New Gossip Message (#14201)

* Add Current Changes

* add back check

* Avoid a Panic

* fix: Multiple network flags should prevent the BN to start (#14169)

* Implement Initial Logic

* Include check in main.go

* Add tests for multiple flags

* remove usage of append

* remove config/features dependency

* Move ValidateNetworkFlags to config/features

* Nit

* removed NetworkFlags from cmd

* remove usage of empty string literal

* add comment

* add flag validation to prysctl validator-exit

---------

Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>

* fix tests

* Radek' review + tests

* fix tests

* Radek' review

* forgot one

* almost forgot the tests

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: kira <shyampkira@gmail.com>
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Electra electra hardfork
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants