-
-
Notifications
You must be signed in to change notification settings - Fork 410
fix: delayed broadcasting of Voluntary exits #8579
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
Open
pheobeayo
wants to merge
2
commits into
ChainSafe:unstable
Choose a base branch
from
pheobeayo:fix-#7431
base: unstable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+341
−7
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,9 @@ export async function validateApiVoluntaryExit( | |
| voluntaryExit: phase0.SignedVoluntaryExit | ||
| ): Promise<void> { | ||
| const prioritizeBls = true; | ||
| return validateVoluntaryExit(chain, voluntaryExit, prioritizeBls); | ||
| // For API submissions, we validate signature and permanent conditions | ||
| // Transient conditions will be checked by the opPool before broadcasting | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
doesn't seem to be implemented |
||
| return validateVoluntaryExitForApi(chain, voluntaryExit, prioritizeBls); | ||
pheobeayo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| export async function validateGossipVoluntaryExit( | ||
|
|
@@ -28,6 +30,35 @@ export async function validateGossipVoluntaryExit( | |
| return validateVoluntaryExit(chain, voluntaryExit); | ||
| } | ||
|
|
||
| async function validateVoluntaryExitForApi( | ||
| chain: IBeaconChain, | ||
| voluntaryExit: phase0.SignedVoluntaryExit, | ||
| prioritizeBls = false | ||
| ): Promise<void> { | ||
| // [IGNORE] The voluntary exit is the first valid voluntary exit received for the validator with index | ||
| // signed_voluntary_exit.message.validator_index. | ||
| if (chain.opPool.hasSeenVoluntaryExit(voluntaryExit.message.validatorIndex)) { | ||
| throw new VoluntaryExitError(GossipAction.IGNORE, { | ||
| code: VoluntaryExitErrorCode.ALREADY_EXISTS, | ||
| }); | ||
| } | ||
|
|
||
| // Get current state for validation | ||
| const state = await chain.getHeadStateAtCurrentEpoch(RegenCaller.validateGossipVoluntaryExit); | ||
pheobeayo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Validate signature - this is a permanent check | ||
| const signatureSet = getVoluntaryExitSignatureSet(state, voluntaryExit); | ||
| if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true, priority: prioritizeBls}))) { | ||
| throw new VoluntaryExitError(GossipAction.REJECT, { | ||
| code: VoluntaryExitErrorCode.INVALID_SIGNATURE, | ||
| }); | ||
| } | ||
pheobeayo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| /** | ||
| * Full validation for gossip voluntary exits. | ||
| * Checks all conditions including transient ones. | ||
| */ | ||
| async function validateVoluntaryExit( | ||
| chain: IBeaconChain, | ||
| voluntaryExit: phase0.SignedVoluntaryExit, | ||
|
|
@@ -50,7 +81,7 @@ async function validateVoluntaryExit( | |
| // relevant on periods of many skipped slots. | ||
| const state = await chain.getHeadStateAtCurrentEpoch(RegenCaller.validateGossipVoluntaryExit); | ||
|
|
||
| // [REJECT] All of the conditions within process_voluntary_exit pass validation. | ||
| // Check all conditions here: | ||
| // verifySignature = false, verified in batch below | ||
| const validity = getVoluntaryExitValidity(chain.config.getForkSeq(state.slot), state, voluntaryExit, false); | ||
| if (validity !== VoluntaryExitValidity.valid) { | ||
|
|
@@ -66,3 +97,17 @@ async function validateVoluntaryExit( | |
| }); | ||
| } | ||
| } | ||
|
|
||
| export async function validateVoluntaryExitTransientConditions( | ||
| chain: IBeaconChain, | ||
| voluntaryExit: phase0.SignedVoluntaryExit | ||
| ): Promise<boolean> { | ||
| try { | ||
| const state = await chain.getHeadStateAtCurrentEpoch(RegenCaller.validateGossipVoluntaryExit); | ||
| // Check all transient conditions (verifySignature = false since we already verified it) | ||
| const validity = getVoluntaryExitValidity(chain.config.getForkSeq(state.slot), state, voluntaryExit, false); | ||
| return validity === VoluntaryExitValidity.valid; | ||
| } catch (_e) { | ||
| return false; | ||
| } | ||
| } | ||
pheobeayo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't see those changes implemented in the PR